llvm-project
90 строк · 3.2 Кб
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
9// <map>
10
11// template<class Key, class T, class Compare, class Alloc>
12// bool operator==(const std::multimap<Key, T, Compare, Alloc>& lhs,
13// const std::multimap<Key, T, Compare, Alloc>& rhs);
14//
15// template<class Key, class T, class Compare, class Alloc>
16// bool operator!=(const std::multimap<Key, T, Compare, Alloc>& lhs,
17// const std::multimap<Key, T, Compare, Alloc>& rhs);
18//
19// template<class Key, class T, class Compare, class Alloc>
20// bool operator<(const std::multimap<Key, T, Compare, Alloc>& lhs,
21// const std::multimap<Key, T, Compare, Alloc>& rhs);
22//
23// template<class Key, class T, class Compare, class Alloc>
24// bool operator>(const std::multimap<Key, T, Compare, Alloc>& lhs,
25// const std::multimap<Key, T, Compare, Alloc>& rhs);
26//
27// template<class Key, class T, class Compare, class Alloc>
28// bool operator<=(const std::multimap<Key, T, Compare, Alloc>& lhs,
29// const std::multimap<Key, T, Compare, Alloc>& rhs);
30//
31// template<class Key, class T, class Compare, class Alloc>
32// bool operator>=(const std::multimap<Key, T, Compare, Alloc>& lhs,
33// const std::multimap<Key, T, Compare, Alloc>& rhs);
34
35#include <map>36#include <cassert>37#include <string>38
39#include "test_comparisons.h"40
41int main(int, char**) {42typedef std::multimap<int, std::string> map_type;43typedef map_type::value_type value_type;44{45map_type m1, m2;46m1.insert(value_type(1, "abc"));47m2.insert(value_type(2, "abc"));48const map_type& cm1 = m1, cm2 = m2;49assert(testComparisons(cm1, cm2, false, true));50}51{52map_type m1, m2;53m1.insert(value_type(1, "abc"));54m2.insert(value_type(1, "abc"));55const map_type& cm1 = m1, cm2 = m2;56assert(testComparisons(cm1, cm2, true, false));57}58{59map_type m1, m2;60m1.insert(value_type(1, "ab"));61m2.insert(value_type(1, "abc"));62const map_type& cm1 = m1, cm2 = m2;63assert(testComparisons(cm1, cm2, false, true));64}65{66map_type m1, m2;67m1.insert(value_type(1, "abc"));68m2.insert(value_type(1, "bcd"));69const map_type& cm1 = m1, cm2 = m2;70assert(testComparisons(cm1, cm2, false, true));71}72{73map_type m1, m2;74m1.insert(value_type(1, "abc"));75m2.insert(value_type(1, "abc"));76m2.insert(value_type(2, "abc"));77const map_type& cm1 = m1, cm2 = m2;78assert(testComparisons(cm1, cm2, false, true));79}80{81map_type m1, m2;82m1.insert(value_type(1, "abc"));83m2.insert(value_type(1, "abc"));84m2.insert(value_type(1, "abc"));85m2.insert(value_type(1, "bcd"));86const map_type& cm1 = m1, cm2 = m2;87assert(testComparisons(cm1, cm2, false, true));88}89return 0;90}
91