From b382d36aa94fd70d72e08edc505af82542a044dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Del=20Pino?= <stephane.delpino44@gmail.com> Date: Mon, 26 Jul 2021 14:05:45 +0200 Subject: [PATCH] Add missing tests for TinyMatrix --- tests/test_TinyMatrix.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/test_TinyMatrix.cpp b/tests/test_TinyMatrix.cpp index 3a03b47f7..31ded1e24 100644 --- a/tests/test_TinyMatrix.cpp +++ b/tests/test_TinyMatrix.cpp @@ -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))); TinyMatrix<3, int> B(6, 5, 3, 8, 34, 6, 35, 6, 7); + SECTION("checking for opposed matrix") { const TinyMatrix<3, int> minus_A = -A; @@ -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(2, 2) == -9))); } + SECTION("checking for equality and difference tests") { const TinyMatrix<3, int> copy_A = A; @@ -209,14 +211,24 @@ TEST_CASE("TinyMatrix", "[algebra]") REQUIRE(TinyMatrix<1>{}.numberOfRows() == 1); REQUIRE(TinyMatrix<1>{}.numberOfColumns() == 1); REQUIRE(TinyMatrix<1>{}.dimension() == 1); + REQUIRE(TinyMatrix<1>{}.numberOfValues() == 1); REQUIRE(TinyMatrix<2>{}.numberOfRows() == 2); REQUIRE(TinyMatrix<2>{}.numberOfColumns() == 2); - REQUIRE(TinyMatrix<2>{}.dimension() == 4); + REQUIRE(TinyMatrix<2>{}.numberOfValues() == 4); REQUIRE(TinyMatrix<3>{}.numberOfRows() == 3); REQUIRE(TinyMatrix<3>{}.numberOfColumns() == 3); 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") -- GitLab