Index: test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_copy.pass.cpp =================================================================== --- test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_copy.pass.cpp +++ test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_copy.pass.cpp @@ -27,6 +27,20 @@ #include "test_allocator.h" #include "min_allocator.h" +template +void CheckConsecutiveValues(C c, typename Iter::value_type value, size_t count) +{ + Iter pos = c.find(value); + Iter end = c.end(); + for ( size_t i = 0; i < count; ++i ) + { + assert(pos != end); + assert(*pos == value); + ++pos; + } + assert(pos == end || *pos != value); +} + int main(int, char**) { { @@ -61,18 +75,10 @@ c = c0; LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 6); - C::const_iterator i = c.cbegin(); - assert(*i == 1); - ++i; - assert(*i == 1); - ++i; - assert(*i == 2); - ++i; - assert(*i == 2); - ++i; - assert(*i == 3); - ++i; - assert(*i == 4); + CheckConsecutiveValues(c, 1, 2); + CheckConsecutiveValues(c, 2, 2); + CheckConsecutiveValues(c, 3, 1); + CheckConsecutiveValues(c, 4, 1); assert(c.hash_function() == test_hash >(8)); assert(c.key_eq() == test_compare >(9)); assert(c.get_allocator() == A(4)); @@ -133,18 +139,10 @@ c = c0; assert(c.bucket_count() >= 7); assert(c.size() == 6); - C::const_iterator i = c.cbegin(); - assert(*i == 1); - ++i; - assert(*i == 1); - ++i; - assert(*i == 2); - ++i; - assert(*i == 2); - ++i; - assert(*i == 3); - ++i; - assert(*i == 4); + CheckConsecutiveValues(c, 1, 2); + CheckConsecutiveValues(c, 2, 2); + CheckConsecutiveValues(c, 3, 1); + CheckConsecutiveValues(c, 4, 1); assert(c.hash_function() == test_hash >(8)); assert(c.key_eq() == test_compare >(9)); assert(c.get_allocator() == A(10)); @@ -187,18 +185,10 @@ c = c0; LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 6); - C::const_iterator i = c.cbegin(); - assert(*i == 1); - ++i; - assert(*i == 1); - ++i; - assert(*i == 2); - ++i; - assert(*i == 2); - ++i; - assert(*i == 3); - ++i; - assert(*i == 4); + CheckConsecutiveValues(c, 1, 2); + CheckConsecutiveValues(c, 2, 2); + CheckConsecutiveValues(c, 3, 1); + CheckConsecutiveValues(c, 4, 1); assert(c.hash_function() == test_hash >(8)); assert(c.key_eq() == test_compare >(9)); assert(c.get_allocator() == A()); Index: test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp =================================================================== --- test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp +++ test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp @@ -28,6 +28,20 @@ #include "test_allocator.h" #include "min_allocator.h" +template +void CheckConsecutiveValues(C c, typename Iter::value_type value, size_t count) +{ + Iter pos = c.find(value); + Iter end = c.end(); + for ( size_t i = 0; i < count; ++i ) + { + assert(pos != end); + assert(*pos == value); + ++pos; + } + assert(pos == end || *pos != value); +} + int main(int, char**) { { @@ -62,18 +76,10 @@ c = std::move(c0); LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 6); - C::const_iterator i = c.cbegin(); - assert(*i == 1); - ++i; - assert(*i == 1); - ++i; - assert(*i == 2); - ++i; - assert(*i == 2); - ++i; - assert(*i == 3); - ++i; - assert(*i == 4); + CheckConsecutiveValues(c, 1, 2); + CheckConsecutiveValues(c, 2, 2); + CheckConsecutiveValues(c, 3, 1); + CheckConsecutiveValues(c, 4, 1); assert(c.hash_function() == test_hash >(8)); assert(c.key_eq() == test_compare >(9)); assert(c.get_allocator() == A(4)); Index: test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy.pass.cpp =================================================================== --- test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy.pass.cpp +++ test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy.pass.cpp @@ -26,6 +26,20 @@ #include "test_allocator.h" #include "min_allocator.h" +template +void CheckConsecutiveValues(C c, typename Iter::value_type value, size_t count) +{ + Iter pos = c.find(value); + Iter end = c.end(); + for ( size_t i = 0; i < count; ++i ) + { + assert(pos != end); + assert(*pos == value); + ++pos; + } + assert(pos == end || *pos != value); +} + int main(int, char**) { { @@ -53,18 +67,10 @@ C c = c0; LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 6); - C::const_iterator i = c.cbegin(); - assert(*i == 1); - ++i; - assert(*i == 1); - ++i; - assert(*i == 2); - ++i; - assert(*i == 2); - ++i; - assert(*i == 3); - ++i; - assert(*i == 4); + CheckConsecutiveValues(c, 1, 2); + CheckConsecutiveValues(c, 2, 2); + CheckConsecutiveValues(c, 3, 1); + CheckConsecutiveValues(c, 4, 1); assert(c.hash_function() == test_hash >(8)); assert(c.key_eq() == test_compare >(9)); assert(c.get_allocator() == test_allocator(10)); @@ -100,18 +106,10 @@ C c = c0; LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 6); - C::const_iterator i = c.cbegin(); - assert(*i == 1); - ++i; - assert(*i == 1); - ++i; - assert(*i == 2); - ++i; - assert(*i == 2); - ++i; - assert(*i == 3); - ++i; - assert(*i == 4); + CheckConsecutiveValues(c, 1, 2); + CheckConsecutiveValues(c, 2, 2); + CheckConsecutiveValues(c, 3, 1); + CheckConsecutiveValues(c, 4, 1); assert(c.hash_function() == test_hash >(8)); assert(c.key_eq() == test_compare >(9)); assert(c.get_allocator() == other_allocator(-2)); @@ -146,18 +144,10 @@ C c = c0; LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 6); - C::const_iterator i = c.cbegin(); - assert(*i == 1); - ++i; - assert(*i == 1); - ++i; - assert(*i == 2); - ++i; - assert(*i == 2); - ++i; - assert(*i == 3); - ++i; - assert(*i == 4); + CheckConsecutiveValues(c, 1, 2); + CheckConsecutiveValues(c, 2, 2); + CheckConsecutiveValues(c, 3, 1); + CheckConsecutiveValues(c, 4, 1); assert(c.hash_function() == test_hash >(8)); assert(c.key_eq() == test_compare >(9)); assert(c.get_allocator() == min_allocator()); Index: test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy_alloc.pass.cpp =================================================================== --- test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy_alloc.pass.cpp +++ test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy_alloc.pass.cpp @@ -26,6 +26,20 @@ #include "test_allocator.h" #include "min_allocator.h" +template +void CheckConsecutiveValues(C c, typename Iter::value_type value, size_t count) +{ + Iter pos = c.find(value); + Iter end = c.end(); + for ( size_t i = 0; i < count; ++i ) + { + assert(pos != end); + assert(*pos == value); + ++pos; + } + assert(pos == end || *pos != value); +} + int main(int, char**) { { @@ -53,18 +67,10 @@ C c(c0, test_allocator(5)); LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 6); - C::const_iterator i = c.cbegin(); - assert(*i == 1); - ++i; - assert(*i == 1); - ++i; - assert(*i == 2); - ++i; - assert(*i == 2); - ++i; - assert(*i == 3); - ++i; - assert(*i == 4); + CheckConsecutiveValues(c, 1, 2); + CheckConsecutiveValues(c, 2, 2); + CheckConsecutiveValues(c, 3, 1); + CheckConsecutiveValues(c, 4, 1); assert(c.hash_function() == test_hash >(8)); assert(c.key_eq() == test_compare >(9)); assert(c.get_allocator() == test_allocator(5)); @@ -100,18 +106,10 @@ C c(c0, min_allocator()); LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 6); - C::const_iterator i = c.cbegin(); - assert(*i == 1); - ++i; - assert(*i == 1); - ++i; - assert(*i == 2); - ++i; - assert(*i == 2); - ++i; - assert(*i == 3); - ++i; - assert(*i == 4); + CheckConsecutiveValues(c, 1, 2); + CheckConsecutiveValues(c, 2, 2); + CheckConsecutiveValues(c, 3, 1); + CheckConsecutiveValues(c, 4, 1); assert(c.hash_function() == test_hash >(8)); assert(c.key_eq() == test_compare >(9)); assert(c.get_allocator() == min_allocator()); Index: test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp =================================================================== --- test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp +++ test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp @@ -28,6 +28,20 @@ #include "test_allocator.h" #include "min_allocator.h" +template +void CheckConsecutiveValues(C c, typename Iter::value_type value, size_t count) +{ + Iter pos = c.find(value); + Iter end = c.end(); + for ( size_t i = 0; i < count; ++i ) + { + assert(pos != end); + assert(*pos == value); + ++pos; + } + assert(pos == end || *pos != value); +} + int main(int, char**) { { @@ -56,18 +70,10 @@ C c(std::move(c0), A(12)); assert(c.bucket_count() >= 7); assert(c.size() == 6); - C::const_iterator i = c.cbegin(); - assert(*i == 1); - ++i; - assert(*i == 1); - ++i; - assert(*i == 2); - ++i; - assert(*i == 2); - ++i; - assert(*i == 3); - ++i; - assert(*i == 4); + CheckConsecutiveValues(c, 1, 2); + CheckConsecutiveValues(c, 2, 2); + CheckConsecutiveValues(c, 3, 1); + CheckConsecutiveValues(c, 4, 1); assert(c.hash_function() == test_hash >(8)); assert(c.key_eq() == test_compare >(9)); assert(c.get_allocator() == A(12));