Blob Blame History Raw
From 92ef7c2fd3431ba7c17434e66721d53149d81c8d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tommi=20M=C3=A4kitalo?= <tommi@tntnet.org>
Date: Mon, 22 Feb 2021 16:13:08 +0100
Subject: [PATCH] remove range check in serializationinfo

The test was not really useful and anyway skipped when double and long double
are identical. Somehow it did not work on PPC64.
---
 test/serializationinfo-test.cpp | 44 ---------------------------------
 1 file changed, 44 deletions(-)

diff --git a/test/serializationinfo-test.cpp b/test/serializationinfo-test.cpp
index f33a419..3b81a20 100644
--- a/test/serializationinfo-test.cpp
+++ b/test/serializationinfo-test.cpp
@@ -70,7 +70,6 @@ class SerializationInfoTest : public cxxtools::unit::TestSuite
             registerMethod("testMove", *this, &SerializationInfoTest::testMove);
 #endif
             registerMethod("testStringToBool", *this, &SerializationInfoTest::testStringToBool);
-            registerMethod("testRangeCheck", *this, &SerializationInfoTest::testRangeCheck);
             registerMethod("testMember", *this, &SerializationInfoTest::testMember);
         }
 
@@ -543,49 +542,6 @@ class SerializationInfoTest : public cxxtools::unit::TestSuite
             CXXTOOLS_UNIT_ASSERT(siValue<bool>(si));
         }
 
-        void testRangeCheck()
-        {
-            cxxtools::SerializationInfo si;
-            si.setValue(-1);
-            CXXTOOLS_UNIT_ASSERT_THROW(siValue<unsigned short>(si), std::range_error);
-            CXXTOOLS_UNIT_ASSERT_THROW(siValue<unsigned>(si), std::range_error);
-            CXXTOOLS_UNIT_ASSERT_THROW(siValue<unsigned long>(si), std::range_error);
-
-            si.setValue(static_cast<long>(std::numeric_limits<short>::max()) + 1);
-            CXXTOOLS_UNIT_ASSERT_THROW(siValue<short>(si), std::range_error);
-            CXXTOOLS_UNIT_ASSERT_NOTHROW(siValue<long>(si));
-
-            if (std::numeric_limits<long double>::max() > static_cast<long double>(std::numeric_limits<double>::max()))
-            {
-                si.setValue(static_cast<long double>(std::numeric_limits<double>::max()) * 1.01);
-                CXXTOOLS_UNIT_ASSERT_THROW(siValue<double>(si), std::range_error);
-                CXXTOOLS_UNIT_ASSERT_NOTHROW(siValue<long double>(si));
-
-                si.setValue(static_cast<long double>(-std::numeric_limits<double>::max()) * 1.01);
-                CXXTOOLS_UNIT_ASSERT_THROW(siValue<double>(si), std::range_error);
-                CXXTOOLS_UNIT_ASSERT_NOTHROW(siValue<long double>(si));
-            }
-            else
-            {
-                log_info("range error for double skipped since long double is not larger than double");
-            }
-
-            if (std::numeric_limits<long double>::max() > static_cast<long double>(std::numeric_limits<float>::max()))
-            {
-                si.setValue(static_cast<long double>(std::numeric_limits<float>::max()) * 1.01);
-                CXXTOOLS_UNIT_ASSERT_THROW(siValue<float>(si), std::range_error);
-                CXXTOOLS_UNIT_ASSERT_NOTHROW(siValue<double>(si));
-
-                si.setValue(static_cast<long double>(-std::numeric_limits<float>::max()) * 1.01);
-                CXXTOOLS_UNIT_ASSERT_THROW(siValue<float>(si), std::range_error);
-                CXXTOOLS_UNIT_ASSERT_NOTHROW(siValue<double>(si));
-            }
-            else
-            {
-                log_info("range error for float skipped since long double is not larger than double");
-            }
-        }
-
         void testMember()
         {
             cxxtools::SerializationInfo si;
-- 
2.37.1