From 58113db00cc4bb9c63ccb7b013a3e2b405bfc1cd Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Tue, 30 Jun 2015 18:15:41 +0000 Subject: [PATCH] Add tests for LWG#2299. While doing so, I noticed that the tests we have for the transparent comparators don't actually call them. Fix those tests, too. Now one of them is failing, due to a missing const in . Add that (twice). Next step is to do the same for git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@241091 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/map | 4 +- .../associative/map/map.ops/count.pass.cpp | 20 +++++++ .../associative/map/map.ops/count0.pass.cpp | 34 ++++++++++++ .../associative/map/map.ops/count1.fail.cpp | 39 ++++++++++++++ .../associative/map/map.ops/count2.fail.cpp | 39 ++++++++++++++ .../associative/map/map.ops/count3.fail.cpp | 39 ++++++++++++++ .../map/map.ops/equal_range.pass.cpp | 53 +++++++++++++++++++ .../map/map.ops/equal_range0.pass.cpp | 34 ++++++++++++ .../map/map.ops/equal_range1.fail.cpp | 39 ++++++++++++++ .../map/map.ops/equal_range2.fail.cpp | 39 ++++++++++++++ .../map/map.ops/equal_range3.fail.cpp | 39 ++++++++++++++ .../associative/map/map.ops/find.pass.cpp | 20 +++++++ .../associative/map/map.ops/find0.pass.cpp | 34 ++++++++++++ .../associative/map/map.ops/find1.fail.cpp | 39 ++++++++++++++ .../associative/map/map.ops/find2.fail.cpp | 39 ++++++++++++++ .../associative/map/map.ops/find3.fail.cpp | 39 ++++++++++++++ .../map/map.ops/lower_bound.pass.cpp | 36 +++++++++++++ .../map/map.ops/lower_bound0.pass.cpp | 34 ++++++++++++ .../map/map.ops/lower_bound1.fail.cpp | 39 ++++++++++++++ .../map/map.ops/lower_bound2.fail.cpp | 39 ++++++++++++++ .../map/map.ops/lower_bound3.fail.cpp | 39 ++++++++++++++ .../map/map.ops/upper_bound0.pass.cpp | 34 ++++++++++++ .../map/map.ops/upper_bound1.fail.cpp | 39 ++++++++++++++ .../map/map.ops/upper_bound2.fail.cpp | 39 ++++++++++++++ .../map/map.ops/upper_bound3.fail.cpp | 39 ++++++++++++++ .../multimap/multimap.ops/count.pass.cpp | 16 ++++++ .../multimap/multimap.ops/count0.pass.cpp | 34 ++++++++++++ .../multimap/multimap.ops/count1.fail.cpp | 37 +++++++++++++ .../multimap/multimap.ops/count2.fail.cpp | 37 +++++++++++++ .../multimap/multimap.ops/count3.fail.cpp | 37 +++++++++++++ .../multimap.ops/equal_range.pass.cpp | 25 ++++++++- .../multimap.ops/equal_range0.pass.cpp | 34 ++++++++++++ .../multimap.ops/equal_range1.fail.cpp | 37 +++++++++++++ .../multimap.ops/equal_range2.fail.cpp | 39 ++++++++++++++ .../multimap.ops/equal_range3.fail.cpp | 39 ++++++++++++++ .../multimap/multimap.ops/find.pass.cpp | 14 +++++ .../multimap/multimap.ops/find0.pass.cpp | 34 ++++++++++++ .../multimap/multimap.ops/find1.fail.cpp | 39 ++++++++++++++ .../multimap/multimap.ops/find2.fail.cpp | 39 ++++++++++++++ .../multimap/multimap.ops/find3.fail.cpp | 39 ++++++++++++++ .../multimap.ops/lower_bound.pass.cpp | 16 ++++++ .../multimap.ops/lower_bound0.pass.cpp | 34 ++++++++++++ .../multimap.ops/lower_bound1.fail.cpp | 39 ++++++++++++++ .../multimap.ops/lower_bound2.fail.cpp | 39 ++++++++++++++ .../multimap.ops/lower_bound3.fail.cpp | 39 ++++++++++++++ .../multimap.ops/upper_bound.pass.cpp | 15 ++++++ .../multimap.ops/upper_bound0.pass.cpp | 34 ++++++++++++ .../multimap.ops/upper_bound1.fail.cpp | 39 ++++++++++++++ .../multimap.ops/upper_bound2.fail.cpp | 39 ++++++++++++++ .../multimap.ops/upper_bound3.fail.cpp | 39 ++++++++++++++ 50 files changed, 1718 insertions(+), 3 deletions(-) create mode 100644 test/std/containers/associative/map/map.ops/count0.pass.cpp create mode 100644 test/std/containers/associative/map/map.ops/count1.fail.cpp create mode 100644 test/std/containers/associative/map/map.ops/count2.fail.cpp create mode 100644 test/std/containers/associative/map/map.ops/count3.fail.cpp create mode 100644 test/std/containers/associative/map/map.ops/equal_range0.pass.cpp create mode 100644 test/std/containers/associative/map/map.ops/equal_range1.fail.cpp create mode 100644 test/std/containers/associative/map/map.ops/equal_range2.fail.cpp create mode 100644 test/std/containers/associative/map/map.ops/equal_range3.fail.cpp create mode 100644 test/std/containers/associative/map/map.ops/find0.pass.cpp create mode 100644 test/std/containers/associative/map/map.ops/find1.fail.cpp create mode 100644 test/std/containers/associative/map/map.ops/find2.fail.cpp create mode 100644 test/std/containers/associative/map/map.ops/find3.fail.cpp create mode 100644 test/std/containers/associative/map/map.ops/lower_bound0.pass.cpp create mode 100644 test/std/containers/associative/map/map.ops/lower_bound1.fail.cpp create mode 100644 test/std/containers/associative/map/map.ops/lower_bound2.fail.cpp create mode 100644 test/std/containers/associative/map/map.ops/lower_bound3.fail.cpp create mode 100644 test/std/containers/associative/map/map.ops/upper_bound0.pass.cpp create mode 100644 test/std/containers/associative/map/map.ops/upper_bound1.fail.cpp create mode 100644 test/std/containers/associative/map/map.ops/upper_bound2.fail.cpp create mode 100644 test/std/containers/associative/map/map.ops/upper_bound3.fail.cpp create mode 100644 test/std/containers/associative/multimap/multimap.ops/count0.pass.cpp create mode 100644 test/std/containers/associative/multimap/multimap.ops/count1.fail.cpp create mode 100644 test/std/containers/associative/multimap/multimap.ops/count2.fail.cpp create mode 100644 test/std/containers/associative/multimap/multimap.ops/count3.fail.cpp create mode 100644 test/std/containers/associative/multimap/multimap.ops/equal_range0.pass.cpp create mode 100644 test/std/containers/associative/multimap/multimap.ops/equal_range1.fail.cpp create mode 100644 test/std/containers/associative/multimap/multimap.ops/equal_range2.fail.cpp create mode 100644 test/std/containers/associative/multimap/multimap.ops/equal_range3.fail.cpp create mode 100644 test/std/containers/associative/multimap/multimap.ops/find0.pass.cpp create mode 100644 test/std/containers/associative/multimap/multimap.ops/find1.fail.cpp create mode 100644 test/std/containers/associative/multimap/multimap.ops/find2.fail.cpp create mode 100644 test/std/containers/associative/multimap/multimap.ops/find3.fail.cpp create mode 100644 test/std/containers/associative/multimap/multimap.ops/lower_bound0.pass.cpp create mode 100644 test/std/containers/associative/multimap/multimap.ops/lower_bound1.fail.cpp create mode 100644 test/std/containers/associative/multimap/multimap.ops/lower_bound2.fail.cpp create mode 100644 test/std/containers/associative/multimap/multimap.ops/lower_bound3.fail.cpp create mode 100644 test/std/containers/associative/multimap/multimap.ops/upper_bound0.pass.cpp create mode 100644 test/std/containers/associative/multimap/multimap.ops/upper_bound1.fail.cpp create mode 100644 test/std/containers/associative/multimap/multimap.ops/upper_bound2.fail.cpp create mode 100644 test/std/containers/associative/multimap/multimap.ops/upper_bound3.fail.cpp diff --git a/include/map b/include/map index 14eb4eb2..cdcf4056 100644 --- a/include/map +++ b/include/map @@ -1117,7 +1117,7 @@ public: template _LIBCPP_INLINE_VISIBILITY typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type - count(const _K2& __k) {return __tree_.__count_unique(__k);} + count(const _K2& __k) const {return __tree_.__count_unique(__k);} #endif _LIBCPP_INLINE_VISIBILITY iterator lower_bound(const key_type& __k) @@ -1850,7 +1850,7 @@ public: template _LIBCPP_INLINE_VISIBILITY typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type - count(const _K2& __k) {return __tree_.__count_multi(__k);} + count(const _K2& __k) const {return __tree_.__count_multi(__k);} #endif _LIBCPP_INLINE_VISIBILITY iterator lower_bound(const key_type& __k) diff --git a/test/std/containers/associative/map/map.ops/count.pass.cpp b/test/std/containers/associative/map/map.ops/count.pass.cpp index 9668055b..ae87ae83 100644 --- a/test/std/containers/associative/map/map.ops/count.pass.cpp +++ b/test/std/containers/associative/map/map.ops/count.pass.cpp @@ -18,6 +18,7 @@ #include "min_allocator.h" #include "private_constructor.hpp" +#include "is_transparent.h" int main() { @@ -133,6 +134,25 @@ int main() assert(r == 1); r = m.count(4); assert(r == 0); + + r = m.count(C2Int(5)); + assert(r == 1); + r = m.count(C2Int(6)); + assert(r == 1); + r = m.count(C2Int(7)); + assert(r == 1); + r = m.count(C2Int(8)); + assert(r == 1); + r = m.count(C2Int(9)); + assert(r == 1); + r = m.count(C2Int(10)); + assert(r == 1); + r = m.count(C2Int(11)); + assert(r == 1); + r = m.count(C2Int(12)); + assert(r == 1); + r = m.count(C2Int(4)); + assert(r == 0); } { diff --git a/test/std/containers/associative/map/map.ops/count0.pass.cpp b/test/std/containers/associative/map/map.ops/count0.pass.cpp new file mode 100644 index 00000000..ce549366 --- /dev/null +++ b/test/std/containers/associative/map/map.ops/count0.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// XFAIL: c++03, c++11 + +// + +// class map + +// iterator find(const key_type& k); +// const_iterator find(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +int main() +{ + typedef std::map M; + + M().count(C2Int{5}); +} diff --git a/test/std/containers/associative/map/map.ops/count1.fail.cpp b/test/std/containers/associative/map/map.ops/count1.fail.cpp new file mode 100644 index 00000000..9c15059d --- /dev/null +++ b/test/std/containers/associative/map/map.ops/count1.fail.cpp @@ -0,0 +1,39 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// class map + +// iterator find(const key_type& k); +// const_iterator find(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::map M; + + M().count(C2Int{5}); + } +} +#endif \ No newline at end of file diff --git a/test/std/containers/associative/map/map.ops/count2.fail.cpp b/test/std/containers/associative/map/map.ops/count2.fail.cpp new file mode 100644 index 00000000..7aa1553e --- /dev/null +++ b/test/std/containers/associative/map/map.ops/count2.fail.cpp @@ -0,0 +1,39 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// class map + +// iterator find(const key_type& k); +// const_iterator find(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::map M; + + M().count(C2Int{5}); + } +} +#endif \ No newline at end of file diff --git a/test/std/containers/associative/map/map.ops/count3.fail.cpp b/test/std/containers/associative/map/map.ops/count3.fail.cpp new file mode 100644 index 00000000..7e7bb8f6 --- /dev/null +++ b/test/std/containers/associative/map/map.ops/count3.fail.cpp @@ -0,0 +1,39 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// class map + +// iterator find(const key_type& k); +// const_iterator find(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::map M; + + M().count(C2Int{5}); + } +} +#endif \ No newline at end of file diff --git a/test/std/containers/associative/map/map.ops/equal_range.pass.cpp b/test/std/containers/associative/map/map.ops/equal_range.pass.cpp index dff751c3..a71149a4 100644 --- a/test/std/containers/associative/map/map.ops/equal_range.pass.cpp +++ b/test/std/containers/associative/map/map.ops/equal_range.pass.cpp @@ -19,6 +19,7 @@ #include "min_allocator.h" #include "private_constructor.hpp" +#include "is_transparent.h" int main() { @@ -365,6 +366,58 @@ int main() r = m.equal_range(20); assert(r.first == next(m.begin(), 8)); assert(r.second == next(m.begin(), 8)); + + r = m.equal_range(C2Int(5)); + assert(r.first == next(m.begin(), 0)); + assert(r.second == next(m.begin(), 1)); + r = m.equal_range(C2Int(7)); + assert(r.first == next(m.begin(), 1)); + assert(r.second == next(m.begin(), 2)); + r = m.equal_range(C2Int(9)); + assert(r.first == next(m.begin(), 2)); + assert(r.second == next(m.begin(), 3)); + r = m.equal_range(C2Int(11)); + assert(r.first == next(m.begin(), 3)); + assert(r.second == next(m.begin(), 4)); + r = m.equal_range(C2Int(13)); + assert(r.first == next(m.begin(), 4)); + assert(r.second == next(m.begin(), 5)); + r = m.equal_range(C2Int(15)); + assert(r.first == next(m.begin(), 5)); + assert(r.second == next(m.begin(), 6)); + r = m.equal_range(C2Int(17)); + assert(r.first == next(m.begin(), 6)); + assert(r.second == next(m.begin(), 7)); + r = m.equal_range(C2Int(19)); + assert(r.first == next(m.begin(), 7)); + assert(r.second == next(m.begin(), 8)); + r = m.equal_range(C2Int(4)); + assert(r.first == next(m.begin(), 0)); + assert(r.second == next(m.begin(), 0)); + r = m.equal_range(C2Int(6)); + assert(r.first == next(m.begin(), 1)); + assert(r.second == next(m.begin(), 1)); + r = m.equal_range(C2Int(8)); + assert(r.first == next(m.begin(), 2)); + assert(r.second == next(m.begin(), 2)); + r = m.equal_range(C2Int(10)); + assert(r.first == next(m.begin(), 3)); + assert(r.second == next(m.begin(), 3)); + r = m.equal_range(C2Int(12)); + assert(r.first == next(m.begin(), 4)); + assert(r.second == next(m.begin(), 4)); + r = m.equal_range(C2Int(14)); + assert(r.first == next(m.begin(), 5)); + assert(r.second == next(m.begin(), 5)); + r = m.equal_range(C2Int(16)); + assert(r.first == next(m.begin(), 6)); + assert(r.second == next(m.begin(), 6)); + r = m.equal_range(C2Int(18)); + assert(r.first == next(m.begin(), 7)); + assert(r.second == next(m.begin(), 7)); + r = m.equal_range(C2Int(20)); + assert(r.first == next(m.begin(), 8)); + assert(r.second == next(m.begin(), 8)); } { typedef PrivateConstructor PC; diff --git a/test/std/containers/associative/map/map.ops/equal_range0.pass.cpp b/test/std/containers/associative/map/map.ops/equal_range0.pass.cpp new file mode 100644 index 00000000..c95c3dff --- /dev/null +++ b/test/std/containers/associative/map/map.ops/equal_range0.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// XFAIL: c++03, c++11 + +// + +// class map + +// iterator find(const key_type& k); +// const_iterator find(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +int main() +{ + typedef std::map M; + + M().equal_range(C2Int{5}); +} diff --git a/test/std/containers/associative/map/map.ops/equal_range1.fail.cpp b/test/std/containers/associative/map/map.ops/equal_range1.fail.cpp new file mode 100644 index 00000000..8f0da08e --- /dev/null +++ b/test/std/containers/associative/map/map.ops/equal_range1.fail.cpp @@ -0,0 +1,39 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// class map + +// iterator find(const key_type& k); +// const_iterator find(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::map M; + + M().equal_range(C2Int{5}); + } +} +#endif \ No newline at end of file diff --git a/test/std/containers/associative/map/map.ops/equal_range2.fail.cpp b/test/std/containers/associative/map/map.ops/equal_range2.fail.cpp new file mode 100644 index 00000000..e73122d6 --- /dev/null +++ b/test/std/containers/associative/map/map.ops/equal_range2.fail.cpp @@ -0,0 +1,39 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// class map + +// iterator find(const key_type& k); +// const_iterator find(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::map M; + + M().equal_range(C2Int{5}); + } +} +#endif \ No newline at end of file diff --git a/test/std/containers/associative/map/map.ops/equal_range3.fail.cpp b/test/std/containers/associative/map/map.ops/equal_range3.fail.cpp new file mode 100644 index 00000000..bb72e9e7 --- /dev/null +++ b/test/std/containers/associative/map/map.ops/equal_range3.fail.cpp @@ -0,0 +1,39 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// class map + +// iterator find(const key_type& k); +// const_iterator find(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::map M; + + M().equal_range(C2Int{5}); + } +} +#endif \ No newline at end of file diff --git a/test/std/containers/associative/map/map.ops/find.pass.cpp b/test/std/containers/associative/map/map.ops/find.pass.cpp index a7578449..17463b65 100644 --- a/test/std/containers/associative/map/map.ops/find.pass.cpp +++ b/test/std/containers/associative/map/map.ops/find.pass.cpp @@ -19,6 +19,7 @@ #include "min_allocator.h" #include "private_constructor.hpp" +#include "is_transparent.h" int main() { @@ -200,6 +201,25 @@ int main() assert(r == next(m.begin(), 7)); r = m.find(4); assert(r == next(m.begin(), 8)); + + r = m.find(C2Int(5)); + assert(r == m.begin()); + r = m.find(C2Int(6)); + assert(r == next(m.begin())); + r = m.find(C2Int(7)); + assert(r == next(m.begin(), 2)); + r = m.find(C2Int(8)); + assert(r == next(m.begin(), 3)); + r = m.find(C2Int(9)); + assert(r == next(m.begin(), 4)); + r = m.find(C2Int(10)); + assert(r == next(m.begin(), 5)); + r = m.find(C2Int(11)); + assert(r == next(m.begin(), 6)); + r = m.find(C2Int(12)); + assert(r == next(m.begin(), 7)); + r = m.find(C2Int(4)); + assert(r == next(m.begin(), 8)); } { diff --git a/test/std/containers/associative/map/map.ops/find0.pass.cpp b/test/std/containers/associative/map/map.ops/find0.pass.cpp new file mode 100644 index 00000000..5f310b07 --- /dev/null +++ b/test/std/containers/associative/map/map.ops/find0.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// XFAIL: c++03, c++11 + +// + +// class map + +// iterator find(const key_type& k); +// const_iterator find(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +int main() +{ + typedef std::map M; + + M().find(C2Int{5}); +} diff --git a/test/std/containers/associative/map/map.ops/find1.fail.cpp b/test/std/containers/associative/map/map.ops/find1.fail.cpp new file mode 100644 index 00000000..c33b5a9a --- /dev/null +++ b/test/std/containers/associative/map/map.ops/find1.fail.cpp @@ -0,0 +1,39 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// class map + +// iterator find(const key_type& k); +// const_iterator find(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::map M; + + M().find(C2Int{5}); + } +} +#endif \ No newline at end of file diff --git a/test/std/containers/associative/map/map.ops/find2.fail.cpp b/test/std/containers/associative/map/map.ops/find2.fail.cpp new file mode 100644 index 00000000..40bf323a --- /dev/null +++ b/test/std/containers/associative/map/map.ops/find2.fail.cpp @@ -0,0 +1,39 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// class map + +// iterator find(const key_type& k); +// const_iterator find(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::map M; + + M().find(C2Int{5}); + } +} +#endif \ No newline at end of file diff --git a/test/std/containers/associative/map/map.ops/find3.fail.cpp b/test/std/containers/associative/map/map.ops/find3.fail.cpp new file mode 100644 index 00000000..9526c0e2 --- /dev/null +++ b/test/std/containers/associative/map/map.ops/find3.fail.cpp @@ -0,0 +1,39 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// class map + +// iterator find(const key_type& k); +// const_iterator find(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::map M; + + M().find(C2Int{5}); + } +} +#endif \ No newline at end of file diff --git a/test/std/containers/associative/map/map.ops/lower_bound.pass.cpp b/test/std/containers/associative/map/map.ops/lower_bound.pass.cpp index 87b84eef..3cbfbf7d 100644 --- a/test/std/containers/associative/map/map.ops/lower_bound.pass.cpp +++ b/test/std/containers/associative/map/map.ops/lower_bound.pass.cpp @@ -19,6 +19,7 @@ #include "min_allocator.h" #include "private_constructor.hpp" +#include "is_transparent.h" int main() { @@ -280,6 +281,41 @@ int main() assert(r == next(m.begin(), 7)); r = m.lower_bound(20); assert(r == next(m.begin(), 8)); + + r = m.lower_bound(C2Int(5)); + assert(r == m.begin()); + r = m.lower_bound(C2Int(7)); + assert(r == next(m.begin())); + r = m.lower_bound(C2Int(9)); + assert(r == next(m.begin(), 2)); + r = m.lower_bound(C2Int(11)); + assert(r == next(m.begin(), 3)); + r = m.lower_bound(C2Int(13)); + assert(r == next(m.begin(), 4)); + r = m.lower_bound(C2Int(15)); + assert(r == next(m.begin(), 5)); + r = m.lower_bound(C2Int(17)); + assert(r == next(m.begin(), 6)); + r = m.lower_bound(C2Int(19)); + assert(r == next(m.begin(), 7)); + r = m.lower_bound(C2Int(4)); + assert(r == next(m.begin(), 0)); + r = m.lower_bound(C2Int(6)); + assert(r == next(m.begin(), 1)); + r = m.lower_bound(C2Int(8)); + assert(r == next(m.begin(), 2)); + r = m.lower_bound(C2Int(10)); + assert(r == next(m.begin(), 3)); + r = m.lower_bound(C2Int(12)); + assert(r == next(m.begin(), 4)); + r = m.lower_bound(C2Int(14)); + assert(r == next(m.begin(), 5)); + r = m.lower_bound(C2Int(16)); + assert(r == next(m.begin(), 6)); + r = m.lower_bound(C2Int(18)); + assert(r == next(m.begin(), 7)); + r = m.lower_bound(C2Int(20)); + assert(r == next(m.begin(), 8)); } { diff --git a/test/std/containers/associative/map/map.ops/lower_bound0.pass.cpp b/test/std/containers/associative/map/map.ops/lower_bound0.pass.cpp new file mode 100644 index 00000000..2fc095a8 --- /dev/null +++ b/test/std/containers/associative/map/map.ops/lower_bound0.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// XFAIL: c++03, c++11 + +// + +// class map + +// iterator lower_bound(const key_type& k); +// const_iterator lower_bound(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +int main() +{ + typedef std::map M; + + M().lower_bound(C2Int{5}); +} diff --git a/test/std/containers/associative/map/map.ops/lower_bound1.fail.cpp b/test/std/containers/associative/map/map.ops/lower_bound1.fail.cpp new file mode 100644 index 00000000..a4a986c1 --- /dev/null +++ b/test/std/containers/associative/map/map.ops/lower_bound1.fail.cpp @@ -0,0 +1,39 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// class map + +// iterator lower_bound(const key_type& k); +// const_iterator lower_bound(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::map M; + + M().lower_bound(C2Int{5}); + } +} +#endif diff --git a/test/std/containers/associative/map/map.ops/lower_bound2.fail.cpp b/test/std/containers/associative/map/map.ops/lower_bound2.fail.cpp new file mode 100644 index 00000000..3f6380e5 --- /dev/null +++ b/test/std/containers/associative/map/map.ops/lower_bound2.fail.cpp @@ -0,0 +1,39 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// class map + +// iterator lower_bound(const key_type& k); +// const_iterator lower_bound(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::map M; + + M().lower_bound(C2Int{5}); + } +} +#endif diff --git a/test/std/containers/associative/map/map.ops/lower_bound3.fail.cpp b/test/std/containers/associative/map/map.ops/lower_bound3.fail.cpp new file mode 100644 index 00000000..18f2c7b7 --- /dev/null +++ b/test/std/containers/associative/map/map.ops/lower_bound3.fail.cpp @@ -0,0 +1,39 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// class map + +// iterator lower_bound(const key_type& k); +// const_iterator lower_bound(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::map M; + + M().lower_bound(C2Int{5}); + } +} +#endif diff --git a/test/std/containers/associative/map/map.ops/upper_bound0.pass.cpp b/test/std/containers/associative/map/map.ops/upper_bound0.pass.cpp new file mode 100644 index 00000000..c58e55f2 --- /dev/null +++ b/test/std/containers/associative/map/map.ops/upper_bound0.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// XFAIL: c++03, c++11 + +// + +// class map + +// iterator upper_bound(const key_type& k); +// const_iterator upper_bound(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +int main() +{ + typedef std::map M; + + M().upper_bound(C2Int{5}); +} diff --git a/test/std/containers/associative/map/map.ops/upper_bound1.fail.cpp b/test/std/containers/associative/map/map.ops/upper_bound1.fail.cpp new file mode 100644 index 00000000..4647681b --- /dev/null +++ b/test/std/containers/associative/map/map.ops/upper_bound1.fail.cpp @@ -0,0 +1,39 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// class map + +// iterator upper_bound(const key_type& k); +// const_iterator upper_bound(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::map M; + + M().upper_bound(C2Int{5}); + } +} +#endif diff --git a/test/std/containers/associative/map/map.ops/upper_bound2.fail.cpp b/test/std/containers/associative/map/map.ops/upper_bound2.fail.cpp new file mode 100644 index 00000000..11852fe0 --- /dev/null +++ b/test/std/containers/associative/map/map.ops/upper_bound2.fail.cpp @@ -0,0 +1,39 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// class map + +// iterator upper_bound(const key_type& k); +// const_iterator upper_bound(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::map M; + + M().upper_bound(C2Int{5}); + } +} +#endif diff --git a/test/std/containers/associative/map/map.ops/upper_bound3.fail.cpp b/test/std/containers/associative/map/map.ops/upper_bound3.fail.cpp new file mode 100644 index 00000000..9cddeb8a --- /dev/null +++ b/test/std/containers/associative/map/map.ops/upper_bound3.fail.cpp @@ -0,0 +1,39 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// class map + +// iterator upper_bound(const key_type& k); +// const_iterator upper_bound(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::map M; + + M().upper_bound(C2Int{5}); + } +} +#endif diff --git a/test/std/containers/associative/multimap/multimap.ops/count.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/count.pass.cpp index 2f172d11..c666c295 100644 --- a/test/std/containers/associative/multimap/multimap.ops/count.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.ops/count.pass.cpp @@ -18,6 +18,7 @@ #include "min_allocator.h" #include "private_constructor.hpp" +#include "is_transparent.h" int main() { @@ -122,6 +123,21 @@ int main() assert(r == 3); r = m.count(10); assert(r == 0); + + r = m.count(C2Int(4)); + assert(r == 0); + r = m.count(C2Int(5)); + assert(r == 3); + r = m.count(C2Int(6)); + assert(r == 0); + r = m.count(C2Int(7)); + assert(r == 3); + r = m.count(C2Int(8)); + assert(r == 0); + r = m.count(C2Int(9)); + assert(r == 3); + r = m.count(C2Int(10)); + assert(r == 0); } { diff --git a/test/std/containers/associative/multimap/multimap.ops/count0.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/count0.pass.cpp new file mode 100644 index 00000000..7da13bb0 --- /dev/null +++ b/test/std/containers/associative/multimap/multimap.ops/count0.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// XFAIL: c++03, c++11 + +// + +// class multimap + +// iterator find(const key_type& k); +// const_iterator find(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +int main() +{ + typedef std::multimap M; + + M().count(C2Int{5}); +} diff --git a/test/std/containers/associative/multimap/multimap.ops/count1.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/count1.fail.cpp new file mode 100644 index 00000000..f30d1bfd --- /dev/null +++ b/test/std/containers/associative/multimap/multimap.ops/count1.fail.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// class multimap + +// iterator find(const key_type& k); +// const_iterator find(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + typedef std::multimap M; + + M().count(C2Int{5}); +} +#endif \ No newline at end of file diff --git a/test/std/containers/associative/multimap/multimap.ops/count2.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/count2.fail.cpp new file mode 100644 index 00000000..ffb7eb6a --- /dev/null +++ b/test/std/containers/associative/multimap/multimap.ops/count2.fail.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// class multimap + +// iterator find(const key_type& k); +// const_iterator find(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + typedef std::multimap M; + + M().count(C2Int{5}); +} +#endif \ No newline at end of file diff --git a/test/std/containers/associative/multimap/multimap.ops/count3.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/count3.fail.cpp new file mode 100644 index 00000000..4bb9d146 --- /dev/null +++ b/test/std/containers/associative/multimap/multimap.ops/count3.fail.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// class multimap + +// iterator find(const key_type& k); +// const_iterator find(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + typedef std::multimap M; + + M().count(C2Int{5}); +} +#endif \ No newline at end of file diff --git a/test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp index a408796d..5a071042 100644 --- a/test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// -// +// // class multimap @@ -19,6 +19,7 @@ #include "min_allocator.h" #include "private_constructor.hpp" +#include "is_transparent.h" int main() { @@ -219,6 +220,28 @@ int main() r = m.equal_range(10); assert(r.first == m.end()); assert(r.second == m.end()); + + r = m.equal_range(C2Int(4)); + assert(r.first == m.begin()); + assert(r.second == m.begin()); + r = m.equal_range(C2Int(5)); + assert(r.first == m.begin()); + assert(r.second == next(m.begin(), 3)); + r = m.equal_range(C2Int(6)); + assert(r.first == next(m.begin(), 3)); + assert(r.second == next(m.begin(), 3)); + r = m.equal_range(C2Int(7)); + assert(r.first == next(m.begin(), 3)); + assert(r.second == next(m.begin(), 6)); + r = m.equal_range(C2Int(8)); + assert(r.first == next(m.begin(), 6)); + assert(r.second == next(m.begin(), 6)); + r = m.equal_range(C2Int(9)); + assert(r.first == next(m.begin(), 6)); + assert(r.second == next(m.begin(), 9)); + r = m.equal_range(C2Int(10)); + assert(r.first == m.end()); + assert(r.second == m.end()); } { diff --git a/test/std/containers/associative/multimap/multimap.ops/equal_range0.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/equal_range0.pass.cpp new file mode 100644 index 00000000..c0f07468 --- /dev/null +++ b/test/std/containers/associative/multimap/multimap.ops/equal_range0.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// XFAIL: c++03, c++11 + +// + +// class multimap + +// iterator find(const key_type& k); +// const_iterator find(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +int main() +{ + typedef std::multimap M; + + M().equal_range(C2Int{5}); +} diff --git a/test/std/containers/associative/multimap/multimap.ops/equal_range1.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/equal_range1.fail.cpp new file mode 100644 index 00000000..f022e943 --- /dev/null +++ b/test/std/containers/associative/multimap/multimap.ops/equal_range1.fail.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// class multimap + +// iterator find(const key_type& k); +// const_iterator find(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + typedef std::multimap M; + + M().equal_range(C2Int{5}); +} +#endif \ No newline at end of file diff --git a/test/std/containers/associative/multimap/multimap.ops/equal_range2.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/equal_range2.fail.cpp new file mode 100644 index 00000000..695e7170 --- /dev/null +++ b/test/std/containers/associative/multimap/multimap.ops/equal_range2.fail.cpp @@ -0,0 +1,39 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// class multimap + +// iterator find(const key_type& k); +// const_iterator find(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::multimap M; + + M().equal_range(C2Int{5}); + } +} +#endif \ No newline at end of file diff --git a/test/std/containers/associative/multimap/multimap.ops/equal_range3.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/equal_range3.fail.cpp new file mode 100644 index 00000000..59c2855e --- /dev/null +++ b/test/std/containers/associative/multimap/multimap.ops/equal_range3.fail.cpp @@ -0,0 +1,39 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// class multimap + +// iterator find(const key_type& k); +// const_iterator find(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::multimap M; + + M().equal_range(C2Int{5}); + } +} +#endif \ No newline at end of file diff --git a/test/std/containers/associative/multimap/multimap.ops/find.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/find.pass.cpp index fb5afa24..a60e42cf 100644 --- a/test/std/containers/associative/multimap/multimap.ops/find.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.ops/find.pass.cpp @@ -19,6 +19,7 @@ #include "min_allocator.h" #include "private_constructor.hpp" +#include "is_transparent.h" int main() { @@ -174,6 +175,19 @@ int main() assert(r == next(m.begin(), 6)); r = m.find(10); assert(r == m.end()); + + r = m.find(C2Int(5)); + assert(r == m.begin()); + r = m.find(C2Int(6)); + assert(r == m.end()); + r = m.find(C2Int(7)); + assert(r == next(m.begin(), 3)); + r = m.find(C2Int(8)); + assert(r == m.end()); + r = m.find(C2Int(9)); + assert(r == next(m.begin(), 6)); + r = m.find(C2Int(10)); + assert(r == m.end()); } { diff --git a/test/std/containers/associative/multimap/multimap.ops/find0.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/find0.pass.cpp new file mode 100644 index 00000000..4f336987 --- /dev/null +++ b/test/std/containers/associative/multimap/multimap.ops/find0.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// XFAIL: c++03, c++11 + +// + +// class multimap + +// iterator find(const key_type& k); +// const_iterator find(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +int main() +{ + typedef std::multimap M; + + M().find(C2Int{5}); +} diff --git a/test/std/containers/associative/multimap/multimap.ops/find1.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/find1.fail.cpp new file mode 100644 index 00000000..e1eef034 --- /dev/null +++ b/test/std/containers/associative/multimap/multimap.ops/find1.fail.cpp @@ -0,0 +1,39 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// class multimap + +// iterator find(const key_type& k); +// const_iterator find(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::multimap M; + + M().find(C2Int{5}); + } +} +#endif \ No newline at end of file diff --git a/test/std/containers/associative/multimap/multimap.ops/find2.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/find2.fail.cpp new file mode 100644 index 00000000..4c03f583 --- /dev/null +++ b/test/std/containers/associative/multimap/multimap.ops/find2.fail.cpp @@ -0,0 +1,39 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// class map + +// iterator find(const key_type& k); +// const_iterator find(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::multimap M; + + M().find(C2Int{5}); + } +} +#endif \ No newline at end of file diff --git a/test/std/containers/associative/multimap/multimap.ops/find3.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/find3.fail.cpp new file mode 100644 index 00000000..f10bc60a --- /dev/null +++ b/test/std/containers/associative/multimap/multimap.ops/find3.fail.cpp @@ -0,0 +1,39 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// class multimap + +// iterator find(const key_type& k); +// const_iterator find(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::multimap M; + + M().find(C2Int{5}); + } +} +#endif \ No newline at end of file diff --git a/test/std/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp index 49cf6de8..38b93180 100644 --- a/test/std/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp @@ -19,6 +19,7 @@ #include "min_allocator.h" #include "private_constructor.hpp" +#include "is_transparent.h" int main() { @@ -183,6 +184,21 @@ int main() assert(r == next(m.begin(), 6)); r = m.lower_bound(10); assert(r == m.end()); + + r = m.lower_bound(C2Int(4)); + assert(r == m.begin()); + r = m.lower_bound(C2Int(5)); + assert(r == m.begin()); + r = m.lower_bound(C2Int(6)); + assert(r == next(m.begin(), 3)); + r = m.lower_bound(C2Int(7)); + assert(r == next(m.begin(), 3)); + r = m.lower_bound(C2Int(8)); + assert(r == next(m.begin(), 6)); + r = m.lower_bound(C2Int(9)); + assert(r == next(m.begin(), 6)); + r = m.lower_bound(C2Int(10)); + assert(r == m.end()); } { diff --git a/test/std/containers/associative/multimap/multimap.ops/lower_bound0.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/lower_bound0.pass.cpp new file mode 100644 index 00000000..c5271f65 --- /dev/null +++ b/test/std/containers/associative/multimap/multimap.ops/lower_bound0.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// XFAIL: c++03, c++11 + +// + +// class multimap + +// iterator lower_bound(const key_type& k); +// const_iterator lower_bound(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +int main() +{ + typedef std::multimap M; + + M().lower_bound(C2Int{5}); +} diff --git a/test/std/containers/associative/multimap/multimap.ops/lower_bound1.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/lower_bound1.fail.cpp new file mode 100644 index 00000000..b452be86 --- /dev/null +++ b/test/std/containers/associative/multimap/multimap.ops/lower_bound1.fail.cpp @@ -0,0 +1,39 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// class multimap + +// iterator lower_bound(const key_type& k); +// const_iterator lower_bound(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::multimap M; + + M().lower_bound(C2Int{5}); + } +} +#endif diff --git a/test/std/containers/associative/multimap/multimap.ops/lower_bound2.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/lower_bound2.fail.cpp new file mode 100644 index 00000000..a2ba3023 --- /dev/null +++ b/test/std/containers/associative/multimap/multimap.ops/lower_bound2.fail.cpp @@ -0,0 +1,39 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// class multimap + +// iterator lower_bound(const key_type& k); +// const_iterator lower_bound(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::multimap M; + + M().lower_bound(C2Int{5}); + } +} +#endif diff --git a/test/std/containers/associative/multimap/multimap.ops/lower_bound3.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/lower_bound3.fail.cpp new file mode 100644 index 00000000..50d9fca9 --- /dev/null +++ b/test/std/containers/associative/multimap/multimap.ops/lower_bound3.fail.cpp @@ -0,0 +1,39 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// class multimap + +// iterator lower_bound(const key_type& k); +// const_iterator lower_bound(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::multimap M; + + M().lower_bound(C2Int{5}); + } +} +#endif diff --git a/test/std/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp index 19206477..7c647a94 100644 --- a/test/std/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp @@ -19,6 +19,7 @@ #include "min_allocator.h" #include "private_constructor.hpp" +#include "is_transparent.h" int main() { @@ -183,6 +184,20 @@ int main() assert(r == next(m.begin(), 9)); r = m.upper_bound(10); assert(r == m.end()); + + r = m.upper_bound(C2Int(4)); + assert(r == m.begin()); + r = m.upper_bound(C2Int(5)); + assert(r == next(m.begin(), 3)); + r = m.upper_bound(C2Int(6)); + assert(r == next(m.begin(), 3)); + r = m.upper_bound(C2Int(7)); + assert(r == next(m.begin(), 6)); + r = m.upper_bound(C2Int(8)); + assert(r == next(m.begin(), 6)); + r = m.upper_bound(C2Int(9)); + assert(r == next(m.begin(), 9)); + r = m.upper_bound(C2Int(10)); } { diff --git a/test/std/containers/associative/multimap/multimap.ops/upper_bound0.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/upper_bound0.pass.cpp new file mode 100644 index 00000000..322c6f55 --- /dev/null +++ b/test/std/containers/associative/multimap/multimap.ops/upper_bound0.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// XFAIL: c++03, c++11 + +// + +// class multimap + +// iterator upper_bound(const key_type& k); +// const_iterator upper_bound(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +int main() +{ + typedef std::multimap M; + + M().upper_bound(C2Int{5}); +} diff --git a/test/std/containers/associative/multimap/multimap.ops/upper_bound1.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/upper_bound1.fail.cpp new file mode 100644 index 00000000..bb78ad69 --- /dev/null +++ b/test/std/containers/associative/multimap/multimap.ops/upper_bound1.fail.cpp @@ -0,0 +1,39 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// class multimap + +// iterator upper_bound(const key_type& k); +// const_iterator upper_bound(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::multimap M; + + M().upper_bound(C2Int{5}); + } +} +#endif diff --git a/test/std/containers/associative/multimap/multimap.ops/upper_bound2.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/upper_bound2.fail.cpp new file mode 100644 index 00000000..a79d5938 --- /dev/null +++ b/test/std/containers/associative/multimap/multimap.ops/upper_bound2.fail.cpp @@ -0,0 +1,39 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// class multimap + +// iterator upper_bound(const key_type& k); +// const_iterator upper_bound(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::multimap M; + + M().upper_bound(C2Int{5}); + } +} +#endif diff --git a/test/std/containers/associative/multimap/multimap.ops/upper_bound3.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/upper_bound3.fail.cpp new file mode 100644 index 00000000..1c1dc74b --- /dev/null +++ b/test/std/containers/associative/multimap/multimap.ops/upper_bound3.fail.cpp @@ -0,0 +1,39 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// class multimap + +// iterator upper_bound(const key_type& k); +// const_iterator upper_bound(const key_type& k) const; +// +// The member function templates find, count, lower_bound, upper_bound, and +// equal_range shall not participate in overload resolution unless the +// qualified-id Compare::is_transparent is valid and denotes a type + + +#include +#include + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::multimap M; + + M().upper_bound(C2Int{5}); + } +} +#endif