Skip to content

Commit 33ff3a4

Browse files
committed
fix undefined bahaviour in msgpack_basic tests
1 parent 05de839 commit 33ff3a4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/msgpack_basic.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ BOOST_AUTO_TEST_CASE(simple_buffer_float)
190190
BOOST_CHECK(fabs(val2 - val1) <= kEPS);
191191

192192
// check for compact storing of float
193-
if (val1 == val1 && val1 == float(int64_t(val1)))
193+
if (val1 == val1 && val1 >= float(std::numeric_limits<int64_t>::min()) && val1 <= float(std::numeric_limits<int64_t>::max()) && val1 == float(int64_t(val1)))
194194
BOOST_REQUIRE_EQUAL(sbuf.size(),1);
195195
else
196196
BOOST_REQUIRE_EQUAL(sbuf.data()[0],char(0xca));
@@ -284,7 +284,7 @@ BOOST_AUTO_TEST_CASE(simple_buffer_double)
284284
BOOST_CHECK(fabs(val2 - val1) <= kEPS);
285285

286286
// check for compact storing of double
287-
if (val1 == val1 && val1 == double(int64_t(val1)))
287+
if (val1 == val1 && val1 >= double(std::numeric_limits<int64_t>::min()) && val1 <= double(std::numeric_limits<int64_t>::max()) && val1 == double(int64_t(val1)))
288288
BOOST_REQUIRE_EQUAL(sbuf.size(),1);
289289
else
290290
BOOST_REQUIRE_EQUAL(uint8_t(sbuf.data()[0]),uint8_t(0xcb));

0 commit comments

Comments
 (0)