[PowerPC][NFC] Cleanup PPCCTRLoopsVerify pass
[llvm-project.git] / libcxx / test / std / containers / check_consecutive.h
blobfdd26adb1562f03a4f16d7467dbdc8d0da31b07e
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 //===----------------------------------------------------------------------===//
8 #ifndef CHECK_CONSECUTIVE_H
9 #define CHECK_CONSECUTIVE_H
11 // <unordered_multiset>
12 // <unordered_multimap>
14 #include <cassert>
15 #include <set>
16 #include <stddef.h>
18 // Check consecutive equal values in an unordered_multiset iterator
19 template <typename Iter>
20 void CheckConsecutiveValues(Iter pos, Iter end, typename Iter::value_type value, size_t count)
22 for ( size_t i = 0; i < count; ++i )
24 assert(pos != end);
25 assert(*pos == value);
26 ++pos;
28 assert(pos == end || *pos != value);
31 // Check consecutive equal keys in an unordered_multimap iterator
32 template <typename Iter>
33 void CheckConsecutiveKeys(Iter pos, Iter end, typename Iter::value_type::first_type key, std::multiset<typename Iter::value_type::second_type>& values)
35 while (!values.empty())
37 assert(pos != end);
38 assert(pos->first == key);
39 assert(values.find(pos->second) != values.end());
40 values.erase(values.find(pos->second));
41 ++pos;
43 assert(pos == end || pos->first != key);
46 #endif