lmi-commits
[Top][All Lists]
Advanced

[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)



reply via email to

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