SHA256
8
0
forked from pool/cxxtools
Files
cxxtools/0001-remove-range-check-in-serializationinfo.patch
Michal Vyskocil 5b0cee9845 Accepting request 994506 from home:cgiboudeaux:branches:devel:libraries:c_c++
- Add upstream changes to fix build and tests:
  * 0001-add-missing-header-time.h-to-src-timer.cpp.patch
  * 0001-remove-timespan-unittest-which-is-prone-to-rounding-.patch
  * 0001-fix-reading-time-zones-on-32-bit-systems.patch
  * 0001-remove-range-check-in-serializationinfo.patch

OBS-URL: https://build.opensuse.org/request/show/994506
OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/cxxtools?expand=0&rev=18
2022-08-15 08:45:56 +00:00

77 lines
3.5 KiB
Diff

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