Author: astitcher
Date: Fri Oct 19 09:23:30 2007
New Revision: 586520
URL: http://svn.apache.org/viewvc?rev=586520&view=rev
Log: (empty)
Added:
incubator/qpid/trunk/qpid/cpp/src/tests/FieldTable.cpp (with props)
incubator/qpid/trunk/qpid/cpp/src/tests/FieldValue.cpp (with props)
Removed:
incubator/qpid/trunk/qpid/cpp/src/qpid/framing/Value.cpp
incubator/qpid/trunk/qpid/cpp/src/qpid/framing/Value.h
incubator/qpid/trunk/qpid/cpp/src/tests/FieldTableTest.cpp
incubator/qpid/trunk/qpid/cpp/src/tests/ValueTest.cpp
Modified:
incubator/qpid/trunk/qpid/ (props changed)
incubator/qpid/trunk/qpid/cpp/bootstrap
incubator/qpid/trunk/qpid/cpp/src/qpid/framing/FieldValue.h
incubator/qpid/trunk/qpid/cpp/src/tests/Blob.cpp
incubator/qpid/trunk/qpid/cpp/src/tests/Makefile.am
Propchange: incubator/qpid/trunk/qpid/
------------------------------------------------------------------------------
--- svk:merge (original)
+++ svk:merge Fri Oct 19 09:23:30 2007
@@ -1,3 +1,3 @@
8427bd24-ae5a-4eba-a324-d2fc9c9c6c77:/local/qpid.0-9.ams:1224
-c99eadab-1afc-4df6-acde-a632afdabecb:/local/qpid-trunk:947
-c99eadab-1afc-4df6-acde-a632afdabecb:/local/qpid/trunk/qpid:1036
+c99eadab-1afc-4df6-acde-a632afdabecb:/local/qpid-trunk:1612
+c99eadab-1afc-4df6-acde-a632afdabecb:/local/qpid/trunk/qpid:1616
Modified: incubator/qpid/trunk/qpid/cpp/bootstrap
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/bootstrap?rev=586520&r1=586519&r2=586520&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/bootstrap (original)
+++ incubator/qpid/trunk/qpid/cpp/bootstrap Fri Oct 19 09:23:30 2007
@@ -16,6 +16,7 @@
\$(rgen_cmd)
EOF
+
automake
autoconf
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/framing/FieldValue.h
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/framing/FieldValue.h?rev=586520&r1=586519&r2=586520&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/framing/FieldValue.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/framing/FieldValue.h Fri Oct 19
09:23:30 2007
@@ -24,6 +24,8 @@
#include "Buffer.h"
#include "amqp_types.h"
+#include "assert.h"
+
#include <iostream>
#include <memory>
#include <vector>
@@ -49,10 +51,10 @@
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;
};
Modified: incubator/qpid/trunk/qpid/cpp/src/tests/Blob.cpp
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/Blob.cpp?rev=586520&r1=586519&r2=586520&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/Blob.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/Blob.cpp Fri Oct 19 09:23:30 2007
@@ -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
Added: incubator/qpid/trunk/qpid/cpp/src/tests/FieldTable.cpp
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/FieldTable.cpp?rev=586520&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/FieldTable.cpp (added)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/FieldTable.cpp Fri Oct 19 09:23:30
2007
@@ -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"));
+}
+
+
+
Propchange: incubator/qpid/trunk/qpid/cpp/src/tests/FieldTable.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/qpid/trunk/qpid/cpp/src/tests/FieldTable.cpp
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/qpid/trunk/qpid/cpp/src/tests/FieldValue.cpp
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/FieldValue.cpp?rev=586520&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/FieldValue.cpp (added)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/FieldValue.cpp Fri Oct 19 09:23:30
2007
@@ -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
+
Propchange: incubator/qpid/trunk/qpid/cpp/src/tests/FieldValue.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/qpid/trunk/qpid/cpp/src/tests/FieldValue.cpp
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/qpid/trunk/qpid/cpp/src/tests/Makefile.am
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/Makefile.am?rev=586520&r1=586519&r2=586520&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/Makefile.am (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/Makefile.am Fri Oct 19 09:23:30 2007
@@ -60,6 +60,16 @@
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 @@
ClientChannelTest
framing_unit_tests = \
- FieldTableTest \
FramingTest \
HeaderTest \
SequenceNumberTest