From ea16e50919f21fbab181e20e25b03d1a314634c8 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Thu, 16 Apr 2015 19:04:23 +0000 Subject: QPID-6470: Fix float conversion problems. Previous code would incorrectly convert between float and int types producing nonsense values, and would not allow legal conversions between float and double types. Created FixedWidthIntValue and FixedWidthFloatValue template subclasses to correctly handle conversions. Enabled FieldValue unit tests for float conversions. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1674137 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/tests/FieldTable.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'qpid/cpp/src/tests/FieldTable.cpp') diff --git a/qpid/cpp/src/tests/FieldTable.cpp b/qpid/cpp/src/tests/FieldTable.cpp index 81372d87c5..c040f1d433 100644 --- a/qpid/cpp/src/tests/FieldTable.cpp +++ b/qpid/cpp/src/tests/FieldTable.cpp @@ -176,19 +176,19 @@ QPID_AUTO_TEST_CASE(testFloatAndDouble) Buffer rbuffer(buff, 100); FieldTable a; rbuffer.get(a); - BOOST_CHECK(string("abc") == a.getAsString("string")); - BOOST_CHECK(5672 == a.getAsInt("int")); + BOOST_CHECK_EQUAL(string("abc"), a.getAsString("string")); + BOOST_CHECK_EQUAL(5672, a.getAsInt("int")); float f2; BOOST_CHECK(!a.getFloat("string", f2)); BOOST_CHECK(!a.getFloat("int", f2)); BOOST_CHECK(a.getFloat("float", f2)); - BOOST_CHECK(f2 == f); + BOOST_CHECK_EQUAL(f2, f); double d2; BOOST_CHECK(!a.getDouble("string", d2)); BOOST_CHECK(!a.getDouble("int", d2)); BOOST_CHECK(a.getDouble("double", d2)); - BOOST_CHECK(d2 == d); + BOOST_CHECK_EQUAL(d2, d); } } -- cgit v1.2.1