From 04234ceceec446c7b17eafd583aa89f8ced080f4 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Wed, 27 May 2009 17:44:09 +0000 Subject: [PATCH] Use lightweight_test for unordered. [SVN r53314] --- test/exception/erase_exception_tests.cpp | 2 +- test/exception/insert_exception_tests.cpp | 16 +-- test/exception/swap_exception_tests.cpp | 4 +- test/helpers/exception_test.hpp | 26 ----- test/helpers/memory.hpp | 18 ++-- test/helpers/test.hpp | 15 +-- test/helpers/tracker.hpp | 4 +- test/unordered/assign_tests.cpp | 22 ++-- test/unordered/at_tests.cpp | 4 +- test/unordered/bucket_tests.cpp | 14 +-- test/unordered/compile_tests.hpp | 10 +- test/unordered/constructor_tests.cpp | 126 +++++++++++----------- test/unordered/copy_tests.cpp | 36 +++---- test/unordered/equality_tests.cpp | 42 ++++---- test/unordered/erase_equiv_tests.cpp | 12 +-- test/unordered/erase_tests.cpp | 44 ++++---- test/unordered/find_tests.cpp | 20 ++-- test/unordered/fwd_map_test.cpp | 16 +-- test/unordered/fwd_set_test.cpp | 22 ++-- test/unordered/insert_stable_tests.cpp | 28 ++--- test/unordered/insert_tests.cpp | 36 +++---- test/unordered/load_factor_tests.cpp | 10 +- test/unordered/move_tests.cpp | 48 ++++----- test/unordered/rehash_tests.cpp | 12 +-- test/unordered/simple_tests.cpp | 46 ++++---- 25 files changed, 299 insertions(+), 334 deletions(-) diff --git a/test/exception/erase_exception_tests.cpp b/test/exception/erase_exception_tests.cpp index 3f227263..6746d628 100644 --- a/test/exception/erase_exception_tests.cpp +++ b/test/exception/erase_exception_tests.cpp @@ -25,7 +25,7 @@ struct erase_test_base : public test::exception_base void check(T const& x) const { std::string scope(test::scope); - BOOST_CHECK(scope.find("hash::") != std::string::npos || + BOOST_TEST(scope.find("hash::") != std::string::npos || scope.find("equal_to::") != std::string::npos || scope == "operator==(object, object)"); diff --git a/test/exception/insert_exception_tests.cpp b/test/exception/insert_exception_tests.cpp index 8965e070..c44d56ba 100644 --- a/test/exception/insert_exception_tests.cpp +++ b/test/exception/insert_exception_tests.cpp @@ -128,10 +128,10 @@ struct insert_test_rehash1 : public insert_test_base size_type bucket_count = x.bucket_count(); size_type initial_elements = static_cast( ceil(bucket_count * (double) x.max_load_factor()) - 1); - BOOST_REQUIRE(initial_elements < this->values.size()); + BOOST_TEST(initial_elements < this->values.size()); x.insert(this->values.begin(), boost::next(this->values.begin(), initial_elements)); - BOOST_REQUIRE(bucket_count == x.bucket_count()); + BOOST_TEST(bucket_count == x.bucket_count()); return x; } @@ -150,7 +150,7 @@ struct insert_test_rehash1 : public insert_test_base // This isn't actually a failure, but it means the test isn't doing its // job. - BOOST_REQUIRE(x.bucket_count() != bucket_count); + BOOST_TEST(x.bucket_count() != bucket_count); } }; @@ -173,7 +173,7 @@ struct insert_test_rehash2 : public insert_test_rehash1 // This isn't actually a failure, but it means the test isn't doing its // job. - BOOST_REQUIRE(x.bucket_count() != bucket_count); + BOOST_TEST(x.bucket_count() != bucket_count); } }; @@ -197,10 +197,10 @@ struct insert_test_rehash3 : public insert_test_base size_type initial_elements = rehash_bucket_count - 5; - BOOST_REQUIRE(initial_elements < this->values.size()); + BOOST_TEST(initial_elements < this->values.size()); x.insert(this->values.begin(), boost::next(this->values.begin(), initial_elements)); - BOOST_REQUIRE(original_bucket_count == x.bucket_count()); + BOOST_TEST(original_bucket_count == x.bucket_count()); return x; } @@ -212,12 +212,12 @@ struct insert_test_rehash3 : public insert_test_base // This isn't actually a failure, but it means the test isn't doing its // job. - BOOST_REQUIRE(x.bucket_count() != bucket_count); + BOOST_TEST(x.bucket_count() != bucket_count); } void check(T const& x) const { if(x.size() < rehash_bucket_count) { - //BOOST_CHECK(x.bucket_count() == original_bucket_count); + //BOOST_TEST(x.bucket_count() == original_bucket_count); } test::check_equivalent_keys(x); } diff --git a/test/exception/swap_exception_tests.cpp b/test/exception/swap_exception_tests.cpp index 0e77e588..2025b8bd 100644 --- a/test/exception/swap_exception_tests.cpp +++ b/test/exception/swap_exception_tests.cpp @@ -22,7 +22,7 @@ struct self_swap_base : public test::exception_base std::string scope(test::scope); #if BOOST_UNORDERED_SWAP_METHOD != 2 - BOOST_CHECK( + BOOST_TEST( scope == "hash::operator(hash)" || scope == "hash::operator=(hash)" || scope == "equal_to::operator(equal_to)" || @@ -77,7 +77,7 @@ struct swap_base : public test::exception_base std::string scope(test::scope); #if BOOST_UNORDERED_SWAP_METHOD != 2 - BOOST_CHECK( + BOOST_TEST( scope == "hash::operator(hash)" || scope == "hash::operator=(hash)" || scope == "equal_to::operator(equal_to)" || diff --git a/test/helpers/exception_test.hpp b/test/helpers/exception_test.hpp index 699d5abb..a235526c 100644 --- a/test/helpers/exception_test.hpp +++ b/test/helpers/exception_test.hpp @@ -8,25 +8,10 @@ #include "./test.hpp" -#if defined(BOOST_UNORDERED_FULL_TEST) -# define BOOST_TEST_MAIN -# include -# include -#endif - #include #include #include -#if defined(BOOST_UNORDERED_FULL_TEST) -# define UNORDERED_EXCEPTION_TEST_CASE(name, test_func, type) \ - UNORDERED_AUTO_TEST(name) \ - { \ - test_func< type > fixture; \ - ::test::exception_safety(fixture, BOOST_STRINGIZE(test_func)); \ - } -# define UNORDERED_EPOINT_IMPL BOOST_ITEST_EPOINT -#else # define UNORDERED_EXCEPTION_TEST_CASE(name, test_func, type) \ UNORDERED_AUTO_TEST(name) \ { \ @@ -34,7 +19,6 @@ ::test::lightweight::exception_safety(fixture, BOOST_STRINGIZE(test_func)); \ } # define UNORDERED_EPOINT_IMPL ::test::lightweight::epoint -#endif #define UNORDERED_EXCEPTION_TEST_POSTFIX RUN_TESTS() @@ -178,16 +162,7 @@ namespace test { } } }; - - -#if defined(BOOST_UNORDERED_FULL_TEST) - template - void exception_safety(Test const& f, char const* name) { - test_runner runner(f); - ::boost::itest::exception_safety(runner, name); - } -#else // Quick exception testing based on lightweight test namespace lightweight { @@ -237,7 +212,6 @@ namespace test { } while(!success); } } -#endif } #endif diff --git a/test/helpers/memory.hpp b/test/helpers/memory.hpp index 5dc02b70..6dbec85f 100644 --- a/test/helpers/memory.hpp +++ b/test/helpers/memory.hpp @@ -98,7 +98,7 @@ namespace test void allocator_unref() { - BOOST_CHECK(count_allocators > 0); + BOOST_TEST(count_allocators > 0); if(count_allocators > 0) { --count_allocators; if(count_allocators == 0) { @@ -111,9 +111,9 @@ namespace test count_constructions = 0; allocated_memory.clear(); - BOOST_CHECK(no_allocations_left); - BOOST_CHECK(no_constructions_left); - BOOST_CHECK(allocated_memory_empty); + BOOST_TEST(no_allocations_left); + BOOST_TEST(no_constructions_left); + BOOST_TEST(allocated_memory_empty); } } } @@ -139,12 +139,12 @@ namespace test if(pos == allocated_memory.end()) { BOOST_ERROR("Deallocating unknown pointer."); } else { - BOOST_CHECK(pos->first.start == ptr); - BOOST_CHECK(pos->first.end == (char*) ptr + n * size); - BOOST_CHECK(pos->second.tag_ == tag); + BOOST_TEST(pos->first.start == ptr); + BOOST_TEST(pos->first.end == (char*) ptr + n * size); + BOOST_TEST(pos->second.tag_ == tag); allocated_memory.erase(pos); } - BOOST_CHECK(count_allocations > 0); + BOOST_TEST(count_allocations > 0); if(count_allocations > 0) --count_allocations; } @@ -155,7 +155,7 @@ namespace test void track_destroy(void* /*ptr*/, std::size_t /*size*/, int /*tag*/) { - BOOST_CHECK(count_constructions > 0); + BOOST_TEST(count_constructions > 0); if(count_constructions > 0) --count_constructions; } }; diff --git a/test/helpers/test.hpp b/test/helpers/test.hpp index 136cf756..40b642b6 100644 --- a/test/helpers/test.hpp +++ b/test/helpers/test.hpp @@ -6,15 +6,7 @@ #if !defined(BOOST_UNORDERED_TEST_TEST_HEADER) #define BOOST_UNORDERED_TEST_TEST_HEADER -#if defined(BOOST_UNORDERED_FULL_TEST) - -#include -#define UNORDERED_AUTO_TEST(x) BOOST_AUTO_TEST_CASE(x) -#define RUN_TESTS() - -#else - -#include +#include #include #include #include @@ -30,7 +22,8 @@ }; \ BOOST_PP_CAT(x, _type) x; \ void BOOST_PP_CAT(x, _type)::run() -#define RUN_TESTS() int test_main(int, char**) { ::test::test_list::run_tests(); return 0; } +#define RUN_TESTS() int main(int, char**) \ + { ::test::test_list::run_tests(); return boost::report_errors(); } namespace test { struct registered_test_base { @@ -74,8 +67,6 @@ namespace test { } } -#endif - #include #include #include diff --git a/test/helpers/tracker.hpp b/test/helpers/tracker.hpp index 612f0edc..bf6417aa 100644 --- a/test/helpers/tracker.hpp +++ b/test/helpers/tracker.hpp @@ -49,7 +49,7 @@ namespace test value_list values2(x2.begin(), x2.end()); values1.sort(); values2.sort(); - BOOST_CHECK(values1.size() == values2.size() && + BOOST_TEST(values1.size() == values2.size() && std::equal(values1.begin(), values1.end(), values2.begin(), test::equivalent)); } @@ -61,7 +61,7 @@ namespace test test::list values2(x2.first, x2.second); values1.sort(); values2.sort(); - BOOST_CHECK(values1.size() == values2.size() && + BOOST_TEST(values1.size() == values2.size() && std::equal(values1.begin(), values1.end(), values2.begin(), test::equivalent)); } diff --git a/test/unordered/assign_tests.cpp b/test/unordered/assign_tests.cpp index b2a4b1c3..09d64408 100644 --- a/test/unordered/assign_tests.cpp +++ b/test/unordered/assign_tests.cpp @@ -27,9 +27,9 @@ void assign_tests1(T*, test::random_generator generator = test::default_generato { T x; x = x; - BOOST_CHECK(x.empty()); - BOOST_CHECK(test::equivalent(x.hash_function(), hf)); - BOOST_CHECK(test::equivalent(x.key_eq(), eq)); + BOOST_TEST(x.empty()); + BOOST_TEST(test::equivalent(x.hash_function(), hf)); + BOOST_TEST(test::equivalent(x.key_eq(), eq)); } std::cerr<<"assign_tests1.2\n"; @@ -47,7 +47,7 @@ void assign_tests1(T*, test::random_generator generator = test::default_generato y.max_load_factor(x.max_load_factor() / 20); y = x; tracker.compare(y); - BOOST_CHECK(x.max_load_factor() == y.max_load_factor()); + BOOST_TEST(x.max_load_factor() == y.max_load_factor()); } } @@ -67,8 +67,8 @@ void assign_tests2(T*, test::random_generator generator = test::default_generato T x1(v.begin(), v.end(), 0, hf1, eq1); T x2(0, hf2, eq2); x2 = x1; - BOOST_CHECK(test::equivalent(x2.hash_function(), hf1)); - BOOST_CHECK(test::equivalent(x2.key_eq(), eq1)); + BOOST_TEST(test::equivalent(x2.hash_function(), hf1)); + BOOST_TEST(test::equivalent(x2.key_eq(), eq1)); test::check_container(x2, v); } @@ -78,9 +78,9 @@ void assign_tests2(T*, test::random_generator generator = test::default_generato T x1(v1.begin(), v1.end(), 0, hf1, eq1, al1); T x2(v2.begin(), v2.end(), 0, hf2, eq2, al2); x2 = x1; - BOOST_CHECK(test::equivalent(x2.hash_function(), hf1)); - BOOST_CHECK(test::equivalent(x2.key_eq(), eq1)); - BOOST_CHECK(test::equivalent(x2.get_allocator(), al2)); + BOOST_TEST(test::equivalent(x2.hash_function(), hf1)); + BOOST_TEST(test::equivalent(x2.key_eq(), eq1)); + BOOST_TEST(test::equivalent(x2.get_allocator(), al2)); test::check_container(x2, v1); } } @@ -113,8 +113,8 @@ UNORDERED_AUTO_TEST(assign_initializer_list) x.insert(10); x.insert(20); x = { 1, 2, -10 }; - BOOST_CHECK(x.find(10) == x.end()); - BOOST_CHECK(x.find(-10) != x.end()); + BOOST_TEST(x.find(10) == x.end()); + BOOST_TEST(x.find(-10) != x.end()); } #endif diff --git a/test/unordered/at_tests.cpp b/test/unordered/at_tests.cpp index 798bf9d4..ff9fdc81 100644 --- a/test/unordered/at_tests.cpp +++ b/test/unordered/at_tests.cpp @@ -16,8 +16,8 @@ UNORDERED_AUTO_TEST(at_tests) { x["one"] = 1; x["two"] = 2; - BOOST_CHECK(x.at("one") == 1); - BOOST_CHECK(x.at("two") == 2); + BOOST_TEST(x.at("one") == 1); + BOOST_TEST(x.at("two") == 2); try { x.at("three"); diff --git a/test/unordered/bucket_tests.cpp b/test/unordered/bucket_tests.cpp index e4326ed1..eeaa625a 100644 --- a/test/unordered/bucket_tests.cpp +++ b/test/unordered/bucket_tests.cpp @@ -24,7 +24,7 @@ void tests(X* = 0, test::random_generator generator = test::default_generator) X x(v.begin(), v.end()); - BOOST_CHECK(x.bucket_count() < x.max_bucket_count()); + BOOST_TEST(x.bucket_count() < x.max_bucket_count()); std::cerr<::const_iterator @@ -32,21 +32,21 @@ void tests(X* = 0, test::random_generator generator = test::default_generator) { size_type bucket = x.bucket(test::get_key(*it)); - BOOST_CHECK(bucket < x.bucket_count()); + BOOST_TEST(bucket < x.bucket_count()); if(bucket < x.max_bucket_count()) { // lit? lend?? I need a new naming scheme. const_local_iterator lit = x.begin(bucket), lend = x.end(bucket); while(lit != lend && test::get_key(*it) != test::get_key(*lit)) ++lit; - BOOST_CHECK(lit != lend); + BOOST_TEST(lit != lend); } } for(size_type i = 0; i < x.bucket_count(); ++i) { - BOOST_CHECK(x.bucket_size(i) == (size_type) std::distance(x.begin(i), x.end(i))); - BOOST_CHECK(x.bucket_size(i) == (size_type) std::distance(x.cbegin(i), x.cend(i))); + BOOST_TEST(x.bucket_size(i) == (size_type) std::distance(x.begin(i), x.end(i))); + BOOST_TEST(x.bucket_size(i) == (size_type) std::distance(x.cbegin(i), x.cend(i))); X const& x_ref = x; - BOOST_CHECK(x.bucket_size(i) == (size_type) std::distance(x_ref.begin(i), x_ref.end(i))); - BOOST_CHECK(x.bucket_size(i) == (size_type) std::distance(x_ref.cbegin(i), x_ref.cend(i))); + BOOST_TEST(x.bucket_size(i) == (size_type) std::distance(x_ref.begin(i), x_ref.end(i))); + BOOST_TEST(x.bucket_size(i) == (size_type) std::distance(x_ref.cbegin(i), x_ref.cend(i))); } } diff --git a/test/unordered/compile_tests.hpp b/test/unordered/compile_tests.hpp index 3dd00fdf..b657629b 100644 --- a/test/unordered/compile_tests.hpp +++ b/test/unordered/compile_tests.hpp @@ -87,10 +87,10 @@ void container_test(X& r, T const&) // I'm not sure about either of these tests... size_type max_diff((std::numeric_limits::max)()); difference_type converted_diff(max_diff); - BOOST_CHECK((std::numeric_limits::max)() + BOOST_TEST((std::numeric_limits::max)() == converted_diff); - BOOST_CHECK( + BOOST_TEST( static_cast( (std::numeric_limits::max)()) > static_cast( @@ -98,8 +98,8 @@ void container_test(X& r, T const&) // I don't test the runtime post-conditions here. X u; - BOOST_CHECK(u.size() == 0); - BOOST_CHECK(X().size() == 0); + BOOST_TEST(u.size() == 0); + BOOST_TEST(X().size() == 0); X a,b; @@ -288,7 +288,7 @@ void unordered_test(X&, Key& k, T& t, Hash& hf, Pred& eq) a.insert(i, j); test::check_return_type::equals(a.erase(k)); - BOOST_CHECK(a.empty()); + BOOST_TEST(a.empty()); if(a.empty()) { a.insert(t); q = a.cbegin(); diff --git a/test/unordered/constructor_tests.cpp b/test/unordered/constructor_tests.cpp index 231365a5..a2005cdc 100644 --- a/test/unordered/constructor_tests.cpp +++ b/test/unordered/constructor_tests.cpp @@ -29,42 +29,42 @@ void constructor_tests1(T*, test::random_generator generator = test::default_gen std::cerr<<"Construct 1\n"; { T x(0, hf, eq); - BOOST_CHECK(x.empty()); - BOOST_CHECK(test::equivalent(x.hash_function(), hf)); - BOOST_CHECK(test::equivalent(x.key_eq(), eq)); - BOOST_CHECK(test::equivalent(x.get_allocator(), al)); + BOOST_TEST(x.empty()); + BOOST_TEST(test::equivalent(x.hash_function(), hf)); + BOOST_TEST(test::equivalent(x.key_eq(), eq)); + BOOST_TEST(test::equivalent(x.get_allocator(), al)); test::check_equivalent_keys(x); } std::cerr<<"Construct 2\n"; { T x(100, hf); - BOOST_CHECK(x.empty()); - BOOST_CHECK(x.bucket_count() >= 100); - BOOST_CHECK(test::equivalent(x.hash_function(), hf)); - BOOST_CHECK(test::equivalent(x.key_eq(), eq)); - BOOST_CHECK(test::equivalent(x.get_allocator(), al)); + BOOST_TEST(x.empty()); + BOOST_TEST(x.bucket_count() >= 100); + BOOST_TEST(test::equivalent(x.hash_function(), hf)); + BOOST_TEST(test::equivalent(x.key_eq(), eq)); + BOOST_TEST(test::equivalent(x.get_allocator(), al)); test::check_equivalent_keys(x); } std::cerr<<"Construct 3\n"; { T x(2000); - BOOST_CHECK(x.empty()); - BOOST_CHECK(x.bucket_count() >= 2000); - BOOST_CHECK(test::equivalent(x.hash_function(), hf)); - BOOST_CHECK(test::equivalent(x.key_eq(), eq)); - BOOST_CHECK(test::equivalent(x.get_allocator(), al)); + BOOST_TEST(x.empty()); + BOOST_TEST(x.bucket_count() >= 2000); + BOOST_TEST(test::equivalent(x.hash_function(), hf)); + BOOST_TEST(test::equivalent(x.key_eq(), eq)); + BOOST_TEST(test::equivalent(x.get_allocator(), al)); test::check_equivalent_keys(x); } std::cerr<<"Construct 4\n"; { T x; - BOOST_CHECK(x.empty()); - BOOST_CHECK(test::equivalent(x.hash_function(), hf)); - BOOST_CHECK(test::equivalent(x.key_eq(), eq)); - BOOST_CHECK(test::equivalent(x.get_allocator(), al)); + BOOST_TEST(x.empty()); + BOOST_TEST(test::equivalent(x.hash_function(), hf)); + BOOST_TEST(test::equivalent(x.key_eq(), eq)); + BOOST_TEST(test::equivalent(x.get_allocator(), al)); test::check_equivalent_keys(x); } @@ -72,10 +72,10 @@ void constructor_tests1(T*, test::random_generator generator = test::default_gen { test::random_values v(1000, generator); T x(v.begin(), v.end(), 10000, hf, eq); - BOOST_CHECK(x.bucket_count() >= 10000); - BOOST_CHECK(test::equivalent(x.hash_function(), hf)); - BOOST_CHECK(test::equivalent(x.key_eq(), eq)); - BOOST_CHECK(test::equivalent(x.get_allocator(), al)); + BOOST_TEST(x.bucket_count() >= 10000); + BOOST_TEST(test::equivalent(x.hash_function(), hf)); + BOOST_TEST(test::equivalent(x.key_eq(), eq)); + BOOST_TEST(test::equivalent(x.get_allocator(), al)); test::check_container(x, v); test::check_equivalent_keys(x); } @@ -84,10 +84,10 @@ void constructor_tests1(T*, test::random_generator generator = test::default_gen { test::random_values v(10, generator); T x(v.begin(), v.end(), 10000, hf); - BOOST_CHECK(x.bucket_count() >= 10000); - BOOST_CHECK(test::equivalent(x.hash_function(), hf)); - BOOST_CHECK(test::equivalent(x.key_eq(), eq)); - BOOST_CHECK(test::equivalent(x.get_allocator(), al)); + BOOST_TEST(x.bucket_count() >= 10000); + BOOST_TEST(test::equivalent(x.hash_function(), hf)); + BOOST_TEST(test::equivalent(x.key_eq(), eq)); + BOOST_TEST(test::equivalent(x.get_allocator(), al)); test::check_container(x, v); test::check_equivalent_keys(x); } @@ -96,10 +96,10 @@ void constructor_tests1(T*, test::random_generator generator = test::default_gen { test::random_values v(100, generator); T x(v.begin(), v.end(), 100); - BOOST_CHECK(x.bucket_count() >= 100); - BOOST_CHECK(test::equivalent(x.hash_function(), hf)); - BOOST_CHECK(test::equivalent(x.key_eq(), eq)); - BOOST_CHECK(test::equivalent(x.get_allocator(), al)); + BOOST_TEST(x.bucket_count() >= 100); + BOOST_TEST(test::equivalent(x.hash_function(), hf)); + BOOST_TEST(test::equivalent(x.key_eq(), eq)); + BOOST_TEST(test::equivalent(x.get_allocator(), al)); test::check_container(x, v); test::check_equivalent_keys(x); } @@ -108,9 +108,9 @@ void constructor_tests1(T*, test::random_generator generator = test::default_gen { test::random_values v(1, generator); T x(v.begin(), v.end()); - BOOST_CHECK(test::equivalent(x.hash_function(), hf)); - BOOST_CHECK(test::equivalent(x.key_eq(), eq)); - BOOST_CHECK(test::equivalent(x.get_allocator(), al)); + BOOST_TEST(test::equivalent(x.hash_function(), hf)); + BOOST_TEST(test::equivalent(x.key_eq(), eq)); + BOOST_TEST(test::equivalent(x.get_allocator(), al)); test::check_container(x, v); test::check_equivalent_keys(x); } @@ -118,10 +118,10 @@ void constructor_tests1(T*, test::random_generator generator = test::default_gen std::cerr<<"Construct 9\n"; { T x(0, hf, eq, al); - BOOST_CHECK(x.empty()); - BOOST_CHECK(test::equivalent(x.hash_function(), hf)); - BOOST_CHECK(test::equivalent(x.key_eq(), eq)); - BOOST_CHECK(test::equivalent(x.get_allocator(), al)); + BOOST_TEST(x.empty()); + BOOST_TEST(test::equivalent(x.hash_function(), hf)); + BOOST_TEST(test::equivalent(x.key_eq(), eq)); + BOOST_TEST(test::equivalent(x.get_allocator(), al)); test::check_equivalent_keys(x); } @@ -129,10 +129,10 @@ void constructor_tests1(T*, test::random_generator generator = test::default_gen { test::random_values v(1000, generator); T x(v.begin(), v.end(), 10000, hf, eq, al); - BOOST_CHECK(x.bucket_count() >= 10000); - BOOST_CHECK(test::equivalent(x.hash_function(), hf)); - BOOST_CHECK(test::equivalent(x.key_eq(), eq)); - BOOST_CHECK(test::equivalent(x.get_allocator(), al)); + BOOST_TEST(x.bucket_count() >= 10000); + BOOST_TEST(test::equivalent(x.hash_function(), hf)); + BOOST_TEST(test::equivalent(x.key_eq(), eq)); + BOOST_TEST(test::equivalent(x.get_allocator(), al)); test::check_container(x, v); test::check_equivalent_keys(x); } @@ -141,10 +141,10 @@ void constructor_tests1(T*, test::random_generator generator = test::default_gen { test::random_values v(1000, generator); T x(al); - BOOST_CHECK(x.empty()); - BOOST_CHECK(test::equivalent(x.hash_function(), hf)); - BOOST_CHECK(test::equivalent(x.key_eq(), eq)); - BOOST_CHECK(test::equivalent(x.get_allocator(), al)); + BOOST_TEST(x.empty()); + BOOST_TEST(test::equivalent(x.hash_function(), hf)); + BOOST_TEST(test::equivalent(x.key_eq(), eq)); + BOOST_TEST(test::equivalent(x.get_allocator(), al)); test::check_equivalent_keys(x); } } @@ -165,21 +165,21 @@ void constructor_tests2(T*, test::random_generator const& generator = test::defa std::cerr<<"Construct 1\n"; { T x(10000, hf1, eq1); - BOOST_CHECK(x.bucket_count() >= 10000); - BOOST_CHECK(test::equivalent(x.hash_function(), hf1)); - BOOST_CHECK(test::equivalent(x.key_eq(), eq1)); - BOOST_CHECK(test::equivalent(x.get_allocator(), al)); + BOOST_TEST(x.bucket_count() >= 10000); + BOOST_TEST(test::equivalent(x.hash_function(), hf1)); + BOOST_TEST(test::equivalent(x.key_eq(), eq1)); + BOOST_TEST(test::equivalent(x.get_allocator(), al)); test::check_equivalent_keys(x); } std::cerr<<"Construct 2\n"; { T x(100, hf1); - BOOST_CHECK(x.empty()); - BOOST_CHECK(x.bucket_count() >= 100); - BOOST_CHECK(test::equivalent(x.hash_function(), hf1)); - BOOST_CHECK(test::equivalent(x.key_eq(), eq)); - BOOST_CHECK(test::equivalent(x.get_allocator(), al)); + BOOST_TEST(x.empty()); + BOOST_TEST(x.bucket_count() >= 100); + BOOST_TEST(test::equivalent(x.hash_function(), hf1)); + BOOST_TEST(test::equivalent(x.key_eq(), eq)); + BOOST_TEST(test::equivalent(x.get_allocator(), al)); test::check_equivalent_keys(x); } @@ -187,9 +187,9 @@ void constructor_tests2(T*, test::random_generator const& generator = test::defa { test::random_values v(100, generator); T x(v.begin(), v.end(), 0, hf1, eq1); - BOOST_CHECK(test::equivalent(x.hash_function(), hf1)); - BOOST_CHECK(test::equivalent(x.key_eq(), eq1)); - BOOST_CHECK(test::equivalent(x.get_allocator(), al)); + BOOST_TEST(test::equivalent(x.hash_function(), hf1)); + BOOST_TEST(test::equivalent(x.key_eq(), eq1)); + BOOST_TEST(test::equivalent(x.get_allocator(), al)); test::check_container(x, v); test::check_equivalent_keys(x); } @@ -198,10 +198,10 @@ void constructor_tests2(T*, test::random_generator const& generator = test::defa { test::random_values v(5, generator); T x(v.begin(), v.end(), 1000, hf1); - BOOST_CHECK(x.bucket_count() >= 1000); - BOOST_CHECK(test::equivalent(x.hash_function(), hf1)); - BOOST_CHECK(test::equivalent(x.key_eq(), eq)); - BOOST_CHECK(test::equivalent(x.get_allocator(), al)); + BOOST_TEST(x.bucket_count() >= 1000); + BOOST_TEST(test::equivalent(x.hash_function(), hf1)); + BOOST_TEST(test::equivalent(x.key_eq(), eq)); + BOOST_TEST(test::equivalent(x.get_allocator(), al)); test::check_container(x, v); test::check_equivalent_keys(x); } @@ -293,8 +293,8 @@ UNORDERED_TEST(map_constructor_test, UNORDERED_AUTO_TEST(test_initializer_list) { std::cerr<<"Initializer List Tests\n"; boost::unordered_set x1 = { 2, 10, 45, -5 }; - BOOST_CHECK(x1.find(10) != x1.end()); - BOOST_CHECK(x1.find(46) == x1.end()); + BOOST_TEST(x1.find(10) != x1.end()); + BOOST_TEST(x1.find(46) == x1.end()); } #endif diff --git a/test/unordered/copy_tests.cpp b/test/unordered/copy_tests.cpp index b30df849..dc143bb8 100644 --- a/test/unordered/copy_tests.cpp +++ b/test/unordered/copy_tests.cpp @@ -27,11 +27,11 @@ void copy_construct_tests1(T*, test::random_generator const& generator = test::d { T x; T y(x); - BOOST_CHECK(y.empty()); - BOOST_CHECK(test::equivalent(y.hash_function(), hf)); - BOOST_CHECK(test::equivalent(y.key_eq(), eq)); - BOOST_CHECK(test::equivalent(y.get_allocator(), al)); - BOOST_CHECK(x.max_load_factor() == y.max_load_factor()); + BOOST_TEST(y.empty()); + BOOST_TEST(test::equivalent(y.hash_function(), hf)); + BOOST_TEST(test::equivalent(y.key_eq(), eq)); + BOOST_TEST(test::equivalent(y.get_allocator(), al)); + BOOST_TEST(x.max_load_factor() == y.max_load_factor()); test::check_equivalent_keys(y); } @@ -57,7 +57,7 @@ void copy_construct_tests1(T*, test::random_generator const& generator = test::d test::unordered_equivalence_tester equivalent(x); equivalent(y); // This isn't guaranteed: - BOOST_CHECK(y.load_factor() < y.max_load_factor()); + BOOST_TEST(y.load_factor() < y.max_load_factor()); test::check_equivalent_keys(y); } } @@ -75,22 +75,22 @@ void copy_construct_tests2(T* ptr, test::random_generator const& generator = tes { T x(10000, hf, eq, al); T y(x); - BOOST_CHECK(y.empty()); - BOOST_CHECK(test::equivalent(y.hash_function(), hf)); - BOOST_CHECK(test::equivalent(y.key_eq(), eq)); - BOOST_CHECK(test::equivalent(y.get_allocator(), al)); - BOOST_CHECK(x.max_load_factor() == y.max_load_factor()); + BOOST_TEST(y.empty()); + BOOST_TEST(test::equivalent(y.hash_function(), hf)); + BOOST_TEST(test::equivalent(y.key_eq(), eq)); + BOOST_TEST(test::equivalent(y.get_allocator(), al)); + BOOST_TEST(x.max_load_factor() == y.max_load_factor()); test::check_equivalent_keys(y); } { T x(1000, hf, eq, al); T y(x, al2); - BOOST_CHECK(y.empty()); - BOOST_CHECK(test::equivalent(y.hash_function(), hf)); - BOOST_CHECK(test::equivalent(y.key_eq(), eq)); - BOOST_CHECK(test::equivalent(y.get_allocator(), al2)); - BOOST_CHECK(x.max_load_factor() == y.max_load_factor()); + BOOST_TEST(y.empty()); + BOOST_TEST(test::equivalent(y.hash_function(), hf)); + BOOST_TEST(test::equivalent(y.key_eq(), eq)); + BOOST_TEST(test::equivalent(y.get_allocator(), al2)); + BOOST_TEST(x.max_load_factor() == y.max_load_factor()); test::check_equivalent_keys(y); } @@ -102,7 +102,7 @@ void copy_construct_tests2(T* ptr, test::random_generator const& generator = tes test::unordered_equivalence_tester equivalent(x); equivalent(y); test::check_equivalent_keys(y); - BOOST_CHECK(test::equivalent(y.get_allocator(), al)); + BOOST_TEST(test::equivalent(y.get_allocator(), al)); } { @@ -113,7 +113,7 @@ void copy_construct_tests2(T* ptr, test::random_generator const& generator = tes test::unordered_equivalence_tester equivalent(x); equivalent(y); test::check_equivalent_keys(y); - BOOST_CHECK(test::equivalent(y.get_allocator(), al2)); + BOOST_TEST(test::equivalent(y.get_allocator(), al2)); } } diff --git a/test/unordered/equality_tests.cpp b/test/unordered/equality_tests.cpp index 1679cf86..bfc78f1b 100644 --- a/test/unordered/equality_tests.cpp +++ b/test/unordered/equality_tests.cpp @@ -33,7 +33,7 @@ namespace equality_tests boost::unordered_set set1, set2; \ BOOST_PP_SEQ_FOR_EACH(UNORDERED_SET_INSERT, set1, seq1) \ BOOST_PP_SEQ_FOR_EACH(UNORDERED_SET_INSERT, set2, seq2) \ - BOOST_CHECK(set1 op set2); \ + BOOST_TEST(set1 op set2); \ } while(false) #define UNORDERED_EQUALITY_MULTISET_TEST(seq1, op, seq2) \ @@ -41,7 +41,7 @@ namespace equality_tests boost::unordered_multiset set1, set2; \ BOOST_PP_SEQ_FOR_EACH(UNORDERED_SET_INSERT, set1, seq1) \ BOOST_PP_SEQ_FOR_EACH(UNORDERED_SET_INSERT, set2, seq2) \ - BOOST_CHECK(set1 op set2); \ + BOOST_TEST(set1 op set2); \ } while(false) #define UNORDERED_EQUALITY_MAP_TEST(seq1, op, seq2) \ @@ -49,7 +49,7 @@ namespace equality_tests boost::unordered_map map1, map2; \ BOOST_PP_SEQ_FOR_EACH(UNORDERED_MAP_INSERT, map1, seq1) \ BOOST_PP_SEQ_FOR_EACH(UNORDERED_MAP_INSERT, map2, seq2) \ - BOOST_CHECK(map1 op map2); \ + BOOST_TEST(map1 op map2); \ } while(false) #define UNORDERED_EQUALITY_MULTIMAP_TEST(seq1, op, seq2) \ @@ -57,7 +57,7 @@ namespace equality_tests boost::unordered_multimap map1, map2; \ BOOST_PP_SEQ_FOR_EACH(UNORDERED_MAP_INSERT, map1, seq1) \ BOOST_PP_SEQ_FOR_EACH(UNORDERED_MAP_INSERT, map2, seq2) \ - BOOST_CHECK(map1 op map2); \ + BOOST_TEST(map1 op map2); \ } while(false) #define UNORDERED_SET_INSERT(r, set, item) set.insert(item); @@ -67,24 +67,24 @@ namespace equality_tests UNORDERED_AUTO_TEST(equality_size_tests) { boost::unordered_set x1, x2; - BOOST_CHECK(x1 == x2); - BOOST_CHECK(!(x1 != x2)); + BOOST_TEST(x1 == x2); + BOOST_TEST(!(x1 != x2)); x1.insert(1); - BOOST_CHECK(x1 != x2); - BOOST_CHECK(!(x1 == x2)); - BOOST_CHECK(x2 != x1); - BOOST_CHECK(!(x2 == x1)); + BOOST_TEST(x1 != x2); + BOOST_TEST(!(x1 == x2)); + BOOST_TEST(x2 != x1); + BOOST_TEST(!(x2 == x1)); x2.insert(1); - BOOST_CHECK(x1 == x2); - BOOST_CHECK(!(x1 != x2)); + BOOST_TEST(x1 == x2); + BOOST_TEST(!(x1 != x2)); x2.insert(2); - BOOST_CHECK(x1 != x2); - BOOST_CHECK(!(x1 == x2)); - BOOST_CHECK(x2 != x1); - BOOST_CHECK(!(x2 == x1)); + BOOST_TEST(x1 != x2); + BOOST_TEST(!(x1 == x2)); + BOOST_TEST(x2 != x1); + BOOST_TEST(!(x2 == x1)); } UNORDERED_AUTO_TEST(equality_key_value_tests) @@ -150,15 +150,15 @@ namespace equality_tests typedef boost::unordered_set set; set set1(0, mod_compare(false), mod_compare(false)); set set2(0, mod_compare(true), mod_compare(true)); - BOOST_CHECK(set1 == set2); + BOOST_TEST(set1 == set2); set1.insert(1); set2.insert(2); - BOOST_CHECK(set1 != set2); + BOOST_TEST(set1 != set2); set1.insert(2); set2.insert(1); - BOOST_CHECK(set1 == set2); + BOOST_TEST(set1 == set2); set1.insert(10); set2.insert(20); - BOOST_CHECK(set1 != set2); + BOOST_TEST(set1 != set2); set1.insert(20); set2.insert(10); - BOOST_CHECK(set1 == set2); + BOOST_TEST(set1 == set2); } } diff --git a/test/unordered/erase_equiv_tests.cpp b/test/unordered/erase_equiv_tests.cpp index 0bf7ab53..fbd56c27 100644 --- a/test/unordered/erase_equiv_tests.cpp +++ b/test/unordered/erase_equiv_tests.cpp @@ -67,11 +67,11 @@ UNORDERED_AUTO_TEST(single_item_tests) collide_map x(init.begin(), init.end()); x.erase(x.begin(), x.begin()); - BOOST_CHECK(x.count(1) == 1 && x.size() == 1); + BOOST_TEST(x.count(1) == 1 && x.size() == 1); x.erase(x.end(), x.end()); - BOOST_CHECK(x.count(1) == 1 && x.size() == 1); + BOOST_TEST(x.count(1) == 1 && x.size() == 1); x.erase(x.begin(), x.end()); - BOOST_CHECK(x.count(1) == 0 && x.size() == 0); + BOOST_TEST(x.count(1) == 0 && x.size() == 0); } UNORDERED_AUTO_TEST(two_equivalent_item_tests) @@ -83,14 +83,14 @@ UNORDERED_AUTO_TEST(two_equivalent_item_tests) { collide_map x(init.begin(), init.end()); x.erase(x.begin(), x.end()); - BOOST_CHECK(x.count(1) == 0 && x.size() == 0); + BOOST_TEST(x.count(1) == 0 && x.size() == 0); } { collide_map x(init.begin(), init.end()); int value = boost::next(x.begin())->second; x.erase(x.begin(), boost::next(x.begin())); - BOOST_CHECK(x.count(1) == 1 && x.size() == 1 && + BOOST_TEST(x.count(1) == 1 && x.size() == 1 && x.begin()->first == 1 && x.begin()->second == value); } @@ -98,7 +98,7 @@ UNORDERED_AUTO_TEST(two_equivalent_item_tests) collide_map x(init.begin(), init.end()); int value = x.begin()->second; x.erase(boost::next(x.begin()), x.end()); - BOOST_CHECK(x.count(1) == 1 && x.size() == 1 && + BOOST_TEST(x.count(1) == 1 && x.size() == 1 && x.begin()->first == 1 && x.begin()->second == value); } } diff --git a/test/unordered/erase_tests.cpp b/test/unordered/erase_tests.cpp index 74da3cf8..74fc6d1f 100644 --- a/test/unordered/erase_tests.cpp +++ b/test/unordered/erase_tests.cpp @@ -32,10 +32,10 @@ void erase_tests1(Container*, test::random_generator generator = test::default_g { std::size_t count = x.count(test::get_key(*it)); std::size_t old_size = x.size(); - BOOST_CHECK(count == x.erase(test::get_key(*it))); - BOOST_CHECK(x.size() == old_size - count); - BOOST_CHECK(x.count(test::get_key(*it)) == 0); - BOOST_CHECK(x.find(test::get_key(*it)) == x.end()); + BOOST_TEST(count == x.erase(test::get_key(*it))); + BOOST_TEST(x.size() == old_size - count); + BOOST_TEST(x.count(test::get_key(*it)) == 0); + BOOST_TEST(x.find(test::get_key(*it)) == x.end()); } } @@ -50,11 +50,11 @@ void erase_tests1(Container*, test::random_generator generator = test::default_g std::size_t count = x.count(key); BOOST_DEDUCED_TYPENAME Container::iterator pos = x.erase(x.begin()); --size; - BOOST_CHECK(pos == x.begin()); - BOOST_CHECK(x.count(key) == count - 1); - BOOST_CHECK(x.size() == size); + BOOST_TEST(pos == x.begin()); + BOOST_TEST(x.count(key) == count - 1); + BOOST_TEST(x.size() == size); } - BOOST_CHECK(x.empty()); + BOOST_TEST(x.empty()); } std::cerr<<"erase(random position).\n"; @@ -77,15 +77,15 @@ void erase_tests1(Container*, test::random_generator generator = test::default_g next = boost::next(pos); BOOST_DEDUCED_TYPENAME Container::key_type key = test::get_key(*pos); std::size_t count = x.count(key); - BOOST_CHECK(next == x.erase(pos)); + BOOST_TEST(next == x.erase(pos)); --size; if(size > 0) - BOOST_CHECK(index == 0 ? next == x.begin() : + BOOST_TEST(index == 0 ? next == x.begin() : next == boost::next(prev)); - BOOST_CHECK(x.count(key) == count - 1); - BOOST_CHECK(x.size() == size); + BOOST_TEST(x.count(key) == count - 1); + BOOST_TEST(x.size() == size); } - BOOST_CHECK(x.empty()); + BOOST_TEST(x.empty()); } std::cerr<<"erase(ranges).\n"; @@ -99,15 +99,15 @@ void erase_tests1(Container*, test::random_generator generator = test::default_g // returns 'the iterator immediately following the erase elements' // and if nothing is erased, then there's nothing to follow. But I // think this is the only sensible option... - BOOST_CHECK(x.erase(x.end(), x.end()) == x.end()); - BOOST_CHECK(x.erase(x.begin(), x.begin()) == x.begin()); - BOOST_CHECK(x.size() == size); + BOOST_TEST(x.erase(x.end(), x.end()) == x.end()); + BOOST_TEST(x.erase(x.begin(), x.begin()) == x.begin()); + BOOST_TEST(x.size() == size); - BOOST_CHECK(x.erase(x.begin(), x.end()) == x.end()); - BOOST_CHECK(x.empty()); - BOOST_CHECK(x.begin() == x.end()); + BOOST_TEST(x.erase(x.begin(), x.end()) == x.end()); + BOOST_TEST(x.empty()); + BOOST_TEST(x.begin() == x.end()); - BOOST_CHECK(x.erase(x.begin(), x.end()) == x.begin()); + BOOST_TEST(x.erase(x.begin(), x.end()) == x.begin()); } std::cerr<<"clear().\n"; @@ -115,8 +115,8 @@ void erase_tests1(Container*, test::random_generator generator = test::default_g test::random_values v(500, generator); Container x(v.begin(), v.end()); x.clear(); - BOOST_CHECK(x.empty()); - BOOST_CHECK(x.begin() == x.end()); + BOOST_TEST(x.empty()); + BOOST_TEST(x.begin() == x.end()); } std::cerr<<"\n"; diff --git a/test/unordered/find_tests.cpp b/test/unordered/find_tests.cpp index 77f6caeb..ad170a44 100644 --- a/test/unordered/find_tests.cpp +++ b/test/unordered/find_tests.cpp @@ -34,12 +34,12 @@ void find_tests1(X*, test::random_generator generator = test::default_generator) BOOST_DEDUCED_TYPENAME X::key_type key = test::get_key(*it1); iterator pos = x.find(key); BOOST_DEDUCED_TYPENAME X::const_iterator const_pos = x_const.find(key); - BOOST_CHECK(pos != x.end() && + BOOST_TEST(pos != x.end() && x.key_eq()(key, test::get_key(*pos))); - BOOST_CHECK(const_pos != x_const.end() && + BOOST_TEST(const_pos != x_const.end() && x_const.key_eq()(key, test::get_key(*const_pos))); - BOOST_CHECK(x.count(key) == tracker.count(key)); + BOOST_TEST(x.count(key) == tracker.count(key)); test::compare_pairs(x.equal_range(key), tracker.equal_range(key), @@ -56,11 +56,11 @@ void find_tests1(X*, test::random_generator generator = test::default_generator) BOOST_DEDUCED_TYPENAME X::key_type key = test::get_key(*it2); if(tracker.find(test::get_key(key)) == tracker.end()) { - BOOST_CHECK(x.find(key) == x.end()); - BOOST_CHECK(x_const.find(key) == x_const.end()); - BOOST_CHECK(x.count(key) == 0); + BOOST_TEST(x.find(key) == x.end()); + BOOST_TEST(x_const.find(key) == x_const.end()); + BOOST_TEST(x.count(key) == 0); std::pair range = x.equal_range(key); - BOOST_CHECK(range.first == range.second); + BOOST_TEST(range.first == range.second); } } } @@ -73,10 +73,10 @@ void find_tests1(X*, test::random_generator generator = test::default_generator) v2.begin(); it3 != v2.end(); ++it3) { BOOST_DEDUCED_TYPENAME X::key_type key = test::get_key(*it3); - BOOST_CHECK(x.find(key) == x.end()); - BOOST_CHECK(x.count(key) == 0); + BOOST_TEST(x.find(key) == x.end()); + BOOST_TEST(x.count(key) == 0); std::pair range = x.equal_range(key); - BOOST_CHECK(range.first == range.second); + BOOST_TEST(range.first == range.second); } } } diff --git a/test/unordered/fwd_map_test.cpp b/test/unordered/fwd_map_test.cpp index e5e905c2..831e54d4 100644 --- a/test/unordered/fwd_map_test.cpp +++ b/test/unordered/fwd_map_test.cpp @@ -42,21 +42,21 @@ UNORDERED_AUTO_TEST(use_map_fwd_declared_function) { y[2] = 1; call_swap(x, y); - BOOST_CHECK(y.find(1) != y.end() && y.find(1)->second == 2); - BOOST_CHECK(y.find(2) == y.end()); + BOOST_TEST(y.find(1) != y.end() && y.find(1)->second == 2); + BOOST_TEST(y.find(2) == y.end()); - BOOST_CHECK(x.find(1) == x.end()); - BOOST_CHECK(x.find(2) != x.end() && x.find(2)->second == 1); + BOOST_TEST(x.find(1) == x.end()); + BOOST_TEST(x.find(2) != x.end() && x.find(2)->second == 1); - BOOST_CHECK(!call_equals(x, y)); - BOOST_CHECK(call_not_equals(x, y)); + BOOST_TEST(!call_equals(x, y)); + BOOST_TEST(call_not_equals(x, y)); } UNORDERED_AUTO_TEST(use_multimap_fwd_declared_function) { int_multimap x, y; call_swap(x, y); - BOOST_CHECK(call_equals(x, y)); - BOOST_CHECK(!call_not_equals(x, y)); + BOOST_TEST(call_equals(x, y)); + BOOST_TEST(!call_not_equals(x, y)); } RUN_TESTS() diff --git a/test/unordered/fwd_set_test.cpp b/test/unordered/fwd_set_test.cpp index 9ea0c478..3db151a7 100644 --- a/test/unordered/fwd_set_test.cpp +++ b/test/unordered/fwd_set_test.cpp @@ -45,17 +45,17 @@ bool call_not_equals(int_multiset& x, int_multiset& y) { #include "../helpers/test.hpp" UNORDERED_AUTO_TEST(use_fwd_declared_trait_without_definition) { - BOOST_CHECK(sizeof(is_unordered_set_impl((int_set*) 0)) == sizeof(true_type)); + BOOST_TEST(sizeof(is_unordered_set_impl((int_set*) 0)) == sizeof(true_type)); } #include UNORDERED_AUTO_TEST(use_fwd_declared_trait) { boost::unordered_set x; - BOOST_CHECK(sizeof(is_unordered_set_impl(&x)) == sizeof(true_type)); + BOOST_TEST(sizeof(is_unordered_set_impl(&x)) == sizeof(true_type)); int dummy; - BOOST_CHECK(sizeof(is_unordered_set_impl(&dummy)) == sizeof(false_type)); + BOOST_TEST(sizeof(is_unordered_set_impl(&dummy)) == sizeof(false_type)); } UNORDERED_AUTO_TEST(use_set_fwd_declared_function) { @@ -64,21 +64,21 @@ UNORDERED_AUTO_TEST(use_set_fwd_declared_function) { y.insert(2); call_swap(x, y); - BOOST_CHECK(y.find(1) != y.end()); - BOOST_CHECK(y.find(2) == y.end()); + BOOST_TEST(y.find(1) != y.end()); + BOOST_TEST(y.find(2) == y.end()); - BOOST_CHECK(x.find(1) == x.end()); - BOOST_CHECK(x.find(2) != x.end()); + BOOST_TEST(x.find(1) == x.end()); + BOOST_TEST(x.find(2) != x.end()); - BOOST_CHECK(!call_equals(x, y)); - BOOST_CHECK(call_not_equals(x, y)); + BOOST_TEST(!call_equals(x, y)); + BOOST_TEST(call_not_equals(x, y)); } UNORDERED_AUTO_TEST(use_multiset_fwd_declared_function) { int_multiset x, y; call_swap(x, y); - BOOST_CHECK(call_equals(x, y)); - BOOST_CHECK(!call_not_equals(x, y)); + BOOST_TEST(call_equals(x, y)); + BOOST_TEST(!call_not_equals(x, y)); } RUN_TESTS() diff --git a/test/unordered/insert_stable_tests.cpp b/test/unordered/insert_stable_tests.cpp index 01ec3969..df38743e 100644 --- a/test/unordered/insert_stable_tests.cpp +++ b/test/unordered/insert_stable_tests.cpp @@ -47,13 +47,13 @@ UNORDERED_AUTO_TEST(stable_insert_test1) { x.insert(insert_stable::member(1,3)); boost::unordered_multiset::const_iterator it = x.begin(), end = x.end(); - BOOST_CHECK(it != end); - if(it != end) { BOOST_CHECK(it->tag2_ == 1); ++it; } - BOOST_CHECK(it != end); - if(it != end) { BOOST_CHECK(it->tag2_ == 2); ++it; } - BOOST_CHECK(it != end); - if(it != end) { BOOST_CHECK(it->tag2_ == 3); ++it; } - BOOST_CHECK(it == end); + BOOST_TEST(it != end); + if(it != end) { BOOST_TEST(it->tag2_ == 1); ++it; } + BOOST_TEST(it != end); + if(it != end) { BOOST_TEST(it->tag2_ == 2); ++it; } + BOOST_TEST(it != end); + if(it != end) { BOOST_TEST(it->tag2_ == 3); ++it; } + BOOST_TEST(it == end); } UNORDERED_AUTO_TEST(stable_insert_test2) { @@ -66,13 +66,13 @@ UNORDERED_AUTO_TEST(stable_insert_test2) { it = x.begin(); iterator end = x.end(); - BOOST_CHECK(it != end); - if(it != end) { BOOST_CHECK(it->first.tag2_ == 1 && it->second == 1); ++it; } - BOOST_CHECK(it != end); - if(it != end) { BOOST_CHECK(it->first.tag2_ == 2 && it->second == 2); ++it; } - BOOST_CHECK(it != end); - if(it != end) { BOOST_CHECK(it->first.tag2_ == 3 && it->second == 3); ++it; } - BOOST_CHECK(it == end); + BOOST_TEST(it != end); + if(it != end) { BOOST_TEST(it->first.tag2_ == 1 && it->second == 1); ++it; } + BOOST_TEST(it != end); + if(it != end) { BOOST_TEST(it->first.tag2_ == 2 && it->second == 2); ++it; } + BOOST_TEST(it != end); + if(it != end) { BOOST_TEST(it->first.tag2_ == 3 && it->second == 3); ++it; } + BOOST_TEST(it == end); } RUN_TESTS() diff --git a/test/unordered/insert_tests.cpp b/test/unordered/insert_tests.cpp index 9434cba0..6a4f4d86 100644 --- a/test/unordered/insert_tests.cpp +++ b/test/unordered/insert_tests.cpp @@ -43,13 +43,13 @@ void unique_insert_tests1(X*, test::random_generator generator = test::default_g std::pair r1 = x.insert(*it); std::pair r2 = tracker.insert(*it); - BOOST_CHECK(r1.second == r2.second); - BOOST_CHECK(*r1.first == *r2.first); + BOOST_TEST(r1.second == r2.second); + BOOST_TEST(*r1.first == *r2.first); tracker.compare_key(x, *it); if(x.size() < b * old_bucket_count) - BOOST_CHECK(x.bucket_count() == old_bucket_count); + BOOST_TEST(x.bucket_count() == old_bucket_count); } test::check_equivalent_keys(x); @@ -73,12 +73,12 @@ void equivalent_insert_tests1(X*, test::random_generator generator = test::defau BOOST_DEDUCED_TYPENAME X::iterator r1 = x.insert(*it); BOOST_DEDUCED_TYPENAME test::ordered::iterator r2 = tracker.insert(*it); - BOOST_CHECK(*r1 == *r2); + BOOST_TEST(*r1 == *r2); tracker.compare_key(x, *it); if(x.size() < b * old_bucket_count) - BOOST_CHECK(x.bucket_count() == old_bucket_count); + BOOST_TEST(x.bucket_count() == old_bucket_count); } test::check_equivalent_keys(x); @@ -107,11 +107,11 @@ void insert_tests2(X*, test::random_generator generator = test::default_generato iterator r1 = x.insert(x.begin(), *it); tracker_iterator r2 = tracker.insert(tracker.begin(), *it); - BOOST_CHECK(*r1 == *r2); + BOOST_TEST(*r1 == *r2); tracker.compare_key(x, *it); if(x.size() < b * old_bucket_count) - BOOST_CHECK(x.bucket_count() == old_bucket_count); + BOOST_TEST(x.bucket_count() == old_bucket_count); } test::check_equivalent_keys(x); @@ -133,11 +133,11 @@ void insert_tests2(X*, test::random_generator generator = test::default_generato const_iterator r1 = x.insert(x_const.end(), *it); tracker_iterator r2 = tracker.insert(tracker.end(), *it); - BOOST_CHECK(*r1 == *r2); + BOOST_TEST(*r1 == *r2); tracker.compare_key(x, *it); if(x.size() < b * old_bucket_count) - BOOST_CHECK(x.bucket_count() == old_bucket_count); + BOOST_TEST(x.bucket_count() == old_bucket_count); } test::check_equivalent_keys(x); @@ -159,11 +159,11 @@ void insert_tests2(X*, test::random_generator generator = test::default_generato pos = x.insert(pos, *it); tracker_iterator r2 = tracker.insert(tracker.begin(), *it); - BOOST_CHECK(*pos == *r2); + BOOST_TEST(*pos == *r2); tracker.compare_key(x, *it); if(x.size() < b * old_bucket_count) - BOOST_CHECK(x.bucket_count() == old_bucket_count); + BOOST_TEST(x.bucket_count() == old_bucket_count); } test::check_equivalent_keys(x); @@ -187,7 +187,7 @@ void insert_tests2(X*, test::random_generator generator = test::default_generato tracker.compare_key(x, *it); if(x.size() < b * old_bucket_count) - BOOST_CHECK(x.bucket_count() == old_bucket_count); + BOOST_TEST(x.bucket_count() == old_bucket_count); } test::check_equivalent_keys(x); @@ -243,13 +243,13 @@ void unique_emplace_tests1(X*, test::random_generator generator = test::default_ std::pair r1 = x.emplace(*it); std::pair r2 = tracker.insert(*it); - BOOST_CHECK(r1.second == r2.second); - BOOST_CHECK(*r1.first == *r2.first); + BOOST_TEST(r1.second == r2.second); + BOOST_TEST(*r1.first == *r2.first); tracker.compare_key(x, *it); if(x.size() < b * old_bucket_count) - BOOST_CHECK(x.bucket_count() == old_bucket_count); + BOOST_TEST(x.bucket_count() == old_bucket_count); } test::check_equivalent_keys(x); @@ -273,12 +273,12 @@ void equivalent_emplace_tests1(X*, test::random_generator generator = test::defa BOOST_DEDUCED_TYPENAME X::iterator r1 = x.emplace(*it); BOOST_DEDUCED_TYPENAME test::ordered::iterator r2 = tracker.insert(*it); - BOOST_CHECK(*r1 == *r2); + BOOST_TEST(*r1 == *r2); tracker.compare_key(x, *it); if(x.size() < b * old_bucket_count) - BOOST_CHECK(x.bucket_count() == old_bucket_count); + BOOST_TEST(x.bucket_count() == old_bucket_count); } test::check_equivalent_keys(x); @@ -307,7 +307,7 @@ void map_tests(X*, test::random_generator generator = test::default_generator) tracker.compare_key(x, *it); if(x.size() < b * old_bucket_count) - BOOST_CHECK(x.bucket_count() == old_bucket_count); + BOOST_TEST(x.bucket_count() == old_bucket_count); } test::check_equivalent_keys(x); diff --git a/test/unordered/load_factor_tests.cpp b/test/unordered/load_factor_tests.cpp index b54f1d7a..8a2297c7 100644 --- a/test/unordered/load_factor_tests.cpp +++ b/test/unordered/load_factor_tests.cpp @@ -24,13 +24,13 @@ void set_load_factor_tests(X* = 0) { X x; - BOOST_CHECK(x.max_load_factor() == 1.0); - BOOST_CHECK(x.load_factor() == 0); + BOOST_TEST(x.max_load_factor() == 1.0); + BOOST_TEST(x.load_factor() == 0); // A valid implementation could fail these tests, but I think they're // reasonable. - x.max_load_factor(2.0); BOOST_CHECK(x.max_load_factor() == 2.0); - x.max_load_factor(0.5); BOOST_CHECK(x.max_load_factor() == 0.5); + x.max_load_factor(2.0); BOOST_TEST(x.max_load_factor() == 2.0); + x.max_load_factor(0.5); BOOST_TEST(x.max_load_factor() == 0.5); } template @@ -49,7 +49,7 @@ void insert_test(X*, float mlf, test::random_generator generator = test::default old_bucket_count = x.bucket_count(); x.insert(*it); if(old_size + 1 < b * old_bucket_count) - BOOST_CHECK(x.bucket_count() == old_bucket_count); + BOOST_TEST(x.bucket_count() == old_bucket_count); } } diff --git a/test/unordered/move_tests.cpp b/test/unordered/move_tests.cpp index c6e8c3c5..a78e6f8b 100644 --- a/test/unordered/move_tests.cpp +++ b/test/unordered/move_tests.cpp @@ -52,11 +52,11 @@ namespace move_tests { T y(empty(ptr)); - BOOST_CHECK(y.empty()); - BOOST_CHECK(test::equivalent(y.hash_function(), hf)); - BOOST_CHECK(test::equivalent(y.key_eq(), eq)); - BOOST_CHECK(test::equivalent(y.get_allocator(), al)); - BOOST_CHECK(y.max_load_factor() == 1.0); + BOOST_TEST(y.empty()); + BOOST_TEST(test::equivalent(y.hash_function(), hf)); + BOOST_TEST(test::equivalent(y.key_eq(), eq)); + BOOST_TEST(test::equivalent(y.get_allocator(), al)); + BOOST_TEST(y.max_load_factor() == 1.0); test::check_equivalent_keys(y); } @@ -64,7 +64,7 @@ namespace move_tests test::random_values v(1000, generator); test::object_count count; T y(create(v, count)); - BOOST_CHECK(count == test::global_object_count); + BOOST_TEST(count == test::global_object_count); test::check_container(y, v); test::check_equivalent_keys(y); } @@ -78,7 +78,7 @@ namespace move_tests test::object_count count; T y; y = create(v, count); - BOOST_CHECK(count == test::global_object_count); + BOOST_TEST(count == test::global_object_count); test::check_container(y, v); test::check_equivalent_keys(y); } @@ -98,12 +98,12 @@ namespace move_tests { test::random_values v(500, generator); T y(create(v, count, hf, eq, al, 0.5)); - BOOST_CHECK(count == test::global_object_count); + BOOST_TEST(count == test::global_object_count); test::check_container(y, v); - BOOST_CHECK(test::equivalent(y.hash_function(), hf)); - BOOST_CHECK(test::equivalent(y.key_eq(), eq)); - BOOST_CHECK(test::equivalent(y.get_allocator(), al)); - BOOST_CHECK(y.max_load_factor() == 0.5); // Not necessarily required. + BOOST_TEST(test::equivalent(y.hash_function(), hf)); + BOOST_TEST(test::equivalent(y.key_eq(), eq)); + BOOST_TEST(test::equivalent(y.get_allocator(), al)); + BOOST_TEST(y.max_load_factor() == 0.5); // Not necessarily required. test::check_equivalent_keys(y); } @@ -111,12 +111,12 @@ namespace move_tests // TODO: To do this correctly requires the fancy new allocator stuff. test::random_values v(500, generator); T y(create(v, count, hf, eq, al, 2.0), al2); - BOOST_CHECK(count != test::global_object_count); + BOOST_TEST(count != test::global_object_count); test::check_container(y, v); - BOOST_CHECK(test::equivalent(y.hash_function(), hf)); - BOOST_CHECK(test::equivalent(y.key_eq(), eq)); - BOOST_CHECK(test::equivalent(y.get_allocator(), al2)); - BOOST_CHECK(y.max_load_factor() == 2.0); // Not necessarily required. + BOOST_TEST(test::equivalent(y.hash_function(), hf)); + BOOST_TEST(test::equivalent(y.key_eq(), eq)); + BOOST_TEST(test::equivalent(y.get_allocator(), al2)); + BOOST_TEST(y.max_load_factor() == 2.0); // Not necessarily required. test::check_equivalent_keys(y); } @@ -124,17 +124,17 @@ namespace move_tests test::random_values v(25, generator); T y(create(v, count, hf, eq, al, 1.0), al); #if defined(BOOST_HAS_RVALUE_REFS) - BOOST_CHECK(count == test::global_object_count); + BOOST_TEST(count == test::global_object_count); #else - BOOST_CHECK(test::global_object_count.constructions - count.constructions <= + BOOST_TEST(test::global_object_count.constructions - count.constructions <= (test::is_map::value ? 50 : 25)); - BOOST_CHECK(count.instances == test::global_object_count.instances); + BOOST_TEST(count.instances == test::global_object_count.instances); #endif test::check_container(y, v); - BOOST_CHECK(test::equivalent(y.hash_function(), hf)); - BOOST_CHECK(test::equivalent(y.key_eq(), eq)); - BOOST_CHECK(test::equivalent(y.get_allocator(), al)); - BOOST_CHECK(y.max_load_factor() == 1.0); // Not necessarily required. + BOOST_TEST(test::equivalent(y.hash_function(), hf)); + BOOST_TEST(test::equivalent(y.key_eq(), eq)); + BOOST_TEST(test::equivalent(y.get_allocator(), al)); + BOOST_TEST(y.max_load_factor() == 1.0); // Not necessarily required. test::check_equivalent_keys(y); } } diff --git a/test/unordered/rehash_tests.cpp b/test/unordered/rehash_tests.cpp index e346a567..64608cb9 100644 --- a/test/unordered/rehash_tests.cpp +++ b/test/unordered/rehash_tests.cpp @@ -26,10 +26,10 @@ void rehash_empty_test1(X* = 0) X x; x.rehash(10000); - BOOST_CHECK(postcondition(x, 10000)); + BOOST_TEST(postcondition(x, 10000)); x.rehash(0); - BOOST_CHECK(postcondition(x, 0)); + BOOST_TEST(postcondition(x, 0)); } template @@ -40,18 +40,18 @@ void rehash_test1(X* = 0, test::random_generator generator = test::default_gener tracker.insert_range(v.begin(), v.end()); X x(v.begin(), v.end()); - x.rehash(0); BOOST_CHECK(postcondition(x, 0)); + x.rehash(0); BOOST_TEST(postcondition(x, 0)); tracker.compare(x); x.max_load_factor(0.25); - x.rehash(0); BOOST_CHECK(postcondition(x, 0)); + x.rehash(0); BOOST_TEST(postcondition(x, 0)); tracker.compare(x); x.max_load_factor(50.0); - x.rehash(0); BOOST_CHECK(postcondition(x, 0)); + x.rehash(0); BOOST_TEST(postcondition(x, 0)); tracker.compare(x); - x.rehash(1000); BOOST_CHECK(postcondition(x, 1000)); + x.rehash(1000); BOOST_TEST(postcondition(x, 1000)); tracker.compare(x); } diff --git a/test/unordered/simple_tests.cpp b/test/unordered/simple_tests.cpp index 09e48bfc..fab91746 100644 --- a/test/unordered/simple_tests.cpp +++ b/test/unordered/simple_tests.cpp @@ -19,67 +19,67 @@ void simple_test(X const& a) { X u; - BOOST_CHECK(u.size() == 0); - BOOST_CHECK(X().size() == 0); + BOOST_TEST(u.size() == 0); + BOOST_TEST(X().size() == 0); } { - BOOST_CHECK(equivalent(X(a))); + BOOST_TEST(equivalent(X(a))); } { X u(a); - BOOST_CHECK(equivalent(u)); + BOOST_TEST(equivalent(u)); } { X u = a; - BOOST_CHECK(equivalent(u)); + BOOST_TEST(equivalent(u)); } { X b(a); - BOOST_CHECK(b.begin() == const_cast(b).cbegin()); - BOOST_CHECK(b.end() == const_cast(b).cend()); + BOOST_TEST(b.begin() == const_cast(b).cbegin()); + BOOST_TEST(b.end() == const_cast(b).cend()); } { X b(a); X c; - BOOST_CHECK(equivalent(b)); - BOOST_CHECK(c.empty()); + BOOST_TEST(equivalent(b)); + BOOST_TEST(c.empty()); b.swap(c); - BOOST_CHECK(b.empty()); - BOOST_CHECK(equivalent(c)); + BOOST_TEST(b.empty()); + BOOST_TEST(equivalent(c)); b.swap(c); - BOOST_CHECK(c.empty()); - BOOST_CHECK(equivalent(b)); + BOOST_TEST(c.empty()); + BOOST_TEST(equivalent(b)); } { X u; X& r = u; - BOOST_CHECK(&(r = r) == &r); - BOOST_CHECK(r.empty()); - BOOST_CHECK(&(r = a) == &r); - BOOST_CHECK(equivalent(r)); - BOOST_CHECK(&(r = r) == &r); - BOOST_CHECK(equivalent(r)); + BOOST_TEST(&(r = r) == &r); + BOOST_TEST(r.empty()); + BOOST_TEST(&(r = a) == &r); + BOOST_TEST(equivalent(r)); + BOOST_TEST(&(r = r) == &r); + BOOST_TEST(equivalent(r)); } { - BOOST_CHECK(a.size() == + BOOST_TEST(a.size() == (BOOST_DEDUCED_TYPENAME X::size_type) std::distance(a.begin(), a.end())); } { - BOOST_CHECK(a.empty() == (a.size() == 0)); + BOOST_TEST(a.empty() == (a.size() == 0)); } { - BOOST_CHECK(a.empty() == (a.begin() == a.end())); + BOOST_TEST(a.empty() == (a.begin() == a.end())); X u; - BOOST_CHECK(u.begin() == u.end()); + BOOST_TEST(u.begin() == u.end()); } }