lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master fdf41a42 4/9: Reorganize unit tests


From: Greg Chicares
Subject: [lmi-commits] [lmi] master fdf41a42 4/9: Reorganize unit tests
Date: Sat, 21 May 2022 20:13:52 -0400 (EDT)

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

    Reorganize unit tests
    
    [As always,
      git config --global diff.colormoved plain
    is suggested; lmi chroot scripts take care of that.]
---
 math_functions_test.cpp | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/math_functions_test.cpp b/math_functions_test.cpp
index 4509921f..90cbc586 100644
--- a/math_functions_test.cpp
+++ b/math_functions_test.cpp
@@ -379,10 +379,8 @@ void test_signum(char const* file, int line)
         }
 }
 
-int test_main(int, char*[])
+void test_assign_midpoint()
 {
-    // Test assign_midpoint().
-
     constexpr double smallnum = std::numeric_limits<double>::denorm_min();
     constexpr double bignum   = std::numeric_limits<double>::max();
 
@@ -398,9 +396,10 @@ int test_main(int, char*[])
     LMI_TEST_EQUAL(v3[4], v2[4]);
     LMI_TEST_EQUAL(v3[5], v2[5]);
     LMI_TEST_EQUAL(6, v0.size());
+}
 
-    // Test outward_quotient().
-
+void test_outward_quotient()
+{
     LMI_TEST_EQUAL( 1, outward_quotient( 2,  2));
     LMI_TEST_EQUAL( 1, outward_quotient( 1,  2));
     LMI_TEST_EQUAL( 0, outward_quotient( 0,  2));
@@ -458,9 +457,10 @@ int test_main(int, char*[])
 
 // Appropriately fails to compile due to static assertion:
 //  outward_quotient(1.0, 1.0);
+}
 
-    // Actuarial functions.
-
+void test_compound_interest()
+{
     // Test with 1 == 'n'.
 
     LMI_TEST
@@ -592,6 +592,15 @@ int test_main(int, char*[])
             ,1.0e-15
             )
         );
+}
+
+int test_main(int, char*[])
+{
+    test_assign_midpoint();
+
+    test_outward_quotient();
+
+    test_compound_interest();
 
     std::cout << LMI_CONTEXT << '\n' << std::endl;
 



reply via email to

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