[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 2faa024 5/6: Test auxiliary functions with an
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 2faa024 5/6: Test auxiliary functions with an unsigned type too |
Date: |
Sun, 30 Apr 2017 11:49:37 -0400 (EDT) |
branch: master
commit 2faa024a27e7db044b534aeef37decf04057cdc2
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Test auxiliary functions with an unsigned type too
Conditionalized initializations involving negative values.
---
tn_range_test.cpp | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/tn_range_test.cpp b/tn_range_test.cpp
index c4e85ea..0d099ec 100644
--- a/tn_range_test.cpp
+++ b/tn_range_test.cpp
@@ -134,21 +134,27 @@ template<typename T>
void tn_range_test::test_auxiliary_functions(char const* file, int line)
{
T const maxT = std::numeric_limits<T>::max();
+ T const minT = std::numeric_limits<T>::lowest();
+
INVOKE_BOOST_TEST(!is_strictly_between_extrema(maxT), file, line);
// This test would fail for type bool.
INVOKE_BOOST_TEST( is_strictly_between_extrema<T>(1), file, line);
- INVOKE_BOOST_TEST_EQUAL(-1, signum(T(-1)), file, line);
INVOKE_BOOST_TEST_EQUAL( 0, signum(T( 0)), file, line);
INVOKE_BOOST_TEST_EQUAL( 1, signum(T( 1)), file, line);
- INVOKE_BOOST_TEST_EQUAL(-1, signum(-maxT), file, line);
- INVOKE_BOOST_TEST_EQUAL( 1, signum( maxT), file, line);
+ INVOKE_BOOST_TEST_EQUAL( 1, signum(maxT), file, line);
- INVOKE_BOOST_TEST_EQUAL(true , is_exact_integer(T(-1)), file, line);
INVOKE_BOOST_TEST_EQUAL(true , is_exact_integer(T( 0)), file, line);
INVOKE_BOOST_TEST_EQUAL(true , is_exact_integer(T( 1)), file, line);
+ if(minT < 0)
+ {
+ INVOKE_BOOST_TEST_EQUAL(-1, signum(T(-1)), file, line);
+ INVOKE_BOOST_TEST_EQUAL(-1, signum(minT), file, line);
+ INVOKE_BOOST_TEST_EQUAL(true , is_exact_integer(T(-1)), file, line);
+ }
+
// Integer types truncate the argument, always resulting in an
// exact integer.
bool volatile exact = std::numeric_limits<T>::is_exact;
@@ -285,11 +291,12 @@ void tn_range_test::test_percentages(char const* file,
int line)
void tn_range_test::test()
{
- test_auxiliary_functions<signed char>(__FILE__, __LINE__);
- test_auxiliary_functions<int >(__FILE__, __LINE__);
- test_auxiliary_functions<float >(__FILE__, __LINE__);
- test_auxiliary_functions<double >(__FILE__, __LINE__);
- test_auxiliary_functions<long double>(__FILE__, __LINE__);
+ test_auxiliary_functions<signed char >(__FILE__, __LINE__);
+ test_auxiliary_functions<unsigned char>(__FILE__, __LINE__);
+ test_auxiliary_functions<int >(__FILE__, __LINE__);
+ test_auxiliary_functions<float >(__FILE__, __LINE__);
+ test_auxiliary_functions<double >(__FILE__, __LINE__);
+ test_auxiliary_functions<long double >(__FILE__, __LINE__);
test_floating_auxiliary_functions<float >(__FILE__, __LINE__);
test_floating_auxiliary_functions<double >(__FILE__, __LINE__);
- [lmi-commits] [lmi] master updated (f306a7d -> 2cbcddd), Greg Chicares, 2017/04/30
- [lmi-commits] [lmi] master 2faa024 5/6: Test auxiliary functions with an unsigned type too,
Greg Chicares <=
- [lmi-commits] [lmi] master eab8e30 4/6: Improve signum(), Greg Chicares, 2017/04/30
- [lmi-commits] [lmi] master 1484727 1/6: Remove emulation of std::isnan(), Greg Chicares, 2017/04/30
- [lmi-commits] [lmi] master eb921be 3/6: Fix peccable unit tests, Greg Chicares, 2017/04/30
- [lmi-commits] [lmi] master 2cbcddd 6/6: Test auxiliary functions with type bool too, Greg Chicares, 2017/04/30
- [lmi-commits] [lmi] master 3718824 2/6: Improve interest-conversion example, Greg Chicares, 2017/04/30