forked from boostorg/unordered
Use Boost.Test's minimal test library for unordered & hash. It's closer to
Boster.Test which makes it easier to switch to take advantage of Boost.Test's extra testing facilities. Merged revisions 44420 via svnmerge from https://svn.boost.org/svn/boost/branches/unordered/trunk ........ r44420 | danieljames | 2008-04-14 19:02:03 +0100 (Mon, 14 Apr 2008) | 1 line Use Boost.Test's minimal test library. ........ [SVN r44487]
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "./test.hpp"
|
||||
|
||||
#if defined(BOOST_UNORDERED_USE_TEST)
|
||||
#if defined(BOOST_UNORDERED_FULL_TEST)
|
||||
# define BOOST_TEST_MAIN
|
||||
# include <boost/test/exception_safety.hpp>
|
||||
# include <boost/test/unit_test.hpp>
|
||||
@@ -18,7 +18,7 @@
|
||||
#include <boost/preprocessor/seq/elem.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
|
||||
#if defined(BOOST_UNORDERED_USE_TEST)
|
||||
#if defined(BOOST_UNORDERED_FULL_TEST)
|
||||
# define UNORDERED_EXCEPTION_TEST_CASE(name, test_func, type) \
|
||||
UNORDERED_AUTO_TEST(name) \
|
||||
{ \
|
||||
@@ -181,7 +181,7 @@ namespace test {
|
||||
|
||||
|
||||
|
||||
#if defined(BOOST_UNORDERED_USE_TEST)
|
||||
#if defined(BOOST_UNORDERED_FULL_TEST)
|
||||
template <class Test>
|
||||
void exception_safety(Test const& f, char const* name) {
|
||||
test_runner<Test> runner(f);
|
||||
|
||||
@@ -6,21 +6,17 @@
|
||||
#if !defined(BOOST_UNORDERED_TEST_TEST_HEADER)
|
||||
#define BOOST_UNORDERED_TEST_TEST_HEADER
|
||||
|
||||
#if defined(BOOST_UNORDERED_USE_TEST)
|
||||
#if defined(BOOST_UNORDERED_FULL_TEST)
|
||||
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#define UNORDERED_CHECK(x) BOOST_CHECK(x)
|
||||
#define UNORDERED_REQUIRE(x) BOOST_REQUIRE(x)
|
||||
#define UNORDERED_AUTO_TEST(x) BOOST_AUTO_TEST_CASE(x)
|
||||
#define RUN_TESTS()
|
||||
|
||||
#else
|
||||
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/test/minimal.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
|
||||
#define UNORDERED_CHECK(x) BOOST_TEST(x)
|
||||
#define UNORDERED_REQUIRE(x) if(!(x)) { BOOST_ERROR(BOOST_STRINGIZE(x)); throw ::test::lightweight::test_failure(); }
|
||||
#define UNORDERED_AUTO_TEST(x) \
|
||||
struct BOOST_PP_CAT(x, _type) : public ::test::registered_test_base { \
|
||||
BOOST_PP_CAT(x, _type)() { \
|
||||
@@ -30,7 +26,7 @@
|
||||
}; \
|
||||
BOOST_PP_CAT(x, _type) x; \
|
||||
void BOOST_PP_CAT(x, _type)::run()
|
||||
#define RUN_TESTS() int main() { ::test::test_list::run_tests(); return boost::report_errors(); }
|
||||
#define RUN_TESTS() int test_main(int, char**) { ::test::test_list::run_tests(); return 0; }
|
||||
|
||||
namespace test {
|
||||
struct registered_test_base {
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace test
|
||||
std::copy(x2.begin(), x2.end(), std::back_inserter(values2));
|
||||
std::sort(values1.begin(), values1.end());
|
||||
std::sort(values2.begin(), values2.end());
|
||||
BOOST_TEST(values1.size() == values2.size() &&
|
||||
BOOST_CHECK(values1.size() == values2.size() &&
|
||||
std::equal(values1.begin(), values1.end(), values2.begin(), test::equivalent));
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace test
|
||||
std::copy(x2.first, x2.second, std::back_inserter(values2));
|
||||
std::sort(values1.begin(), values1.end());
|
||||
std::sort(values2.begin(), values2.end());
|
||||
BOOST_TEST(values1.size() == values2.size() &&
|
||||
BOOST_CHECK(values1.size() == values2.size() &&
|
||||
std::equal(values1.begin(), values1.end(), values2.begin(), test::equivalent));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user