From 45e76928f9e1cab8b0993038f815be73c7ad9869 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Del=20Pino?= <stephane.delpino44@gmail.com>
Date: Mon, 13 Sep 2021 18:15:12 +0200
Subject: [PATCH] Add missing test for CRSMatrixDescriptor

The case of square matrices defined by providing only the number of
rows was not treated.
---
 tests/test_CRSMatrixDescriptor.cpp | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/tests/test_CRSMatrixDescriptor.cpp b/tests/test_CRSMatrixDescriptor.cpp
index 28276aaad..4d31a7397 100644
--- a/tests/test_CRSMatrixDescriptor.cpp
+++ b/tests/test_CRSMatrixDescriptor.cpp
@@ -12,6 +12,34 @@ template class CRSMatrixDescriptor<int>;
 
 TEST_CASE("CRSMatrixDescriptor", "[algebra]")
 {
+  SECTION("sizes")
+  {
+    SECTION("rectangle")
+    {
+      const size_t nb_lines   = 2;
+      const size_t nb_columns = 5;
+
+      Array<int> non_zeros{nb_lines};
+      non_zeros.fill(2);
+      CRSMatrixDescriptor<int> S(nb_lines, nb_columns, non_zeros);
+
+      REQUIRE(S.numberOfRows() == 2);
+      REQUIRE(S.numberOfColumns() == 5);
+    }
+
+    SECTION("square")
+    {
+      const size_t nb_lines = 3;
+
+      Array<int> non_zeros{nb_lines};
+      non_zeros.fill(2);
+      CRSMatrixDescriptor<int> S(nb_lines, non_zeros);
+
+      REQUIRE(S.numberOfRows() == 3);
+      REQUIRE(S.numberOfColumns() == 3);
+    }
+  }
+
   SECTION("has overflow / not filled")
   {
     const size_t nb_lines   = 2;
-- 
GitLab