[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 43c26210 2/8: Make a unit test more thorough
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 43c26210 2/8: Make a unit test more thorough |
Date: |
Mon, 6 Jun 2022 18:40:33 -0400 (EDT) |
branch: master
commit 43c26210e142b924b48a7fcfd2067ab39b8072ca
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Make a unit test more thorough
Obviously the intention was to test all 256 rather than only 255 values.
Loops like this:
for(some_type j = min; j < max; ++j)
are so common that this one, as here corrected:
for(some_type j = min; j <= max; ++j)
feels wrong; therefore, added a comment so that no thoughtful
maintainer will "fix" it by reverting this change.
---
math_functions_test.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/math_functions_test.cpp b/math_functions_test.cpp
index 08eed487..60fa695e 100644
--- a/math_functions_test.cpp
+++ b/math_functions_test.cpp
@@ -566,7 +566,8 @@ void test_u_abs()
LMI_TEST_EQUAL(128, u_abs(INT8_MIN));
- for(std::int16_t j = INT8_MIN; j < INT8_MAX; ++j)
+ // Test all 256 possibilities.
+ for(std::int16_t j = INT8_MIN; j <= INT8_MAX; ++j)
{
std::uint16_t u = u_abs(j);
if(0 <= j)
- [lmi-commits] [lmi] master updated (a0472892 -> 9be3fe4e), Greg Chicares, 2022/06/06
- [lmi-commits] [lmi] master 43c26210 2/8: Make a unit test more thorough,
Greg Chicares <=
- [lmi-commits] [lmi] master 9be3fe4e 8/8: Update dotfiles, Greg Chicares, 2022/06/06
- [lmi-commits] [lmi] master 4d1b7487 3/8: Improve a local name, Greg Chicares, 2022/06/06
- [lmi-commits] [lmi] master d7249cec 1/8: Test whether macros were already defined, Greg Chicares, 2022/06/06
- [lmi-commits] [lmi] master 8f25a9bd 5/8: Resolve an issue identified by UBSAN, Greg Chicares, 2022/06/06
- [lmi-commits] [lmi] master fe203b1e 4/8: Use undefined-behavior sanitizer, Greg Chicares, 2022/06/06
- [lmi-commits] [lmi] master cc85be94 6/8: Resolve another issue identified by UBSAN, Greg Chicares, 2022/06/06
- [lmi-commits] [lmi] master 7ae73fae 7/8: Localize an 'f2c' global, Greg Chicares, 2022/06/06