summaryrefslogtreecommitdiff
path: root/cpp/src/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/tests')
-rw-r--r--cpp/src/tests/Array.cpp7
-rw-r--r--cpp/src/tests/Blob.cpp6
-rw-r--r--cpp/src/tests/Cluster.cpp7
-rw-r--r--cpp/src/tests/Cpg.cpp8
-rw-r--r--cpp/src/tests/FieldTable.cpp7
-rw-r--r--cpp/src/tests/FieldValue.cpp7
-rw-r--r--cpp/src/tests/Frame.cpp7
-rw-r--r--cpp/src/tests/InlineVector.cpp7
-rw-r--r--cpp/src/tests/Makefile.am2
-rw-r--r--cpp/src/tests/RefCounted.cpp7
-rw-r--r--cpp/src/tests/RefCountedMap.cpp6
-rw-r--r--cpp/src/tests/Serializer.cpp8
-rw-r--r--cpp/src/tests/SessionState.cpp10
-rw-r--r--cpp/src/tests/Shlib.cpp7
-rw-r--r--cpp/src/tests/Url.cpp6
-rw-r--r--cpp/src/tests/Uuid.cpp7
-rw-r--r--cpp/src/tests/cluster_client.cpp7
-rw-r--r--cpp/src/tests/interop_runner.cpp10
-rw-r--r--cpp/src/tests/logging.cpp13
-rw-r--r--cpp/src/tests/unit_test.cpp7
-rw-r--r--cpp/src/tests/unit_test.h44
21 files changed, 126 insertions, 64 deletions
diff --git a/cpp/src/tests/Array.cpp b/cpp/src/tests/Array.cpp
index 5bf7fadce0..336e57b485 100644
--- a/cpp/src/tests/Array.cpp
+++ b/cpp/src/tests/Array.cpp
@@ -23,8 +23,9 @@
#include "qpid/framing/Array.h"
#include "qpid/framing/FieldValue.h"
-#include <boost/test/auto_unit_test.hpp>
-BOOST_AUTO_TEST_SUITE(Array);
+#include "unit_test.h"
+
+QPID_AUTO_TEST_SUITE(ArrayTestSuite)
using namespace qpid::framing;
@@ -75,4 +76,4 @@ BOOST_AUTO_TEST_CASE(testAssignment)
BOOST_CHECK(data == data2);
}
-BOOST_AUTO_TEST_SUITE_END();
+QPID_AUTO_TEST_SUITE_END()
diff --git a/cpp/src/tests/Blob.cpp b/cpp/src/tests/Blob.cpp
index d10cbf20c0..d27c0bbd85 100644
--- a/cpp/src/tests/Blob.cpp
+++ b/cpp/src/tests/Blob.cpp
@@ -18,9 +18,9 @@
*/
#include "qpid/framing/Blob.h"
-#include <boost/test/auto_unit_test.hpp>
+#include "unit_test.h"
-BOOST_AUTO_TEST_SUITE(Blob);
+QPID_AUTO_TEST_SUITE(BlobTestSuite)
using namespace std;
using namespace qpid::framing;
@@ -125,4 +125,4 @@ BOOST_AUTO_TEST_CASE(testClear) {
BOOST_CHECK_EQUAL(0, Foo::instances);
}
-BOOST_AUTO_TEST_SUITE_END();
+QPID_AUTO_TEST_SUITE_END()
diff --git a/cpp/src/tests/Cluster.cpp b/cpp/src/tests/Cluster.cpp
index 635126053f..b448128620 100644
--- a/cpp/src/tests/Cluster.cpp
+++ b/cpp/src/tests/Cluster.cpp
@@ -24,11 +24,12 @@
#include "qpid/framing/all_method_bodies.h"
#include "qpid/cluster/ClassifierHandler.h"
-#include <boost/test/auto_unit_test.hpp>
-BOOST_AUTO_TEST_SUITE(Cluster);
+#include "unit_test.h"
#include <sys/wait.h>
+QPID_AUTO_TEST_SUITE(ClusterTestSuite)
+
static const ProtocolVersion VER;
/** Verify membership in a cluster with one member. */
@@ -107,4 +108,4 @@ BOOST_AUTO_TEST_CASE(testClassifierHandlerWiring) {
BOOST_CHECK_EQUAL(1u, other.count);
}
-BOOST_AUTO_TEST_SUITE_END();
+QPID_AUTO_TEST_SUITE_END()
diff --git a/cpp/src/tests/Cpg.cpp b/cpp/src/tests/Cpg.cpp
index 06c8aec9ef..fddfe9ef05 100644
--- a/cpp/src/tests/Cpg.cpp
+++ b/cpp/src/tests/Cpg.cpp
@@ -22,8 +22,7 @@
#include "qpid/framing/AMQBody.h"
#include <boost/bind.hpp>
-#include <boost/test/auto_unit_test.hpp>
-BOOST_AUTO_TEST_SUITE(Cpg);
+#include "unit_test.h"
#include <string>
#include <iostream>
@@ -31,6 +30,9 @@ BOOST_AUTO_TEST_SUITE(Cpg);
#include <vector>
#include <algorithm>
+QPID_AUTO_TEST_SUITE(CpgTestSuite)
+
+
using namespace std;
using namespace qpid::cluster;
using namespace qpid::framing;
@@ -106,4 +108,4 @@ BOOST_AUTO_TEST_CASE(CpgBasic) {
}
-BOOST_AUTO_TEST_SUITE_END();
+QPID_AUTO_TEST_SUITE_END()
diff --git a/cpp/src/tests/FieldTable.cpp b/cpp/src/tests/FieldTable.cpp
index ee23360d9a..db4c4906fa 100644
--- a/cpp/src/tests/FieldTable.cpp
+++ b/cpp/src/tests/FieldTable.cpp
@@ -22,11 +22,12 @@
#include "qpid/framing/FieldTable.h"
#include "qpid/framing/FieldValue.h"
-#include <boost/test/auto_unit_test.hpp>
-BOOST_AUTO_TEST_SUITE(FieldTable);
+#include "unit_test.h"
using namespace qpid::framing;
+QPID_AUTO_TEST_SUITE(FieldTableTestSuite)
+
BOOST_AUTO_TEST_CASE(testMe)
{
FieldTable ft;
@@ -80,4 +81,4 @@ BOOST_AUTO_TEST_CASE(testAssignment)
BOOST_CHECK(IntegerValue(1234) == *d.get("B"));
}
-BOOST_AUTO_TEST_SUITE_END();
+QPID_AUTO_TEST_SUITE_END()
diff --git a/cpp/src/tests/FieldValue.cpp b/cpp/src/tests/FieldValue.cpp
index a852a07327..a820ae57bd 100644
--- a/cpp/src/tests/FieldValue.cpp
+++ b/cpp/src/tests/FieldValue.cpp
@@ -18,8 +18,9 @@
*/
#include "qpid/framing/FieldValue.h"
-#include <boost/test/auto_unit_test.hpp>
-BOOST_AUTO_TEST_SUITE(FieldValue);
+#include "unit_test.h"
+
+QPID_AUTO_TEST_SUITE(FieldValueTestSuite)
using namespace qpid::framing;
@@ -86,4 +87,4 @@ BOOST_AUTO_TEST_CASE(testFieldTableValueEquals)
}
#endif
-BOOST_AUTO_TEST_SUITE_END();
+QPID_AUTO_TEST_SUITE_END()
diff --git a/cpp/src/tests/Frame.cpp b/cpp/src/tests/Frame.cpp
index c0839b67d7..0484dc4b2a 100644
--- a/cpp/src/tests/Frame.cpp
+++ b/cpp/src/tests/Frame.cpp
@@ -21,8 +21,9 @@
#include "qpid/framing/Frame.h"
#include <boost/lexical_cast.hpp>
-#include <boost/test/auto_unit_test.hpp>
-BOOST_AUTO_TEST_SUITE(Frame);
+#include "unit_test.h"
+
+QPID_AUTO_TEST_SUITE(FrameTestSuite)
using namespace std;
using namespace qpid::framing;
@@ -76,4 +77,4 @@ BOOST_AUTO_TEST_CASE(testLoop) {
}
}
-BOOST_AUTO_TEST_SUITE_END();
+QPID_AUTO_TEST_SUITE_END()
diff --git a/cpp/src/tests/InlineVector.cpp b/cpp/src/tests/InlineVector.cpp
index a213f24809..d1b3ebf7de 100644
--- a/cpp/src/tests/InlineVector.cpp
+++ b/cpp/src/tests/InlineVector.cpp
@@ -20,8 +20,9 @@
*/
#include "qpid/InlineVector.h"
-#include <boost/test/auto_unit_test.hpp>
-BOOST_AUTO_TEST_SUITE(InlineVector);
+#include "unit_test.h"
+
+QPID_AUTO_TEST_SUITE(InlineVectorTestSuite)
using namespace qpid;
using namespace std;
@@ -85,4 +86,4 @@ BOOST_AUTO_TEST_CASE(testInsert) {
}
-BOOST_AUTO_TEST_SUITE_END();
+QPID_AUTO_TEST_SUITE_END()
diff --git a/cpp/src/tests/Makefile.am b/cpp/src/tests/Makefile.am
index 5265411b54..c3f48b0366 100644
--- a/cpp/src/tests/Makefile.am
+++ b/cpp/src/tests/Makefile.am
@@ -1,4 +1,4 @@
-AM_CXXFLAGS = $(WARNING_CFLAGS) $(CPPUNIT_CXXFLAGS) $(APR_CXXFLAGS)
+AM_CXXFLAGS = $(WARNING_CFLAGS) $(CPPUNIT_CXXFLAGS) $(APR_CXXFLAGS) -DBOOST_TEST_DYN_LINK
INCLUDES = -I$(srcdir)/.. -I$(srcdir)/../gen -I$(top_builddir)/src/gen
abs_builddir=@abs_builddir@
diff --git a/cpp/src/tests/RefCounted.cpp b/cpp/src/tests/RefCounted.cpp
index 1d453aedd1..d111d58712 100644
--- a/cpp/src/tests/RefCounted.cpp
+++ b/cpp/src/tests/RefCounted.cpp
@@ -18,8 +18,9 @@
#include "qpid/RefCounted.h"
-#include <boost/test/auto_unit_test.hpp>
-BOOST_AUTO_TEST_SUITE(RefCounted);
+#include "unit_test.h"
+
+QPID_AUTO_TEST_SUITE(RefCountedTestSuiteTestSuite)
using namespace std;
using namespace qpid;
@@ -69,4 +70,4 @@ BOOST_AUTO_TEST_CASE(testRefCounted) {
BOOST_CHECK_EQUAL(0, CountMe::instances);
}
-BOOST_AUTO_TEST_SUITE_END();
+QPID_AUTO_TEST_SUITE_END()
diff --git a/cpp/src/tests/RefCountedMap.cpp b/cpp/src/tests/RefCountedMap.cpp
index ba98401b92..1875b8161c 100644
--- a/cpp/src/tests/RefCountedMap.cpp
+++ b/cpp/src/tests/RefCountedMap.cpp
@@ -18,10 +18,10 @@
#include "qpid/sys/RefCountedMap.h"
-#include <boost/test/auto_unit_test.hpp>
+#include "unit_test.h"
#include <boost/bind.hpp>
-BOOST_AUTO_TEST_SUITE(RefCountedMap);
+QPID_AUTO_TEST_SUITE(RefCountedMapTestSuite)
using namespace std;
using namespace qpid;
@@ -121,3 +121,5 @@ BOOST_AUTO_TEST_CASE(testRefCountedMapAttachClose) {
BOOST_CHECK_EQUAL(0, Data::instances);
BOOST_CHECK_EQUAL(0, Attachment::instances);
}
+
+QPID_AUTO_TEST_SUITE_END()
diff --git a/cpp/src/tests/Serializer.cpp b/cpp/src/tests/Serializer.cpp
index 0d52eef711..51b739218d 100644
--- a/cpp/src/tests/Serializer.cpp
+++ b/cpp/src/tests/Serializer.cpp
@@ -26,13 +26,15 @@
#include <boost/bind.hpp>
#include <boost/utility/value_init.hpp>
-#include <boost/test/auto_unit_test.hpp>
-BOOST_AUTO_TEST_SUITE(Serializer);
+#include "unit_test.h"
#include <set>
#include <unistd.h>
+QPID_AUTO_TEST_SUITE(SerializerTestSuite)
+
+
using namespace qpid;
using namespace qpid::sys;
using namespace qpid::framing;
@@ -152,4 +154,4 @@ BOOST_AUTO_TEST_CASE(testExternalDispatch) {
BOOST_CHECK(Thread::logId() != *tester.threads.begin());
}
-BOOST_AUTO_TEST_SUITE_END();
+QPID_AUTO_TEST_SUITE_END()
diff --git a/cpp/src/tests/SessionState.cpp b/cpp/src/tests/SessionState.cpp
index b8d0560c48..56d0055ed8 100644
--- a/cpp/src/tests/SessionState.cpp
+++ b/cpp/src/tests/SessionState.cpp
@@ -17,10 +17,12 @@
*/
#include "qpid/framing/SessionState.h"
+#include "qpid/Exception.h"
#include <boost/bind.hpp>
-#include <boost/test/auto_unit_test.hpp>
-BOOST_AUTO_TEST_SUITE(SessionState);
+#include "unit_test.h"
+
+QPID_AUTO_TEST_SUITE(SessionStateTestSuite)
using namespace std;
using namespace qpid::framing;
@@ -119,7 +121,7 @@ BOOST_AUTO_TEST_CASE(testReplay) {
try {
session.receivedAck(6);
BOOST_FAIL("expected exception");
- } catch(const qpid::Exception&) {}
+ } catch(const std::exception&) {}
}
@@ -141,4 +143,4 @@ BOOST_AUTO_TEST_CASE(testReceived) {
BOOST_CHECK_EQUAL(5u, *s3.received(f));
}
-BOOST_AUTO_TEST_SUITE_END();
+QPID_AUTO_TEST_SUITE_END()
diff --git a/cpp/src/tests/Shlib.cpp b/cpp/src/tests/Shlib.cpp
index f394f7c795..3adc33aac9 100644
--- a/cpp/src/tests/Shlib.cpp
+++ b/cpp/src/tests/Shlib.cpp
@@ -22,8 +22,9 @@
#include "qpid/sys/Shlib.h"
#include "qpid/Exception.h"
-#include <boost/test/auto_unit_test.hpp>
-BOOST_AUTO_TEST_SUITE(Shlib);
+#include "unit_test.h"
+
+QPID_AUTO_TEST_SUITE(ShlibTestSuite)
using namespace qpid::sys;
typedef void (*CallMe)(int*);
@@ -56,4 +57,4 @@ BOOST_AUTO_TEST_CASE(testAutoShlib) {
}
-BOOST_AUTO_TEST_SUITE_END();
+QPID_AUTO_TEST_SUITE_END()
diff --git a/cpp/src/tests/Url.cpp b/cpp/src/tests/Url.cpp
index a1ce2b8cf5..5d376e3439 100644
--- a/cpp/src/tests/Url.cpp
+++ b/cpp/src/tests/Url.cpp
@@ -17,7 +17,7 @@
*/
-#include <boost/test/auto_unit_test.hpp>
+#include "unit_test.h"
#include "test_tools.h"
#include "qpid/Url.h"
#include <boost/assign.hpp>
@@ -26,7 +26,7 @@ using namespace std;
using namespace qpid;
using namespace boost::assign;
-BOOST_AUTO_TEST_SUITE(Url);
+QPID_AUTO_TEST_SUITE(UrlTestSuite)
BOOST_AUTO_TEST_CASE(testUrl_str) {
Url url;
@@ -61,4 +61,4 @@ BOOST_AUTO_TEST_CASE(testUrl_parse) {
}
-BOOST_AUTO_TEST_SUITE_END();
+QPID_AUTO_TEST_SUITE_END()
diff --git a/cpp/src/tests/Uuid.cpp b/cpp/src/tests/Uuid.cpp
index 6926077d30..c158cf53d2 100644
--- a/cpp/src/tests/Uuid.cpp
+++ b/cpp/src/tests/Uuid.cpp
@@ -19,11 +19,12 @@
#include "qpid/framing/Uuid.h"
#include "qpid/framing/Buffer.h"
-#include <boost/test/auto_unit_test.hpp>
-BOOST_AUTO_TEST_SUITE(Uuid);
+#include "unit_test.h"
#include <set>
+QPID_AUTO_TEST_SUITE(UuidTestSuite)
+
using namespace std;
using namespace qpid::framing;
@@ -74,4 +75,4 @@ BOOST_AUTO_TEST_CASE(testUuidEncodeDecode) {
string(decoded.begin(), decoded.end()));
}
-BOOST_AUTO_TEST_SUITE_END();
+QPID_AUTO_TEST_SUITE_END()
diff --git a/cpp/src/tests/cluster_client.cpp b/cpp/src/tests/cluster_client.cpp
index d3ce25540d..c74d7329f0 100644
--- a/cpp/src/tests/cluster_client.cpp
+++ b/cpp/src/tests/cluster_client.cpp
@@ -19,14 +19,15 @@
#include "qpid/client/Connection.h"
#include "qpid/shared_ptr.h"
-#include <boost/test/auto_unit_test.hpp>
-BOOST_AUTO_TEST_SUITE(cluster_client);
+#include "unit_test.h"
#include <fstream>
#include <vector>
#include <functional>
+QPID_AUTO_TEST_SUITE(cluster_clientTestSuite)
+
using namespace std;
using namespace qpid;
using namespace qpid::client;
@@ -78,4 +79,4 @@ BOOST_AUTO_TEST_CASE(testWiringReplication) {
}
}
-BOOST_AUTO_TEST_SUITE_END();
+QPID_AUTO_TEST_SUITE_END()
diff --git a/cpp/src/tests/interop_runner.cpp b/cpp/src/tests/interop_runner.cpp
index 56f9cbf3d2..824af7f3b7 100644
--- a/cpp/src/tests/interop_runner.cpp
+++ b/cpp/src/tests/interop_runner.cpp
@@ -20,6 +20,7 @@
*/
#include "qpid/Options.h"
+#include "qpid/ptr_map.h"
#include "qpid/Exception.h"
#include "qpid/client/Channel.h"
#include "qpid/client/Connection.h"
@@ -71,7 +72,7 @@ class Listener : public MessageListener, private Runnable{
TestMap tests;
const string name;
const string topic;
- TestMap::iterator test;
+ TestCase* test;
auto_ptr<Thread> runner;
ReplyTo reportTo;
string reportCorrelator;
@@ -186,7 +187,7 @@ void Listener::received(Message& message)
test->stop();
sendReport();
} else if (type == "TERMINATE") {
- if (test != tests.end()) test->stop();
+ if (test) test->stop();
shutdown();
} else {
cerr <<"ERROR!: Received unknown control message: " << type << endl;
@@ -201,8 +202,9 @@ void Listener::shutdown()
bool Listener::invite(const string& name)
{
- test = tests.find(name);
- return test != tests.end();
+ TestMap::iterator i = tests.find(name);
+ test = (i != tests.end()) ? qpid::ptr_map::get_pointer(i) : 0;
+ return test;
}
void Listener::run()
diff --git a/cpp/src/tests/logging.cpp b/cpp/src/tests/logging.cpp
index 0f7ad3f4d5..2065b031e7 100644
--- a/cpp/src/tests/logging.cpp
+++ b/cpp/src/tests/logging.cpp
@@ -16,7 +16,6 @@
*
*/
-
#include "test_tools.h"
#include "qpid/log/Logger.h"
#include "qpid/log/Options.h"
@@ -25,14 +24,15 @@
#include <boost/test/floating_point_comparison.hpp>
#include <boost/format.hpp>
-#include <boost/test/auto_unit_test.hpp>
-BOOST_AUTO_TEST_SUITE(logging);
+#include "unit_test.h"
#include <exception>
#include <fstream>
#include <time.h>
+QPID_AUTO_TEST_SUITE(loggingTestSuite)
+
using namespace std;
using namespace boost;
using namespace qpid::log;
@@ -42,7 +42,6 @@ BOOST_AUTO_TEST_CASE(testStatementInit) {
BOOST_CHECK(!s.enabled);
BOOST_CHECK_EQUAL(string(__FILE__), s.file);
BOOST_CHECK_EQUAL(line, s.line);
- BOOST_CHECK_EQUAL(string("void testStatementInit()"), s.function);
BOOST_CHECK_EQUAL(debug, s.level);
}
@@ -141,7 +140,6 @@ BOOST_AUTO_TEST_CASE(testMacro) {
vector<string> expect=list_of("foo\n");
BOOST_CHECK_EQUAL(expect, out->msg);
BOOST_CHECK_EQUAL(__FILE__, out->stmt.front().file);
- BOOST_CHECK_EQUAL("void testMacro()", out->stmt.front().function);
// Not enabled:
QPID_LOG(debug, "bar");
@@ -173,7 +171,6 @@ BOOST_AUTO_TEST_CASE(testLoggerFormat) {
l.format(Logger::FUNCTION);
QPID_LOG(critical, "foo");
- BOOST_CHECK_EQUAL("void testLoggerFormat(): foo\n", out->last());
l.format(Logger::LEVEL);
QPID_LOG(critical, "foo");
@@ -181,7 +178,7 @@ BOOST_AUTO_TEST_CASE(testLoggerFormat) {
l.format(~0); // Everything
QPID_LOG(critical, "foo");
- re=".* critical \\[[0-9a-f]*] "+string(__FILE__)+":\\d+:void testLoggerFormat\\(\\): foo\n";
+ re=".* critical \\[[0-9a-f]*] "+string(__FILE__)+":\\d+:void .*testLoggerFormat.*\\(\\): foo\n";
BOOST_CHECK_REGEX(re, out->last());
}
@@ -370,4 +367,4 @@ BOOST_AUTO_TEST_CASE(testLoggerConfigure) {
unlink("logging.tmp");
}
-BOOST_AUTO_TEST_SUITE_END();
+QPID_AUTO_TEST_SUITE_END()
diff --git a/cpp/src/tests/unit_test.cpp b/cpp/src/tests/unit_test.cpp
index aed6f6a4af..00c61242e4 100644
--- a/cpp/src/tests/unit_test.cpp
+++ b/cpp/src/tests/unit_test.cpp
@@ -16,7 +16,8 @@
*
*/
-#define BOOST_AUTO_TEST_MAIN // Must come before #include<boost/test/*>
-#include <boost/test/auto_unit_test.hpp>
-
// Defines test_main function to link with actual unit test code.
+#define BOOST_AUTO_TEST_MAIN // Boost 1.33
+#define BOOST_TEST_MAIN
+#include "unit_test.h"
+
diff --git a/cpp/src/tests/unit_test.h b/cpp/src/tests/unit_test.h
new file mode 100644
index 0000000000..83e2ce39f8
--- /dev/null
+++ b/cpp/src/tests/unit_test.h
@@ -0,0 +1,44 @@
+#ifndef QPIPD_TEST_UNIT_TEST_H_
+#define QPIPD_TEST_UNIT_TEST_H_
+
+/*
+ *
+ * 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.
+ *
+ */
+
+// Workaround so we can build against boost 1.33 and boost 1.34.
+// Remove when we no longer need to support 1.33.
+//
+
+#if (BOOST_VERSION < 103400)
+
+# include <boost/test/auto_unit_test.hpp>
+
+# define QPID_AUTO_TEST_SUITE(name) BOOST_AUTO_TEST_SUITE(name);
+# define QPID_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE_END();
+
+#else
+
+# define QPID_AUTO_TEST_SUITE(name) BOOST_AUTO_TEST_SUITE(name)
+# define QPID_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE_END()
+
+# include <boost/test/unit_test.hpp>
+#endif
+
+#endif /*!QPIPD_TEST_UNIT_TEST_H_*/