lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master dcfcc94 3/8: Rename and document a unit-test


From: Greg Chicares
Subject: [lmi-commits] [lmi] master dcfcc94 3/8: Rename and document a unit-test function template
Date: Mon, 28 Jun 2021 10:29:52 -0400 (EDT)

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

    Rename and document a unit-test function template
---
 zero_test.cpp | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/zero_test.cpp b/zero_test.cpp
index 131eb80..ae94688 100644
--- a/zero_test.cpp
+++ b/zero_test.cpp
@@ -66,8 +66,10 @@ int max_n_iter_brent(double a, double b, double tol, double 
zeta)
 }
 } // Unnamed namespace.
 
+/// Test with all biases, asserting obvious invariants.
+
 template<typename F>
-void test_zero(double bound0, double bound1, int dec, F f, double exact_root)
+void test_bias(double bound0, double bound1, int dec, F f, double exact_root)
 {
     double maximum_error = max_err(exact_root, 0.5 * std::pow(10.0, -dec));
 
@@ -245,17 +247,17 @@ int test_main(int, char*[])
 
     // Various tests--see function-template definition.
 
-    test_zero(-1.0e100, 4.0e100, -100, e, std::exp(1.0));
-    test_zero(-1.0    , 4.0    ,    0, e, std::exp(1.0));
-    test_zero( 0.5    , 5.0    ,    1, e, std::exp(1.0));
-    test_zero( 0.5    , 5.0    ,    2, e, std::exp(1.0));
-    test_zero( 0.5    , 5.0    ,    3, e, std::exp(1.0));
-    test_zero( 0.5    , 5.0    ,    4, e, std::exp(1.0));
-    test_zero( 0.5    , 5.0    ,    5, e, std::exp(1.0));
-    test_zero( 0.5    , 5.0    ,    6, e, std::exp(1.0));
-    test_zero( 0.5    , 5.0    ,    7, e, std::exp(1.0));
-    test_zero( 0.5    , 5.0    ,    8, e, std::exp(1.0));
-    test_zero(-1.0    , 4.0    ,  100, e, std::exp(1.0));
+    test_bias(-1.0e100, 4.0e100, -100, e, std::exp(1.0));
+    test_bias(-1.0    , 4.0    ,    0, e, std::exp(1.0));
+    test_bias( 0.5    , 5.0    ,    1, e, std::exp(1.0));
+    test_bias( 0.5    , 5.0    ,    2, e, std::exp(1.0));
+    test_bias( 0.5    , 5.0    ,    3, e, std::exp(1.0));
+    test_bias( 0.5    , 5.0    ,    4, e, std::exp(1.0));
+    test_bias( 0.5    , 5.0    ,    5, e, std::exp(1.0));
+    test_bias( 0.5    , 5.0    ,    6, e, std::exp(1.0));
+    test_bias( 0.5    , 5.0    ,    7, e, std::exp(1.0));
+    test_bias( 0.5    , 5.0    ,    8, e, std::exp(1.0));
+    test_bias(-1.0    , 4.0    ,  100, e, std::exp(1.0));
 
     // Brent's book uses the nineteenth-power function in examples.
     // His example using a tolerance of 1e-20 is subject to underflow



reply via email to

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