diff --git a/tempest/matrix/C44Matrix.hpp b/tempest/matrix/C44Matrix.hpp index 8c85e83..987f2b7 100644 --- a/tempest/matrix/C44Matrix.hpp +++ b/tempest/matrix/C44Matrix.hpp @@ -20,6 +20,26 @@ class C44Matrix { float d1 = 0.0f; float d2 = 0.0f; float d3 = 1.0f; + + // Member functions + C44Matrix() = default; + C44Matrix(float a0, float a1, float a2, float a3, float b0, float b1, float b2, float b3, float c0, float c1, float c2, float c3, float d0, float d1, float d2, float d3) + : a0(a0) + , a1(a1) + , a2(a2) + , a3(a3) + , b0(b0) + , b1(b1) + , b2(b2) + , b3(b3) + , c0(c0) + , c1(c1) + , c2(c2) + , c3(c3) + , d0(d0) + , d1(d1) + , d2(d2) + , d3(d3) {}; }; #endif diff --git a/test/Matrix.cpp b/test/Matrix.cpp index abb51a3..7fe4736 100644 --- a/test/Matrix.cpp +++ b/test/Matrix.cpp @@ -21,4 +21,24 @@ TEST_CASE("C44Matrix", "[matrix]") { REQUIRE(matrix.d2 == 0.0f); REQUIRE(matrix.d3 == 1.0f); } + + SECTION("constructs with element constructor") { + auto matrix = C44Matrix(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f); + REQUIRE(matrix.a0 == 1.0f); + REQUIRE(matrix.a1 == 2.0f); + REQUIRE(matrix.a2 == 3.0f); + REQUIRE(matrix.a3 == 4.0f); + REQUIRE(matrix.b0 == 5.0f); + REQUIRE(matrix.b1 == 6.0f); + REQUIRE(matrix.b2 == 7.0f); + REQUIRE(matrix.b3 == 8.0f); + REQUIRE(matrix.c0 == 9.0f); + REQUIRE(matrix.c1 == 10.0f); + REQUIRE(matrix.c2 == 11.0f); + REQUIRE(matrix.c3 == 12.0f); + REQUIRE(matrix.d0 == 13.0f); + REQUIRE(matrix.d1 == 14.0f); + REQUIRE(matrix.d2 == 15.0f); + REQUIRE(matrix.d3 == 16.0f); + } }