summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2007-10-19 16:23:30 +0000
committerAndrew Stitcher <astitcher@apache.org>2007-10-19 16:23:30 +0000
commit8c133bd9b5f92bcdfcb0ce4ed6f7c82fcf1fbfd5 (patch)
tree4c47c0f808b9e61cba11d8a8015f5d55ca567d79
parentf33b0010633359c55e75c1005d38118cbaf1ea39 (diff)
downloadqpid-python-8c133bd9b5f92bcdfcb0ce4ed6f7c82fcf1fbfd5.tar.gz
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@586520 13f79535-47bb-0310-9956-ffa450edef68
-rwxr-xr-xcpp/bootstrap1
-rw-r--r--cpp/src/qpid/framing/FieldValue.h8
-rw-r--r--cpp/src/qpid/framing/Value.cpp122
-rw-r--r--cpp/src/qpid/framing/Value.h171
-rw-r--r--cpp/src/tests/Blob.cpp32
-rw-r--r--cpp/src/tests/FieldTable.cpp84
-rw-r--r--cpp/src/tests/FieldTableTest.cpp96
-rw-r--r--cpp/src/tests/FieldValue.cpp79
-rw-r--r--cpp/src/tests/Makefile.am11
-rw-r--r--cpp/src/tests/ValueTest.cpp102
10 files changed, 195 insertions, 511 deletions
diff --git a/cpp/bootstrap b/cpp/bootstrap
index feb45f7510..84f0fbd89b 100755
--- a/cpp/bootstrap
+++ b/cpp/bootstrap
@@ -16,6 +16,7 @@ cat > src/rubygen.mk <<EOF
\$(rgen_cmd)
EOF
+
automake
autoconf
diff --git a/cpp/src/qpid/framing/FieldValue.h b/cpp/src/qpid/framing/FieldValue.h
index 7e3d895b61..2a33201254 100644
--- a/cpp/src/qpid/framing/FieldValue.h
+++ b/cpp/src/qpid/framing/FieldValue.h
@@ -24,6 +24,8 @@
#include "Buffer.h"
#include "amqp_types.h"
+#include "assert.h"
+
#include <iostream>
#include <memory>
#include <vector>
@@ -49,10 +51,10 @@ class FieldValue {
virtual void decode(Buffer& buffer) = 0;
virtual bool operator==(const Data&) const = 0;
- virtual bool convertsToInt() const { return false; }
+ virtual bool convertsToInt() const { assert(0!=0); return false; }
virtual bool convertsToString() const { return false; }
- virtual int64_t getInt() const { return 0; }
- virtual std::string getString() const { return ""; }
+ virtual int64_t getInt() const { assert(0!=0); return 0;}
+ virtual std::string getString() const { assert(0!=0); return ""; }
virtual void print(std::ostream& out) const = 0;
};
diff --git a/cpp/src/qpid/framing/Value.cpp b/cpp/src/qpid/framing/Value.cpp
deleted file mode 100644
index a9f316667f..0000000000
--- a/cpp/src/qpid/framing/Value.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "Value.h"
-#include "Buffer.h"
-#include "FieldTable.h"
-#include "qpid/QpidError.h"
-#include <sstream>
-
-namespace qpid {
-namespace framing {
-
-Value::~Value() {}
-
-void StringValue::encode(Buffer& buffer){
- buffer.putLongString(value);
-}
-void StringValue::decode(Buffer& buffer){
- buffer.getLongString(value);
-}
-
-void IntegerValue::encode(Buffer& buffer){
- buffer.putLong((uint32_t) value);
-}
-void IntegerValue::decode(Buffer& buffer){
- value = buffer.getLong();
-}
-
-void TimeValue::encode(Buffer& buffer){
- buffer.putLongLong(value);
-}
-void TimeValue::decode(Buffer& buffer){
- value = buffer.getLongLong();
-}
-
-void DecimalValue::encode(Buffer& buffer){
- buffer.putOctet(value.decimals);
- buffer.putLong(value.value);
-}
-void DecimalValue::decode(Buffer& buffer){
- value = Decimal(buffer.getLong(), buffer.getOctet());
-}
-
-void FieldTableValue::encode(Buffer& buffer){
- buffer.put(value);
-}
-void FieldTableValue::decode(Buffer& buffer){
- buffer.get(value);
-}
-
-std::auto_ptr<Value> Value::decode_value(Buffer& buffer)
-{
- std::auto_ptr<Value> value;
- uint8_t type = buffer.getOctet();
- switch(type){
- case 'S':
- value.reset(new StringValue());
- break;
- case 'I':
- value.reset(new IntegerValue());
- break;
- case 'D':
- value.reset(new DecimalValue());
- break;
- case 'T':
- value.reset(new TimeValue());
- break;
- case 'F':
- value.reset(new FieldTableValue());
- break;
-
- //non-standard types, introduced in java client for JMS compliance
- case 'x':
- value.reset(new BinaryValue());
- break;
- default:
- std::stringstream out;
- out << "Unknown field table value type: " << type;
- THROW_QPID_ERROR(FRAMING_ERROR, out.str());
- }
- value->decode(buffer);
- return value;
-}
-
-EmptyValue::~EmptyValue() {}
-
-void EmptyValue::print(std::ostream& out) const
-{
- out << "<empty field value>";
-}
-
-std::ostream& operator<<(std::ostream& out, const Value& v) {
- v.print(out);
- return out;
-}
-
-std::ostream& operator<<(std::ostream& out, const Decimal& d)
-{
- return out << "Decimal(" << d.value << "," << d.decimals << ")";
-}
-
-}}
-
-
-
diff --git a/cpp/src/qpid/framing/Value.h b/cpp/src/qpid/framing/Value.h
deleted file mode 100644
index a6cff8ec88..0000000000
--- a/cpp/src/qpid/framing/Value.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include <iostream>
-#include <vector>
-#include "amqp_types.h"
-#include "FieldTable.h"
-
-#ifndef _Value_
-#define _Value_
-
-namespace qpid {
-namespace framing {
-
-class Buffer;
-
-/**
- * Represents a decimal value.
- * No arithmetic functionality for now, we only care about encoding/decoding.
- */
-struct Decimal {
- uint32_t value;
- uint8_t decimals;
-
- Decimal(uint32_t value_=0, uint8_t decimals_=0) : value(value_), decimals(decimals_) {}
- bool operator==(const Decimal& d) const {
- return decimals == d.decimals && value == d.value;
- }
- bool operator!=(const Decimal& d) const { return !(*this == d); }
-};
-
-std::ostream& operator<<(std::ostream& out, const Decimal& d);
-
-/**
- * Polymorpic base class for values.
- */
-class Value {
- public:
- virtual ~Value();
- virtual uint32_t size() const = 0;
- virtual char getType() const = 0;
- virtual void encode(Buffer& buffer) = 0;
- virtual void decode(Buffer& buffer) = 0;
- virtual bool operator==(const Value&) const = 0;
- bool operator!=(const Value& v) const { return !(*this == v); }
- virtual void print(std::ostream& out) const = 0;
-
- /** Create a new value by decoding from the buffer */
- static std::auto_ptr<Value> decode_value(Buffer& buffer);
-};
-
-std::ostream& operator<<(std::ostream& out, const Value& d);
-
-
-/**
- * Template for common operations on Value sub-classes.
- */
-template <class T>
-class ValueOps : public Value
-{
- protected:
- T value;
- public:
- ValueOps() {}
- ValueOps(const T& v) : value(v) {}
- const T& getValue() const { return value; }
- T& getValue() { return value; }
-
- virtual bool operator==(const Value& v) const {
- const ValueOps<T>* vo = dynamic_cast<const ValueOps<T>*>(&v);
- if (vo == 0) return false;
- else return value == vo->value;
- }
-
- void print(std::ostream& out) const { out << value; }
-};
-
-
-class StringValue : public ValueOps<std::string> {
- public:
- StringValue(const std::string& v) : ValueOps<std::string>(v) {}
- StringValue() {}
- virtual uint32_t size() const { return 4 + value.length(); }
- virtual char getType() const { return 'S'; }
- virtual void encode(Buffer& buffer);
- virtual void decode(Buffer& buffer);
-};
-
-class IntegerValue : public ValueOps<int> {
- public:
- IntegerValue(int v) : ValueOps<int>(v) {}
- IntegerValue(){}
- virtual uint32_t size() const { return 4; }
- virtual char getType() const { return 'I'; }
- virtual void encode(Buffer& buffer);
- virtual void decode(Buffer& buffer);
-};
-
-class TimeValue : public ValueOps<uint64_t> {
- public:
- TimeValue(uint64_t v) : ValueOps<uint64_t>(v){}
- TimeValue(){}
- virtual uint32_t size() const { return 8; }
- virtual char getType() const { return 'T'; }
- virtual void encode(Buffer& buffer);
- virtual void decode(Buffer& buffer);
-};
-
-class DecimalValue : public ValueOps<Decimal> {
- public:
- DecimalValue(const Decimal& d) : ValueOps<Decimal>(d) {}
- DecimalValue(uint32_t value_=0, uint8_t decimals_=0) :
- ValueOps<Decimal>(Decimal(value_, decimals_)){}
- virtual uint32_t size() const { return 5; }
- virtual char getType() const { return 'D'; }
- virtual void encode(Buffer& buffer);
- virtual void decode(Buffer& buffer);
-};
-
-
-class FieldTableValue : public ValueOps<FieldTable> {
- public:
- FieldTableValue(const FieldTable& v) : ValueOps<FieldTable>(v){}
- FieldTableValue(){}
- virtual uint32_t size() const { return 4 + value.size(); }
- virtual char getType() const { return 'F'; }
- virtual void encode(Buffer& buffer);
- virtual void decode(Buffer& buffer);
-};
-
-class EmptyValue : public Value {
- public:
- ~EmptyValue();
- virtual uint32_t size() const { return 0; }
- virtual char getType() const { return 0; }
- virtual void encode(Buffer& ) {}
- virtual void decode(Buffer& ) {}
- virtual bool operator==(const Value& v) const {
- return dynamic_cast<const EmptyValue*>(&v);
- }
- virtual void print(std::ostream& out) const;
-};
-
-//non-standard types, introduced in java client for JMS compliance
-class BinaryValue : public StringValue {
- public:
- BinaryValue(const std::string& v) : StringValue(v) {}
- BinaryValue() {}
- virtual char getType() const { return 'x'; }
-};
-
-}} // qpid::framing
-
-#endif
diff --git a/cpp/src/tests/Blob.cpp b/cpp/src/tests/Blob.cpp
index 96861a3670..eeb2fa693b 100644
--- a/cpp/src/tests/Blob.cpp
+++ b/cpp/src/tests/Blob.cpp
@@ -1,21 +1,21 @@
/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-
#include "qpid/framing/Blob.h"
#define BOOST_AUTO_TEST_MAIN
diff --git a/cpp/src/tests/FieldTable.cpp b/cpp/src/tests/FieldTable.cpp
new file mode 100644
index 0000000000..31e3b08cba
--- /dev/null
+++ b/cpp/src/tests/FieldTable.cpp
@@ -0,0 +1,84 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+#include <iostream>
+#include "qpid/framing/FieldTable.h"
+#include "qpid/framing/FieldValue.h"
+
+#define BOOST_AUTO_TEST_MAIN
+#include <boost/test/auto_unit_test.hpp>
+
+using namespace qpid::framing;
+
+BOOST_AUTO_TEST_CASE(testMe)
+{
+ FieldTable ft;
+ ft.setString("A", "BCDE");
+ BOOST_CHECK(StringValue("BCDE") == *ft.get("A"));
+
+ char buff[100];
+ Buffer wbuffer(buff, 100);
+ wbuffer.put(ft);
+
+ Buffer rbuffer(buff, 100);
+ FieldTable ft2;
+ rbuffer.get(ft2);
+ BOOST_CHECK(StringValue("BCDE") == *ft2.get("A"));
+
+}
+
+BOOST_AUTO_TEST_CASE(testAssignment)
+{
+ FieldTable a;
+ FieldTable b;
+
+ a.setString("A", "BBBB");
+ a.setInt("B", 1234);
+ b = a;
+ a.setString("A", "CCCC");
+
+ BOOST_CHECK(StringValue("CCCC") == *a.get("A"));
+ BOOST_CHECK(StringValue("BBBB") == *b.get("A"));
+ BOOST_CHECK_EQUAL(1234, a.getInt("B"));
+ BOOST_CHECK_EQUAL(1234, b.getInt("B"));
+ BOOST_CHECK(IntegerValue(1234) == *a.get("B"));
+ BOOST_CHECK(IntegerValue(1234) == *b.get("B"));
+
+ FieldTable d;
+ {
+ FieldTable c;
+ c = a;
+
+ char* buff = static_cast<char*>(::alloca(c.size()));
+ Buffer wbuffer(buff, c.size());
+ wbuffer.put(c);
+
+ Buffer rbuffer(buff, c.size());
+ rbuffer.get(d);
+ BOOST_CHECK_EQUAL(c, d);
+ BOOST_CHECK(StringValue("CCCC") == *c.get("A"));
+ BOOST_CHECK(IntegerValue(1234) == *c.get("B"));
+ }
+ BOOST_CHECK(StringValue("CCCC") == *d.get("A"));
+ BOOST_CHECK(IntegerValue(1234) == *d.get("B"));
+}
+
+
+
diff --git a/cpp/src/tests/FieldTableTest.cpp b/cpp/src/tests/FieldTableTest.cpp
deleted file mode 100644
index b2efb23954..0000000000
--- a/cpp/src/tests/FieldTableTest.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include <iostream>
-#include "qpid/framing/FieldTable.h"
-#include "qpid/framing/FieldValue.h"
-
-#include "qpid_test_plugin.h"
-
-using namespace qpid::framing;
-
-class FieldTableTest : public CppUnit::TestCase
-{
- CPPUNIT_TEST_SUITE(FieldTableTest);
- CPPUNIT_TEST(testMe);
- CPPUNIT_TEST(testAssignment);
- CPPUNIT_TEST_SUITE_END();
-
- public:
-
- void testMe()
- {
- FieldTable ft;
- ft.setString("A", "BCDE");
- CPPUNIT_ASSERT(StringValue("BCDE") == *ft.get("A"));
-
- char buff[100];
- Buffer wbuffer(buff, 100);
- wbuffer.put(ft);
-
- Buffer rbuffer(buff, 100);
- FieldTable ft2;
- rbuffer.get(ft2);
- CPPUNIT_ASSERT(StringValue("BCDE") == *ft2.get("A"));
-
- }
-
- void testAssignment()
- {
- FieldTable a;
- FieldTable b;
-
- a.setString("A", "BBBB");
- a.setInt("B", 1234);
- b = a;
- a.setString("A", "CCCC");
-
- CPPUNIT_ASSERT(StringValue("CCCC") == *a.get("A"));
- CPPUNIT_ASSERT(StringValue("BBBB") == *b.get("A"));
- CPPUNIT_ASSERT_EQUAL(1234, a.getInt("B"));
- CPPUNIT_ASSERT_EQUAL(1234, b.getInt("B"));
- CPPUNIT_ASSERT(IntegerValue(1234) == *a.get("B"));
- CPPUNIT_ASSERT(IntegerValue(1234) == *b.get("B"));
-
- FieldTable d;
- {
- FieldTable c;
- c = a;
-
- char* buff = static_cast<char*>(::alloca(c.size()));
- Buffer wbuffer(buff, c.size());
- wbuffer.put(c);
-
- Buffer rbuffer(buff, c.size());
- rbuffer.get(d);
- CPPUNIT_ASSERT_EQUAL(c, d);
- CPPUNIT_ASSERT(StringValue("CCCC") == *c.get("A"));
- CPPUNIT_ASSERT(IntegerValue(1234) == *c.get("B"));
- }
- CPPUNIT_ASSERT(StringValue("CCCC") == *d.get("A"));
- CPPUNIT_ASSERT(IntegerValue(1234) == *d.get("B"));
- }
-};
-
-
-// Make this test suite a plugin.
-CPPUNIT_PLUGIN_IMPLEMENT();
-CPPUNIT_TEST_SUITE_REGISTRATION(FieldTableTest);
-
diff --git a/cpp/src/tests/FieldValue.cpp b/cpp/src/tests/FieldValue.cpp
new file mode 100644
index 0000000000..f2a859c95e
--- /dev/null
+++ b/cpp/src/tests/FieldValue.cpp
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+#include "qpid/framing/FieldValue.h"
+
+#define BOOST_AUTO_TEST_MAIN
+#include <boost/test/auto_unit_test.hpp>
+
+using namespace qpid::framing;
+
+StringValue s("abc");
+IntegerValue i(42);
+//DecimalValue d(1234,2);
+//FieldTableValue ft;
+//EmptyValue e;
+
+BOOST_AUTO_TEST_CASE(testStringValueEquals)
+{
+
+ BOOST_CHECK(StringValue("abc") == s);
+ BOOST_CHECK(StringValue("foo") != s);
+ BOOST_CHECK(s != i);
+// BOOST_CHECK(s != ft);
+}
+
+BOOST_AUTO_TEST_CASE(testIntegerValueEquals)
+{
+ BOOST_CHECK(IntegerValue(42) == i);
+ BOOST_CHECK(IntegerValue(5) != i);
+ BOOST_CHECK(i != s);
+// BOOST_CHECK(i != ft);
+}
+
+#if 0
+BOOST_AUTO_TEST_CASE(testDecimalValueEquals)
+{
+ BOOST_CHECK(DecimalValue(1234, 2) == d);
+ BOOST_CHECK(DecimalValue(12345, 2) != d);
+ BOOST_CHECK(DecimalValue(1234, 3) != d);
+ BOOST_CHECK(d != s);
+}
+
+BOOST_AUTO_TEST_CASE(testFieldTableValueEquals)
+{
+ ft.getValue().setString("foo", "FOO");
+ ft.getValue().setInt("magic", 7);
+
+ BOOST_CHECK_EQUAL(std::string("FOO"),
+ ft.getValue().getString("foo"));
+ BOOST_CHECK_EQUAL(7, ft.getValue().getInt("magic"));
+
+ FieldTableValue f2;
+ BOOST_CHECK(ft != f2);
+ f2.getValue().setString("foo", "FOO");
+ BOOST_CHECK(ft != f2);
+ f2.getValue().setInt("magic", 7);
+ BOOST_CHECK_EQUAL(ft,f2);
+ BOOST_CHECK(ft == f2);
+ f2.getValue().setString("foo", "BAR");
+ BOOST_CHECK(ft != f2);
+ BOOST_CHECK(ft != i);
+}
+#endif
+
diff --git a/cpp/src/tests/Makefile.am b/cpp/src/tests/Makefile.am
index eea2e6570a..b484bc19c7 100644
--- a/cpp/src/tests/Makefile.am
+++ b/cpp/src/tests/Makefile.am
@@ -60,6 +60,16 @@ check_PROGRAMS+=Shlib
Shlib_SOURCES=Shlib.cpp
Shlib_LDADD=-lboost_unit_test_framework $(lib_common)
+TESTS+=FieldValue
+check_PROGRAMS+=FieldValue
+FieldValue_SOURCES=FieldValue.cpp
+FieldValue_LDADD=-lboost_unit_test_framework $(lib_common)
+
+TESTS+=FieldTable
+check_PROGRAMS+=FieldTable
+FieldTable_SOURCES=FieldTable.cpp
+FieldTable_LDADD=-lboost_unit_test_framework $(lib_common)
+
# TODO aconway 2007-08-07: Why aren't these tests run automatically?
check_PROGRAMS+=ConcurrentQueue
@@ -106,7 +116,6 @@ broker_unit_tests = \
ClientChannelTest
framing_unit_tests = \
- FieldTableTest \
FramingTest \
HeaderTest \
SequenceNumberTest
diff --git a/cpp/src/tests/ValueTest.cpp b/cpp/src/tests/ValueTest.cpp
deleted file mode 100644
index 7e767b8559..0000000000
--- a/cpp/src/tests/ValueTest.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-#include "qpid/framing/Value.h"
-#include "qpid_test_plugin.h"
-
-using namespace qpid::framing;
-
-
-class ValueTest : public CppUnit::TestCase
-{
- CPPUNIT_TEST_SUITE(ValueTest);
- CPPUNIT_TEST(testStringValueEquals);
- CPPUNIT_TEST(testIntegerValueEquals);
- CPPUNIT_TEST(testDecimalValueEquals);
- CPPUNIT_TEST(testFieldTableValueEquals);
- CPPUNIT_TEST_SUITE_END();
-
- StringValue s;
- IntegerValue i;
- DecimalValue d;
- FieldTableValue ft;
- EmptyValue e;
-
- public:
- ValueTest() :
- s("abc"),
- i(42),
- d(1234,2)
-
- {
- ft.getValue().setString("foo", "FOO");
- ft.getValue().setInt("magic", 7);
- }
-
- void testStringValueEquals()
- {
-
- CPPUNIT_ASSERT(StringValue("abc") == s);
- CPPUNIT_ASSERT(s != StringValue("foo"));
- CPPUNIT_ASSERT(s != e);
- CPPUNIT_ASSERT(e != d);
- CPPUNIT_ASSERT(e != ft);
- }
-
- void testIntegerValueEquals()
- {
- CPPUNIT_ASSERT(IntegerValue(42) == i);
- CPPUNIT_ASSERT(IntegerValue(5) != i);
- CPPUNIT_ASSERT(i != e);
- CPPUNIT_ASSERT(i != d);
- }
-
- void testDecimalValueEquals()
- {
- CPPUNIT_ASSERT(DecimalValue(1234, 2) == d);
- CPPUNIT_ASSERT(DecimalValue(12345, 2) != d);
- CPPUNIT_ASSERT(DecimalValue(1234, 3) != d);
- CPPUNIT_ASSERT(d != s);
- }
-
-
- void testFieldTableValueEquals()
- {
- CPPUNIT_ASSERT_EQUAL(std::string("FOO"),
- ft.getValue().getString("foo"));
- CPPUNIT_ASSERT_EQUAL(7, ft.getValue().getInt("magic"));
-
- FieldTableValue f2;
- CPPUNIT_ASSERT(ft != f2);
- f2.getValue().setString("foo", "FOO");
- CPPUNIT_ASSERT(ft != f2);
- f2.getValue().setInt("magic", 7);
- CPPUNIT_ASSERT_EQUAL(ft,f2);
- CPPUNIT_ASSERT(ft == f2);
- f2.getValue().setString("foo", "BAR");
- CPPUNIT_ASSERT(ft != f2);
- CPPUNIT_ASSERT(ft != i);
- }
-
-};
-
-
-// Make this test suite a plugin.
-CPPUNIT_PLUGIN_IMPLEMENT();
-CPPUNIT_TEST_SUITE_REGISTRATION(ValueTest);
-