lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master e89831e 2/2: C++20-ize two unit tests


From: Greg Chicares
Subject: [lmi-commits] [lmi] master e89831e 2/2: C++20-ize two unit tests
Date: Mon, 1 Mar 2021 12:35:51 -0500 (EST)

branch: master
commit e89831e23c0bc12a31302ffa6705d54e88f424db
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    C++20-ize two unit tests
    
    * bourn_cast_test.cpp: See:
        https://lists.nongnu.org/archive/html/lmi/2021-02/msg00031.html
    * expression_template_0_test.cpp: lmi will never use ublas anyway.
---
 bourn_cast_test.cpp            | 18 +++++++++---------
 expression_template_0_test.cpp |  4 +++-
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/bourn_cast_test.cpp b/bourn_cast_test.cpp
index 0a2e9a0..2320665 100644
--- a/bourn_cast_test.cpp
+++ b/bourn_cast_test.cpp
@@ -64,14 +64,14 @@ void test_same(char const* file, int line)
     using traits = std::numeric_limits<T>;
     T upper = traits::max();
     T lower = traits::lowest();
-    INVOKE_BOOST_TEST_EQUAL(upper, bourn_cast<T>(upper), file, line);
-    INVOKE_BOOST_TEST_EQUAL(T( 1), bourn_cast<T>(T( 1)), file, line);
-    INVOKE_BOOST_TEST_EQUAL(T( 0), bourn_cast<T>(T( 0)), file, line);
-    INVOKE_BOOST_TEST_EQUAL(lower, bourn_cast<T>(lower), file, line);
+    INVOKE_BOOST_TEST(upper == bourn_cast<T>(upper), file, line);
+    INVOKE_BOOST_TEST(T( 1) == bourn_cast<T>(T( 1)), file, line);
+    INVOKE_BOOST_TEST(T( 0) == bourn_cast<T>(T( 0)), file, line);
+    INVOKE_BOOST_TEST(lower == bourn_cast<T>(lower), file, line);
 
     if(traits::is_signed)
         {
-        INVOKE_BOOST_TEST_EQUAL(T(-1), bourn_cast<T>(T(-1)), file, line);
+        INVOKE_BOOST_TEST(T(-1) == bourn_cast<T>(T(-1)), file, line);
         }
 
     // Test whether integer limits are correctly calculated by this
@@ -86,12 +86,12 @@ void test_same(char const* file, int line)
         long double const x = std::scalbln(1.0l, traits::digits);
         long double const max = x - 1;
         long double const min = traits::is_signed ? -x : 0;
-        INVOKE_BOOST_TEST_EQUAL(traits::max(), max, file, line);
-        INVOKE_BOOST_TEST_EQUAL(traits::min(), min, file, line);
+        INVOKE_BOOST_TEST(traits::max() == max, file, line);
+        INVOKE_BOOST_TEST(traits::min() == min, file, line);
         T imax = bourn_cast<T>(max);
         T imin = bourn_cast<T>(min);
-        INVOKE_BOOST_TEST_EQUAL(traits::max(), imax, file, line);
-        INVOKE_BOOST_TEST_EQUAL(traits::min(), imin, file, line);
+        INVOKE_BOOST_TEST(traits::max() == imax, file, line);
+        INVOKE_BOOST_TEST(traits::min() == imin, file, line);
         }
 }
 
diff --git a/expression_template_0_test.cpp b/expression_template_0_test.cpp
index 7150961..f88da1d 100644
--- a/expression_template_0_test.cpp
+++ b/expression_template_0_test.cpp
@@ -21,7 +21,9 @@
 
 #include "pchfile.hpp"
 
-#define USE_UBLAS
+#if 202002L <= __cplusplus
+#   define USE_UBLAS
+#endif // 202002L < __cplusplus
 
 #if defined USE_UBLAS
 // BOOST !! Startlingly enough, boost uBLAS depends on this standard



reply via email to

[Prev in Thread] Current Thread [Next in Thread]