[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;
- [lmi-commits] [lmi] master updated (926d9f91 -> 82468e66), Greg Chicares, 2022/05/21
- [lmi-commits] [lmi] master b52923fa 2/9: Make further use of values known to be correctly rounded, Greg Chicares, 2022/05/21
- [lmi-commits] [lmi] master fdf41a42 4/9: Reorganize unit tests,
Greg Chicares <=
- [lmi-commits] [lmi] master 82468e66 9/9: Show architectural context at start of main test function, Greg Chicares, 2022/05/21
- [lmi-commits] [lmi] master e59c42d3 7/9: Rearrange unit-test functions in invocation order, Greg Chicares, 2022/05/21
- [lmi-commits] [lmi] master d393cd47 3/9: Move a block to make an incipient refactoring simpler, Greg Chicares, 2022/05/21
- [lmi-commits] [lmi] master ff833df3 1/9: Verify against independent calculations, Greg Chicares, 2022/05/21
- [lmi-commits] [lmi] master 0c667ac5 5/9: Move an output line, Greg Chicares, 2022/05/21
- [lmi-commits] [lmi] master 3ebab874 8/9: Test fdlibm against C RTL, Greg Chicares, 2022/05/21
- [lmi-commits] [lmi] master 4e300fbc 6/9: Rearrange a unit test's output, Greg Chicares, 2022/05/21