[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 11df70d 2/6: Assert nonnegativity of certain
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 11df70d 2/6: Assert nonnegativity of certain unit-test parameters |
Date: |
Thu, 26 Aug 2021 20:48:05 -0400 (EDT) |
branch: master
commit 11df70d524bd64e54bfb9dd0903c894543c8b510
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Assert nonnegativity of certain unit-test parameters
---
zero_test.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/zero_test.cpp b/zero_test.cpp
index 3206507..828c19c 100644
--- a/zero_test.cpp
+++ b/zero_test.cpp
@@ -23,6 +23,7 @@
#include "zero.hpp"
+#include "assert_lmi.hpp"
#include "materially_equal.hpp"
#include "math_functions.hpp" // signum()
#include "miscellany.hpp" // stifle_warning_for_unused_variable()
@@ -48,6 +49,7 @@ static double const epsilon =
std::numeric_limits<double>::epsilon();
double max_err(double zeta, double tol)
{
+ LMI_ASSERT(0.0 <= tol);
return 6.0 * epsilon * std::fabs(zeta) + 2.0 * tol;
}
@@ -78,6 +80,7 @@ double max_err(double zeta, double tol)
int max_n_eval_bolzano(double a, double b, double tol, double zeta)
{
+ LMI_ASSERT(0.0 <= tol);
double delta = 2.0 * epsilon * std::fabs(zeta) + tol;
double k = std::ceil(std::log2(std::fabs(b - a) / delta));
return 1 + static_cast<int>(k);
- [lmi-commits] [lmi] master updated (8fd99ca -> 9e68ef8), Greg Chicares, 2021/08/26
- [lmi-commits] [lmi] master 144c075 5/6: Make a unit-test function return a useful value, Greg Chicares, 2021/08/26
- [lmi-commits] [lmi] master 0215566 4/6: Further improve a local function in a unit-test TU, Greg Chicares, 2021/08/26
- [lmi-commits] [lmi] master d4aeb8d 1/6: Improve shellcheck usage, Greg Chicares, 2021/08/26
- [lmi-commits] [lmi] master 166571d 3/6: Improve a local function in a unit-test TU, Greg Chicares, 2021/08/26
- [lmi-commits] [lmi] master 9e68ef8 6/6: Add TOMS 748 unit tests, Greg Chicares, 2021/08/26
- [lmi-commits] [lmi] master 11df70d 2/6: Assert nonnegativity of certain unit-test parameters,
Greg Chicares <=