Skip to content
Snippets Groups Projects
Commit b382d36a authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Add missing tests for TinyMatrix

parent 7fc02d4c
No related branches found
No related tags found
1 merge request!103Set AssertError to inherit from std::runtime_error
...@@ -24,6 +24,7 @@ TEST_CASE("TinyMatrix", "[algebra]") ...@@ -24,6 +24,7 @@ TEST_CASE("TinyMatrix", "[algebra]")
(A(1, 2) == 6) and (A(2, 0) == 7) and (A(2, 1) == 8) and (A(2, 2) == 9))); (A(1, 2) == 6) and (A(2, 0) == 7) and (A(2, 1) == 8) and (A(2, 2) == 9)));
TinyMatrix<3, int> B(6, 5, 3, 8, 34, 6, 35, 6, 7); TinyMatrix<3, int> B(6, 5, 3, 8, 34, 6, 35, 6, 7);
SECTION("checking for opposed matrix") SECTION("checking for opposed matrix")
{ {
const TinyMatrix<3, int> minus_A = -A; const TinyMatrix<3, int> minus_A = -A;
...@@ -31,6 +32,7 @@ TEST_CASE("TinyMatrix", "[algebra]") ...@@ -31,6 +32,7 @@ TEST_CASE("TinyMatrix", "[algebra]")
(minus_A(1, 1) == -5) and (minus_A(1, 2) == -6) and (minus_A(2, 0) == -7) and (minus_A(2, 1) == -8) and (minus_A(1, 1) == -5) and (minus_A(1, 2) == -6) and (minus_A(2, 0) == -7) and (minus_A(2, 1) == -8) and
(minus_A(2, 2) == -9))); (minus_A(2, 2) == -9)));
} }
SECTION("checking for equality and difference tests") SECTION("checking for equality and difference tests")
{ {
const TinyMatrix<3, int> copy_A = A; const TinyMatrix<3, int> copy_A = A;
...@@ -209,14 +211,24 @@ TEST_CASE("TinyMatrix", "[algebra]") ...@@ -209,14 +211,24 @@ TEST_CASE("TinyMatrix", "[algebra]")
REQUIRE(TinyMatrix<1>{}.numberOfRows() == 1); REQUIRE(TinyMatrix<1>{}.numberOfRows() == 1);
REQUIRE(TinyMatrix<1>{}.numberOfColumns() == 1); REQUIRE(TinyMatrix<1>{}.numberOfColumns() == 1);
REQUIRE(TinyMatrix<1>{}.dimension() == 1); REQUIRE(TinyMatrix<1>{}.dimension() == 1);
REQUIRE(TinyMatrix<1>{}.numberOfValues() == 1);
REQUIRE(TinyMatrix<2>{}.numberOfRows() == 2); REQUIRE(TinyMatrix<2>{}.numberOfRows() == 2);
REQUIRE(TinyMatrix<2>{}.numberOfColumns() == 2); REQUIRE(TinyMatrix<2>{}.numberOfColumns() == 2);
REQUIRE(TinyMatrix<2>{}.dimension() == 4); REQUIRE(TinyMatrix<2>{}.numberOfValues() == 4);
REQUIRE(TinyMatrix<3>{}.numberOfRows() == 3); REQUIRE(TinyMatrix<3>{}.numberOfRows() == 3);
REQUIRE(TinyMatrix<3>{}.numberOfColumns() == 3); REQUIRE(TinyMatrix<3>{}.numberOfColumns() == 3);
REQUIRE(TinyMatrix<3>{}.dimension() == 9); REQUIRE(TinyMatrix<3>{}.dimension() == 9);
REQUIRE(TinyMatrix<3>{}.numberOfValues() == 9);
}
SECTION("is square matrix")
{
REQUIRE(TinyMatrix<1>{}.isSquare());
REQUIRE(TinyMatrix<2>{}.isSquare());
REQUIRE(TinyMatrix<3>{}.isSquare());
REQUIRE(TinyMatrix<4>{}.isSquare());
} }
SECTION("checking for matrices output") SECTION("checking for matrices output")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment