[LV] Remove hard-coded VPValue numbers in test check lines. (NFC)
[llvm-project.git] / libcxx / test / std / containers / check_consecutive.h
blob0fe46e7f19557bfb2a9c9e0d07a87c93d604b007
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #ifndef CHECK_CONSECUTIVE_H
10 #define CHECK_CONSECUTIVE_H
12 // <unordered_multiset>
13 // <unordered_multimap>
15 #include <cassert>
16 #include <set>
17 #include <stddef.h>
19 // Check consecutive equal values in an unordered_multiset iterator
20 template <typename Iter>
21 void CheckConsecutiveValues(Iter pos, Iter end, typename Iter::value_type value, std::size_t count)
23 for ( std::size_t i = 0; i < count; ++i )
25 assert(pos != end);
26 assert(*pos == value);
27 ++pos;
29 assert(pos == end || *pos != value);
32 // Check consecutive equal keys in an unordered_multimap iterator
33 template <typename Iter>
34 void CheckConsecutiveKeys(Iter pos, Iter end, typename Iter::value_type::first_type key, std::multiset<typename Iter::value_type::second_type>& values)
36 while (!values.empty())
38 assert(pos != end);
39 assert(pos->first == key);
40 assert(values.find(pos->second) != values.end());
41 values.erase(values.find(pos->second));
42 ++pos;
44 assert(pos == end || pos->first != key);
47 #endif