From a8e32a8767408668bc376e36c7b78a81089737a9 Mon Sep 17 00:00:00 2001
From: Elias Pipping <elias.pipping@fu-berlin.de>
Date: Wed, 25 Nov 2015 13:34:15 +0100
Subject: [PATCH] Extend test

---
 dune/common/test/fmatrixtest.cc | 50 +++++++++++++++++++++++++++++----
 1 file changed, 44 insertions(+), 6 deletions(-)

diff --git a/dune/common/test/fmatrixtest.cc b/dune/common/test/fmatrixtest.cc
index cb75a7098..43811a19e 100644
--- a/dune/common/test/fmatrixtest.cc
+++ b/dune/common/test/fmatrixtest.cc
@@ -524,10 +524,42 @@ template <typename T>
 void
 test_nan(T const &mynan)
 {
-  Dune::FieldMatrix<T, 2, 2> m = {
-    { mynan, mynan },
-    { mynan, mynan }
-  checkNormNAN(m, __LINE__);
+  T const n(0);
+  {
+    Dune::FieldMatrix<T, 2, 2> m = {
+      { mynan, mynan },
+      { mynan, mynan }
+    };
+    checkNormNAN(m, __LINE__);
+  }
+  {
+    Dune::FieldMatrix<T, 2, 2> m = {
+      { mynan, n },
+      { n, n }
+    };
+    checkNormNAN(m, __LINE__);
+  }
+  {
+    Dune::FieldMatrix<T, 2, 2> m = {
+      { n, mynan },
+      { n, n }
+    };
+    checkNormNAN(m, __LINE__);
+  }
+  {
+    Dune::FieldMatrix<T, 2, 2> m = {
+      { n, n },
+      { mynan, n }
+    };
+    checkNormNAN(m, __LINE__);
+  }
+  {
+    Dune::FieldMatrix<T, 2, 2> m = {
+      { n, n },
+      { n, mynan }
+    };
+    checkNormNAN(m, __LINE__);
+  }
 }
 
 // The computation of infinity_norm_real() was flawed from r6819 on
@@ -573,8 +605,14 @@ void test_initialisation()
 int main()
 {
   try {
-    double nan = std::nan("");
-    test_nan(nan);
+    {
+      double nan = std::nan("");
+      test_nan(nan);
+    }
+    {
+      std::complex<double> nan( std::nan(""), 17 );
+      test_nan(nan);
+    }
     test_infinity_norms();
     test_initialisation();
 
-- 
GitLab