Feature/more constexpr (#125)

* added constexpr

* fix

* improved stuff

* added const

* improvement

* fix

* fix

* patch
This commit is contained in:
2025-12-24 02:32:14 +03:00
committed by GitHub
parent 897484bea1
commit d935caf1a4
36 changed files with 543 additions and 399 deletions

View File

@@ -10,23 +10,21 @@ using namespace omath;
static void make_bad_mat_rows()
{
// wrong number of rows -> should throw inside initializer-list ctor
Mat<2, 2, float> m{{1.f, 2.f}};
(void)m;
[[maybe_unused]] const Mat<2, 2, float> m{{1.f, 2.f}};
}
static void make_bad_mat_cols()
{
// row with wrong number of columns -> should throw
Mat<2, 2, float> m{{1.f, 2.f}, {1.f}};
(void)m;
[[maybe_unused]] const Mat<2, 2, float> m{{1.f, 2.f}, {1.f}};
}
TEST(Vector4Operator, Subtraction)
{
Vector4<float> a{5.f, 6.f, 7.f, 8.f};
Vector4<float> b{1.f, 2.f, 3.f, 4.f};
constexpr Vector4<float> a{5.f, 6.f, 7.f, 8.f};
constexpr Vector4<float> b{1.f, 2.f, 3.f, 4.f};
auto r = a - b;
constexpr auto r = a - b;
EXPECT_FLOAT_EQ(r.x, 4.f);
EXPECT_FLOAT_EQ(r.y, 4.f);
EXPECT_FLOAT_EQ(r.z, 4.f);