Index: test/std/containers/check_consecutive.h =================================================================== --- /dev/null +++ test/std/containers/check_consecutive.h @@ -0,0 +1,46 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +#ifndef CHECK_CONSECUTIVE_H +#define CHECK_CONSECUTIVE_H + +// +// + +#include +#include +#include + +// Check consecutive equal values in an unordered_multiset iterator +template +void CheckConsecutiveValues(Iter pos, Iter end, typename Iter::value_type value, size_t count) +{ + for ( size_t i = 0; i < count; ++i ) + { + assert(pos != end); + assert(*pos == value); + ++pos; + } + assert(pos == end || *pos != value); +} + +// Check consecutive equal keys in an unordered_multimap iterator +template +void CheckConsecutiveKeys(Iter pos, Iter end, typename Iter::value_type::first_type key, std::multiset& values) +{ + while (!values.empty()) + { + assert(pos != end); + assert(pos->first == key); + assert(values.find(pos->second) != values.end()); + values.erase(values.find(pos->second)); + ++pos; + } + assert(pos == end || pos->first != key); +} + +#endif Index: test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_copy.pass.cpp =================================================================== --- test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_copy.pass.cpp +++ test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_copy.pass.cpp @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -23,6 +24,7 @@ #include #include "test_macros.h" +#include "../../../check_consecutive.h" #include "../../../test_compare.h" #include "../../../test_hash.h" #include "test_allocator.h" @@ -62,24 +64,17 @@ c = c0; LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 6); - C::const_iterator i = c.cbegin(); - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); - ++i; - assert(i->first == 2); - assert(i->second == "two"); - ++i; - assert(i->first == 2); - assert(i->second == "four"); - ++i; - assert(i->first == 3); - assert(i->second == "three"); - ++i; - assert(i->first == 4); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); + s.insert("three"); + CheckConsecutiveKeys(c.find(3), c.end(), 3, s); + s.insert("four"); + CheckConsecutiveKeys(c.find(4), c.end(), 4, s); assert(c.hash_function() == test_hash >(8)); assert(c.key_eq() == test_compare >(9)); assert(c.get_allocator() == A(4)); @@ -139,24 +134,17 @@ c = c0; assert(c.bucket_count() >= 7); assert(c.size() == 6); - C::const_iterator i = c.cbegin(); - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); - ++i; - assert(i->first == 2); - assert(i->second == "two"); - ++i; - assert(i->first == 2); - assert(i->second == "four"); - ++i; - assert(i->first == 3); - assert(i->second == "three"); - ++i; - assert(i->first == 4); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); + s.insert("three"); + CheckConsecutiveKeys(c.find(3), c.end(), 3, s); + s.insert("four"); + CheckConsecutiveKeys(c.find(4), c.end(), 4, s); assert(c.hash_function() == test_hash >(8)); assert(c.key_eq() == test_compare >(9)); assert(c.get_allocator() == A(10)); @@ -199,24 +187,17 @@ c = c0; LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 6); - C::const_iterator i = c.cbegin(); - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); - ++i; - assert(i->first == 2); - assert(i->second == "two"); - ++i; - assert(i->first == 2); - assert(i->second == "four"); - ++i; - assert(i->first == 3); - assert(i->second == "three"); - ++i; - assert(i->first == 4); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); + s.insert("three"); + CheckConsecutiveKeys(c.find(3), c.end(), 3, s); + s.insert("four"); + CheckConsecutiveKeys(c.find(4), c.end(), 4, s); 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.multimap/unord.multimap.cnstr/assign_init.pass.cpp =================================================================== --- test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp +++ test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp @@ -18,11 +18,13 @@ #include #include +#include #include #include #include #include +#include "../../../check_consecutive.h" #include "../../../test_compare.h" #include "../../../test_hash.h" #include "test_allocator.h" @@ -56,24 +58,19 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator i = eq.first; - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); 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"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - i = eq.first; + C::const_iterator i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); @@ -112,24 +109,19 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator i = eq.first; - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); 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"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - i = eq.first; + C::const_iterator i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); Index: test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_move.pass.cpp =================================================================== --- test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_move.pass.cpp +++ test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_move.pass.cpp @@ -18,12 +18,14 @@ #include #include +#include #include #include #include #include #include "test_macros.h" +#include "../../../check_consecutive.h" #include "../../../test_compare.h" #include "../../../test_hash.h" #include "test_allocator.h" @@ -66,24 +68,19 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator i = eq.first; - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); 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"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - i = eq.first; + C::const_iterator i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); @@ -131,24 +128,19 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator i = eq.first; - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); 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"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - i = eq.first; + C::const_iterator i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); @@ -196,24 +188,19 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator i = eq.first; - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); 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"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - i = eq.first; + C::const_iterator i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); @@ -261,24 +248,19 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator i = eq.first; - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); 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"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - i = eq.first; + C::const_iterator i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); Index: test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy.pass.cpp =================================================================== --- test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy.pass.cpp +++ test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy.pass.cpp @@ -16,12 +16,14 @@ #include #include +#include #include #include #include #include #include "test_macros.h" +#include "../../../check_consecutive.h" #include "../../../test_compare.h" #include "../../../test_hash.h" #include "test_allocator.h" @@ -54,24 +56,17 @@ C c = c0; LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 6); - C::const_iterator i = c.cbegin(); - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); - ++i; - assert(i->first == 2); - assert(i->second == "two"); - ++i; - assert(i->first == 2); - assert(i->second == "four"); - ++i; - assert(i->first == 3); - assert(i->second == "three"); - ++i; - assert(i->first == 4); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); + s.insert("three"); + CheckConsecutiveKeys(c.find(3), c.end(), 3, s); + s.insert("four"); + CheckConsecutiveKeys(c.find(4), c.end(), 4, s); assert(c.hash_function() == test_hash >(8)); assert(c.key_eq() == test_compare >(9)); assert(c.get_allocator() == @@ -108,24 +103,17 @@ C c = c0; LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 6); - C::const_iterator i = c.cbegin(); - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); - ++i; - assert(i->first == 2); - assert(i->second == "two"); - ++i; - assert(i->first == 2); - assert(i->second == "four"); - ++i; - assert(i->first == 3); - assert(i->second == "three"); - ++i; - assert(i->first == 4); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); + s.insert("three"); + CheckConsecutiveKeys(c.find(3), c.end(), 3, s); + s.insert("four"); + CheckConsecutiveKeys(c.find(4), c.end(), 4, s); assert(c.hash_function() == test_hash >(8)); assert(c.key_eq() == test_compare >(9)); assert(c.get_allocator() == @@ -161,24 +149,17 @@ C c = c0; LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 6); - C::const_iterator i = c.cbegin(); - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); - ++i; - assert(i->first == 2); - assert(i->second == "two"); - ++i; - assert(i->first == 2); - assert(i->second == "four"); - ++i; - assert(i->first == 3); - assert(i->second == "three"); - ++i; - assert(i->first == 4); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); + s.insert("three"); + CheckConsecutiveKeys(c.find(3), c.end(), 3, s); + s.insert("four"); + CheckConsecutiveKeys(c.find(4), c.end(), 4, s); assert(c.hash_function() == test_hash >(8)); assert(c.key_eq() == test_compare >(9)); assert(c.get_allocator() == Index: test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy_alloc.pass.cpp =================================================================== --- test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy_alloc.pass.cpp +++ test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy_alloc.pass.cpp @@ -16,12 +16,14 @@ #include #include +#include #include #include #include #include #include "test_macros.h" +#include "../../../check_consecutive.h" #include "../../../test_compare.h" #include "../../../test_hash.h" #include "test_allocator.h" @@ -54,24 +56,17 @@ C c(c0, test_allocator >(5)); LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 6); - C::const_iterator i = c.cbegin(); - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); - ++i; - assert(i->first == 2); - assert(i->second == "two"); - ++i; - assert(i->first == 2); - assert(i->second == "four"); - ++i; - assert(i->first == 3); - assert(i->second == "three"); - ++i; - assert(i->first == 4); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); + s.insert("three"); + CheckConsecutiveKeys(c.find(3), c.end(), 3, s); + s.insert("four"); + CheckConsecutiveKeys(c.find(4), c.end(), 4, s); assert(c.hash_function() == test_hash >(8)); assert(c.key_eq() == test_compare >(9)); assert(c.get_allocator() == @@ -108,24 +103,17 @@ C c(c0, min_allocator >()); LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 6); - C::const_iterator i = c.cbegin(); - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); - ++i; - assert(i->first == 2); - assert(i->second == "two"); - ++i; - assert(i->first == 2); - assert(i->second == "four"); - ++i; - assert(i->first == 3); - assert(i->second == "three"); - ++i; - assert(i->first == 4); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); + s.insert("three"); + CheckConsecutiveKeys(c.find(3), c.end(), 3, s); + s.insert("four"); + CheckConsecutiveKeys(c.find(4), c.end(), 4, s); assert(c.hash_function() == test_hash >(8)); assert(c.key_eq() == test_compare >(9)); assert(c.get_allocator() == @@ -162,24 +150,17 @@ C c(c0, A{}); LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 6); - C::const_iterator i = c.cbegin(); - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); - ++i; - assert(i->first == 2); - assert(i->second == "two"); - ++i; - assert(i->first == 2); - assert(i->second == "four"); - ++i; - assert(i->first == 3); - assert(i->second == "three"); - ++i; - assert(i->first == 4); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); + s.insert("three"); + CheckConsecutiveKeys(c.find(3), c.end(), 3, s); + s.insert("four"); + CheckConsecutiveKeys(c.find(4), c.end(), 4, s); 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.multimap/unord.multimap.cnstr/init.pass.cpp =================================================================== --- test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp +++ test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp @@ -18,12 +18,14 @@ #include #include +#include #include #include #include #include #include "test_macros.h" +#include "../../../check_consecutive.h" #include "../../../test_compare.h" #include "../../../test_hash.h" #include "test_allocator.h" @@ -51,24 +53,19 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator i = eq.first; - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); 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"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - i = eq.first; + C::const_iterator i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); @@ -104,24 +101,19 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator i = eq.first; - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); 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"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - i = eq.first; + C::const_iterator i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); @@ -159,24 +151,19 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator i = eq.first; - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); 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"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - i = eq.first; + C::const_iterator i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); @@ -215,24 +202,19 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator i = eq.first; - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); 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"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - i = eq.first; + C::const_iterator i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); Index: test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size.pass.cpp =================================================================== --- test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size.pass.cpp +++ test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size.pass.cpp @@ -18,12 +18,14 @@ #include #include +#include #include #include #include #include #include "test_macros.h" +#include "../../../check_consecutive.h" #include "../../../test_compare.h" #include "../../../test_hash.h" #include "test_allocator.h" @@ -53,24 +55,19 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator i = eq.first; - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); 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"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - i = eq.first; + C::const_iterator i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); @@ -108,24 +105,19 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator i = eq.first; - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); 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"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - i = eq.first; + C::const_iterator i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); Index: test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash.pass.cpp =================================================================== --- test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash.pass.cpp +++ test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash.pass.cpp @@ -18,12 +18,14 @@ #include #include +#include #include #include #include #include #include "test_macros.h" +#include "../../../check_consecutive.h" #include "../../../test_compare.h" #include "../../../test_hash.h" #include "test_allocator.h" @@ -54,24 +56,19 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator i = eq.first; - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); 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"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - i = eq.first; + C::const_iterator i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); @@ -110,24 +107,19 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator i = eq.first; - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); 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"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - i = eq.first; + C::const_iterator i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); Index: test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal.pass.cpp =================================================================== --- test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal.pass.cpp +++ test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal.pass.cpp @@ -19,12 +19,14 @@ #include #include +#include #include #include #include #include #include "test_macros.h" +#include "../../../check_consecutive.h" #include "../../../test_compare.h" #include "../../../test_hash.h" #include "test_allocator.h" @@ -56,24 +58,19 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator i = eq.first; - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); 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"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - i = eq.first; + C::const_iterator i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); @@ -113,24 +110,19 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator i = eq.first; - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); 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"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - i = eq.first; + C::const_iterator i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); Index: test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal_allocator.pass.cpp =================================================================== --- test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal_allocator.pass.cpp +++ test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal_allocator.pass.cpp @@ -19,12 +19,14 @@ #include #include +#include #include #include #include #include #include "test_macros.h" +#include "../../../check_consecutive.h" #include "../../../test_compare.h" #include "../../../test_hash.h" #include "test_allocator.h" @@ -57,24 +59,19 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator i = eq.first; - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); 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"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - i = eq.first; + C::const_iterator i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); @@ -115,24 +112,19 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator i = eq.first; - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); 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"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - i = eq.first; + C::const_iterator i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); @@ -174,24 +166,19 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator i = eq.first; - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); 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"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - i = eq.first; + C::const_iterator i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); Index: test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move.pass.cpp =================================================================== --- test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move.pass.cpp +++ test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move.pass.cpp @@ -18,12 +18,14 @@ #include #include +#include #include #include #include #include #include "test_macros.h" +#include "../../../check_consecutive.h" #include "../../../test_compare.h" #include "../../../test_hash.h" #include "test_allocator.h" @@ -86,24 +88,19 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator i = eq.first; - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); 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"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - i = eq.first; + C::const_iterator i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); @@ -175,24 +172,19 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator i = eq.first; - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); 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"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - i = eq.first; + C::const_iterator i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); Index: test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.pass.cpp =================================================================== --- test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.pass.cpp +++ test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.pass.cpp @@ -20,12 +20,14 @@ #include #include +#include #include #include #include #include #include "test_macros.h" +#include "../../../check_consecutive.h" #include "../../../test_compare.h" #include "../../../test_hash.h" #include "test_allocator.h" @@ -62,24 +64,19 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator i = eq.first; - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); 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"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - i = eq.first; + C::const_iterator i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); @@ -126,24 +123,19 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator i = eq.first; - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); 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"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - i = eq.first; + C::const_iterator i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); @@ -190,24 +182,19 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator i = eq.first; - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); 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"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - i = eq.first; + C::const_iterator i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); @@ -254,24 +241,19 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator i = eq.first; - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); 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"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - i = eq.first; + C::const_iterator i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); Index: test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range.pass.cpp =================================================================== --- test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range.pass.cpp +++ test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range.pass.cpp @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -24,6 +25,7 @@ #include "test_macros.h" #include "test_iterators.h" +#include "../../../check_consecutive.h" #include "../../../NotConstructible.h" #include "../../../test_compare.h" #include "../../../test_hash.h" @@ -54,24 +56,19 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator i = eq.first; - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); 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"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - i = eq.first; + C::const_iterator i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); @@ -110,24 +107,19 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator i = eq.first; - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); 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"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - i = eq.first; + C::const_iterator i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); @@ -167,24 +159,19 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator i = eq.first; - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); 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"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - i = eq.first; + C::const_iterator i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); @@ -225,24 +212,19 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator i = eq.first; - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); 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"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - i = eq.first; + C::const_iterator i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); Index: test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size.pass.cpp =================================================================== --- test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size.pass.cpp +++ test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size.pass.cpp @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -24,6 +25,7 @@ #include "test_macros.h" #include "test_iterators.h" +#include "../../../check_consecutive.h" #include "../../../NotConstructible.h" #include "../../../test_compare.h" #include "../../../test_hash.h" @@ -56,24 +58,19 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator i = eq.first; - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); 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"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - i = eq.first; + C::const_iterator i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); @@ -114,24 +111,19 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator i = eq.first; - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); 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"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - i = eq.first; + C::const_iterator i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); Index: test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash.pass.cpp =================================================================== --- test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash.pass.cpp +++ test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash.pass.cpp @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -25,6 +26,7 @@ #include "test_macros.h" #include "test_iterators.h" +#include "../../../check_consecutive.h" #include "../../../NotConstructible.h" #include "../../../test_compare.h" #include "../../../test_hash.h" @@ -58,24 +60,19 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator i = eq.first; - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); 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"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - i = eq.first; + C::const_iterator i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); @@ -117,24 +114,19 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator i = eq.first; - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); 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"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - i = eq.first; + C::const_iterator i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); Index: test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash_equal.pass.cpp =================================================================== --- test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash_equal.pass.cpp +++ test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash_equal.pass.cpp @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -26,6 +27,7 @@ #include "test_macros.h" #include "test_iterators.h" #include "../../../NotConstructible.h" +#include "../../../check_consecutive.h" #include "../../../test_compare.h" #include "../../../test_hash.h" #include "test_allocator.h" @@ -59,24 +61,19 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator i = eq.first; - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); 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"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - i = eq.first; + C::const_iterator i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); @@ -119,24 +116,19 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator i = eq.first; - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); 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"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - i = eq.first; + C::const_iterator i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); Index: test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash_equal_allocator.pass.cpp =================================================================== --- test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash_equal_allocator.pass.cpp +++ test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash_equal_allocator.pass.cpp @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -27,6 +28,7 @@ #include "test_macros.h" #include "test_iterators.h" #include "../../../NotConstructible.h" +#include "../../../check_consecutive.h" #include "../../../test_compare.h" #include "../../../test_hash.h" #include "test_allocator.h" @@ -61,24 +63,19 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator i = eq.first; - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); 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"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - i = eq.first; + C::const_iterator i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); @@ -122,24 +119,19 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator i = eq.first; - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); 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"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - i = eq.first; + C::const_iterator i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); @@ -183,24 +175,19 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator i = eq.first; - assert(i->first == 1); - assert(i->second == "one"); - ++i; - assert(i->first == 1); - assert(i->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); 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"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - i = eq.first; + C::const_iterator i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); Index: test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_const_iter.pass.cpp =================================================================== --- test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_const_iter.pass.cpp +++ test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_const_iter.pass.cpp @@ -16,9 +16,11 @@ #include #include +#include #include #include +#include "../../../check_consecutive.h" #include "min_allocator.h" struct TemplateConstructor @@ -48,6 +50,7 @@ C::const_iterator i = c.find(2); C::const_iterator i_next = i; ++i_next; + std::string es = i->second; C::iterator j = c.erase(i); assert(j == i_next); @@ -55,17 +58,15 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator k = eq.first; - assert(k->first == 1); - assert(k->second == "one"); - ++k; - assert(k->first == 1); - assert(k->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); eq = c.equal_range(2); assert(std::distance(eq.first, eq.second) == 1); - k = eq.first; + C::const_iterator k = eq.first; assert(k->first == 2); - assert(k->second == "four"); + assert(k->second == (es == "two" ? "four" : "two")); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); k = eq.first; @@ -97,6 +98,7 @@ C::const_iterator i = c.find(2); C::const_iterator i_next = i; ++i_next; + std::string es = i->second; C::iterator j = c.erase(i); assert(j == i_next); @@ -104,17 +106,15 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator k = eq.first; - assert(k->first == 1); - assert(k->second == "one"); - ++k; - assert(k->first == 1); - assert(k->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); eq = c.equal_range(2); assert(std::distance(eq.first, eq.second) == 1); - k = eq.first; + C::const_iterator k = eq.first; assert(k->first == 2); - assert(k->second == "four"); + assert(k->second == (es == "two" ? "four" : "two")); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); k = eq.first; Index: test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_key.pass.cpp =================================================================== --- test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_key.pass.cpp +++ test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_key.pass.cpp @@ -16,9 +16,11 @@ #include #include +#include #include #include +#include "../../../check_consecutive.h" #include "min_allocator.h" #if TEST_STD_VER >= 11 @@ -57,23 +59,18 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator k = eq.first; - assert(k->first == 1); - assert(k->second == "one"); - ++k; - assert(k->first == 1); - assert(k->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); eq = c.equal_range(2); assert(std::distance(eq.first, eq.second) == 2); - k = eq.first; - assert(k->first == 2); - assert(k->second == "two"); - ++k; - assert(k->first == 2); - assert(k->second == "four"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - k = eq.first; + C::const_iterator k = eq.first; assert(k->first == 3); assert(k->second == "three"); eq = c.equal_range(4); @@ -88,12 +85,9 @@ assert(c.size() == 4); eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - k = eq.first; - assert(k->first == 1); - assert(k->second == "one"); - ++k; - assert(k->first == 1); - assert(k->second == "four"); + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); k = eq.first; @@ -111,12 +105,9 @@ assert(c.size() == 4); eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - k = eq.first; - assert(k->first == 1); - assert(k->second == "one"); - ++k; - assert(k->first == 1); - assert(k->second == "four"); + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); k = eq.first; @@ -134,12 +125,9 @@ assert(c.size() == 3); eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - k = eq.first; - assert(k->first == 1); - assert(k->second == "one"); - ++k; - assert(k->first == 1); - assert(k->second == "four"); + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); k = eq.first; @@ -152,12 +140,9 @@ assert(c.size() == 3); eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - k = eq.first; - assert(k->first == 1); - assert(k->second == "one"); - ++k; - assert(k->first == 1); - assert(k->second == "four"); + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); k = eq.first; @@ -220,23 +205,18 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::const_iterator k = eq.first; - assert(k->first == 1); - assert(k->second == "one"); - ++k; - assert(k->first == 1); - assert(k->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); eq = c.equal_range(2); assert(std::distance(eq.first, eq.second) == 2); - k = eq.first; - assert(k->first == 2); - assert(k->second == "two"); - ++k; - assert(k->first == 2); - assert(k->second == "four"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - k = eq.first; + C::const_iterator k = eq.first; assert(k->first == 3); assert(k->second == "three"); eq = c.equal_range(4); @@ -251,12 +231,9 @@ assert(c.size() == 4); eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - k = eq.first; - assert(k->first == 1); - assert(k->second == "one"); - ++k; - assert(k->first == 1); - assert(k->second == "four"); + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); k = eq.first; @@ -274,12 +251,9 @@ assert(c.size() == 4); eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - k = eq.first; - assert(k->first == 1); - assert(k->second == "one"); - ++k; - assert(k->first == 1); - assert(k->second == "four"); + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); k = eq.first; @@ -297,12 +271,9 @@ assert(c.size() == 3); eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - k = eq.first; - assert(k->first == 1); - assert(k->second == "one"); - ++k; - assert(k->first == 1); - assert(k->second == "four"); + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); k = eq.first; @@ -315,12 +286,9 @@ assert(c.size() == 3); eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - k = eq.first; - assert(k->first == 1); - assert(k->second == "one"); - ++k; - assert(k->first == 1); - assert(k->second == "four"); + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); k = eq.first; Index: test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_range.pass.cpp =================================================================== --- test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_range.pass.cpp +++ test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_range.pass.cpp @@ -16,9 +16,11 @@ #include #include +#include #include #include +#include "../../../check_consecutive.h" #include "min_allocator.h" int main(int, char**) @@ -44,20 +46,15 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - k = eq.first; - assert(k->first == 1); - assert(k->second == "one"); - ++k; - assert(k->first == 1); - assert(k->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); eq = c.equal_range(2); assert(std::distance(eq.first, eq.second) == 2); - k = eq.first; - assert(k->first == 2); - assert(k->second == "two"); - ++k; - assert(k->first == 2); - assert(k->second == "four"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); k = eq.first; @@ -75,12 +72,9 @@ assert(c.size() == 4); eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - k = eq.first; - assert(k->first == 1); - assert(k->second == "one"); - ++k; - assert(k->first == 1); - assert(k->second == "four"); + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); k = eq.first; @@ -121,20 +115,15 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - k = eq.first; - assert(k->first == 1); - assert(k->second == "one"); - ++k; - assert(k->first == 1); - assert(k->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); eq = c.equal_range(2); assert(std::distance(eq.first, eq.second) == 2); - k = eq.first; - assert(k->first == 2); - assert(k->second == "two"); - ++k; - assert(k->first == 2); - assert(k->second == "four"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); k = eq.first; @@ -152,12 +141,9 @@ assert(c.size() == 4); eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - k = eq.first; - assert(k->first == 1); - assert(k->second == "one"); - ++k; - assert(k->first == 1); - assert(k->second == "four"); + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); k = eq.first; Index: test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_init.pass.cpp =================================================================== --- test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_init.pass.cpp +++ test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_init.pass.cpp @@ -18,9 +18,11 @@ #include #include +#include #include #include +#include "../../../check_consecutive.h" #include "test_iterators.h" #include "min_allocator.h" @@ -44,23 +46,18 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::iterator k = eq.first; - assert(k->first == 1); - assert(k->second == "one"); - ++k; - assert(k->first == 1); - assert(k->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); eq = c.equal_range(2); assert(std::distance(eq.first, eq.second) == 2); - k = eq.first; - assert(k->first == 2); - assert(k->second == "two"); - ++k; - assert(k->first == 2); - assert(k->second == "four"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - k = eq.first; + C::iterator k = eq.first; assert(k->first == 3); assert(k->second == "three"); eq = c.equal_range(4); @@ -90,23 +87,18 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::iterator k = eq.first; - assert(k->first == 1); - assert(k->second == "one"); - ++k; - assert(k->first == 1); - assert(k->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); eq = c.equal_range(2); assert(std::distance(eq.first, eq.second) == 2); - k = eq.first; - assert(k->first == 2); - assert(k->second == "two"); - ++k; - assert(k->first == 2); - assert(k->second == "four"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - k = eq.first; + C::iterator k = eq.first; assert(k->first == 3); assert(k->second == "three"); eq = c.equal_range(4); Index: test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_range.pass.cpp =================================================================== --- test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_range.pass.cpp +++ test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_range.pass.cpp @@ -17,9 +17,11 @@ #include #include +#include #include #include +#include "../../../check_consecutive.h" #include "test_iterators.h" #include "min_allocator.h" @@ -43,23 +45,18 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::iterator k = eq.first; - assert(k->first == 1); - assert(k->second == "one"); - ++k; - assert(k->first == 1); - assert(k->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); eq = c.equal_range(2); assert(std::distance(eq.first, eq.second) == 2); - k = eq.first; - assert(k->first == 2); - assert(k->second == "two"); - ++k; - assert(k->first == 2); - assert(k->second == "four"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - k = eq.first; + C::iterator k = eq.first; assert(k->first == 3); assert(k->second == "three"); eq = c.equal_range(4); @@ -90,23 +87,18 @@ typedef std::pair Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); - C::iterator k = eq.first; - assert(k->first == 1); - assert(k->second == "one"); - ++k; - assert(k->first == 1); - assert(k->second == "four"); + std::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c.find(1), c.end(), 1, s); eq = c.equal_range(2); assert(std::distance(eq.first, eq.second) == 2); - k = eq.first; - assert(k->first == 2); - assert(k->second == "two"); - ++k; - assert(k->first == 2); - assert(k->second == "four"); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c.find(2), c.end(), 2, s); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); - k = eq.first; + C::iterator k = eq.first; assert(k->first == 3); assert(k->second == "three"); eq = c.equal_range(4); Index: test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp =================================================================== --- test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp +++ test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp @@ -16,10 +16,12 @@ #include #include +#include #include #include #include "test_macros.h" +#include "../../../check_consecutive.h" #include "../../../test_compare.h" #include "../../../test_hash.h" #include "test_allocator.h" @@ -134,10 +136,13 @@ 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::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c2.find(1), c2.end(), 1, s); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c2.find(2), c2.end(), 2, s); assert(c2.find(3)->second == "three"); assert(c2.find(4)->second == "four"); assert(c2.hash_function() == Hash(1)); @@ -197,10 +202,13 @@ 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::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c2.find(1), c2.end(), 1, s); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c2.find(2), c2.end(), 2, s); assert(c2.find(3)->second == "three"); assert(c2.find(4)->second == "four"); assert(c2.hash_function() == Hash(1)); @@ -318,10 +326,13 @@ 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::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c2.find(1), c2.end(), 1, s); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c2.find(2), c2.end(), 2, s); assert(c2.find(3)->second == "three"); assert(c2.find(4)->second == "four"); assert(c2.hash_function() == Hash(1)); @@ -381,10 +392,13 @@ 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::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c2.find(1), c2.end(), 1, s); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c2.find(2), c2.end(), 2, s); assert(c2.find(3)->second == "three"); assert(c2.find(4)->second == "four"); assert(c2.hash_function() == Hash(1)); @@ -502,10 +516,13 @@ 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::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c2.find(1), c2.end(), 1, s); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c2.find(2), c2.end(), 2, s); assert(c2.find(3)->second == "three"); assert(c2.find(4)->second == "four"); assert(c2.hash_function() == Hash(1)); @@ -565,10 +582,13 @@ 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::multiset s; + s.insert("one"); + s.insert("four"); + CheckConsecutiveKeys(c2.find(1), c2.end(), 1, s); + s.insert("two"); + s.insert("four"); + CheckConsecutiveKeys(c2.find(2), c2.end(), 2, s); assert(c2.find(3)->second == "three"); assert(c2.find(4)->second == "four"); assert(c2.hash_function() == Hash(1));