diff options
| author | Alan Conway <aconway@apache.org> | 2015-04-16 19:04:23 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2015-04-16 19:04:23 +0000 |
| commit | ea16e50919f21fbab181e20e25b03d1a314634c8 (patch) | |
| tree | 59fc8ce516b7ad1e6b46b2f640b418cd9092f10c /qpid/cpp/src/tests/FieldTable.cpp | |
| parent | e7998631f9c479dd659f409f8e38c910e0028858 (diff) | |
| download | qpid-python-ea16e50919f21fbab181e20e25b03d1a314634c8.tar.gz | |
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
Diffstat (limited to 'qpid/cpp/src/tests/FieldTable.cpp')
| -rw-r--r-- | qpid/cpp/src/tests/FieldTable.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
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); } } |
