Unordered: Fix some portability issues in tests.

- Simplify mechanism for detecting traits of test allocators. There were
  some portability issues, but rather than fix them I've just gone for a
  simpler mechanism. Does mean that the relevant tests can't be run for
  other allocators.
- Fix a couple of unnecessary_copy_tests, whose results were the wrong
  way round.
- It appears that Visual C++ only implements RVO for implicitly defined
  copy constructors in debug mode, so adjust a move_test to account for
  the extra copies now that the copy constructors are explicitly
  defined.

[SVN r73798]
This commit is contained in:
Daniel James
2011-08-15 20:23:29 +00:00
parent f64cf03e1d
commit bbad921022
8 changed files with 112 additions and 70 deletions

View File

@@ -41,7 +41,7 @@ void copy_construct_tests1(T*,
BOOST_TEST(test::equivalent(y.get_allocator(), al));
BOOST_TEST(x.max_load_factor() == y.max_load_factor());
BOOST_TEST(test::selected_count(y.get_allocator()) ==
(test::is_select_on_copy<allocator_type>::value ? 1 : 0));
(allocator_type::is_select_on_copy));
test::check_equivalent_keys(y);
}
@@ -55,7 +55,7 @@ void copy_construct_tests1(T*,
test::unordered_equivalence_tester<T> equivalent(x);
BOOST_TEST(equivalent(y));
BOOST_TEST(test::selected_count(y.get_allocator()) ==
(test::is_select_on_copy<allocator_type>::value ? 1 : 0));
(allocator_type::is_select_on_copy));
test::check_equivalent_keys(y);
}
@@ -75,7 +75,7 @@ void copy_construct_tests1(T*,
// This isn't guaranteed:
BOOST_TEST(y.load_factor() < y.max_load_factor());
BOOST_TEST(test::selected_count(y.get_allocator()) ==
(test::is_select_on_copy<allocator_type>::value ? 1 : 0));
(allocator_type::is_select_on_copy));
test::check_equivalent_keys(y);
}
}
@@ -104,7 +104,7 @@ void copy_construct_tests2(T* ptr,
BOOST_TEST(test::equivalent(y.get_allocator(), al));
BOOST_TEST(x.max_load_factor() == y.max_load_factor());
BOOST_TEST(test::selected_count(y.get_allocator()) ==
(test::is_select_on_copy<allocator_type>::value ? 1 : 0));
(allocator_type::is_select_on_copy));
test::check_equivalent_keys(y);
}
@@ -133,7 +133,7 @@ void copy_construct_tests2(T* ptr,
BOOST_TEST(equivalent(y));
test::check_equivalent_keys(y);
BOOST_TEST(test::selected_count(y.get_allocator()) ==
(test::is_select_on_copy<allocator_type>::value ? 1 : 0));
(allocator_type::is_select_on_copy));
BOOST_TEST(test::equivalent(y.get_allocator(), al));
}