diff options
author | Alan Conway <aconway@apache.org> | 2010-10-21 19:05:01 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2010-10-21 19:05:01 +0000 |
commit | 9be58b7519c45c682c36f8d70d8e9c7e1422a440 (patch) | |
tree | 1c7b7853aecea12187bde074f5710e62662ba23d /cpp/src | |
parent | 96df61d4f9c21fd330bdc2f30c571d047e4f722f (diff) | |
download | qpid-python-9be58b7519c45c682c36f8d70d8e9c7e1422a440.tar.gz |
Get rid of boost::regex in test code.
It was barely being used and it causes portability problems on older versions of boost.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1026103 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/tests/BrokerClusterCalls.cpp | 8 | ||||
-rw-r--r-- | cpp/src/tests/CMakeLists.txt | 1 | ||||
-rw-r--r-- | cpp/src/tests/Makefile.am | 2 | ||||
-rw-r--r-- | cpp/src/tests/cluster.mk | 2 | ||||
-rw-r--r-- | cpp/src/tests/logging.cpp | 2 | ||||
-rw-r--r-- | cpp/src/tests/test_tools.h | 16 |
6 files changed, 5 insertions, 26 deletions
diff --git a/cpp/src/tests/BrokerClusterCalls.cpp b/cpp/src/tests/BrokerClusterCalls.cpp index 5cc2991c77..6cdd6fc9bf 100644 --- a/cpp/src/tests/BrokerClusterCalls.cpp +++ b/cpp/src/tests/BrokerClusterCalls.cpp @@ -36,14 +36,12 @@ #include "BrokerFixture.h" #include <boost/assign.hpp> #include <boost/format.hpp> -#include <boost/regex.hpp> using namespace std; using namespace boost; using namespace boost::assign; using namespace qpid::messaging; using boost::format; -using boost::regex; namespace qpid { namespace tests { @@ -297,10 +295,8 @@ QPID_AUTO_TEST_CASE(testFanout) { sender.send(Message("a")); f.s.sync(); BOOST_CHECK_EQUAL(h.at(i++), "routing(a)"); - char const * str = "enqueue(amq.fanout_r"; - int len = strlen(str); - BOOST_CHECK_EQUAL(0, strncmp(str, h.at(i++).c_str(), len)); - BOOST_CHECK_EQUAL(0, strncmp(str, h.at(i++).c_str(), len)); + BOOST_CHECK_EQUAL(0u, h.at(i++).find("enqueue(amq.fanout_r")); + BOOST_CHECK_EQUAL(0u, h.at(i++).find("enqueue(amq.fanout_r")); BOOST_CHECK(h.at(i-1) != h.at(i-2)); BOOST_CHECK_EQUAL(h.at(i++), "routed(a)"); BOOST_CHECK_EQUAL(h.size(), i); diff --git a/cpp/src/tests/CMakeLists.txt b/cpp/src/tests/CMakeLists.txt index a6ca6206c4..4046481add 100644 --- a/cpp/src/tests/CMakeLists.txt +++ b/cpp/src/tests/CMakeLists.txt @@ -62,7 +62,6 @@ endif (MSVC) # Like this to work with cmake 2.4 on Unix set (qpid_test_boost_libs - ${Boost_REGEX_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) # Macro to make it easier to remember where the tests are built diff --git a/cpp/src/tests/Makefile.am b/cpp/src/tests/Makefile.am index 5e1438d813..2a7430b8ca 100644 --- a/cpp/src/tests/Makefile.am +++ b/cpp/src/tests/Makefile.am @@ -66,7 +66,7 @@ tmodule_LTLIBRARIES= TESTS+=unit_test check_PROGRAMS+=unit_test -unit_test_LDADD=-lboost_unit_test_framework -lboost_regex \ +unit_test_LDADD=-lboost_unit_test_framework \ $(lib_messaging) $(lib_broker) $(lib_console) $(lib_qmf2) unit_test_SOURCES= unit_test.cpp unit_test.h \ diff --git a/cpp/src/tests/cluster.mk b/cpp/src/tests/cluster.mk index a033025226..bb0f5d150b 100644 --- a/cpp/src/tests/cluster.mk +++ b/cpp/src/tests/cluster.mk @@ -77,7 +77,7 @@ cluster_test_SOURCES = \ PartialFailure.cpp \ ClusterFailover.cpp -cluster_test_LDADD=$(lib_client) $(lib_broker) $(lib_messaging) ../cluster.la -lboost_unit_test_framework -lboost_regex +cluster_test_LDADD=$(lib_client) $(lib_broker) $(lib_messaging) ../cluster.la -lboost_unit_test_framework qpidtest_SCRIPTS += run_cluster_tests cluster_tests.py run_long_cluster_tests long_cluster_tests.py testlib.py cluster_tests.fail diff --git a/cpp/src/tests/logging.cpp b/cpp/src/tests/logging.cpp index 5cb563c7d3..fc55d642c3 100644 --- a/cpp/src/tests/logging.cpp +++ b/cpp/src/tests/logging.cpp @@ -172,7 +172,7 @@ QPID_AUTO_TEST_CASE(testLoggerFormat) { l.format(Logger::FILE|Logger::LINE); QPID_LOG(critical, "foo"); - BOOST_CHECK_REGEX(string(__FILE__)+":\\d+: foo\n", out->last()); + BOOST_CHECK_EQUAL(out->last().find(__FILE__), 0u); l.format(Logger::FUNCTION); QPID_LOG(critical, "foo"); diff --git a/cpp/src/tests/test_tools.h b/cpp/src/tests/test_tools.h index bb2509fd32..de672f938a 100644 --- a/cpp/src/tests/test_tools.h +++ b/cpp/src/tests/test_tools.h @@ -23,7 +23,6 @@ #include <limits.h> // Include before boost/test headers. #include <boost/test/test_tools.hpp> #include <boost/assign/list_of.hpp> -#include <boost/regex.hpp> #include <boost/assign/list_of.hpp> #include <vector> #include <set> @@ -75,21 +74,6 @@ bool operator == (const boost::assign_detail::generic_list<T>& b, const set<T>& namespace qpid { namespace tests { -/** NB: order of parameters is regex first, in line with - * CHECK(expected, actual) convention. - */ -inline bool regexPredicate(const std::string& re, const std::string& text) { - return boost::regex_match(text, boost::regex(re)); -} - -/** Check for regular expression match. You must #include <boost/regex.hpp> */ -#if (BOOST_VERSION < 103300) - #define BOOST_CHECK_REGEX(re, text) -#else - #define BOOST_CHECK_REGEX(re, text) \ - BOOST_CHECK_PREDICATE(regexPredicate, (re)(text)) -#endif - /** Check if types of two objects (as given by typeinfo::name()) match. */ #define BOOST_CHECK_TYPEID_EQUAL(a,b) BOOST_CHECK_EQUAL(typeid(a).name(),typeid(b).name()) |