summaryrefslogtreecommitdiff
path: root/cpp/src/tests/FieldTable.cpp
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2008-09-19 22:31:45 +0000
committerGordon Sim <gsim@apache.org>2008-09-19 22:31:45 +0000
commit7c70d21ca2d788d4432cfa89851c9b928c9f30aa (patch)
tree01ec869bf97701c6de28cdf06f9db11f8782a793 /cpp/src/tests/FieldTable.cpp
parentceababe179b3f80a9444eef358f7ff96c81f7a18 (diff)
downloadqpid-python-7c70d21ca2d788d4432cfa89851c9b928c9f30aa.tar.gz
Support floats and doubles in field tables.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@697269 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests/FieldTable.cpp')
-rw-r--r--cpp/src/tests/FieldTable.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/cpp/src/tests/FieldTable.cpp b/cpp/src/tests/FieldTable.cpp
index 22db287140..953b853cd6 100644
--- a/cpp/src/tests/FieldTable.cpp
+++ b/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()