diff options
author | Gordon Sim <gsim@apache.org> | 2008-09-19 12:56:38 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2008-09-19 12:56:38 +0000 |
commit | 6266b974c0c227d279f4dde0fdbc07defd7b5965 (patch) | |
tree | fb407d8484cd6e01f0823a39aefce922782420e2 /cpp/src/tests/FieldTable.cpp | |
parent | 85021877a773ca361d90ebfce5d9ff0994d50378 (diff) | |
download | qpid-python-6266b974c0c227d279f4dde0fdbc07defd7b5965.tar.gz |
Added support for nested field tables & arrays within a field table.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@697076 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests/FieldTable.cpp')
-rw-r--r-- | cpp/src/tests/FieldTable.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/cpp/src/tests/FieldTable.cpp b/cpp/src/tests/FieldTable.cpp index 315801b428..22db287140 100644 --- a/cpp/src/tests/FieldTable.cpp +++ b/cpp/src/tests/FieldTable.cpp @@ -19,6 +19,7 @@ * */ #include <iostream> +#include "qpid/framing/Array.h" #include "qpid/framing/FieldTable.h" #include "qpid/framing/FieldValue.h" #include <alloca.h> @@ -82,4 +83,43 @@ QPID_AUTO_TEST_CASE(testAssignment) BOOST_CHECK(IntegerValue(1234) == *d.get("B")); } + +QPID_AUTO_TEST_CASE(testNestedValues) +{ + char buff[100]; + { + FieldTable a; + FieldTable b; + std::vector<std::string> items; + items.push_back("one"); + items.push_back("two"); + Array c(items); + + a.setString("id", "A"); + b.setString("id", "B"); + a.setTable("B", b); + a.setArray("C", c); + + + Buffer wbuffer(buff, 100); + wbuffer.put(a); + } + { + Buffer rbuffer(buff, 100); + FieldTable a; + FieldTable b; + Array c; + rbuffer.get(a); + BOOST_CHECK(string("A") == a.getString("id")); + a.getTable("B", b); + BOOST_CHECK(string("B") == b.getString("id")); + a.getArray("C", c); + std::vector<std::string> items; + c.collect(items); + BOOST_CHECK((uint) 2 == items.size()); + BOOST_CHECK(string("one") == items[0]); + BOOST_CHECK(string("two") == items[1]); + } +} + QPID_AUTO_TEST_SUITE_END() |