Improved test formatting

This commit is contained in:
Daniel James 2017-10-09 12:34:47 +01:00
parent 978944fab2
commit 613f154d47
27 changed files with 149 additions and 208 deletions

View File

@ -35,4 +35,4 @@ BraceWrapping:
PointerAlignment: Left PointerAlignment: Left
# Boost specific stuff # Boost specific stuff
ForEachMacros: [ BOOST_FOREACH ] ForEachMacros: [ BOOST_FOREACH, UNORDERED_AUTO_TEST ]

View File

@ -199,11 +199,14 @@ template <class T> struct copy_range_construct_test : public range<T>, objects
} }
}; };
// clang-format off
EXCEPTION_TESTS( EXCEPTION_TESTS(
(construct_test1)(construct_test2)(construct_test3)(construct_test4)( (construct_test1)(construct_test2)(construct_test3)(construct_test4)
construct_test5)(construct_test6)(range_construct_test1)( (construct_test5)(construct_test6)(range_construct_test1)
range_construct_test2)(range_construct_test3)(range_construct_test4)( (range_construct_test2)(range_construct_test3)(range_construct_test4)
range_construct_test5)(input_range_construct_test)( (range_construct_test5)(input_range_construct_test)
copy_range_construct_test), (copy_range_construct_test),
CONTAINER_SEQ) CONTAINER_SEQ)
// clang-format on
RUN_TESTS() RUN_TESTS()

View File

@ -121,8 +121,12 @@ template <class T> struct equivalent_test1 : move_assign_base<T>
} }
}; };
// clang-format off
EXCEPTION_TESTS( EXCEPTION_TESTS(
(move_assign_test1)(move_assign_test2)(move_assign_test3)(move_assign_test4)( (move_assign_test1)(move_assign_test2)(move_assign_test3)
move_assign_test4a)(move_assign_test5)(equivalent_test1), (move_assign_test4)(move_assign_test4a)(move_assign_test5)
(equivalent_test1),
CONTAINER_SEQ) CONTAINER_SEQ)
// clang-format on
RUN_TESTS() RUN_TESTS()

View File

@ -123,7 +123,11 @@ template <class T> struct rehash_test5 : rehash_test_base<T>
} }
}; };
EXCEPTION_TESTS((rehash_test0)(rehash_test1)(rehash_test2)(rehash_test3)( // clang-format off
rehash_test4)(rehash_test5), EXCEPTION_TESTS(
(rehash_test0)(rehash_test1)(rehash_test2)(rehash_test3)(rehash_test4)
(rehash_test5),
CONTAINER_SEQ) CONTAINER_SEQ)
// clang-format on
RUN_TESTS() RUN_TESTS()

View File

@ -135,7 +135,11 @@ template <class T> struct swap_test4 : swap_base<T>
swap_test4() : swap_base<T>(10, 10, 1, 2) {} swap_test4() : swap_base<T>(10, 10, 1, 2) {}
}; };
EXCEPTION_TESTS((self_swap_test1)(self_swap_test2)(swap_test1)(swap_test2)( // clang-format off
swap_test3)(swap_test4), EXCEPTION_TESTS(
(self_swap_test1)(self_swap_test2)
(swap_test1)(swap_test2)(swap_test3)(swap_test4),
CONTAINER_SEQ) CONTAINER_SEQ)
// clang-format on
RUN_TESTS() RUN_TESTS()

View File

@ -14,16 +14,14 @@
#include <boost/preprocessor/seq/for_each_product.hpp> #include <boost/preprocessor/seq/for_each_product.hpp>
#define UNORDERED_EXCEPTION_TEST_CASE(name, test_func, type) \ #define UNORDERED_EXCEPTION_TEST_CASE(name, test_func, type) \
UNORDERED_AUTO_TEST(name) \ UNORDERED_AUTO_TEST (name) { \
{ \
test_func<type> fixture; \ test_func<type> fixture; \
::test::lightweight::exception_safety( \ ::test::lightweight::exception_safety( \
fixture, BOOST_STRINGIZE(test_func<type>)); \ fixture, BOOST_STRINGIZE(test_func<type>)); \
} }
#define UNORDERED_EXCEPTION_TEST_CASE_REPEAT(name, test_func, n, type) \ #define UNORDERED_EXCEPTION_TEST_CASE_REPEAT(name, test_func, n, type) \
UNORDERED_AUTO_TEST(name) \ UNORDERED_AUTO_TEST (name) { \
{ \
for (unsigned i = 0; i < n; ++i) { \ for (unsigned i = 0; i < n; ++i) { \
test_func<type> fixture; \ test_func<type> fixture; \
::test::lightweight::exception_safety( \ ::test::lightweight::exception_safety( \

View File

@ -163,9 +163,8 @@ namespace test {
BOOST_PP_SEQ_TAIL(BOOST_PP_SEQ_TAIL(product))) BOOST_PP_SEQ_TAIL(BOOST_PP_SEQ_TAIL(product)))
#define UNORDERED_TEST_OP2(name, n, params) \ #define UNORDERED_TEST_OP2(name, n, params) \
UNORDERED_AUTO_TEST( \ UNORDERED_AUTO_TEST ( \
BOOST_PP_SEQ_FOLD_LEFT(UNORDERED_TEST_OP_JOIN, name, params)) \ BOOST_PP_SEQ_FOLD_LEFT(UNORDERED_TEST_OP_JOIN, name, params)) { \
{ \
for (int i = 0; i < n; ++i) \ for (int i = 0; i < n; ++i) \
name BOOST_PP_SEQ_TO_TUPLE(params); \ name BOOST_PP_SEQ_TO_TUPLE(params); \
} }
@ -177,8 +176,7 @@ namespace test {
UNORDERED_MULTI_TEST_REPEAT(name, impl, 1, parameters) UNORDERED_MULTI_TEST_REPEAT(name, impl, 1, parameters)
#define UNORDERED_MULTI_TEST_REPEAT(name, impl, n, parameters) \ #define UNORDERED_MULTI_TEST_REPEAT(name, impl, n, parameters) \
UNORDERED_AUTO_TEST(name) \ UNORDERED_AUTO_TEST (name) { \
{ \
BOOST_PP_SEQ_FOR_EACH_PRODUCT( \ BOOST_PP_SEQ_FOR_EACH_PRODUCT( \
UNORDERED_MULTI_TEST_OP, ((impl))((n))parameters) \ UNORDERED_MULTI_TEST_OP, ((impl))((n))parameters) \
} }

View File

@ -242,8 +242,7 @@ namespace assign_tests {
return T::allocator_type::is_propagate_on_assign; return T::allocator_type::is_propagate_on_assign;
} }
UNORDERED_AUTO_TEST(check_traits) UNORDERED_AUTO_TEST (check_traits) {
{
BOOST_TEST(!is_propagate(test_set)); BOOST_TEST(!is_propagate(test_set));
BOOST_TEST(is_propagate(test_set_prop_assign)); BOOST_TEST(is_propagate(test_set_prop_assign));
BOOST_TEST(!is_propagate(test_set_no_prop_assign)); BOOST_TEST(!is_propagate(test_set_no_prop_assign));
@ -267,8 +266,7 @@ namespace assign_tests {
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
UNORDERED_AUTO_TEST(assign_default_initializer_list) UNORDERED_AUTO_TEST (assign_default_initializer_list) {
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Initializer List Tests\n"; BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Initializer List Tests\n";
std::initializer_list<std::pair<int const, int> > init; std::initializer_list<std::pair<int const, int> > init;
boost::unordered_map<int, int> x1; boost::unordered_map<int, int> x1;
@ -282,8 +280,7 @@ namespace assign_tests {
#endif #endif
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
UNORDERED_AUTO_TEST(assign_initializer_list) UNORDERED_AUTO_TEST (assign_initializer_list) {
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Initializer List Tests\n"; BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Initializer List Tests\n";
boost::unordered_set<int> x; boost::unordered_set<int> x;

View File

@ -14,8 +14,7 @@
namespace at_tests { namespace at_tests {
UNORDERED_AUTO_TEST(at_tests) UNORDERED_AUTO_TEST (at_tests) {
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Create Map" << std::endl; BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Create Map" << std::endl;
boost::unordered_map<std::string, int> x; boost::unordered_map<std::string, int> x;

View File

@ -36,8 +36,7 @@ INSTANTIATE(multimap)<test::minimal::assignable, test::minimal::assignable,
test::minimal::equal_to<test::minimal::assignable>, test::minimal::equal_to<test::minimal::assignable>,
test::minimal::allocator<int> >; test::minimal::allocator<int> >;
UNORDERED_AUTO_TEST(test0) UNORDERED_AUTO_TEST (test0) {
{
test::minimal::constructor_param x; test::minimal::constructor_param x;
typedef std::pair<test::minimal::assignable const, test::minimal::assignable> typedef std::pair<test::minimal::assignable const, test::minimal::assignable>
@ -81,8 +80,7 @@ UNORDERED_AUTO_TEST(test0)
container_test(multimap, value); container_test(multimap, value);
} }
UNORDERED_AUTO_TEST(equality_tests) UNORDERED_AUTO_TEST (equality_tests) {
{
typedef std::pair<test::minimal::copy_constructible_equality_comparable const, typedef std::pair<test::minimal::copy_constructible_equality_comparable const,
test::minimal::copy_constructible_equality_comparable> test::minimal::copy_constructible_equality_comparable>
value_type; value_type;
@ -125,8 +123,7 @@ UNORDERED_AUTO_TEST(equality_tests)
equality_test(multimap); equality_test(multimap);
} }
UNORDERED_AUTO_TEST(test1) UNORDERED_AUTO_TEST (test1) {
{
boost::hash<int> hash; boost::hash<int> hash;
std::equal_to<int> equal_to; std::equal_to<int> equal_to;
int value = 0; int value = 0;
@ -167,8 +164,7 @@ UNORDERED_AUTO_TEST(test1)
unordered_copyable_test(multimap2, value, map_value, hash, equal_to); unordered_copyable_test(multimap2, value, map_value, hash, equal_to);
} }
UNORDERED_AUTO_TEST(test2) UNORDERED_AUTO_TEST (test2) {
{
test::minimal::constructor_param x; test::minimal::constructor_param x;
test::minimal::assignable assignable(x); test::minimal::assignable assignable(x);
@ -235,8 +231,7 @@ std::size_t hash_value(lwg2059_key x)
bool operator==(lwg2059_key x, lwg2059_key y) { return x.value == y.value; } bool operator==(lwg2059_key x, lwg2059_key y) { return x.value == y.value; }
UNORDERED_AUTO_TEST(lwg2059) UNORDERED_AUTO_TEST (lwg2059) {
{
{ {
boost::unordered_map<lwg2059_key, int> x; boost::unordered_map<lwg2059_key, int> x;
x.emplace(lwg2059_key(10), 5); x.emplace(lwg2059_key(10), 5);

View File

@ -35,8 +35,7 @@ INSTANTIATE(multiset)<test::minimal::assignable,
test::minimal::equal_to<test::minimal::assignable>, test::minimal::equal_to<test::minimal::assignable>,
test::minimal::allocator<int> >; test::minimal::allocator<int> >;
UNORDERED_AUTO_TEST(test0) UNORDERED_AUTO_TEST (test0) {
{
test::minimal::constructor_param x; test::minimal::constructor_param x;
test::minimal::assignable assignable(x); test::minimal::assignable assignable(x);
@ -78,8 +77,7 @@ UNORDERED_AUTO_TEST(test0)
container_test(multiset, assignable); container_test(multiset, assignable);
} }
UNORDERED_AUTO_TEST(equality_tests) UNORDERED_AUTO_TEST (equality_tests) {
{
typedef test::minimal::copy_constructible_equality_comparable value_type; typedef test::minimal::copy_constructible_equality_comparable value_type;
boost::unordered_set<int> int_set; boost::unordered_set<int> int_set;
@ -118,8 +116,7 @@ UNORDERED_AUTO_TEST(equality_tests)
equality_test(multiset); equality_test(multiset);
} }
UNORDERED_AUTO_TEST(test1) UNORDERED_AUTO_TEST (test1) {
{
boost::hash<int> hash; boost::hash<int> hash;
std::equal_to<int> equal_to; std::equal_to<int> equal_to;
int value = 0; int value = 0;
@ -157,8 +154,7 @@ UNORDERED_AUTO_TEST(test1)
unordered_copyable_test(multiset2, value, value, hash, equal_to); unordered_copyable_test(multiset2, value, value, hash, equal_to);
} }
UNORDERED_AUTO_TEST(test2) UNORDERED_AUTO_TEST (test2) {
{
test::minimal::constructor_param x; test::minimal::constructor_param x;
test::minimal::assignable assignable(x); test::minimal::assignable assignable(x);
@ -193,8 +189,7 @@ UNORDERED_AUTO_TEST(test2)
unordered_set_member_test(multiset, assignable); unordered_set_member_test(multiset, assignable);
} }
UNORDERED_AUTO_TEST(movable1_tests) UNORDERED_AUTO_TEST (movable1_tests) {
{
test::minimal::constructor_param x; test::minimal::constructor_param x;
test::minimal::movable1 movable1(x); test::minimal::movable1 movable1(x);
@ -226,8 +221,7 @@ UNORDERED_AUTO_TEST(movable1_tests)
unordered_movable_test(multiset, movable1, movable1, hash, equal_to); unordered_movable_test(multiset, movable1, movable1, hash, equal_to);
} }
UNORDERED_AUTO_TEST(movable2_tests) UNORDERED_AUTO_TEST (movable2_tests) {
{
test::minimal::constructor_param x; test::minimal::constructor_param x;
test::minimal::movable2 movable2(x); test::minimal::movable2 movable2(x);
@ -259,8 +253,7 @@ UNORDERED_AUTO_TEST(movable2_tests)
unordered_movable_test(multiset, movable2, movable2, hash, equal_to); unordered_movable_test(multiset, movable2, movable2, hash, equal_to);
} }
UNORDERED_AUTO_TEST(destructible_tests) UNORDERED_AUTO_TEST (destructible_tests) {
{
test::minimal::constructor_param x; test::minimal::constructor_param x;
test::minimal::destructible destructible(x); test::minimal::destructible destructible(x);
@ -303,8 +296,7 @@ std::size_t hash_value(lwg2059_key x)
bool operator==(lwg2059_key x, lwg2059_key y) { return x.value == y.value; } bool operator==(lwg2059_key x, lwg2059_key y) { return x.value == y.value; }
UNORDERED_AUTO_TEST(lwg2059) UNORDERED_AUTO_TEST (lwg2059) {
{
{ {
boost::unordered_set<lwg2059_key> x; boost::unordered_set<lwg2059_key> x;
x.emplace(lwg2059_key(10)); x.emplace(lwg2059_key(10));

View File

@ -427,8 +427,7 @@ namespace constructor_tests {
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
UNORDERED_AUTO_TEST(test_default_initializer_list) UNORDERED_AUTO_TEST (test_default_initializer_list) {
{
std::initializer_list<int> init; std::initializer_list<int> init;
boost::unordered_set<int> x1 = init; boost::unordered_set<int> x1 = init;
BOOST_TEST(x1.empty()); BOOST_TEST(x1.empty());
@ -438,8 +437,7 @@ namespace constructor_tests {
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
UNORDERED_AUTO_TEST(test_initializer_list) UNORDERED_AUTO_TEST (test_initializer_list) {
{
boost::unordered_set<int> x1 = {2, 10, 45, -5}; boost::unordered_set<int> x1 = {2, 10, 45, -5};
BOOST_TEST(x1.find(10) != x1.end()); BOOST_TEST(x1.find(10) != x1.end());
BOOST_TEST(x1.find(46) == x1.end()); BOOST_TEST(x1.find(46) == x1.end());

View File

@ -51,8 +51,7 @@ void test_prev_prime(std::size_t value)
} }
} }
UNORDERED_AUTO_TEST(next_prime_test) UNORDERED_AUTO_TEST (next_prime_test) {
{
BOOST_TEST(!is_prime(0)); BOOST_TEST(!is_prime(0));
BOOST_TEST(!is_prime(1)); BOOST_TEST(!is_prime(1));
BOOST_TEST(is_prime(2)); BOOST_TEST(is_prime(2));

View File

@ -167,8 +167,7 @@ namespace emplace_tests {
emplace_value(emplace_value const&); emplace_value(emplace_value const&);
}; };
UNORDERED_AUTO_TEST(emplace_set) UNORDERED_AUTO_TEST (emplace_set) {
{
test::check_instances check_; test::check_instances check_;
typedef boost::unordered_set<emplace_value, boost::hash<emplace_value> > typedef boost::unordered_set<emplace_value, boost::hash<emplace_value> >
@ -249,8 +248,7 @@ namespace emplace_tests {
BOOST_TEST(x.count(v4) == 1); BOOST_TEST(x.count(v4) == 1);
} }
UNORDERED_AUTO_TEST(emplace_multiset) UNORDERED_AUTO_TEST (emplace_multiset) {
{
test::check_instances check_; test::check_instances check_;
typedef boost::unordered_multiset<emplace_value, typedef boost::unordered_multiset<emplace_value,
@ -328,8 +326,7 @@ namespace emplace_tests {
BOOST_TEST_EQ(x.count(v3), 2u); BOOST_TEST_EQ(x.count(v3), 2u);
} }
UNORDERED_AUTO_TEST(emplace_map) UNORDERED_AUTO_TEST (emplace_map) {
{
test::check_instances check_; test::check_instances check_;
typedef boost::unordered_map<emplace_value, emplace_value, typedef boost::unordered_map<emplace_value, emplace_value,
@ -400,8 +397,7 @@ namespace emplace_tests {
BOOST_TEST_EQ(check_.constructions(), 16); BOOST_TEST_EQ(check_.constructions(), 16);
} }
UNORDERED_AUTO_TEST(emplace_multimap) UNORDERED_AUTO_TEST (emplace_multimap) {
{
test::check_instances check_; test::check_instances check_;
typedef boost::unordered_multimap<emplace_value, emplace_value, typedef boost::unordered_multimap<emplace_value, emplace_value,
@ -466,8 +462,7 @@ namespace emplace_tests {
BOOST_TEST_EQ(check_.constructions(), 20); BOOST_TEST_EQ(check_.constructions(), 20);
} }
UNORDERED_AUTO_TEST(try_emplace) UNORDERED_AUTO_TEST (try_emplace) {
{
test::check_instances check_; test::check_instances check_;
typedef boost::unordered_map<int, emplace_value> container; typedef boost::unordered_map<int, emplace_value> container;

View File

@ -31,43 +31,42 @@ namespace equality_tests {
}; };
#define UNORDERED_EQUALITY_SET_TEST(seq1, op, seq2) \ #define UNORDERED_EQUALITY_SET_TEST(seq1, op, seq2) \
{ \ do { \
boost::unordered_set<int, mod_compare, mod_compare> set1, set2; \ boost::unordered_set<int, mod_compare, mod_compare> set1, set2; \
BOOST_PP_SEQ_FOR_EACH(UNORDERED_SET_INSERT, set1, seq1) \ BOOST_PP_SEQ_FOR_EACH(UNORDERED_SET_INSERT, set1, seq1) \
BOOST_PP_SEQ_FOR_EACH(UNORDERED_SET_INSERT, set2, seq2) \ BOOST_PP_SEQ_FOR_EACH(UNORDERED_SET_INSERT, set2, seq2) \
BOOST_TEST(set1 op set2); \ BOOST_TEST(set1 op set2); \
} } while (0)
#define UNORDERED_EQUALITY_MULTISET_TEST(seq1, op, seq2) \ #define UNORDERED_EQUALITY_MULTISET_TEST(seq1, op, seq2) \
{ \ do { \
boost::unordered_multiset<int, mod_compare, mod_compare> set1, set2; \ boost::unordered_multiset<int, mod_compare, mod_compare> set1, set2; \
BOOST_PP_SEQ_FOR_EACH(UNORDERED_SET_INSERT, set1, seq1) \ BOOST_PP_SEQ_FOR_EACH(UNORDERED_SET_INSERT, set1, seq1) \
BOOST_PP_SEQ_FOR_EACH(UNORDERED_SET_INSERT, set2, seq2) \ BOOST_PP_SEQ_FOR_EACH(UNORDERED_SET_INSERT, set2, seq2) \
BOOST_TEST(set1 op set2); \ BOOST_TEST(set1 op set2); \
} } while (0)
#define UNORDERED_EQUALITY_MAP_TEST(seq1, op, seq2) \ #define UNORDERED_EQUALITY_MAP_TEST(seq1, op, seq2) \
{ \ do { \
boost::unordered_map<int, int, mod_compare, mod_compare> map1, map2; \ boost::unordered_map<int, int, mod_compare, mod_compare> map1, map2; \
BOOST_PP_SEQ_FOR_EACH(UNORDERED_MAP_INSERT, map1, seq1) \ BOOST_PP_SEQ_FOR_EACH(UNORDERED_MAP_INSERT, map1, seq1) \
BOOST_PP_SEQ_FOR_EACH(UNORDERED_MAP_INSERT, map2, seq2) \ BOOST_PP_SEQ_FOR_EACH(UNORDERED_MAP_INSERT, map2, seq2) \
BOOST_TEST(map1 op map2); \ BOOST_TEST(map1 op map2); \
} } while (0)
#define UNORDERED_EQUALITY_MULTIMAP_TEST(seq1, op, seq2) \ #define UNORDERED_EQUALITY_MULTIMAP_TEST(seq1, op, seq2) \
{ \ do { \
boost::unordered_multimap<int, int, mod_compare, mod_compare> map1, map2; \ boost::unordered_multimap<int, int, mod_compare, mod_compare> map1, map2; \
BOOST_PP_SEQ_FOR_EACH(UNORDERED_MAP_INSERT, map1, seq1) \ BOOST_PP_SEQ_FOR_EACH(UNORDERED_MAP_INSERT, map1, seq1) \
BOOST_PP_SEQ_FOR_EACH(UNORDERED_MAP_INSERT, map2, seq2) \ BOOST_PP_SEQ_FOR_EACH(UNORDERED_MAP_INSERT, map2, seq2) \
BOOST_TEST(map1 op map2); \ BOOST_TEST(map1 op map2); \
} } while (0)
#define UNORDERED_SET_INSERT(r, set, item) set.insert(item); #define UNORDERED_SET_INSERT(r, set, item) set.insert(item);
#define UNORDERED_MAP_INSERT(r, map, item) \ #define UNORDERED_MAP_INSERT(r, map, item) \
map.insert(std::pair<int const, int> BOOST_PP_SEQ_TO_TUPLE(item)); map.insert(std::pair<int const, int> BOOST_PP_SEQ_TO_TUPLE(item));
UNORDERED_AUTO_TEST(equality_size_tests) UNORDERED_AUTO_TEST (equality_size_tests) {
{
boost::unordered_set<int> x1, x2; boost::unordered_set<int> x1, x2;
BOOST_TEST(x1 == x2); BOOST_TEST(x1 == x2);
BOOST_TEST(!(x1 != x2)); BOOST_TEST(!(x1 != x2));
@ -89,38 +88,44 @@ namespace equality_tests {
BOOST_TEST(!(x2 == x1)); BOOST_TEST(!(x2 == x1));
} }
UNORDERED_AUTO_TEST(equality_key_value_tests){ UNORDERED_AUTO_TEST (equality_key_value_tests) {
UNORDERED_EQUALITY_MULTISET_TEST((1), !=, (2)) UNORDERED_EQUALITY_MULTISET_TEST((1), !=, (2));
UNORDERED_EQUALITY_SET_TEST((2), ==, (2)) UNORDERED_EQUALITY_SET_TEST((2), ==, (2));
UNORDERED_EQUALITY_MAP_TEST(((1)(1))((2)(1)), !=, ((1)(1))((3)(1)))} UNORDERED_EQUALITY_MAP_TEST(((1)(1))((2)(1)), !=, ((1)(1))((3)(1)));
}
UNORDERED_AUTO_TEST(equality_collision_test){UNORDERED_EQUALITY_MULTISET_TEST( UNORDERED_AUTO_TEST (equality_collision_test) {
(1), !=, (501)) UNORDERED_EQUALITY_MULTISET_TEST((1)(251), !=, UNORDERED_EQUALITY_MULTISET_TEST((1), !=, (501));
(1)(501)) UNORDERED_EQUALITY_MULTIMAP_TEST(((251)(1))((1)(1)), !=, UNORDERED_EQUALITY_MULTISET_TEST((1)(251), !=, (1)(501));
((501)(1))((1)(1))) UNORDERED_EQUALITY_MULTISET_TEST((1)(501), ==, (1)(501)) UNORDERED_EQUALITY_MULTIMAP_TEST(
UNORDERED_EQUALITY_SET_TEST((1)(501), ==, (501)(1))} ((251)(1))((1)(1)), !=, ((501)(1))((1)(1)));
UNORDERED_EQUALITY_MULTISET_TEST((1)(501), ==, (1)(501));
UNORDERED_EQUALITY_SET_TEST((1)(501), ==, (501)(1));
}
UNORDERED_AUTO_TEST(equality_group_size_test){ UNORDERED_AUTO_TEST (equality_group_size_test) {
UNORDERED_EQUALITY_MULTISET_TEST((10)(20)(20), !=, (10)(10)(20)) UNORDERED_EQUALITY_MULTISET_TEST((10)(20)(20), !=, (10)(10)(20));
UNORDERED_EQUALITY_MULTIMAP_TEST( UNORDERED_EQUALITY_MULTIMAP_TEST(
((10)(1))((20)(1))((20)(1)), !=, ((10)(1))((20)(1))((10)(1))) ((10)(1))((20)(1))((20)(1)), !=, ((10)(1))((20)(1))((10)(1)));
UNORDERED_EQUALITY_MULTIMAP_TEST( UNORDERED_EQUALITY_MULTIMAP_TEST(
((20)(1))((10)(1))((10)(1)), ==, ((10)(1))((20)(1))((10)(1)))} ((20)(1))((10)(1))((10)(1)), ==, ((10)(1))((20)(1))((10)(1)));
}
UNORDERED_AUTO_TEST(equality_map_value_test){UNORDERED_EQUALITY_MAP_TEST( UNORDERED_AUTO_TEST (equality_map_value_test) {
((1)(1)), !=, ((1)(2))) UNORDERED_EQUALITY_MAP_TEST(((1)(1)), ==, UNORDERED_EQUALITY_MAP_TEST(((1)(1)), !=, ((1)(2)));
((1)(1))) UNORDERED_EQUALITY_MULTIMAP_TEST(((1)(1)), !=, ((1)(2))) UNORDERED_EQUALITY_MAP_TEST(((1)(1)), ==, ((1)(1)));
UNORDERED_EQUALITY_MULTIMAP_TEST(((1)(1))((1)(1)), !=, ((1)(1))((1)(2))) UNORDERED_EQUALITY_MULTIMAP_TEST(((1)(1)), !=, ((1)(2)));
UNORDERED_EQUALITY_MULTIMAP_TEST(((1)(2))((1)(1)), ==, ((1)(1))((1)(2))) UNORDERED_EQUALITY_MULTIMAP_TEST(((1)(1))((1)(1)), !=, ((1)(1))((1)(2)));
UNORDERED_EQUALITY_MULTIMAP_TEST( UNORDERED_EQUALITY_MULTIMAP_TEST(((1)(2))((1)(1)), ==, ((1)(1))((1)(2)));
((1)(2))((1)(1)), !=, ((1)(1))((1)(3)))} UNORDERED_EQUALITY_MULTIMAP_TEST(((1)(2))((1)(1)), !=, ((1)(1))((1)(3)));
}
UNORDERED_AUTO_TEST(equality_predicate_test){ UNORDERED_AUTO_TEST (equality_predicate_test) {
UNORDERED_EQUALITY_SET_TEST((1), !=, (1001)) UNORDERED_EQUALITY_SET_TEST((1), !=, (1001));
UNORDERED_EQUALITY_MAP_TEST(((1)(2))((1001)(1)), !=, ((1001)(2))((1)(1)))} UNORDERED_EQUALITY_MAP_TEST(((1)(2))((1001)(1)), !=, ((1001)(2))((1)(1)));
}
UNORDERED_AUTO_TEST(equality_multiple_group_test) UNORDERED_AUTO_TEST (equality_multiple_group_test) {
{
UNORDERED_EQUALITY_MULTISET_TEST( UNORDERED_EQUALITY_MULTISET_TEST(
(1)(1)(1)(1001)(2001)(2001)(2)(1002)(3)(1003)(2003), ==, (1)(1)(1)(1001)(2001)(2001)(2)(1002)(3)(1003)(2003), ==,
(3)(1003)(2003)(1002)(2)(2001)(2001)(1)(1001)(1)(1)); (3)(1003)(2003)(1002)(2)(2001)(2001)(1)(1001)(1)(1));
@ -129,8 +134,7 @@ namespace equality_tests {
// Test that equality still works when the two containers have // Test that equality still works when the two containers have
// different hash functions but the same equality predicate. // different hash functions but the same equality predicate.
UNORDERED_AUTO_TEST(equality_different_hash_test) UNORDERED_AUTO_TEST (equality_different_hash_test) {
{
typedef boost::unordered_set<int, mod_compare, mod_compare> set; typedef boost::unordered_set<int, mod_compare, mod_compare> set;
set set1(0, mod_compare(false), mod_compare(false)); set set1(0, mod_compare(false), mod_compare(false));
set set2(0, mod_compare(true), mod_compare(true)); set set2(0, mod_compare(true), mod_compare(true));

View File

@ -35,8 +35,7 @@ void test_equal_insertion(Iterator begin, Iterator end)
test::check_equivalent_keys(x1); test::check_equivalent_keys(x1);
} }
UNORDERED_AUTO_TEST(set_tests) UNORDERED_AUTO_TEST (set_tests) {
{
int values[][5] = {{1}, {54, 23}, {-13, 65}, {77, 77}, {986, 25, 986}}; int values[][5] = {{1}, {54, 23}, {-13, 65}, {77, 77}, {986, 25, 986}};
typedef boost::unordered_set<int> set; typedef boost::unordered_set<int> set;
@ -55,8 +54,7 @@ UNORDERED_AUTO_TEST(set_tests)
test_equal_insertion<multiset>(values[4], values[4] + 3); test_equal_insertion<multiset>(values[4], values[4] + 3);
} }
UNORDERED_AUTO_TEST(map_tests) UNORDERED_AUTO_TEST (map_tests) {
{
typedef test::list<std::pair<int const, int> > values_type; typedef test::list<std::pair<int const, int> > values_type;
values_type v[5]; values_type v[5];
v[0].push_back(std::pair<int const, int>(1, 1)); v[0].push_back(std::pair<int const, int>(1, 1));

View File

@ -73,8 +73,7 @@ typedef boost::unordered_multimap<int, int, collision3_hash, std::equal_to<int>,
typedef collide_map::value_type collide_value; typedef collide_map::value_type collide_value;
typedef test::list<collide_value> collide_list; typedef test::list<collide_value> collide_list;
UNORDERED_AUTO_TEST(empty_range_tests) UNORDERED_AUTO_TEST (empty_range_tests) {
{
collide_map x; collide_map x;
x.erase(x.begin(), x.end()); x.erase(x.begin(), x.end());
x.erase(x.begin(), x.begin()); x.erase(x.begin(), x.begin());
@ -82,8 +81,7 @@ UNORDERED_AUTO_TEST(empty_range_tests)
test::check_equivalent_keys(x); test::check_equivalent_keys(x);
} }
UNORDERED_AUTO_TEST(single_item_tests) UNORDERED_AUTO_TEST (single_item_tests) {
{
collide_list init; collide_list init;
init.push_back(collide_value(1, 1)); init.push_back(collide_value(1, 1));
@ -99,8 +97,7 @@ UNORDERED_AUTO_TEST(single_item_tests)
test::check_equivalent_keys(x); test::check_equivalent_keys(x);
} }
UNORDERED_AUTO_TEST(two_equivalent_item_tests) UNORDERED_AUTO_TEST (two_equivalent_item_tests) {
{
collide_list init; collide_list init;
init.push_back(collide_value(1, 1)); init.push_back(collide_value(1, 1));
init.push_back(collide_value(1, 2)); init.push_back(collide_value(1, 2));
@ -198,23 +195,20 @@ void exhaustive_erase_tests(Container* x, int num_values, int num_duplicated)
} }
} }
UNORDERED_AUTO_TEST(exhaustive_collide_tests) UNORDERED_AUTO_TEST (exhaustive_collide_tests) {
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "exhaustive_collide_tests:\n"; BOOST_LIGHTWEIGHT_TEST_OSTREAM << "exhaustive_collide_tests:\n";
collide_map m; collide_map m;
exhaustive_erase_tests((collide_map*)0, 4, 4); exhaustive_erase_tests((collide_map*)0, 4, 4);
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "\n"; BOOST_LIGHTWEIGHT_TEST_OSTREAM << "\n";
} }
UNORDERED_AUTO_TEST(exhaustive_collide2_tests) UNORDERED_AUTO_TEST (exhaustive_collide2_tests) {
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "exhaustive_collide2_tests:\n"; BOOST_LIGHTWEIGHT_TEST_OSTREAM << "exhaustive_collide2_tests:\n";
exhaustive_erase_tests((collide_map2*)0, 8, 4); exhaustive_erase_tests((collide_map2*)0, 8, 4);
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "\n"; BOOST_LIGHTWEIGHT_TEST_OSTREAM << "\n";
} }
UNORDERED_AUTO_TEST(exhaustive_collide3_tests) UNORDERED_AUTO_TEST (exhaustive_collide3_tests) {
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "exhaustive_collide3_tests:\n"; BOOST_LIGHTWEIGHT_TEST_OSTREAM << "exhaustive_collide3_tests:\n";
exhaustive_erase_tests((collide_map3*)0, 8, 4); exhaustive_erase_tests((collide_map3*)0, 8, 4);
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "\n"; BOOST_LIGHTWEIGHT_TEST_OSTREAM << "\n";

View File

@ -55,8 +55,7 @@ bool call_not_equals(
typedef boost::unordered_map<int, int> int_map; typedef boost::unordered_map<int, int> int_map;
typedef boost::unordered_multimap<int, int> int_multimap; typedef boost::unordered_multimap<int, int> int_multimap;
UNORDERED_AUTO_TEST(use_map_fwd_declared_function) UNORDERED_AUTO_TEST (use_map_fwd_declared_function) {
{
int_map x, y; int_map x, y;
x[1] = 2; x[1] = 2;
y[2] = 1; y[2] = 1;
@ -72,8 +71,7 @@ UNORDERED_AUTO_TEST(use_map_fwd_declared_function)
BOOST_TEST(call_not_equals(x, y)); BOOST_TEST(call_not_equals(x, y));
} }
UNORDERED_AUTO_TEST(use_multimap_fwd_declared_function) UNORDERED_AUTO_TEST (use_multimap_fwd_declared_function) {
{
int_multimap x, y; int_multimap x, y;
call_swap(x, y); call_swap(x, y);
BOOST_TEST(call_equals(x, y)); BOOST_TEST(call_equals(x, y));

View File

@ -67,23 +67,20 @@ bool call_not_equals(
typedef boost::unordered_set<int> int_set; typedef boost::unordered_set<int> int_set;
typedef boost::unordered_multiset<int> int_multiset; typedef boost::unordered_multiset<int> int_multiset;
UNORDERED_AUTO_TEST(use_fwd_declared_trait_without_definition) UNORDERED_AUTO_TEST (use_fwd_declared_trait_without_definition) {
{
BOOST_TEST(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 <boost/unordered_set.hpp> #include <boost/unordered_set.hpp>
UNORDERED_AUTO_TEST(use_fwd_declared_trait) UNORDERED_AUTO_TEST (use_fwd_declared_trait) {
{
boost::unordered_set<int> x; boost::unordered_set<int> x;
BOOST_TEST(sizeof(is_unordered_set_impl(&x)) == sizeof(true_type)); BOOST_TEST(sizeof(is_unordered_set_impl(&x)) == sizeof(true_type));
BOOST_TEST(sizeof(is_unordered_set_impl((int*)0)) == sizeof(false_type)); BOOST_TEST(sizeof(is_unordered_set_impl((int*)0)) == sizeof(false_type));
} }
UNORDERED_AUTO_TEST(use_set_fwd_declared_function) UNORDERED_AUTO_TEST (use_set_fwd_declared_function) {
{
int_set x, y; int_set x, y;
x.insert(1); x.insert(1);
y.insert(2); y.insert(2);
@ -99,8 +96,7 @@ UNORDERED_AUTO_TEST(use_set_fwd_declared_function)
BOOST_TEST(call_not_equals(x, y)); BOOST_TEST(call_not_equals(x, y));
} }
UNORDERED_AUTO_TEST(use_multiset_fwd_declared_function) UNORDERED_AUTO_TEST (use_multiset_fwd_declared_function) {
{
int_multiset x, y; int_multiset x, y;
call_swap(x, y); call_swap(x, y);
BOOST_TEST(call_equals(x, y)); BOOST_TEST(call_equals(x, y));

View File

@ -17,8 +17,7 @@
#include <set> #include <set>
namespace insert_hint { namespace insert_hint {
UNORDERED_AUTO_TEST(insert_hint_empty) UNORDERED_AUTO_TEST (insert_hint_empty) {
{
typedef boost::unordered_multiset<int> container; typedef boost::unordered_multiset<int> container;
container x; container x;
x.insert(x.cbegin(), 10); x.insert(x.cbegin(), 10);
@ -27,8 +26,7 @@ namespace insert_hint {
test::check_equivalent_keys(x); test::check_equivalent_keys(x);
} }
UNORDERED_AUTO_TEST(insert_hint_empty2) UNORDERED_AUTO_TEST (insert_hint_empty2) {
{
typedef boost::unordered_multimap<std::string, int> container; typedef boost::unordered_multimap<std::string, int> container;
container x; container x;
x.emplace_hint(x.cbegin(), "hello", 50); x.emplace_hint(x.cbegin(), "hello", 50);
@ -38,8 +36,7 @@ namespace insert_hint {
test::check_equivalent_keys(x); test::check_equivalent_keys(x);
} }
UNORDERED_AUTO_TEST(insert_hint_single) UNORDERED_AUTO_TEST (insert_hint_single) {
{
typedef boost::unordered_multiset<std::string> container; typedef boost::unordered_multiset<std::string> container;
container x; container x;
x.insert("equal"); x.insert("equal");
@ -49,8 +46,7 @@ namespace insert_hint {
test::check_equivalent_keys(x); test::check_equivalent_keys(x);
} }
UNORDERED_AUTO_TEST(insert_hint_single2) UNORDERED_AUTO_TEST (insert_hint_single2) {
{
typedef boost::unordered_multimap<int, std::string> container; typedef boost::unordered_multimap<int, std::string> container;
container x; container x;
x.emplace(10, "one"); x.emplace(10, "one");
@ -69,8 +65,7 @@ namespace insert_hint {
test::check_equivalent_keys(x); test::check_equivalent_keys(x);
} }
UNORDERED_AUTO_TEST(insert_hint_multiple) UNORDERED_AUTO_TEST (insert_hint_multiple) {
{
for (unsigned int size = 0; size < 10; ++size) { for (unsigned int size = 0; size < 10; ++size) {
for (unsigned int offset = 0; offset <= size; ++offset) { for (unsigned int offset = 0; offset <= size; ++offset) {
typedef boost::unordered_multiset<std::string> container; typedef boost::unordered_multiset<std::string> container;
@ -96,8 +91,7 @@ namespace insert_hint {
} }
} }
UNORDERED_AUTO_TEST(insert_hint_unique) UNORDERED_AUTO_TEST (insert_hint_unique) {
{
typedef boost::unordered_set<int> container; typedef boost::unordered_set<int> container;
container x; container x;
x.insert(x.cbegin(), 10); x.insert(x.cbegin(), 10);
@ -106,8 +100,7 @@ namespace insert_hint {
test::check_equivalent_keys(x); test::check_equivalent_keys(x);
} }
UNORDERED_AUTO_TEST(insert_hint_unique_single) UNORDERED_AUTO_TEST (insert_hint_unique_single) {
{
typedef boost::unordered_set<int> container; typedef boost::unordered_set<int> container;
container x; container x;
x.insert(10); x.insert(10);

View File

@ -976,8 +976,7 @@ namespace insert_tests {
} }
}; };
UNORDERED_AUTO_TEST(insert_initializer_list_set) UNORDERED_AUTO_TEST (insert_initializer_list_set) {
{
boost::unordered_set<int> set; boost::unordered_set<int> set;
set.insert({1, 2, 3, 1}); set.insert({1, 2, 3, 1});
BOOST_TEST_EQ(set.size(), 3u); BOOST_TEST_EQ(set.size(), 3u);
@ -1015,8 +1014,7 @@ namespace insert_tests {
#if !BOOST_WORKAROUND(BOOST_MSVC, == 1800) #if !BOOST_WORKAROUND(BOOST_MSVC, == 1800)
UNORDERED_AUTO_TEST(insert_initializer_list_multiset) UNORDERED_AUTO_TEST (insert_initializer_list_multiset) {
{
boost::unordered_multiset<std::string> multiset; boost::unordered_multiset<std::string> multiset;
// multiset.insert({}); // multiset.insert({});
BOOST_TEST(multiset.empty()); BOOST_TEST(multiset.empty());
@ -1033,8 +1031,7 @@ namespace insert_tests {
#endif #endif
UNORDERED_AUTO_TEST(insert_initializer_list_map) UNORDERED_AUTO_TEST (insert_initializer_list_map) {
{
boost::unordered_map<std::string, std::string> map; boost::unordered_map<std::string, std::string> map;
// map.insert({}); // map.insert({});
BOOST_TEST(map.empty()); BOOST_TEST(map.empty());
@ -1042,8 +1039,7 @@ namespace insert_tests {
BOOST_TEST_EQ(map.size(), 2u); BOOST_TEST_EQ(map.size(), 2u);
} }
UNORDERED_AUTO_TEST(insert_initializer_list_multimap) UNORDERED_AUTO_TEST (insert_initializer_list_multimap) {
{
boost::unordered_multimap<std::string, std::string> multimap; boost::unordered_multimap<std::string, std::string> multimap;
// multimap.insert({}); // multimap.insert({});
BOOST_TEST(multimap.empty()); BOOST_TEST(multimap.empty());
@ -1079,8 +1075,7 @@ namespace insert_tests {
} }
}; };
UNORDERED_AUTO_TEST(map_emplace_test) UNORDERED_AUTO_TEST (map_emplace_test) {
{
{ {
boost::unordered_map<int, overloaded_constructor, test::hash, boost::unordered_map<int, overloaded_constructor, test::hash,
test::equal_to, test::equal_to,
@ -1120,8 +1115,7 @@ namespace insert_tests {
} }
} }
UNORDERED_AUTO_TEST(set_emplace_test) UNORDERED_AUTO_TEST (set_emplace_test) {
{
boost::unordered_set<overloaded_constructor> x; boost::unordered_set<overloaded_constructor> x;
overloaded_constructor check; overloaded_constructor check;
@ -1169,8 +1163,7 @@ namespace insert_tests {
} }
}; };
UNORDERED_AUTO_TEST(map_emplace_test2) UNORDERED_AUTO_TEST (map_emplace_test2) {
{
// Emulating piecewise construction with boost::tuple bypasses the // Emulating piecewise construction with boost::tuple bypasses the
// allocator's construct method, but still uses test destroy method. // allocator's construct method, but still uses test destroy method.
test::detail::disable_construction_tracking _scoped; test::detail::disable_construction_tracking _scoped;
@ -1276,8 +1269,7 @@ namespace insert_tests {
} }
} }
UNORDERED_AUTO_TEST(set_emplace_test2) UNORDERED_AUTO_TEST (set_emplace_test2) {
{
boost::unordered_set< boost::unordered_set<
std::pair<overloaded_constructor, overloaded_constructor> > std::pair<overloaded_constructor, overloaded_constructor> >
x; x;
@ -1340,8 +1332,7 @@ RUN_TESTS_QUIET()
#else // PIECEWISE_TEST_NAME #else // PIECEWISE_TEST_NAME
UNORDERED_AUTO_TEST(PIECEWISE_TEST_NAME) UNORDERED_AUTO_TEST (PIECEWISE_TEST_NAME) {
{
#if EMULATING_PIECEWISE_CONSTRUCTION #if EMULATING_PIECEWISE_CONSTRUCTION
test::detail::disable_construction_tracking _scoped; test::detail::disable_construction_tracking _scoped;
#endif #endif
@ -1431,8 +1422,7 @@ UNORDERED_AUTO_TEST(PIECEWISE_TEST_NAME)
} }
} }
UNORDERED_AUTO_TEST(BOOST_PP_CAT(PIECEWISE_TEST_NAME, 2)) UNORDERED_AUTO_TEST (BOOST_PP_CAT(PIECEWISE_TEST_NAME, 2)) {
{
#if EMULATING_PIECEWISE_CONSTRUCTION #if EMULATING_PIECEWISE_CONSTRUCTION
test::detail::disable_construction_tracking _scoped; test::detail::disable_construction_tracking _scoped;
#endif #endif

View File

@ -19,8 +19,7 @@
namespace merge_tests { namespace merge_tests {
UNORDERED_AUTO_TEST(merge_set) UNORDERED_AUTO_TEST (merge_set) {
{
boost::unordered_set<int> x; boost::unordered_set<int> x;
boost::unordered_set<int> y; boost::unordered_set<int> y;
@ -59,8 +58,7 @@ namespace merge_tests {
test::check_equivalent_keys(y); test::check_equivalent_keys(y);
} }
UNORDERED_AUTO_TEST(merge_multiset) UNORDERED_AUTO_TEST (merge_multiset) {
{
boost::unordered_multiset<int> x; boost::unordered_multiset<int> x;
boost::unordered_multiset<int> y; boost::unordered_multiset<int> y;
@ -99,8 +97,7 @@ namespace merge_tests {
test::check_equivalent_keys(y); test::check_equivalent_keys(y);
} }
UNORDERED_AUTO_TEST(merge_set_and_multiset) UNORDERED_AUTO_TEST (merge_set_and_multiset) {
{
boost::unordered_set<int> x; boost::unordered_set<int> x;
boost::unordered_multiset<int> y; boost::unordered_multiset<int> y;

View File

@ -16,8 +16,7 @@
#include <set> #include <set>
#include <string> #include <string>
UNORDERED_AUTO_TEST(example1) UNORDERED_AUTO_TEST (example1) {
{
typedef boost::unordered_map<int, std::string>::insert_return_type typedef boost::unordered_map<int, std::string>::insert_return_type
insert_return_type; insert_return_type;
@ -42,8 +41,7 @@ UNORDERED_AUTO_TEST(example1)
BOOST_TEST(r.node.mapped() == "buckle my shoe"); BOOST_TEST(r.node.mapped() == "buckle my shoe");
} }
UNORDERED_AUTO_TEST(example2) UNORDERED_AUTO_TEST (example2) {
{
boost::unordered_set<int> src; boost::unordered_set<int> src;
src.insert(1); src.insert(1);
src.insert(3); src.insert(3);
@ -58,8 +56,7 @@ UNORDERED_AUTO_TEST(example2)
// dst == {1, 2, 3, 4, 5} // dst == {1, 2, 3, 4, 5}
} }
UNORDERED_AUTO_TEST(example3) UNORDERED_AUTO_TEST (example3) {
{
typedef boost::unordered_set<int>::iterator iterator; typedef boost::unordered_set<int>::iterator iterator;
boost::unordered_set<int> src; boost::unordered_set<int> src;
@ -90,8 +87,7 @@ UNORDERED_AUTO_TEST(example3)
BOOST_TEST(it == dst2.end()); BOOST_TEST(it == dst2.end());
} }
UNORDERED_AUTO_TEST(failed_insertion_with_hint) UNORDERED_AUTO_TEST (failed_insertion_with_hint) {
{
{ {
boost::unordered_set<int> src; boost::unordered_set<int> src;
boost::unordered_set<int> dst; boost::unordered_set<int> dst;
@ -234,8 +230,7 @@ template <typename Container> void node_handle_tests_impl(Container& c)
BOOST_TEST(!n4); BOOST_TEST(!n4);
} }
UNORDERED_AUTO_TEST(node_handle_tests) UNORDERED_AUTO_TEST (node_handle_tests) {
{
boost::unordered_set<int> x1; boost::unordered_set<int> x1;
x1.emplace(100); x1.emplace(100);
x1.emplace(140); x1.emplace(140);
@ -363,8 +358,7 @@ struct hash_thing
} }
}; };
UNORDERED_AUTO_TEST(insert_node_handle_unique_tests) UNORDERED_AUTO_TEST (insert_node_handle_unique_tests) {
{
{ {
boost::unordered_set<int> x1; boost::unordered_set<int> x1;
boost::unordered_set<int> x2; boost::unordered_set<int> x2;
@ -389,8 +383,7 @@ UNORDERED_AUTO_TEST(insert_node_handle_unique_tests)
} }
} }
UNORDERED_AUTO_TEST(insert_node_handle_equiv_tests) UNORDERED_AUTO_TEST (insert_node_handle_equiv_tests) {
{
{ {
boost::unordered_multimap<int, int, hash_thing> x1; boost::unordered_multimap<int, int, hash_thing> x1;
boost::unordered_multimap<int, int> x2; boost::unordered_multimap<int, int> x2;
@ -405,8 +398,7 @@ UNORDERED_AUTO_TEST(insert_node_handle_equiv_tests)
} }
} }
UNORDERED_AUTO_TEST(insert_node_handle_unique_tests2) UNORDERED_AUTO_TEST (insert_node_handle_unique_tests2) {
{
{ {
boost::unordered_set<int> x1; boost::unordered_set<int> x1;
boost::unordered_set<int> x2; boost::unordered_set<int> x2;

View File

@ -100,8 +100,7 @@ namespace noexcept_tests {
bool have_is_nothrow_move = false; bool have_is_nothrow_move = false;
UNORDERED_AUTO_TEST(check_is_nothrow_move) UNORDERED_AUTO_TEST (check_is_nothrow_move) {
{
BOOST_TEST( BOOST_TEST(
!boost::is_nothrow_move_constructible<hash_possible_exception>::value); !boost::is_nothrow_move_constructible<hash_possible_exception>::value);
have_is_nothrow_move = have_is_nothrow_move =
@ -119,8 +118,7 @@ namespace noexcept_tests {
#endif #endif
} }
UNORDERED_AUTO_TEST(test_noexcept) UNORDERED_AUTO_TEST (test_noexcept) {
{
if (have_is_nothrow_move) { if (have_is_nothrow_move) {
BOOST_TEST((boost::is_nothrow_move_constructible< BOOST_TEST((boost::is_nothrow_move_constructible<
boost::unordered_set<int> >::value)); boost::unordered_set<int> >::value));
@ -139,8 +137,7 @@ namespace noexcept_tests {
boost::hash<int>, equal_to_possible_exception> >::value)); boost::hash<int>, equal_to_possible_exception> >::value));
} }
UNORDERED_AUTO_TEST(test_no_throw_when_noexcept) UNORDERED_AUTO_TEST (test_no_throw_when_noexcept) {
{
typedef boost::unordered_set<int, hash_nothrow_move, equal_to_nothrow_move> typedef boost::unordered_set<int, hash_nothrow_move, equal_to_nothrow_move>
throwing_set; throwing_set;

View File

@ -88,8 +88,7 @@ template <class X> void simple_test(X const& a)
} }
} }
UNORDERED_AUTO_TEST(simple_tests) UNORDERED_AUTO_TEST (simple_tests) {
{
using namespace std; using namespace std;
srand(14878); srand(14878);

View File

@ -187,8 +187,7 @@ namespace swap_tests {
using test::generate_collisions; using test::generate_collisions;
using test::limited_range; using test::limited_range;
UNORDERED_AUTO_TEST(check_traits) UNORDERED_AUTO_TEST (check_traits) {
{
BOOST_TEST(!is_propagate(test_set)); BOOST_TEST(!is_propagate(test_set));
BOOST_TEST(is_propagate(test_set_prop_swap)); BOOST_TEST(is_propagate(test_set_prop_swap));
BOOST_TEST(!is_propagate(test_set_no_prop_swap)); BOOST_TEST(!is_propagate(test_set_no_prop_swap));

View File

@ -341,8 +341,7 @@ namespace unnecessary_copy_tests {
UNORDERED_TEST( UNORDERED_TEST(
unnecessary_copy_emplace_boost_move_map_test, ((map)(multimap))) unnecessary_copy_emplace_boost_move_map_test, ((map)(multimap)))
UNORDERED_AUTO_TEST(unnecessary_copy_emplace_set_test) UNORDERED_AUTO_TEST (unnecessary_copy_emplace_set_test) {
{
// When calling 'source' the object is moved on some compilers, but not // When calling 'source' the object is moved on some compilers, but not
// others. So count that here to adjust later. // others. So count that here to adjust later.
@ -425,8 +424,7 @@ namespace unnecessary_copy_tests {
MOVE_COUNT(0); MOVE_COUNT(0);
} }
UNORDERED_AUTO_TEST(unnecessary_copy_emplace_map_test) UNORDERED_AUTO_TEST (unnecessary_copy_emplace_map_test) {
{
// When calling 'source' the object is moved on some compilers, but not // When calling 'source' the object is moved on some compilers, but not
// others. So count that here to adjust later. // others. So count that here to adjust later.