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 41 int main(int, char**) { 42 typedef std::multimap<int, std::string> map_type; 43 typedef map_type::value_type value_type; 44 { 45 map_type m1, m2; 46 m1.insert(value_type(1, "abc")); 47 m2.insert(value_type(2, "abc")); 48 const map_type& cm1 = m1, cm2 = m2; 49 assert(testComparisons(cm1, cm2, false, true)); 50 } 51 { 52 map_type m1, m2; 53 m1.insert(value_type(1, "abc")); 54 m2.insert(value_type(1, "abc")); 55 const map_type& cm1 = m1, cm2 = m2; 56 assert(testComparisons(cm1, cm2, true, false)); 57 } 58 { 59 map_type m1, m2; 60 m1.insert(value_type(1, "ab")); 61 m2.insert(value_type(1, "abc")); 62 const map_type& cm1 = m1, cm2 = m2; 63 assert(testComparisons(cm1, cm2, false, true)); 64 } 65 { 66 map_type m1, m2; 67 m1.insert(value_type(1, "abc")); 68 m2.insert(value_type(1, "bcd")); 69 const map_type& cm1 = m1, cm2 = m2; 70 assert(testComparisons(cm1, cm2, false, true)); 71 } 72 { 73 map_type m1, m2; 74 m1.insert(value_type(1, "abc")); 75 m2.insert(value_type(1, "abc")); 76 m2.insert(value_type(2, "abc")); 77 const map_type& cm1 = m1, cm2 = m2; 78 assert(testComparisons(cm1, cm2, false, true)); 79 } 80 { 81 map_type m1, m2; 82 m1.insert(value_type(1, "abc")); 83 m2.insert(value_type(1, "abc")); 84 m2.insert(value_type(1, "abc")); 85 m2.insert(value_type(1, "bcd")); 86 const map_type& cm1 = m1, cm2 = m2; 87 assert(testComparisons(cm1, cm2, false, true)); 88 } 89 return 0; 90 } 91