diff options
author | Marshall Clow <mclow.lists@gmail.com> | 2015-06-30 18:15:41 +0000 |
---|---|---|
committer | Marshall Clow <mclow.lists@gmail.com> | 2015-06-30 18:15:41 +0000 |
commit | f8457a0735899ba71b7bb321cf88ff48b54c9d30 (patch) | |
tree | a1c8b315114dab918f4bb1f8a200aec9db9d475d /libcxx/test | |
parent | d9f09858a45aaeb1e258e41b04d6f78c345fbd8d (diff) | |
download | bcm5719-llvm-f8457a0735899ba71b7bb321cf88ff48b54c9d30.tar.gz bcm5719-llvm-f8457a0735899ba71b7bb321cf88ff48b54c9d30.zip |
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 <map>. Add that (twice). Next step is to do the same for <unordered_map>
llvm-svn: 241091
Diffstat (limited to 'libcxx/test')
49 files changed, 1716 insertions, 1 deletions
diff --git a/libcxx/test/std/containers/associative/map/map.ops/count.pass.cpp b/libcxx/test/std/containers/associative/map/map.ops/count.pass.cpp index 9668055b8bc..ae87ae8345e 100644 --- a/libcxx/test/std/containers/associative/map/map.ops/count.pass.cpp +++ b/libcxx/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/libcxx/test/std/containers/associative/map/map.ops/count0.pass.cpp b/libcxx/test/std/containers/associative/map/map.ops/count0.pass.cpp new file mode 100644 index 00000000000..ce549366e7a --- /dev/null +++ b/libcxx/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 + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +int main() +{ + typedef std::map<int, double, transparent_less> M; + + M().count(C2Int{5}); +} diff --git a/libcxx/test/std/containers/associative/map/map.ops/count1.fail.cpp b/libcxx/test/std/containers/associative/map/map.ops/count1.fail.cpp new file mode 100644 index 00000000000..9c15059d490 --- /dev/null +++ b/libcxx/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. +// +//===----------------------------------------------------------------------===// + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::map<int, double, transparent_less_no_type> M; + + M().count(C2Int{5}); + } +} +#endif
\ No newline at end of file diff --git a/libcxx/test/std/containers/associative/map/map.ops/count2.fail.cpp b/libcxx/test/std/containers/associative/map/map.ops/count2.fail.cpp new file mode 100644 index 00000000000..7aa1553ef47 --- /dev/null +++ b/libcxx/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. +// +//===----------------------------------------------------------------------===// + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::map<int, double, transparent_less_private> M; + + M().count(C2Int{5}); + } +} +#endif
\ No newline at end of file diff --git a/libcxx/test/std/containers/associative/map/map.ops/count3.fail.cpp b/libcxx/test/std/containers/associative/map/map.ops/count3.fail.cpp new file mode 100644 index 00000000000..7e7bb8f6d37 --- /dev/null +++ b/libcxx/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. +// +//===----------------------------------------------------------------------===// + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::map<int, double, transparent_less_not_a_type> M; + + M().count(C2Int{5}); + } +} +#endif
\ No newline at end of file diff --git a/libcxx/test/std/containers/associative/map/map.ops/equal_range.pass.cpp b/libcxx/test/std/containers/associative/map/map.ops/equal_range.pass.cpp index dff751c3724..a71149a4721 100644 --- a/libcxx/test/std/containers/associative/map/map.ops/equal_range.pass.cpp +++ b/libcxx/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/libcxx/test/std/containers/associative/map/map.ops/equal_range0.pass.cpp b/libcxx/test/std/containers/associative/map/map.ops/equal_range0.pass.cpp new file mode 100644 index 00000000000..c95c3dffa9a --- /dev/null +++ b/libcxx/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 + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +int main() +{ + typedef std::map<int, double, transparent_less> M; + + M().equal_range(C2Int{5}); +} diff --git a/libcxx/test/std/containers/associative/map/map.ops/equal_range1.fail.cpp b/libcxx/test/std/containers/associative/map/map.ops/equal_range1.fail.cpp new file mode 100644 index 00000000000..8f0da08eb32 --- /dev/null +++ b/libcxx/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. +// +//===----------------------------------------------------------------------===// + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::map<int, double, transparent_less_no_type> M; + + M().equal_range(C2Int{5}); + } +} +#endif
\ No newline at end of file diff --git a/libcxx/test/std/containers/associative/map/map.ops/equal_range2.fail.cpp b/libcxx/test/std/containers/associative/map/map.ops/equal_range2.fail.cpp new file mode 100644 index 00000000000..e73122d6533 --- /dev/null +++ b/libcxx/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. +// +//===----------------------------------------------------------------------===// + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::map<int, double, transparent_less_private> M; + + M().equal_range(C2Int{5}); + } +} +#endif
\ No newline at end of file diff --git a/libcxx/test/std/containers/associative/map/map.ops/equal_range3.fail.cpp b/libcxx/test/std/containers/associative/map/map.ops/equal_range3.fail.cpp new file mode 100644 index 00000000000..bb72e9e7a6d --- /dev/null +++ b/libcxx/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. +// +//===----------------------------------------------------------------------===// + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::map<int, double, transparent_less_not_a_type> M; + + M().equal_range(C2Int{5}); + } +} +#endif
\ No newline at end of file diff --git a/libcxx/test/std/containers/associative/map/map.ops/find.pass.cpp b/libcxx/test/std/containers/associative/map/map.ops/find.pass.cpp index a7578449f5b..17463b65740 100644 --- a/libcxx/test/std/containers/associative/map/map.ops/find.pass.cpp +++ b/libcxx/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/libcxx/test/std/containers/associative/map/map.ops/find0.pass.cpp b/libcxx/test/std/containers/associative/map/map.ops/find0.pass.cpp new file mode 100644 index 00000000000..5f310b07c59 --- /dev/null +++ b/libcxx/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 + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +int main() +{ + typedef std::map<int, double, transparent_less> M; + + M().find(C2Int{5}); +} diff --git a/libcxx/test/std/containers/associative/map/map.ops/find1.fail.cpp b/libcxx/test/std/containers/associative/map/map.ops/find1.fail.cpp new file mode 100644 index 00000000000..c33b5a9a34c --- /dev/null +++ b/libcxx/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. +// +//===----------------------------------------------------------------------===// + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::map<int, double, transparent_less_no_type> M; + + M().find(C2Int{5}); + } +} +#endif
\ No newline at end of file diff --git a/libcxx/test/std/containers/associative/map/map.ops/find2.fail.cpp b/libcxx/test/std/containers/associative/map/map.ops/find2.fail.cpp new file mode 100644 index 00000000000..40bf323a453 --- /dev/null +++ b/libcxx/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. +// +//===----------------------------------------------------------------------===// + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::map<int, double, transparent_less_private> M; + + M().find(C2Int{5}); + } +} +#endif
\ No newline at end of file diff --git a/libcxx/test/std/containers/associative/map/map.ops/find3.fail.cpp b/libcxx/test/std/containers/associative/map/map.ops/find3.fail.cpp new file mode 100644 index 00000000000..9526c0e24d9 --- /dev/null +++ b/libcxx/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. +// +//===----------------------------------------------------------------------===// + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::map<int, double, transparent_less_not_a_type> M; + + M().find(C2Int{5}); + } +} +#endif
\ No newline at end of file diff --git a/libcxx/test/std/containers/associative/map/map.ops/lower_bound.pass.cpp b/libcxx/test/std/containers/associative/map/map.ops/lower_bound.pass.cpp index 87b84eef070..3cbfbf7d869 100644 --- a/libcxx/test/std/containers/associative/map/map.ops/lower_bound.pass.cpp +++ b/libcxx/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/libcxx/test/std/containers/associative/map/map.ops/lower_bound0.pass.cpp b/libcxx/test/std/containers/associative/map/map.ops/lower_bound0.pass.cpp new file mode 100644 index 00000000000..2fc095a8f2c --- /dev/null +++ b/libcxx/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 + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +int main() +{ + typedef std::map<int, double, transparent_less> M; + + M().lower_bound(C2Int{5}); +} diff --git a/libcxx/test/std/containers/associative/map/map.ops/lower_bound1.fail.cpp b/libcxx/test/std/containers/associative/map/map.ops/lower_bound1.fail.cpp new file mode 100644 index 00000000000..a4a986c1a7a --- /dev/null +++ b/libcxx/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. +// +//===----------------------------------------------------------------------===// + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::map<int, double, transparent_less_no_type> M; + + M().lower_bound(C2Int{5}); + } +} +#endif diff --git a/libcxx/test/std/containers/associative/map/map.ops/lower_bound2.fail.cpp b/libcxx/test/std/containers/associative/map/map.ops/lower_bound2.fail.cpp new file mode 100644 index 00000000000..3f6380e5e25 --- /dev/null +++ b/libcxx/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. +// +//===----------------------------------------------------------------------===// + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::map<int, double, transparent_less_private> M; + + M().lower_bound(C2Int{5}); + } +} +#endif diff --git a/libcxx/test/std/containers/associative/map/map.ops/lower_bound3.fail.cpp b/libcxx/test/std/containers/associative/map/map.ops/lower_bound3.fail.cpp new file mode 100644 index 00000000000..18f2c7b71fd --- /dev/null +++ b/libcxx/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. +// +//===----------------------------------------------------------------------===// + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::map<int, double, transparent_less_not_a_type> M; + + M().lower_bound(C2Int{5}); + } +} +#endif diff --git a/libcxx/test/std/containers/associative/map/map.ops/upper_bound0.pass.cpp b/libcxx/test/std/containers/associative/map/map.ops/upper_bound0.pass.cpp new file mode 100644 index 00000000000..c58e55f2979 --- /dev/null +++ b/libcxx/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 + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +int main() +{ + typedef std::map<int, double, transparent_less> M; + + M().upper_bound(C2Int{5}); +} diff --git a/libcxx/test/std/containers/associative/map/map.ops/upper_bound1.fail.cpp b/libcxx/test/std/containers/associative/map/map.ops/upper_bound1.fail.cpp new file mode 100644 index 00000000000..4647681b5cd --- /dev/null +++ b/libcxx/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. +// +//===----------------------------------------------------------------------===// + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::map<int, double, transparent_less_no_type> M; + + M().upper_bound(C2Int{5}); + } +} +#endif diff --git a/libcxx/test/std/containers/associative/map/map.ops/upper_bound2.fail.cpp b/libcxx/test/std/containers/associative/map/map.ops/upper_bound2.fail.cpp new file mode 100644 index 00000000000..11852fe0cc9 --- /dev/null +++ b/libcxx/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. +// +//===----------------------------------------------------------------------===// + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::map<int, double, transparent_less_private> M; + + M().upper_bound(C2Int{5}); + } +} +#endif diff --git a/libcxx/test/std/containers/associative/map/map.ops/upper_bound3.fail.cpp b/libcxx/test/std/containers/associative/map/map.ops/upper_bound3.fail.cpp new file mode 100644 index 00000000000..9cddeb8acbd --- /dev/null +++ b/libcxx/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. +// +//===----------------------------------------------------------------------===// + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::map<int, double, transparent_less_not_a_type> M; + + M().upper_bound(C2Int{5}); + } +} +#endif diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/count.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/count.pass.cpp index 2f172d11d67..c666c295f3a 100644 --- a/libcxx/test/std/containers/associative/multimap/multimap.ops/count.pass.cpp +++ b/libcxx/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/libcxx/test/std/containers/associative/multimap/multimap.ops/count0.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/count0.pass.cpp new file mode 100644 index 00000000000..7da13bb0d66 --- /dev/null +++ b/libcxx/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 + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +int main() +{ + typedef std::multimap<int, double, transparent_less> M; + + M().count(C2Int{5}); +} diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/count1.fail.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/count1.fail.cpp new file mode 100644 index 00000000000..f30d1bfd88d --- /dev/null +++ b/libcxx/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. +// +//===----------------------------------------------------------------------===// + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + typedef std::multimap<int, double, transparent_less_no_type> M; + + M().count(C2Int{5}); +} +#endif
\ No newline at end of file diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/count2.fail.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/count2.fail.cpp new file mode 100644 index 00000000000..ffb7eb6a559 --- /dev/null +++ b/libcxx/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. +// +//===----------------------------------------------------------------------===// + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + typedef std::multimap<int, double, transparent_less_private> M; + + M().count(C2Int{5}); +} +#endif
\ No newline at end of file diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/count3.fail.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/count3.fail.cpp new file mode 100644 index 00000000000..4bb9d14634f --- /dev/null +++ b/libcxx/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. +// +//===----------------------------------------------------------------------===// + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + typedef std::multimap<int, double, transparent_less_not_a_type> M; + + M().count(C2Int{5}); +} +#endif
\ No newline at end of file diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp index a408796d1fb..5a071042461 100644 --- a/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp +++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// -// <map> +// <multimap> // 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/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range0.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range0.pass.cpp new file mode 100644 index 00000000000..c0f07468ec5 --- /dev/null +++ b/libcxx/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 + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +int main() +{ + typedef std::multimap<int, double, transparent_less> M; + + M().equal_range(C2Int{5}); +} diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range1.fail.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range1.fail.cpp new file mode 100644 index 00000000000..f022e94324f --- /dev/null +++ b/libcxx/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. +// +//===----------------------------------------------------------------------===// + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + typedef std::multimap<int, double, transparent_less_no_type> M; + + M().equal_range(C2Int{5}); +} +#endif
\ No newline at end of file diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range2.fail.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range2.fail.cpp new file mode 100644 index 00000000000..695e71703e3 --- /dev/null +++ b/libcxx/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. +// +//===----------------------------------------------------------------------===// + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::multimap<int, double, transparent_less_private> M; + + M().equal_range(C2Int{5}); + } +} +#endif
\ No newline at end of file diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range3.fail.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range3.fail.cpp new file mode 100644 index 00000000000..59c2855e8f6 --- /dev/null +++ b/libcxx/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. +// +//===----------------------------------------------------------------------===// + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::multimap<int, double, transparent_less_not_a_type> M; + + M().equal_range(C2Int{5}); + } +} +#endif
\ No newline at end of file diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/find.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/find.pass.cpp index fb5afa241ca..a60e42cf859 100644 --- a/libcxx/test/std/containers/associative/multimap/multimap.ops/find.pass.cpp +++ b/libcxx/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/libcxx/test/std/containers/associative/multimap/multimap.ops/find0.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/find0.pass.cpp new file mode 100644 index 00000000000..4f3369870c8 --- /dev/null +++ b/libcxx/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 + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +int main() +{ + typedef std::multimap<int, double, transparent_less> M; + + M().find(C2Int{5}); +} diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/find1.fail.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/find1.fail.cpp new file mode 100644 index 00000000000..e1eef034064 --- /dev/null +++ b/libcxx/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. +// +//===----------------------------------------------------------------------===// + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::multimap<int, double, transparent_less_no_type> M; + + M().find(C2Int{5}); + } +} +#endif
\ No newline at end of file diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/find2.fail.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/find2.fail.cpp new file mode 100644 index 00000000000..4c03f583fa1 --- /dev/null +++ b/libcxx/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. +// +//===----------------------------------------------------------------------===// + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::multimap<int, double, transparent_less_private> M; + + M().find(C2Int{5}); + } +} +#endif
\ No newline at end of file diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/find3.fail.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/find3.fail.cpp new file mode 100644 index 00000000000..f10bc60aa86 --- /dev/null +++ b/libcxx/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. +// +//===----------------------------------------------------------------------===// + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::multimap<int, double, transparent_less_not_a_type> M; + + M().find(C2Int{5}); + } +} +#endif
\ No newline at end of file diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp index 49cf6de853c..38b931802f8 100644 --- a/libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp +++ b/libcxx/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/libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound0.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound0.pass.cpp new file mode 100644 index 00000000000..c5271f65d7e --- /dev/null +++ b/libcxx/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 + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +int main() +{ + typedef std::multimap<int, double, transparent_less> M; + + M().lower_bound(C2Int{5}); +} diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound1.fail.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound1.fail.cpp new file mode 100644 index 00000000000..b452be864e2 --- /dev/null +++ b/libcxx/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. +// +//===----------------------------------------------------------------------===// + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::multimap<int, double, transparent_less_no_type> M; + + M().lower_bound(C2Int{5}); + } +} +#endif diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound2.fail.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound2.fail.cpp new file mode 100644 index 00000000000..a2ba30236a4 --- /dev/null +++ b/libcxx/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. +// +//===----------------------------------------------------------------------===// + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::multimap<int, double, transparent_less_private> M; + + M().lower_bound(C2Int{5}); + } +} +#endif diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound3.fail.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound3.fail.cpp new file mode 100644 index 00000000000..50d9fca91ad --- /dev/null +++ b/libcxx/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. +// +//===----------------------------------------------------------------------===// + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::multimap<int, double, transparent_less_not_a_type> M; + + M().lower_bound(C2Int{5}); + } +} +#endif diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp index 1920647705f..7c647a9426c 100644 --- a/libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp +++ b/libcxx/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/libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound0.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound0.pass.cpp new file mode 100644 index 00000000000..322c6f55130 --- /dev/null +++ b/libcxx/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 + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +int main() +{ + typedef std::multimap<int, double, transparent_less> M; + + M().upper_bound(C2Int{5}); +} diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound1.fail.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound1.fail.cpp new file mode 100644 index 00000000000..bb78ad69816 --- /dev/null +++ b/libcxx/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. +// +//===----------------------------------------------------------------------===// + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::multimap<int, double, transparent_less_no_type> M; + + M().upper_bound(C2Int{5}); + } +} +#endif diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound2.fail.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound2.fail.cpp new file mode 100644 index 00000000000..a79d5938e56 --- /dev/null +++ b/libcxx/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. +// +//===----------------------------------------------------------------------===// + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::multimap<int, double, transparent_less_private> M; + + M().upper_bound(C2Int{5}); + } +} +#endif diff --git a/libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound3.fail.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound3.fail.cpp new file mode 100644 index 00000000000..1c1dc74b72c --- /dev/null +++ b/libcxx/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. +// +//===----------------------------------------------------------------------===// + +// <map> + +// 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 <map> +#include <cassert> + +#include "is_transparent.h" + +#if _LIBCPP_STD_VER <= 11 +#error "This test requires is C++14 (or later)" +#else + +int main() +{ + { + typedef std::multimap<int, double, transparent_less_not_a_type> M; + + M().upper_bound(C2Int{5}); + } +} +#endif |