Index: test/std/containers/unord/unord.multimap/equal_range_const.pass.cpp =================================================================== --- test/std/containers/unord/unord.multimap/equal_range_const.pass.cpp +++ test/std/containers/unord/unord.multimap/equal_range_const.pass.cpp @@ -17,6 +17,7 @@ #include #include +#include #include #include "min_allocator.h" @@ -48,14 +49,14 @@ r = c.equal_range(5); assert(std::distance(r.first, r.second) == 0); r = c.equal_range(50); - assert(r.first->first == 50); - assert(r.first->second == "fifty"); - ++r.first; - assert(r.first->first == 50); - assert(r.first->second == "fiftyA"); - ++r.first; - assert(r.first->first == 50); - assert(r.first->second == "fiftyB"); + std::set s = {"fifty", "fiftyA", "fiftyB"}; + for ( int i = 0; i < 3; ++i ) + { + assert(r.first->first == 50); + assert(s.find(r.first->second) != s.end()); + s.erase(s.find(r.first->second)); + ++r.first; + } } #if TEST_STD_VER >= 11 { @@ -84,14 +85,14 @@ r = c.equal_range(5); assert(std::distance(r.first, r.second) == 0); r = c.equal_range(50); - assert(r.first->first == 50); - assert(r.first->second == "fifty"); - ++r.first; - assert(r.first->first == 50); - assert(r.first->second == "fiftyA"); - ++r.first; - assert(r.first->first == 50); - assert(r.first->second == "fiftyB"); + std::set s = {"fifty", "fiftyA", "fiftyB"}; + for ( int i = 0; i < 3; ++i ) + { + assert(r.first->first == 50); + assert(s.find(r.first->second) != s.end()); + s.erase(s.find(r.first->second)); + ++r.first; + } } #endif } Index: test/std/containers/unord/unord.multimap/equal_range_non_const.pass.cpp =================================================================== --- test/std/containers/unord/unord.multimap/equal_range_non_const.pass.cpp +++ test/std/containers/unord/unord.multimap/equal_range_non_const.pass.cpp @@ -17,6 +17,7 @@ #include #include +#include #include #include "min_allocator.h" @@ -48,14 +49,14 @@ r = c.equal_range(5); assert(std::distance(r.first, r.second) == 0); r = c.equal_range(50); - assert(r.first->first == 50); - assert(r.first->second == "fifty"); - ++r.first; - assert(r.first->first == 50); - assert(r.first->second == "fiftyA"); - ++r.first; - assert(r.first->first == 50); - assert(r.first->second == "fiftyB"); + std::set s = {"fifty", "fiftyA", "fiftyB"}; + for ( int i = 0; i < 3; ++i ) + { + assert(r.first->first == 50); + assert(s.find(r.first->second) != s.end()); + s.erase(s.find(r.first->second)); + ++r.first; + } } #if TEST_STD_VER >= 11 { @@ -84,14 +85,14 @@ r = c.equal_range(5); assert(std::distance(r.first, r.second) == 0); r = c.equal_range(50); - assert(r.first->first == 50); - assert(r.first->second == "fifty"); - ++r.first; - assert(r.first->first == 50); - assert(r.first->second == "fiftyA"); - ++r.first; - assert(r.first->first == 50); - assert(r.first->second == "fiftyB"); + std::set s = {"fifty", "fiftyA", "fiftyB"}; + for ( int i = 0; i < 3; ++i ) + { + assert(r.first->first == 50); + assert(s.find(r.first->second) != s.end()); + s.erase(s.find(r.first->second)); + ++r.first; + } } #endif } Index: test/std/containers/unord/unord.multimap/local_iterators.pass.cpp =================================================================== --- test/std/containers/unord/unord.multimap/local_iterators.pass.cpp +++ test/std/containers/unord/unord.multimap/local_iterators.pass.cpp @@ -22,6 +22,7 @@ #include #include +#include #include #include "min_allocator.h" @@ -52,21 +53,31 @@ i = c.begin(b); j = c.end(b); assert(std::distance(i, j) == 2); - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + { + std::set s = {"one", "four"}; + for ( int n = 0; n < 2; ++n ) + { + assert(i->first == 1); + assert(s.find(i->second) != s.end()); + s.erase(s.find(i->second)); + ++i; + } + } b = c.bucket(2); i = c.begin(b); j = c.end(b); assert(std::distance(i, j) == 2); - assert(i->first == 2); - assert(i->second == "two"); - ++i; - assert(i->first == 2); - assert(i->second == "four"); + { + std::set s = {"two", "four"}; + for ( int n = 0; n < 2; ++n ) + { + assert(i->first == 2); + assert(s.find(i->second) != s.end()); + s.erase(s.find(i->second)); + ++i; + } + } b = c.bucket(3); i = c.begin(b); @@ -116,21 +127,31 @@ i = c.begin(b); j = c.end(b); assert(std::distance(i, j) == 2); - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + { + std::set s = {"one", "four"}; + for ( int n = 0; n < 2; ++n ) + { + assert(i->first == 1); + assert(s.find(i->second) != s.end()); + s.erase(s.find(i->second)); + ++i; + } + } b = c.bucket(2); i = c.begin(b); j = c.end(b); assert(std::distance(i, j) == 2); - assert(i->first == 2); - assert(i->second == "two"); - ++i; - assert(i->first == 2); - assert(i->second == "four"); + { + std::set s = {"two", "four"}; + for ( int n = 0; n < 2; ++n ) + { + assert(i->first == 2); + assert(s.find(i->second) != s.end()); + s.erase(s.find(i->second)); + ++i; + } + } b = c.bucket(3); i = c.begin(b); @@ -180,21 +201,31 @@ i = c.cbegin(b); j = c.cend(b); assert(std::distance(i, j) == 2); - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + { + std::set s = {"one", "four"}; + for ( int n = 0; n < 2; ++n ) + { + assert(i->first == 1); + assert(s.find(i->second) != s.end()); + s.erase(s.find(i->second)); + ++i; + } + } b = c.bucket(2); i = c.cbegin(b); j = c.cend(b); assert(std::distance(i, j) == 2); - assert(i->first == 2); - assert(i->second == "two"); - ++i; - assert(i->first == 2); - assert(i->second == "four"); + { + std::set s = {"two", "four"}; + for ( int n = 0; n < 2; ++n ) + { + assert(i->first == 2); + assert(s.find(i->second) != s.end()); + s.erase(s.find(i->second)); + ++i; + } + } b = c.bucket(3); i = c.cbegin(b); @@ -244,21 +275,31 @@ i = c.cbegin(b); j = c.cend(b); assert(std::distance(i, j) == 2); - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + { + std::set s = {"one", "four"}; + for ( int n = 0; n < 2; ++n ) + { + assert(i->first == 1); + assert(s.find(i->second) != s.end()); + s.erase(s.find(i->second)); + ++i; + } + } b = c.bucket(2); i = c.cbegin(b); j = c.cend(b); assert(std::distance(i, j) == 2); - assert(i->first == 2); - assert(i->second == "two"); - ++i; - assert(i->first == 2); - assert(i->second == "four"); + { + std::set s = {"two", "four"}; + for ( int n = 0; n < 2; ++n ) + { + assert(i->first == 2); + assert(s.find(i->second) != s.end()); + s.erase(s.find(i->second)); + ++i; + } + } b = c.bucket(3); i = c.cbegin(b); @@ -310,21 +351,31 @@ i = c.begin(b); j = c.end(b); assert(std::distance(i, j) == 2); - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + { + std::set s = {"one", "four"}; + for ( int n = 0; n < 2; ++n ) + { + assert(i->first == 1); + assert(s.find(i->second) != s.end()); + s.erase(s.find(i->second)); + ++i; + } + } b = c.bucket(2); i = c.begin(b); j = c.end(b); assert(std::distance(i, j) == 2); - assert(i->first == 2); - assert(i->second == "two"); - ++i; - assert(i->first == 2); - assert(i->second == "four"); + { + std::set s = {"two", "four"}; + for ( int n = 0; n < 2; ++n ) + { + assert(i->first == 2); + assert(s.find(i->second) != s.end()); + s.erase(s.find(i->second)); + ++i; + } + } b = c.bucket(3); i = c.begin(b); @@ -375,21 +426,31 @@ i = c.begin(b); j = c.end(b); assert(std::distance(i, j) == 2); - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + { + std::set s = {"one", "four"}; + for ( int n = 0; n < 2; ++n ) + { + assert(i->first == 1); + assert(s.find(i->second) != s.end()); + s.erase(s.find(i->second)); + ++i; + } + } b = c.bucket(2); i = c.begin(b); j = c.end(b); assert(std::distance(i, j) == 2); - assert(i->first == 2); - assert(i->second == "two"); - ++i; - assert(i->first == 2); - assert(i->second == "four"); + { + std::set s = {"two", "four"}; + for ( int n = 0; n < 2; ++n ) + { + assert(i->first == 2); + assert(s.find(i->second) != s.end()); + s.erase(s.find(i->second)); + ++i; + } + } b = c.bucket(3); i = c.begin(b); @@ -440,21 +501,31 @@ i = c.cbegin(b); j = c.cend(b); assert(std::distance(i, j) == 2); - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + { + std::set s = {"one", "four"}; + for ( int n = 0; n < 2; ++n ) + { + assert(i->first == 1); + assert(s.find(i->second) != s.end()); + s.erase(s.find(i->second)); + ++i; + } + } b = c.bucket(2); i = c.cbegin(b); j = c.cend(b); assert(std::distance(i, j) == 2); - assert(i->first == 2); - assert(i->second == "two"); - ++i; - assert(i->first == 2); - assert(i->second == "four"); + { + std::set s = {"two", "four"}; + for ( int n = 0; n < 2; ++n ) + { + assert(i->first == 2); + assert(s.find(i->second) != s.end()); + s.erase(s.find(i->second)); + ++i; + } + } b = c.bucket(3); i = c.cbegin(b); @@ -505,21 +576,31 @@ i = c.cbegin(b); j = c.cend(b); assert(std::distance(i, j) == 2); - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + { + std::set s = {"one", "four"}; + for ( int n = 0; n < 2; ++n ) + { + assert(i->first == 1); + assert(s.find(i->second) != s.end()); + s.erase(s.find(i->second)); + ++i; + } + } b = c.bucket(2); i = c.cbegin(b); j = c.cend(b); assert(std::distance(i, j) == 2); - assert(i->first == 2); - assert(i->second == "two"); - ++i; - assert(i->first == 2); - assert(i->second == "four"); + { + std::set s = {"two", "four"}; + for ( int n = 0; n < 2; ++n ) + { + assert(i->first == 2); + assert(s.find(i->second) != s.end()); + s.erase(s.find(i->second)); + ++i; + } + } b = c.bucket(3); i = c.cbegin(b); Index: test/std/containers/unord/unord.multimap/rehash.pass.cpp =================================================================== --- test/std/containers/unord/unord.multimap/rehash.pass.cpp +++ test/std/containers/unord/unord.multimap/rehash.pass.cpp @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -39,20 +40,29 @@ Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); typename C::const_iterator i = eq.first; - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + { + std::set s = {"one", "four"}; + for ( int n = 0; n < 2; ++n ) + { + assert(i->first == 1); + assert(s.find(i->second) != s.end()); + s.erase(s.find(i->second)); + ++i; + } + } eq = c.equal_range(2); assert(std::distance(eq.first, eq.second) == 2); i = eq.first; - assert(i->first == 2); - assert(i->second == "two"); - ++i; - assert(i->first == 2); - assert(i->second == "four"); - + { + std::set s = {"two", "four"}; + for ( int n = 0; n < 2; ++n ) + { + assert(i->first == 2); + assert(s.find(i->second) != s.end()); + s.erase(s.find(i->second)); + ++i; + } + } eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); i = eq.first; Index: test/std/containers/unord/unord.multimap/reserve.pass.cpp =================================================================== --- test/std/containers/unord/unord.multimap/reserve.pass.cpp +++ test/std/containers/unord/unord.multimap/reserve.pass.cpp @@ -13,10 +13,11 @@ // class Alloc = allocator>> // class unordered_multimap -// void rehash(size_type n); +// void reserve(size_type n); #include #include +#include #include #include "test_macros.h" @@ -26,10 +27,18 @@ void test(const C& c) { assert(c.size() == 6); - assert(c.find(1)->second == "one"); - assert(next(c.find(1))->second == "four"); - assert(c.find(2)->second == "two"); - assert(next(c.find(2))->second == "four"); + { + std::set s = {"one", "four"}; + assert(s.find(c.find(1)->second) != s.end()); + s.erase(s.find(c.find(1)->second)); + assert(s.find(next(c.find(1))->second) != s.end()); + } + { + std::set s = {"two", "four"}; + assert(s.find(c.find(2)->second) != s.end()); + s.erase(s.find(c.find(2)->second)); + assert(s.find(next(c.find(2))->second) != s.end()); + } assert(c.find(3)->second == "three"); assert(c.find(4)->second == "four"); } Index: test/std/containers/unord/unord.multimap/swap_member.pass.cpp =================================================================== --- test/std/containers/unord/unord.multimap/swap_member.pass.cpp +++ test/std/containers/unord/unord.multimap/swap_member.pass.cpp @@ -17,6 +17,7 @@ #include #include +#include #include #include @@ -136,10 +137,18 @@ assert(c2.bucket_count() >= 6); assert(c2.size() == 6); - assert(c2.find(1)->second == "one"); - assert(next(c2.find(1))->second == "four"); - assert(c2.find(2)->second == "two"); - assert(next(c2.find(2))->second == "four"); + { + std::set s = {"one", "four"}; + assert(s.find(c2.find(1)->second) != s.end()); + s.erase(s.find(c2.find(1)->second)); + assert(s.find(next(c2.find(1))->second) != s.end()); + } + { + std::set s = {"two", "four"}; + assert(s.find(c2.find(2)->second) != s.end()); + s.erase(s.find(c2.find(2)->second)); + assert(s.find(next(c2.find(2))->second) != s.end()); + } assert(c2.find(3)->second == "three"); assert(c2.find(4)->second == "four"); assert(c2.hash_function() == Hash(1)); @@ -199,10 +208,18 @@ assert(c2.bucket_count() >= 6); assert(c2.size() == 6); - assert(c2.find(1)->second == "one"); - assert(next(c2.find(1))->second == "four"); - assert(c2.find(2)->second == "two"); - assert(next(c2.find(2))->second == "four"); + { + std::set s = {"one", "four"}; + assert(s.find(c2.find(1)->second) != s.end()); + s.erase(s.find(c2.find(1)->second)); + assert(s.find(next(c2.find(1))->second) != s.end()); + } + { + std::set s = {"two", "four"}; + assert(s.find(c2.find(2)->second) != s.end()); + s.erase(s.find(c2.find(2)->second)); + assert(s.find(next(c2.find(2))->second) != s.end()); + } assert(c2.find(3)->second == "three"); assert(c2.find(4)->second == "four"); assert(c2.hash_function() == Hash(1)); @@ -320,10 +337,18 @@ assert(c2.bucket_count() >= 6); assert(c2.size() == 6); - assert(c2.find(1)->second == "one"); - assert(next(c2.find(1))->second == "four"); - assert(c2.find(2)->second == "two"); - assert(next(c2.find(2))->second == "four"); + { + std::set s = {"one", "four"}; + assert(s.find(c2.find(1)->second) != s.end()); + s.erase(s.find(c2.find(1)->second)); + assert(s.find(next(c2.find(1))->second) != s.end()); + } + { + std::set s = {"two", "four"}; + assert(s.find(c2.find(2)->second) != s.end()); + s.erase(s.find(c2.find(2)->second)); + assert(s.find(next(c2.find(2))->second) != s.end()); + } assert(c2.find(3)->second == "three"); assert(c2.find(4)->second == "four"); assert(c2.hash_function() == Hash(1)); @@ -383,10 +408,18 @@ assert(c2.bucket_count() >= 6); assert(c2.size() == 6); - assert(c2.find(1)->second == "one"); - assert(next(c2.find(1))->second == "four"); - assert(c2.find(2)->second == "two"); - assert(next(c2.find(2))->second == "four"); + { + std::set s = {"one", "four"}; + assert(s.find(c2.find(1)->second) != s.end()); + s.erase(s.find(c2.find(1)->second)); + assert(s.find(next(c2.find(1))->second) != s.end()); + } + { + std::set s = {"two", "four"}; + assert(s.find(c2.find(2)->second) != s.end()); + s.erase(s.find(c2.find(2)->second)); + assert(s.find(next(c2.find(2))->second) != s.end()); + } assert(c2.find(3)->second == "three"); assert(c2.find(4)->second == "four"); assert(c2.hash_function() == Hash(1)); @@ -504,10 +537,18 @@ assert(c2.bucket_count() >= 6); assert(c2.size() == 6); - assert(c2.find(1)->second == "one"); - assert(next(c2.find(1))->second == "four"); - assert(c2.find(2)->second == "two"); - assert(next(c2.find(2))->second == "four"); + { + std::set s = {"one", "four"}; + assert(s.find(c2.find(1)->second) != s.end()); + s.erase(s.find(c2.find(1)->second)); + assert(s.find(next(c2.find(1))->second) != s.end()); + } + { + std::set s = {"two", "four"}; + assert(s.find(c2.find(2)->second) != s.end()); + s.erase(s.find(c2.find(2)->second)); + assert(s.find(next(c2.find(2))->second) != s.end()); + } assert(c2.find(3)->second == "three"); assert(c2.find(4)->second == "four"); assert(c2.hash_function() == Hash(1)); @@ -567,10 +608,18 @@ assert(c2.bucket_count() >= 6); assert(c2.size() == 6); - assert(c2.find(1)->second == "one"); - assert(next(c2.find(1))->second == "four"); - assert(c2.find(2)->second == "two"); - assert(next(c2.find(2))->second == "four"); + { + std::set s = {"one", "four"}; + assert(s.find(c2.find(1)->second) != s.end()); + s.erase(s.find(c2.find(1)->second)); + assert(s.find(next(c2.find(1))->second) != s.end()); + } + { + std::set s = {"two", "four"}; + assert(s.find(c2.find(2)->second) != s.end()); + s.erase(s.find(c2.find(2)->second)); + assert(s.find(next(c2.find(2))->second) != s.end()); + } assert(c2.find(3)->second == "three"); assert(c2.find(4)->second == "four"); assert(c2.hash_function() == Hash(1));