mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-13 07:03:25 +00:00
Feature/more constexpr (#125)
* added constexpr * fix * improved stuff * added const * improvement * fix * fix * patch
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user