summaryrefslogtreecommitdiff
path: root/cpp/src/tests/FieldTableTest.cpp
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2007-04-05 11:48:05 +0000
committerGordon Sim <gsim@apache.org>2007-04-05 11:48:05 +0000
commitbe0ad1041a449196a328260d2210c5f7c27fa0a1 (patch)
tree6a4a648a2fca1de6f0a8572e063fc701a9de68b7 /cpp/src/tests/FieldTableTest.cpp
parent4547988868ea17dd34064204de84e66206b16d5b (diff)
downloadqpid-python-be0ad1041a449196a328260d2210c5f7c27fa0a1.tar.gz
* Further (minor) changes to the interface between store and broker.
* TxBuffer now uses shared_ptr to TxOps (removed DeletingTxOp) * Queue now persists the field table of settings git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@525801 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests/FieldTableTest.cpp')
-rw-r--r--cpp/src/tests/FieldTableTest.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/cpp/src/tests/FieldTableTest.cpp b/cpp/src/tests/FieldTableTest.cpp
index f485ca187e..a7a03cc574 100644
--- a/cpp/src/tests/FieldTableTest.cpp
+++ b/cpp/src/tests/FieldTableTest.cpp
@@ -28,6 +28,7 @@ class FieldTableTest : public CppUnit::TestCase
{
CPPUNIT_TEST_SUITE(FieldTableTest);
CPPUNIT_TEST(testMe);
+ CPPUNIT_TEST(testAssignment);
CPPUNIT_TEST_SUITE_END();
public:
@@ -46,6 +47,38 @@ class FieldTableTest : public CppUnit::TestCase
CPPUNIT_ASSERT_EQUAL(std::string("BCDE"), ft2.getString("A"));
}
+
+ void testAssignment()
+ {
+ FieldTable a;
+ FieldTable b;
+
+ a.setString("A", "BBBB");
+ a.setInt("B", 1234);
+ b = a;
+ a.setString("A", "CCCC");
+
+ CPPUNIT_ASSERT_EQUAL(std::string("CCCC"), a.getString("A"));
+ CPPUNIT_ASSERT_EQUAL(std::string("BBBB"), b.getString("A"));
+ CPPUNIT_ASSERT_EQUAL(1234, a.getInt("B"));
+ CPPUNIT_ASSERT_EQUAL(1234, b.getInt("B"));
+
+ FieldTable d;
+ {
+ FieldTable c;
+ c = a;
+
+ Buffer buffer(c.size());
+ buffer.putFieldTable(c);
+ buffer.flip();
+ buffer.getFieldTable(d);
+ CPPUNIT_ASSERT_EQUAL(c, d);
+ CPPUNIT_ASSERT_EQUAL(std::string("CCCC"), c.getString("A"));
+ CPPUNIT_ASSERT_EQUAL(1234, c.getInt("B"));
+ }
+ CPPUNIT_ASSERT_EQUAL(std::string("CCCC"), d.getString("A"));
+ CPPUNIT_ASSERT_EQUAL(1234, d.getInt("B"));
+ }
};