diff options
| author | Gordon Sim <gsim@apache.org> | 2008-09-19 22:31:45 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2008-09-19 22:31:45 +0000 |
| commit | 8d37885858600fdaa3a3e5df042aff0b842d38e9 (patch) | |
| tree | f01116e089d4070045bef5cbb6d4098afe640137 /qpid/cpp/src/tests/FieldTable.cpp | |
| parent | fd64334f3676e7a0ef031732fbef37b73b90d706 (diff) | |
| download | qpid-python-8d37885858600fdaa3a3e5df042aff0b842d38e9.tar.gz | |
Support floats and doubles in field tables.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@697269 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests/FieldTable.cpp')
| -rw-r--r-- | qpid/cpp/src/tests/FieldTable.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/qpid/cpp/src/tests/FieldTable.cpp b/qpid/cpp/src/tests/FieldTable.cpp index 22db287140..953b853cd6 100644 --- a/qpid/cpp/src/tests/FieldTable.cpp +++ b/qpid/cpp/src/tests/FieldTable.cpp @@ -122,4 +122,39 @@ QPID_AUTO_TEST_CASE(testNestedValues) } } +QPID_AUTO_TEST_CASE(testFloatAndDouble) +{ + char buff[100]; + float f = 5.672; + double d = 56.720001; + { + FieldTable a; + a.setString("string", "abc"); + a.setInt("int", 5672); + a.setFloat("float", f); + a.setDouble("double", d); + + Buffer wbuffer(buff, 100); + wbuffer.put(a); + } + { + Buffer rbuffer(buff, 100); + FieldTable a; + rbuffer.get(a); + BOOST_CHECK(string("abc") == a.getString("string")); + BOOST_CHECK(5672 == a.getInt("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); + + double d2; + BOOST_CHECK(!a.getDouble("string", d2)); + BOOST_CHECK(!a.getDouble("int", d2)); + BOOST_CHECK(a.getDouble("double", d2)); + BOOST_CHECK(d2 == d); + } +} + QPID_AUTO_TEST_SUITE_END() |
