diff options
| author | Eric Fiselier <eric@efcs.ca> | 2014-12-20 01:40:03 +0000 |
|---|---|---|
| committer | Eric Fiselier <eric@efcs.ca> | 2014-12-20 01:40:03 +0000 |
| commit | 5a83710e371fe68a06e6e3876c6a2c8b820a8976 (patch) | |
| tree | afde4c82ad6704681781c5cd49baa3fbd05c85db /libcxx/test/containers/associative/map | |
| parent | f11e8eab527fba316c64112f6e05de1a79693a3e (diff) | |
| download | bcm5719-llvm-5a83710e371fe68a06e6e3876c6a2c8b820a8976.tar.gz bcm5719-llvm-5a83710e371fe68a06e6e3876c6a2c8b820a8976.zip | |
Move test into test/std subdirectory.
llvm-svn: 224658
Diffstat (limited to 'libcxx/test/containers/associative/map')
53 files changed, 0 insertions, 6347 deletions
diff --git a/libcxx/test/containers/associative/map/compare.pass.cpp b/libcxx/test/containers/associative/map/compare.pass.cpp deleted file mode 100644 index aa4d5999ff4..00000000000 --- a/libcxx/test/containers/associative/map/compare.pass.cpp +++ /dev/null @@ -1,32 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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> - -// template <class Key, class T, class Compare = less<Key>, -// class Allocator = allocator<pair<const Key, T>>> -// class map - -// http://llvm.org/bugs/show_bug.cgi?id=16538 -// http://llvm.org/bugs/show_bug.cgi?id=16549 - -#include <map> - -struct Key { - template <typename T> Key(const T&) {} - bool operator< (const Key&) const { return false; } -}; - -int -main() -{ - std::map<Key, int>::iterator it = std::map<Key, int>().find(Key(0)); - std::pair<std::map<Key, int>::iterator, bool> result = - std::map<Key, int>().insert(std::make_pair(Key(0), 0)); -} diff --git a/libcxx/test/containers/associative/map/map.access/at.pass.cpp b/libcxx/test/containers/associative/map/map.access/at.pass.cpp deleted file mode 100644 index 86b1e3d2dfa..00000000000 --- a/libcxx/test/containers/associative/map/map.access/at.pass.cpp +++ /dev/null @@ -1,154 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// mapped_type& at(const key_type& k); -// const mapped_type& at(const key_type& k) const; - -#include <map> -#include <cassert> - -#include "min_allocator.h" - -int main() -{ - { - typedef std::pair<const int, double> V; - V ar[] = - { - V(1, 1.5), - V(2, 2.5), - V(3, 3.5), - V(4, 4.5), - V(5, 5.5), - V(7, 7.5), - V(8, 8.5), - }; - std::map<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0])); - assert(m.size() == 7); - assert(m.at(1) == 1.5); - m.at(1) = -1.5; - assert(m.at(1) == -1.5); - assert(m.at(2) == 2.5); - assert(m.at(3) == 3.5); - assert(m.at(4) == 4.5); - assert(m.at(5) == 5.5); - try - { - m.at(6); - assert(false); - } - catch (std::out_of_range&) - { - } - assert(m.at(7) == 7.5); - assert(m.at(8) == 8.5); - assert(m.size() == 7); - } - { - typedef std::pair<const int, double> V; - V ar[] = - { - V(1, 1.5), - V(2, 2.5), - V(3, 3.5), - V(4, 4.5), - V(5, 5.5), - V(7, 7.5), - V(8, 8.5), - }; - const std::map<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0])); - assert(m.size() == 7); - assert(m.at(1) == 1.5); - assert(m.at(2) == 2.5); - assert(m.at(3) == 3.5); - assert(m.at(4) == 4.5); - assert(m.at(5) == 5.5); - try - { - m.at(6); - assert(false); - } - catch (std::out_of_range&) - { - } - assert(m.at(7) == 7.5); - assert(m.at(8) == 8.5); - assert(m.size() == 7); - } -#if __cplusplus >= 201103L - { - typedef std::pair<const int, double> V; - V ar[] = - { - V(1, 1.5), - V(2, 2.5), - V(3, 3.5), - V(4, 4.5), - V(5, 5.5), - V(7, 7.5), - V(8, 8.5), - }; - std::map<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0])); - assert(m.size() == 7); - assert(m.at(1) == 1.5); - m.at(1) = -1.5; - assert(m.at(1) == -1.5); - assert(m.at(2) == 2.5); - assert(m.at(3) == 3.5); - assert(m.at(4) == 4.5); - assert(m.at(5) == 5.5); - try - { - m.at(6); - assert(false); - } - catch (std::out_of_range&) - { - } - assert(m.at(7) == 7.5); - assert(m.at(8) == 8.5); - assert(m.size() == 7); - } - { - typedef std::pair<const int, double> V; - V ar[] = - { - V(1, 1.5), - V(2, 2.5), - V(3, 3.5), - V(4, 4.5), - V(5, 5.5), - V(7, 7.5), - V(8, 8.5), - }; - const std::map<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0])); - assert(m.size() == 7); - assert(m.at(1) == 1.5); - assert(m.at(2) == 2.5); - assert(m.at(3) == 3.5); - assert(m.at(4) == 4.5); - assert(m.at(5) == 5.5); - try - { - m.at(6); - assert(false); - } - catch (std::out_of_range&) - { - } - assert(m.at(7) == 7.5); - assert(m.at(8) == 8.5); - assert(m.size() == 7); - } -#endif -} diff --git a/libcxx/test/containers/associative/map/map.access/empty.pass.cpp b/libcxx/test/containers/associative/map/map.access/empty.pass.cpp deleted file mode 100644 index b11e94c8042..00000000000 --- a/libcxx/test/containers/associative/map/map.access/empty.pass.cpp +++ /dev/null @@ -1,43 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// bool empty() const; - -#include <map> -#include <cassert> - -#include "min_allocator.h" - -int main() -{ - { - typedef std::map<int, double> M; - M m; - assert(m.empty()); - m.insert(M::value_type(1, 1.5)); - assert(!m.empty()); - m.clear(); - assert(m.empty()); - } -#if __cplusplus >= 201103L - { - typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M; - M m; - assert(m.empty()); - m.insert(M::value_type(1, 1.5)); - assert(!m.empty()); - m.clear(); - assert(m.empty()); - } -#endif -} diff --git a/libcxx/test/containers/associative/map/map.access/index_key.pass.cpp b/libcxx/test/containers/associative/map/map.access/index_key.pass.cpp deleted file mode 100644 index ab1144c60af..00000000000 --- a/libcxx/test/containers/associative/map/map.access/index_key.pass.cpp +++ /dev/null @@ -1,105 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// mapped_type& operator[](const key_type& k); - -#include <map> -#include <cassert> - -#include "min_allocator.h" -#include "private_constructor.hpp" - -int main() -{ - { - typedef std::pair<const int, double> V; - V ar[] = - { - V(1, 1.5), - V(2, 2.5), - V(3, 3.5), - V(4, 4.5), - V(5, 5.5), - V(7, 7.5), - V(8, 8.5), - }; - std::map<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0])); - assert(m.size() == 7); - assert(m[1] == 1.5); - assert(m.size() == 7); - m[1] = -1.5; - assert(m[1] == -1.5); - assert(m.size() == 7); - assert(m[6] == 0); - assert(m.size() == 8); - m[6] = 6.5; - assert(m[6] == 6.5); - assert(m.size() == 8); - } -#if __cplusplus >= 201103L - { - typedef std::pair<const int, double> V; - V ar[] = - { - V(1, 1.5), - V(2, 2.5), - V(3, 3.5), - V(4, 4.5), - V(5, 5.5), - V(7, 7.5), - V(8, 8.5), - }; - std::map<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0])); - assert(m.size() == 7); - assert(m[1] == 1.5); - assert(m.size() == 7); - const int i = 1; - m[i] = -1.5; - assert(m[1] == -1.5); - assert(m.size() == 7); - assert(m[6] == 0); - assert(m.size() == 8); - m[6] = 6.5; - assert(m[6] == 6.5); - assert(m.size() == 8); - } -#endif -#if _LIBCPP_STD_VER > 11 - { - typedef std::pair<const int, double> V; - V ar[] = - { - V(1, 1.5), - V(2, 2.5), - V(3, 3.5), - V(4, 4.5), - V(5, 5.5), - V(7, 7.5), - V(8, 8.5), - }; - std::map<int, double, std::less<>> m(ar, ar+sizeof(ar)/sizeof(ar[0])); - - assert(m.size() == 7); - assert(m[1] == 1.5); - assert(m.size() == 7); - m[1] = -1.5; - assert(m[1] == -1.5); - assert(m.size() == 7); - assert(m[6] == 0); - assert(m.size() == 8); - m[6] = 6.5; - assert(m[6] == 6.5); - assert(m.size() == 8); - } -#endif -} diff --git a/libcxx/test/containers/associative/map/map.access/index_rv_key.pass.cpp b/libcxx/test/containers/associative/map/map.access/index_rv_key.pass.cpp deleted file mode 100644 index a58d50d8499..00000000000 --- a/libcxx/test/containers/associative/map/map.access/index_rv_key.pass.cpp +++ /dev/null @@ -1,58 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// mapped_type& operator[](key_type&& k); - -#include <map> -#include <cassert> - -#include "../../../MoveOnly.h" -#include "min_allocator.h" - -int main() -{ -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - { - typedef std::pair<MoveOnly, double> V; - std::map<MoveOnly, double> m; - assert(m.size() == 0); - assert(m[1] == 0.0); - assert(m.size() == 1); - m[1] = -1.5; - assert(m[1] == -1.5); - assert(m.size() == 1); - assert(m[6] == 0); - assert(m.size() == 2); - m[6] = 6.5; - assert(m[6] == 6.5); - assert(m.size() == 2); - } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#if __cplusplus >= 201103L - { - typedef std::pair<MoveOnly, double> V; - std::map<MoveOnly, double, std::less<MoveOnly>, min_allocator<V>> m; - assert(m.size() == 0); - assert(m[1] == 0.0); - assert(m.size() == 1); - m[1] = -1.5; - assert(m[1] == -1.5); - assert(m.size() == 1); - assert(m[6] == 0); - assert(m.size() == 2); - m[6] = 6.5; - assert(m[6] == 6.5); - assert(m.size() == 2); - } -#endif -} diff --git a/libcxx/test/containers/associative/map/map.access/index_tuple.pass.cpp b/libcxx/test/containers/associative/map/map.access/index_tuple.pass.cpp deleted file mode 100644 index 9a00829eadd..00000000000 --- a/libcxx/test/containers/associative/map/map.access/index_tuple.pass.cpp +++ /dev/null @@ -1,33 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// mapped_type& operator[](const key_type& k); - -// http://llvm.org/bugs/show_bug.cgi?id=16542 - -#include <map> - -#ifndef _LIBCPP_HAS_NO_VARIADICS - -#include <tuple> - -#endif - -int main() -{ -#ifndef _LIBCPP_HAS_NO_VARIADICS - using namespace std; - map<tuple<int,int>, size_t> m; - m[make_tuple(2,3)]=7; -#endif -} diff --git a/libcxx/test/containers/associative/map/map.access/iterator.pass.cpp b/libcxx/test/containers/associative/map/map.access/iterator.pass.cpp deleted file mode 100644 index 552e87d8fc8..00000000000 --- a/libcxx/test/containers/associative/map/map.access/iterator.pass.cpp +++ /dev/null @@ -1,227 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 begin(); -// const_iterator begin() const; -// iterator end(); -// const_iterator end() const; -// -// reverse_iterator rbegin(); -// const_reverse_iterator rbegin() const; -// reverse_iterator rend(); -// const_reverse_iterator rend() const; -// -// const_iterator cbegin() const; -// const_iterator cend() const; -// const_reverse_iterator crbegin() const; -// const_reverse_iterator crend() const; - -#include <map> -#include <cassert> - -#include "min_allocator.h" - -int main() -{ - { - typedef std::pair<const int, double> V; - V ar[] = - { - V(1, 1), - V(1, 1.5), - V(1, 2), - V(2, 1), - V(2, 1.5), - V(2, 2), - V(3, 1), - V(3, 1.5), - V(3, 2), - V(4, 1), - V(4, 1.5), - V(4, 2), - V(5, 1), - V(5, 1.5), - V(5, 2), - V(6, 1), - V(6, 1.5), - V(6, 2), - V(7, 1), - V(7, 1.5), - V(7, 2), - V(8, 1), - V(8, 1.5), - V(8, 2) - }; - std::map<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0])); - assert(std::distance(m.begin(), m.end()) == m.size()); - assert(std::distance(m.rbegin(), m.rend()) == m.size()); - std::map<int, double>::iterator i; - i = m.begin(); - std::map<int, double>::const_iterator k = i; - assert(i == k); - for (int j = 1; j <= m.size(); ++j, ++i) - { - assert(i->first == j); - assert(i->second == 1); - i->second = 2.5; - assert(i->second == 2.5); - } - } - { - typedef std::pair<const int, double> V; - V ar[] = - { - V(1, 1), - V(1, 1.5), - V(1, 2), - V(2, 1), - V(2, 1.5), - V(2, 2), - V(3, 1), - V(3, 1.5), - V(3, 2), - V(4, 1), - V(4, 1.5), - V(4, 2), - V(5, 1), - V(5, 1.5), - V(5, 2), - V(6, 1), - V(6, 1.5), - V(6, 2), - V(7, 1), - V(7, 1.5), - V(7, 2), - V(8, 1), - V(8, 1.5), - V(8, 2) - }; - const std::map<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0])); - assert(std::distance(m.begin(), m.end()) == m.size()); - assert(std::distance(m.cbegin(), m.cend()) == m.size()); - assert(std::distance(m.rbegin(), m.rend()) == m.size()); - assert(std::distance(m.crbegin(), m.crend()) == m.size()); - std::map<int, double>::const_iterator i; - i = m.begin(); - for (int j = 1; j <= m.size(); ++j, ++i) - { - assert(i->first == j); - assert(i->second == 1); - } - } -#if __cplusplus >= 201103L - { - typedef std::pair<const int, double> V; - V ar[] = - { - V(1, 1), - V(1, 1.5), - V(1, 2), - V(2, 1), - V(2, 1.5), - V(2, 2), - V(3, 1), - V(3, 1.5), - V(3, 2), - V(4, 1), - V(4, 1.5), - V(4, 2), - V(5, 1), - V(5, 1.5), - V(5, 2), - V(6, 1), - V(6, 1.5), - V(6, 2), - V(7, 1), - V(7, 1.5), - V(7, 2), - V(8, 1), - V(8, 1.5), - V(8, 2) - }; - std::map<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0])); - assert(std::distance(m.begin(), m.end()) == m.size()); - assert(std::distance(m.rbegin(), m.rend()) == m.size()); - std::map<int, double, std::less<int>, min_allocator<V>>::iterator i; - i = m.begin(); - std::map<int, double, std::less<int>, min_allocator<V>>::const_iterator k = i; - assert(i == k); - for (int j = 1; j <= m.size(); ++j, ++i) - { - assert(i->first == j); - assert(i->second == 1); - i->second = 2.5; - assert(i->second == 2.5); - } - } - { - typedef std::pair<const int, double> V; - V ar[] = - { - V(1, 1), - V(1, 1.5), - V(1, 2), - V(2, 1), - V(2, 1.5), - V(2, 2), - V(3, 1), - V(3, 1.5), - V(3, 2), - V(4, 1), - V(4, 1.5), - V(4, 2), - V(5, 1), - V(5, 1.5), - V(5, 2), - V(6, 1), - V(6, 1.5), - V(6, 2), - V(7, 1), - V(7, 1.5), - V(7, 2), - V(8, 1), - V(8, 1.5), - V(8, 2) - }; - const std::map<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0])); - assert(std::distance(m.begin(), m.end()) == m.size()); - assert(std::distance(m.cbegin(), m.cend()) == m.size()); - assert(std::distance(m.rbegin(), m.rend()) == m.size()); - assert(std::distance(m.crbegin(), m.crend()) == m.size()); - std::map<int, double, std::less<int>, min_allocator<V>>::const_iterator i; - i = m.begin(); - for (int j = 1; j <= m.size(); ++j, ++i) - { - assert(i->first == j); - assert(i->second == 1); - } - } -#endif -#if _LIBCPP_STD_VER > 11 - { // N3644 testing - typedef std::map<int, double> C; - C::iterator ii1{}, ii2{}; - C::iterator ii4 = ii1; - C::const_iterator cii{}; - assert ( ii1 == ii2 ); - assert ( ii1 == ii4 ); - - assert (!(ii1 != ii2 )); - - assert ( (ii1 == cii )); - assert ( (cii == ii1 )); - assert (!(ii1 != cii )); - assert (!(cii != ii1 )); - } -#endif -} diff --git a/libcxx/test/containers/associative/map/map.access/max_size.pass.cpp b/libcxx/test/containers/associative/map/map.access/max_size.pass.cpp deleted file mode 100644 index 551120d331e..00000000000 --- a/libcxx/test/containers/associative/map/map.access/max_size.pass.cpp +++ /dev/null @@ -1,35 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// size_type max_size() const; - -#include <map> -#include <cassert> - -#include "min_allocator.h" - -int main() -{ - { - typedef std::map<int, double> M; - M m; - assert(m.max_size() != 0); - } -#if __cplusplus >= 201103L - { - typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M; - M m; - assert(m.max_size() != 0); - } -#endif -} diff --git a/libcxx/test/containers/associative/map/map.access/size.pass.cpp b/libcxx/test/containers/associative/map/map.access/size.pass.cpp deleted file mode 100644 index 07c12322a46..00000000000 --- a/libcxx/test/containers/associative/map/map.access/size.pass.cpp +++ /dev/null @@ -1,59 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// size_type size() const; - -#include <map> -#include <cassert> - -#include "min_allocator.h" - -int main() -{ - { - typedef std::map<int, double> M; - M m; - assert(m.size() == 0); - m.insert(M::value_type(2, 1.5)); - assert(m.size() == 1); - m.insert(M::value_type(1, 1.5)); - assert(m.size() == 2); - m.insert(M::value_type(3, 1.5)); - assert(m.size() == 3); - m.erase(m.begin()); - assert(m.size() == 2); - m.erase(m.begin()); - assert(m.size() == 1); - m.erase(m.begin()); - assert(m.size() == 0); - } -#if __cplusplus >= 201103L - { - typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M; - M m; - assert(m.size() == 0); - m.insert(M::value_type(2, 1.5)); - assert(m.size() == 1); - m.insert(M::value_type(1, 1.5)); - assert(m.size() == 2); - m.insert(M::value_type(3, 1.5)); - assert(m.size() == 3); - m.erase(m.begin()); - assert(m.size() == 2); - m.erase(m.begin()); - assert(m.size() == 1); - m.erase(m.begin()); - assert(m.size() == 0); - } -#endif -} diff --git a/libcxx/test/containers/associative/map/map.cons/alloc.pass.cpp b/libcxx/test/containers/associative/map/map.cons/alloc.pass.cpp deleted file mode 100644 index 2292c47ef74..00000000000 --- a/libcxx/test/containers/associative/map/map.cons/alloc.pass.cpp +++ /dev/null @@ -1,42 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// explicit map(const allocator_type& a); - -#include <map> -#include <cassert> - -#include "test_allocator.h" -#include "min_allocator.h" - -int main() -{ - { - typedef std::less<int> C; - typedef test_allocator<std::pair<const int, double> > A; - std::map<int, double, C, A> m(A(5)); - assert(m.empty()); - assert(m.begin() == m.end()); - assert(m.get_allocator() == A(5)); - } -#if __cplusplus >= 201103L - { - typedef std::less<int> C; - typedef min_allocator<std::pair<const int, double> > A; - std::map<int, double, C, A> m(A{}); - assert(m.empty()); - assert(m.begin() == m.end()); - assert(m.get_allocator() == A()); - } -#endif -} diff --git a/libcxx/test/containers/associative/map/map.cons/assign_initializer_list.pass.cpp b/libcxx/test/containers/associative/map/map.cons/assign_initializer_list.pass.cpp deleted file mode 100644 index 482d1acff84..00000000000 --- a/libcxx/test/containers/associative/map/map.cons/assign_initializer_list.pass.cpp +++ /dev/null @@ -1,75 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// map& operator=(initializer_list<value_type> il); - -#include <map> -#include <cassert> - -#include "min_allocator.h" - -int main() -{ -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - { - typedef std::pair<const int, double> V; - std::map<int, double> m = - { - {20, 1}, - }; - m = - { - {1, 1}, - {1, 1.5}, - {1, 2}, - {2, 1}, - {2, 1.5}, - {2, 2}, - {3, 1}, - {3, 1.5}, - {3, 2} - }; - assert(m.size() == 3); - assert(distance(m.begin(), m.end()) == 3); - assert(*m.begin() == V(1, 1)); - assert(*next(m.begin()) == V(2, 1)); - assert(*next(m.begin(), 2) == V(3, 1)); - } -#if __cplusplus >= 201103L - { - typedef std::pair<const int, double> V; - std::map<int, double, std::less<int>, min_allocator<V>> m = - { - {20, 1}, - }; - m = - { - {1, 1}, - {1, 1.5}, - {1, 2}, - {2, 1}, - {2, 1.5}, - {2, 2}, - {3, 1}, - {3, 1.5}, - {3, 2} - }; - assert(m.size() == 3); - assert(distance(m.begin(), m.end()) == 3); - assert(*m.begin() == V(1, 1)); - assert(*next(m.begin()) == V(2, 1)); - assert(*next(m.begin(), 2) == V(3, 1)); - } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS -} diff --git a/libcxx/test/containers/associative/map/map.cons/compare.pass.cpp b/libcxx/test/containers/associative/map/map.cons/compare.pass.cpp deleted file mode 100644 index 5a213c8e8b8..00000000000 --- a/libcxx/test/containers/associative/map/map.cons/compare.pass.cpp +++ /dev/null @@ -1,40 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// explicit map(const key_compare& comp); - -#include <map> -#include <cassert> - -#include "../../../test_compare.h" -#include "min_allocator.h" - -int main() -{ - { - typedef test_compare<std::less<int> > C; - std::map<int, double, C> m(C(3)); - assert(m.empty()); - assert(m.begin() == m.end()); - assert(m.key_comp() == C(3)); - } -#if __cplusplus >= 201103L - { - typedef test_compare<std::less<int> > C; - std::map<int, double, C, min_allocator<std::pair<const int, double>>> m(C(3)); - assert(m.empty()); - assert(m.begin() == m.end()); - assert(m.key_comp() == C(3)); - } -#endif -} diff --git a/libcxx/test/containers/associative/map/map.cons/compare_alloc.pass.cpp b/libcxx/test/containers/associative/map/map.cons/compare_alloc.pass.cpp deleted file mode 100644 index 56b3c3315e0..00000000000 --- a/libcxx/test/containers/associative/map/map.cons/compare_alloc.pass.cpp +++ /dev/null @@ -1,45 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// map(const key_compare& comp, const allocator_type& a); - -#include <map> -#include <cassert> - -#include "../../../test_compare.h" -#include "test_allocator.h" -#include "min_allocator.h" - -int main() -{ - { - typedef test_compare<std::less<int> > C; - typedef test_allocator<std::pair<const int, double> > A; - std::map<int, double, C, A> m(C(4), A(5)); - assert(m.empty()); - assert(m.begin() == m.end()); - assert(m.key_comp() == C(4)); - assert(m.get_allocator() == A(5)); - } -#if __cplusplus >= 201103L - { - typedef test_compare<std::less<int> > C; - typedef min_allocator<std::pair<const int, double> > A; - std::map<int, double, C, A> m(C(4), A()); - assert(m.empty()); - assert(m.begin() == m.end()); - assert(m.key_comp() == C(4)); - assert(m.get_allocator() == A()); - } -#endif -} diff --git a/libcxx/test/containers/associative/map/map.cons/copy.pass.cpp b/libcxx/test/containers/associative/map/map.cons/copy.pass.cpp deleted file mode 100644 index be527413308..00000000000 --- a/libcxx/test/containers/associative/map/map.cons/copy.pass.cpp +++ /dev/null @@ -1,131 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// map(const map& m); - -#include <map> -#include <cassert> - -#include "../../../test_compare.h" -#include "test_allocator.h" -#include "min_allocator.h" - -int main() -{ - { - typedef std::pair<const int, double> V; - V ar[] = - { - V(1, 1), - V(1, 1.5), - V(1, 2), - V(2, 1), - V(2, 1.5), - V(2, 2), - V(3, 1), - V(3, 1.5), - V(3, 2), - }; - typedef test_compare<std::less<int> > C; - typedef test_allocator<V> A; - std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7)); - std::map<int, double, C, A> m = mo; - assert(m.get_allocator() == A(7)); - assert(m.key_comp() == C(5)); - assert(m.size() == 3); - assert(distance(m.begin(), m.end()) == 3); - assert(*m.begin() == V(1, 1)); - assert(*next(m.begin()) == V(2, 1)); - assert(*next(m.begin(), 2) == V(3, 1)); - - assert(mo.get_allocator() == A(7)); - assert(mo.key_comp() == C(5)); - assert(mo.size() == 3); - assert(distance(mo.begin(), mo.end()) == 3); - assert(*mo.begin() == V(1, 1)); - assert(*next(mo.begin()) == V(2, 1)); - assert(*next(mo.begin(), 2) == V(3, 1)); - } -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE - { - typedef std::pair<const int, double> V; - V ar[] = - { - V(1, 1), - V(1, 1.5), - V(1, 2), - V(2, 1), - V(2, 1.5), - V(2, 2), - V(3, 1), - V(3, 1.5), - V(3, 2), - }; - typedef test_compare<std::less<int> > C; - typedef other_allocator<V> A; - std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7)); - std::map<int, double, C, A> m = mo; - assert(m.get_allocator() == A(-2)); - assert(m.key_comp() == C(5)); - assert(m.size() == 3); - assert(distance(m.begin(), m.end()) == 3); - assert(*m.begin() == V(1, 1)); - assert(*next(m.begin()) == V(2, 1)); - assert(*next(m.begin(), 2) == V(3, 1)); - - assert(mo.get_allocator() == A(7)); - assert(mo.key_comp() == C(5)); - assert(mo.size() == 3); - assert(distance(mo.begin(), mo.end()) == 3); - assert(*mo.begin() == V(1, 1)); - assert(*next(mo.begin()) == V(2, 1)); - assert(*next(mo.begin(), 2) == V(3, 1)); - } -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE -#if __cplusplus >= 201103L - { - typedef std::pair<const int, double> V; - V ar[] = - { - V(1, 1), - V(1, 1.5), - V(1, 2), - V(2, 1), - V(2, 1.5), - V(2, 2), - V(3, 1), - V(3, 1.5), - V(3, 2), - }; - typedef test_compare<std::less<int> > C; - typedef min_allocator<V> A; - std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A()); - std::map<int, double, C, A> m = mo; - assert(m.get_allocator() == A()); - assert(m.key_comp() == C(5)); - assert(m.size() == 3); - assert(distance(m.begin(), m.end()) == 3); - assert(*m.begin() == V(1, 1)); - assert(*next(m.begin()) == V(2, 1)); - assert(*next(m.begin(), 2) == V(3, 1)); - - assert(mo.get_allocator() == A()); - assert(mo.key_comp() == C(5)); - assert(mo.size() == 3); - assert(distance(mo.begin(), mo.end()) == 3); - assert(*mo.begin() == V(1, 1)); - assert(*next(mo.begin()) == V(2, 1)); - assert(*next(mo.begin(), 2) == V(3, 1)); - } -#endif -} diff --git a/libcxx/test/containers/associative/map/map.cons/copy_alloc.pass.cpp b/libcxx/test/containers/associative/map/map.cons/copy_alloc.pass.cpp deleted file mode 100644 index fcbe5976d6d..00000000000 --- a/libcxx/test/containers/associative/map/map.cons/copy_alloc.pass.cpp +++ /dev/null @@ -1,95 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// map(const map& m, const allocator_type& a); - -#include <map> -#include <cassert> - -#include "../../../test_compare.h" -#include "test_allocator.h" -#include "min_allocator.h" - -int main() -{ - { - typedef std::pair<const int, double> V; - V ar[] = - { - V(1, 1), - V(1, 1.5), - V(1, 2), - V(2, 1), - V(2, 1.5), - V(2, 2), - V(3, 1), - V(3, 1.5), - V(3, 2), - }; - typedef test_compare<std::less<int> > C; - typedef test_allocator<V> A; - std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7)); - std::map<int, double, C, A> m(mo, A(3)); - assert(m.get_allocator() == A(3)); - assert(m.key_comp() == C(5)); - assert(m.size() == 3); - assert(distance(m.begin(), m.end()) == 3); - assert(*m.begin() == V(1, 1)); - assert(*next(m.begin()) == V(2, 1)); - assert(*next(m.begin(), 2) == V(3, 1)); - - assert(mo.get_allocator() == A(7)); - assert(mo.key_comp() == C(5)); - assert(mo.size() == 3); - assert(distance(mo.begin(), mo.end()) == 3); - assert(*mo.begin() == V(1, 1)); - assert(*next(mo.begin()) == V(2, 1)); - assert(*next(mo.begin(), 2) == V(3, 1)); - } -#if __cplusplus >= 201103L - { - typedef std::pair<const int, double> V; - V ar[] = - { - V(1, 1), - V(1, 1.5), - V(1, 2), - V(2, 1), - V(2, 1.5), - V(2, 2), - V(3, 1), - V(3, 1.5), - V(3, 2), - }; - typedef test_compare<std::less<int> > C; - typedef min_allocator<V> A; - std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A()); - std::map<int, double, C, A> m(mo, A()); - assert(m.get_allocator() == A()); - assert(m.key_comp() == C(5)); - assert(m.size() == 3); - assert(distance(m.begin(), m.end()) == 3); - assert(*m.begin() == V(1, 1)); - assert(*next(m.begin()) == V(2, 1)); - assert(*next(m.begin(), 2) == V(3, 1)); - - assert(mo.get_allocator() == A()); - assert(mo.key_comp() == C(5)); - assert(mo.size() == 3); - assert(distance(mo.begin(), mo.end()) == 3); - assert(*mo.begin() == V(1, 1)); - assert(*next(mo.begin()) == V(2, 1)); - assert(*next(mo.begin(), 2) == V(3, 1)); - } -#endif -} diff --git a/libcxx/test/containers/associative/map/map.cons/copy_assign.pass.cpp b/libcxx/test/containers/associative/map/map.cons/copy_assign.pass.cpp deleted file mode 100644 index a1bcb30f429..00000000000 --- a/libcxx/test/containers/associative/map/map.cons/copy_assign.pass.cpp +++ /dev/null @@ -1,182 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// map& operator=(const map& m); - -#include <map> -#include <cassert> - -#include "../../../test_compare.h" -#include "test_allocator.h" -#include "min_allocator.h" - -int main() -{ - { - typedef std::pair<const int, double> V; - V ar[] = - { - V(1, 1), - V(1, 1.5), - V(1, 2), - V(2, 1), - V(2, 1.5), - V(2, 2), - V(3, 1), - V(3, 1.5), - V(3, 2) - }; - typedef test_compare<std::less<int> > C; - typedef test_allocator<V> A; - std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(2)); - std::map<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0])/2, C(3), A(7)); - m = mo; - assert(m.get_allocator() == A(7)); - assert(m.key_comp() == C(5)); - assert(m.size() == 3); - assert(distance(m.begin(), m.end()) == 3); - assert(*m.begin() == V(1, 1)); - assert(*next(m.begin()) == V(2, 1)); - assert(*next(m.begin(), 2) == V(3, 1)); - - assert(mo.get_allocator() == A(2)); - assert(mo.key_comp() == C(5)); - assert(mo.size() == 3); - assert(distance(mo.begin(), mo.end()) == 3); - assert(*mo.begin() == V(1, 1)); - assert(*next(mo.begin()) == V(2, 1)); - assert(*next(mo.begin(), 2) == V(3, 1)); - } - { - typedef std::pair<const int, double> V; - const V ar[] = - { - V(1, 1), - V(2, 1), - V(3, 1), - }; - std::map<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0])); - std::map<int, double> *p = &m; - m = *p; - - assert(m.size() == 3); - assert(std::equal(m.begin(), m.end(), ar)); - } - { - typedef std::pair<const int, double> V; - V ar[] = - { - V(1, 1), - V(1, 1.5), - V(1, 2), - V(2, 1), - V(2, 1.5), - V(2, 2), - V(3, 1), - V(3, 1.5), - V(3, 2) - }; - typedef test_compare<std::less<int> > C; - typedef other_allocator<V> A; - std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(2)); - std::map<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0])/2, C(3), A(7)); - m = mo; - assert(m.get_allocator() == A(2)); - assert(m.key_comp() == C(5)); - assert(m.size() == 3); - assert(distance(m.begin(), m.end()) == 3); - assert(*m.begin() == V(1, 1)); - assert(*next(m.begin()) == V(2, 1)); - assert(*next(m.begin(), 2) == V(3, 1)); - - assert(mo.get_allocator() == A(2)); - assert(mo.key_comp() == C(5)); - assert(mo.size() == 3); - assert(distance(mo.begin(), mo.end()) == 3); - assert(*mo.begin() == V(1, 1)); - assert(*next(mo.begin()) == V(2, 1)); - assert(*next(mo.begin(), 2) == V(3, 1)); - } -#if __cplusplus >= 201103L - { - typedef std::pair<const int, double> V; - V ar[] = - { - V(1, 1), - V(1, 1.5), - V(1, 2), - V(2, 1), - V(2, 1.5), - V(2, 2), - V(3, 1), - V(3, 1.5), - V(3, 2) - }; - typedef test_compare<std::less<int> > C; - typedef min_allocator<V> A; - std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A()); - std::map<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0])/2, C(3), A()); - m = mo; - assert(m.get_allocator() == A()); - assert(m.key_comp() == C(5)); - assert(m.size() == 3); - assert(distance(m.begin(), m.end()) == 3); - assert(*m.begin() == V(1, 1)); - assert(*next(m.begin()) == V(2, 1)); - assert(*next(m.begin(), 2) == V(3, 1)); - - assert(mo.get_allocator() == A()); - assert(mo.key_comp() == C(5)); - assert(mo.size() == 3); - assert(distance(mo.begin(), mo.end()) == 3); - assert(*mo.begin() == V(1, 1)); - assert(*next(mo.begin()) == V(2, 1)); - assert(*next(mo.begin(), 2) == V(3, 1)); - } - { - typedef std::pair<const int, double> V; - V ar[] = - { - V(1, 1), - V(1, 1.5), - V(1, 2), - V(2, 1), - V(2, 1.5), - V(2, 2), - V(3, 1), - V(3, 1.5), - V(3, 2) - }; - typedef test_compare<std::less<int> > C; - typedef min_allocator<V> A; - std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A()); - std::map<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0])/2, C(3), A()); - m = mo; - assert(m.get_allocator() == A()); - assert(m.key_comp() == C(5)); - assert(m.size() == 3); - assert(distance(m.begin(), m.end()) == 3); - assert(*m.begin() == V(1, 1)); - assert(*next(m.begin()) == V(2, 1)); - assert(*next(m.begin(), 2) == V(3, 1)); - - assert(mo.get_allocator() == A()); - assert(mo.key_comp() == C(5)); - assert(mo.size() == 3); - assert(distance(mo.begin(), mo.end()) == 3); - assert(*mo.begin() == V(1, 1)); - assert(*next(mo.begin()) == V(2, 1)); - assert(*next(mo.begin(), 2) == V(3, 1)); - } -#endif -} diff --git a/libcxx/test/containers/associative/map/map.cons/default.pass.cpp b/libcxx/test/containers/associative/map/map.cons/default.pass.cpp deleted file mode 100644 index 1832a32fffb..00000000000 --- a/libcxx/test/containers/associative/map/map.cons/default.pass.cpp +++ /dev/null @@ -1,40 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// map(); - -#include <map> -#include <cassert> - -#include "min_allocator.h" - -int main() -{ - { - std::map<int, double> m; - assert(m.empty()); - assert(m.begin() == m.end()); - } -#if __cplusplus >= 201103L - { - std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> m; - assert(m.empty()); - assert(m.begin() == m.end()); - } - { - std::map<int, double> m = {}; - assert(m.empty()); - assert(m.begin() == m.end()); - } -#endif -} diff --git a/libcxx/test/containers/associative/map/map.cons/default_noexcept.pass.cpp b/libcxx/test/containers/associative/map/map.cons/default_noexcept.pass.cpp deleted file mode 100644 index 6c6b6140f0f..00000000000 --- a/libcxx/test/containers/associative/map/map.cons/default_noexcept.pass.cpp +++ /dev/null @@ -1,53 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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> - -// map() -// noexcept( -// is_nothrow_default_constructible<allocator_type>::value && -// is_nothrow_default_constructible<key_compare>::value && -// is_nothrow_copy_constructible<key_compare>::value); - -// This tests a conforming extension - -#include <map> -#include <cassert> - -#include "../../../MoveOnly.h" -#include "test_allocator.h" - -template <class T> -struct some_comp -{ - typedef T value_type; - some_comp(); -}; - -int main() -{ -#if __has_feature(cxx_noexcept) - { - typedef std::map<MoveOnly, MoveOnly> C; - static_assert(std::is_nothrow_default_constructible<C>::value, ""); - } - { - typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C; - static_assert(std::is_nothrow_default_constructible<C>::value, ""); - } - { - typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C; - static_assert(!std::is_nothrow_default_constructible<C>::value, ""); - } - { - typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C; - static_assert(!std::is_nothrow_default_constructible<C>::value, ""); - } -#endif -} diff --git a/libcxx/test/containers/associative/map/map.cons/default_recursive.pass.cpp b/libcxx/test/containers/associative/map/map.cons/default_recursive.pass.cpp deleted file mode 100644 index 8b393d3c91c..00000000000 --- a/libcxx/test/containers/associative/map/map.cons/default_recursive.pass.cpp +++ /dev/null @@ -1,29 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// map(); - -#include <map> - -#if !__has_feature(cxx_noexcept) - -struct X -{ - std::map<int, X> m; -}; - -#endif - -int main() -{ -} diff --git a/libcxx/test/containers/associative/map/map.cons/dtor_noexcept.pass.cpp b/libcxx/test/containers/associative/map/map.cons/dtor_noexcept.pass.cpp deleted file mode 100644 index c60f2e7e8ba..00000000000 --- a/libcxx/test/containers/associative/map/map.cons/dtor_noexcept.pass.cpp +++ /dev/null @@ -1,51 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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> - -// ~map() // implied noexcept; - -#include <map> -#include <cassert> - -#include "../../../MoveOnly.h" -#include "test_allocator.h" - -#if __has_feature(cxx_noexcept) - -template <class T> -struct some_comp -{ - typedef T value_type; - ~some_comp() noexcept(false); -}; - -#endif - -int main() -{ -#if __has_feature(cxx_noexcept) - { - typedef std::map<MoveOnly, MoveOnly> C; - static_assert(std::is_nothrow_destructible<C>::value, ""); - } - { - typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C; - static_assert(std::is_nothrow_destructible<C>::value, ""); - } - { - typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C; - static_assert(std::is_nothrow_destructible<C>::value, ""); - } - { - typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C; - static_assert(!std::is_nothrow_destructible<C>::value, ""); - } -#endif -} diff --git a/libcxx/test/containers/associative/map/map.cons/initializer_list.pass.cpp b/libcxx/test/containers/associative/map/map.cons/initializer_list.pass.cpp deleted file mode 100644 index 196943653a1..00000000000 --- a/libcxx/test/containers/associative/map/map.cons/initializer_list.pass.cpp +++ /dev/null @@ -1,67 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// map(initializer_list<value_type> il); - -#include <map> -#include <cassert> - -#include "min_allocator.h" - -int main() -{ -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - { - typedef std::pair<const int, double> V; - std::map<int, double> m = - { - {1, 1}, - {1, 1.5}, - {1, 2}, - {2, 1}, - {2, 1.5}, - {2, 2}, - {3, 1}, - {3, 1.5}, - {3, 2} - }; - assert(m.size() == 3); - assert(distance(m.begin(), m.end()) == 3); - assert(*m.begin() == V(1, 1)); - assert(*next(m.begin()) == V(2, 1)); - assert(*next(m.begin(), 2) == V(3, 1)); - } -#if __cplusplus >= 201103L - { - typedef std::pair<const int, double> V; - std::map<int, double, std::less<int>, min_allocator<V>> m = - { - {1, 1}, - {1, 1.5}, - {1, 2}, - {2, 1}, - {2, 1.5}, - {2, 2}, - {3, 1}, - {3, 1.5}, - {3, 2} - }; - assert(m.size() == 3); - assert(distance(m.begin(), m.end()) == 3); - assert(*m.begin() == V(1, 1)); - assert(*next(m.begin()) == V(2, 1)); - assert(*next(m.begin(), 2) == V(3, 1)); - } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS -} diff --git a/libcxx/test/containers/associative/map/map.cons/initializer_list_compare.pass.cpp b/libcxx/test/containers/associative/map/map.cons/initializer_list_compare.pass.cpp deleted file mode 100644 index 08f8a529f03..00000000000 --- a/libcxx/test/containers/associative/map/map.cons/initializer_list_compare.pass.cpp +++ /dev/null @@ -1,69 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// map(initializer_list<value_type> il, const key_compare& comp); - -#include <map> -#include <cassert> -#include "../../../test_compare.h" -#include "min_allocator.h" - -int main() -{ -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - { - typedef std::pair<const int, double> V; - typedef test_compare<std::less<int> > C; - std::map<int, double, C> m({ - {1, 1}, - {1, 1.5}, - {1, 2}, - {2, 1}, - {2, 1.5}, - {2, 2}, - {3, 1}, - {3, 1.5}, - {3, 2} - }, C(3)); - assert(m.size() == 3); - assert(distance(m.begin(), m.end()) == 3); - assert(*m.begin() == V(1, 1)); - assert(*next(m.begin()) == V(2, 1)); - assert(*next(m.begin(), 2) == V(3, 1)); - assert(m.key_comp() == C(3)); - } -#if __cplusplus >= 201103L - { - typedef std::pair<const int, double> V; - typedef test_compare<std::less<int> > C; - std::map<int, double, C, min_allocator<std::pair<const int, double>>> m({ - {1, 1}, - {1, 1.5}, - {1, 2}, - {2, 1}, - {2, 1.5}, - {2, 2}, - {3, 1}, - {3, 1.5}, - {3, 2} - }, C(3)); - assert(m.size() == 3); - assert(distance(m.begin(), m.end()) == 3); - assert(*m.begin() == V(1, 1)); - assert(*next(m.begin()) == V(2, 1)); - assert(*next(m.begin(), 2) == V(3, 1)); - assert(m.key_comp() == C(3)); - } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS -} diff --git a/libcxx/test/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp b/libcxx/test/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp deleted file mode 100644 index 765428a631e..00000000000 --- a/libcxx/test/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp +++ /dev/null @@ -1,100 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// map(initializer_list<value_type> il, const key_compare& comp, const allocator_type& a); - -#include <map> -#include <cassert> -#include "../../../test_compare.h" -#include "test_allocator.h" -#include "min_allocator.h" - -int main() -{ -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - { - typedef std::pair<const int, double> V; - typedef test_compare<std::less<int> > C; - typedef test_allocator<std::pair<const int, double> > A; - std::map<int, double, C, A> m({ - {1, 1}, - {1, 1.5}, - {1, 2}, - {2, 1}, - {2, 1.5}, - {2, 2}, - {3, 1}, - {3, 1.5}, - {3, 2} - }, C(3), A(6)); - assert(m.size() == 3); - assert(distance(m.begin(), m.end()) == 3); - assert(*m.begin() == V(1, 1)); - assert(*next(m.begin()) == V(2, 1)); - assert(*next(m.begin(), 2) == V(3, 1)); - assert(m.key_comp() == C(3)); - assert(m.get_allocator() == A(6)); - } -#if __cplusplus >= 201103L - { - typedef std::pair<const int, double> V; - typedef test_compare<std::less<int> > C; - typedef min_allocator<std::pair<const int, double> > A; - std::map<int, double, C, A> m({ - {1, 1}, - {1, 1.5}, - {1, 2}, - {2, 1}, - {2, 1.5}, - {2, 2}, - {3, 1}, - {3, 1.5}, - {3, 2} - }, C(3), A()); - assert(m.size() == 3); - assert(distance(m.begin(), m.end()) == 3); - assert(*m.begin() == V(1, 1)); - assert(*next(m.begin()) == V(2, 1)); - assert(*next(m.begin(), 2) == V(3, 1)); - assert(m.key_comp() == C(3)); - assert(m.get_allocator() == A()); - } -#if _LIBCPP_STD_VER > 11 - { - typedef std::pair<const int, double> V; - typedef min_allocator<V> A; - typedef test_compare<std::less<int> > C; - typedef std::map<int, double, C, A> M; - A a; - M m ({ {1, 1}, - {1, 1.5}, - {1, 2}, - {2, 1}, - {2, 1.5}, - {2, 2}, - {3, 1}, - {3, 1.5}, - {3, 2} - }, a); - - assert(m.size() == 3); - assert(distance(m.begin(), m.end()) == 3); - assert(*m.begin() == V(1, 1)); - assert(*next(m.begin()) == V(2, 1)); - assert(*next(m.begin(), 2) == V(3, 1)); - assert(m.get_allocator() == a); - } -#endif -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS -} diff --git a/libcxx/test/containers/associative/map/map.cons/iter_iter.pass.cpp b/libcxx/test/containers/associative/map/map.cons/iter_iter.pass.cpp deleted file mode 100644 index c1029af6889..00000000000 --- a/libcxx/test/containers/associative/map/map.cons/iter_iter.pass.cpp +++ /dev/null @@ -1,68 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// template <class InputIterator> -// map(InputIterator first, InputIterator last); - -#include <map> -#include <cassert> - -#include "min_allocator.h" - -int main() -{ - { - typedef std::pair<const int, double> V; - V ar[] = - { - V(1, 1), - V(1, 1.5), - V(1, 2), - V(2, 1), - V(2, 1.5), - V(2, 2), - V(3, 1), - V(3, 1.5), - V(3, 2), - }; - std::map<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0])); - assert(m.size() == 3); - assert(distance(m.begin(), m.end()) == 3); - assert(*m.begin() == V(1, 1)); - assert(*next(m.begin()) == V(2, 1)); - assert(*next(m.begin(), 2) == V(3, 1)); - } -#if __cplusplus >= 201103L - { - typedef std::pair<const int, double> V; - V ar[] = - { - V(1, 1), - V(1, 1.5), - V(1, 2), - V(2, 1), - V(2, 1.5), - V(2, 2), - V(3, 1), - V(3, 1.5), - V(3, 2), - }; - std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> m(ar, ar+sizeof(ar)/sizeof(ar[0])); - assert(m.size() == 3); - assert(distance(m.begin(), m.end()) == 3); - assert(*m.begin() == V(1, 1)); - assert(*next(m.begin()) == V(2, 1)); - assert(*next(m.begin(), 2) == V(3, 1)); - } -#endif -} diff --git a/libcxx/test/containers/associative/map/map.cons/iter_iter_comp.pass.cpp b/libcxx/test/containers/associative/map/map.cons/iter_iter_comp.pass.cpp deleted file mode 100644 index 837fa8c6cde..00000000000 --- a/libcxx/test/containers/associative/map/map.cons/iter_iter_comp.pass.cpp +++ /dev/null @@ -1,73 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// template <class InputIterator> -// map(InputIterator first, InputIterator last, const key_compare& comp); - -#include <map> -#include <cassert> - -#include "../../../test_compare.h" -#include "min_allocator.h" - -int main() -{ - { - typedef std::pair<const int, double> V; - V ar[] = - { - V(1, 1), - V(1, 1.5), - V(1, 2), - V(2, 1), - V(2, 1.5), - V(2, 2), - V(3, 1), - V(3, 1.5), - V(3, 2), - }; - typedef test_compare<std::less<int> > C; - std::map<int, double, C> m(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5)); - assert(m.key_comp() == C(5)); - assert(m.size() == 3); - assert(distance(m.begin(), m.end()) == 3); - assert(*m.begin() == V(1, 1)); - assert(*next(m.begin()) == V(2, 1)); - assert(*next(m.begin(), 2) == V(3, 1)); - } -#if __cplusplus >= 201103L - { - typedef std::pair<const int, double> V; - V ar[] = - { - V(1, 1), - V(1, 1.5), - V(1, 2), - V(2, 1), - V(2, 1.5), - V(2, 2), - V(3, 1), - V(3, 1.5), - V(3, 2), - }; - typedef test_compare<std::less<int> > C; - std::map<int, double, C, min_allocator<std::pair<const int, double>>> m(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5)); - assert(m.key_comp() == C(5)); - assert(m.size() == 3); - assert(distance(m.begin(), m.end()) == 3); - assert(*m.begin() == V(1, 1)); - assert(*next(m.begin()) == V(2, 1)); - assert(*next(m.begin(), 2) == V(3, 1)); - } -#endif -} diff --git a/libcxx/test/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp b/libcxx/test/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp deleted file mode 100644 index 67fb5d64476..00000000000 --- a/libcxx/test/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp +++ /dev/null @@ -1,108 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// template <class InputIterator> -// map(InputIterator first, InputIterator last, -// const key_compare& comp, const allocator_type& a); - -#include <map> -#include <cassert> - -#include "../../../test_compare.h" -#include "test_allocator.h" -#include "min_allocator.h" - -int main() -{ - { - typedef std::pair<const int, double> V; - V ar[] = - { - V(1, 1), - V(1, 1.5), - V(1, 2), - V(2, 1), - V(2, 1.5), - V(2, 2), - V(3, 1), - V(3, 1.5), - V(3, 2), - }; - typedef test_compare<std::less<int> > C; - typedef test_allocator<V> A; - std::map<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7)); - assert(m.get_allocator() == A(7)); - assert(m.key_comp() == C(5)); - assert(m.size() == 3); - assert(distance(m.begin(), m.end()) == 3); - assert(*m.begin() == V(1, 1)); - assert(*next(m.begin()) == V(2, 1)); - assert(*next(m.begin(), 2) == V(3, 1)); - } -#if __cplusplus >= 201103L - { - typedef std::pair<const int, double> V; - V ar[] = - { - V(1, 1), - V(1, 1.5), - V(1, 2), - V(2, 1), - V(2, 1.5), - V(2, 2), - V(3, 1), - V(3, 1.5), - V(3, 2), - }; - typedef test_compare<std::less<int> > C; - typedef min_allocator<V> A; - std::map<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A()); - assert(m.get_allocator() == A()); - assert(m.key_comp() == C(5)); - assert(m.size() == 3); - assert(distance(m.begin(), m.end()) == 3); - assert(*m.begin() == V(1, 1)); - assert(*next(m.begin()) == V(2, 1)); - assert(*next(m.begin(), 2) == V(3, 1)); - } -#if _LIBCPP_STD_VER > 11 - { - typedef std::pair<const int, double> V; - V ar[] = - { - V(1, 1), - V(1, 1.5), - V(1, 2), - V(2, 1), - V(2, 1.5), - V(2, 2), - V(3, 1), - V(3, 1.5), - V(3, 2), - }; - typedef std::pair<const int, double> V; - typedef min_allocator<V> A; - typedef test_compare<std::less<int> > C; - A a; - std::map<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0]), a ); - - assert(m.size() == 3); - assert(distance(m.begin(), m.end()) == 3); - assert(*m.begin() == V(1, 1)); - assert(*next(m.begin()) == V(2, 1)); - assert(*next(m.begin(), 2) == V(3, 1)); - assert(m.get_allocator() == a); - } -#endif -#endif -} diff --git a/libcxx/test/containers/associative/map/map.cons/move.pass.cpp b/libcxx/test/containers/associative/map/map.cons/move.pass.cpp deleted file mode 100644 index c06f2ee5021..00000000000 --- a/libcxx/test/containers/associative/map/map.cons/move.pass.cpp +++ /dev/null @@ -1,120 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// map(map&& m); - -#include <map> -#include <cassert> - -#include "../../../test_compare.h" -#include "test_allocator.h" -#include "min_allocator.h" - -int main() -{ -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - typedef std::pair<const int, double> V; - { - typedef test_compare<std::less<int> > C; - typedef test_allocator<V> A; - std::map<int, double, C, A> mo(C(5), A(7)); - std::map<int, double, C, A> m = std::move(mo); - assert(m.get_allocator() == A(7)); - assert(m.key_comp() == C(5)); - assert(m.size() == 0); - assert(distance(m.begin(), m.end()) == 0); - - assert(mo.get_allocator() == A(7)); - assert(mo.key_comp() == C(5)); - assert(mo.size() == 0); - assert(distance(mo.begin(), mo.end()) == 0); - } - { - V ar[] = - { - V(1, 1), - V(1, 1.5), - V(1, 2), - V(2, 1), - V(2, 1.5), - V(2, 2), - V(3, 1), - V(3, 1.5), - V(3, 2), - }; - typedef test_compare<std::less<int> > C; - typedef test_allocator<V> A; - std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7)); - std::map<int, double, C, A> m = std::move(mo); - assert(m.get_allocator() == A(7)); - assert(m.key_comp() == C(5)); - assert(m.size() == 3); - assert(distance(m.begin(), m.end()) == 3); - assert(*m.begin() == V(1, 1)); - assert(*next(m.begin()) == V(2, 1)); - assert(*next(m.begin(), 2) == V(3, 1)); - - assert(mo.get_allocator() == A(7)); - assert(mo.key_comp() == C(5)); - assert(mo.size() == 0); - assert(distance(mo.begin(), mo.end()) == 0); - } -#if __cplusplus >= 201103L - { - typedef test_compare<std::less<int> > C; - typedef min_allocator<V> A; - std::map<int, double, C, A> mo(C(5), A()); - std::map<int, double, C, A> m = std::move(mo); - assert(m.get_allocator() == A()); - assert(m.key_comp() == C(5)); - assert(m.size() == 0); - assert(distance(m.begin(), m.end()) == 0); - - assert(mo.get_allocator() == A()); - assert(mo.key_comp() == C(5)); - assert(mo.size() == 0); - assert(distance(mo.begin(), mo.end()) == 0); - } - { - V ar[] = - { - V(1, 1), - V(1, 1.5), - V(1, 2), - V(2, 1), - V(2, 1.5), - V(2, 2), - V(3, 1), - V(3, 1.5), - V(3, 2), - }; - typedef test_compare<std::less<int> > C; - typedef min_allocator<V> A; - std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A()); - std::map<int, double, C, A> m = std::move(mo); - assert(m.get_allocator() == A()); - assert(m.key_comp() == C(5)); - assert(m.size() == 3); - assert(distance(m.begin(), m.end()) == 3); - assert(*m.begin() == V(1, 1)); - assert(*next(m.begin()) == V(2, 1)); - assert(*next(m.begin(), 2) == V(3, 1)); - - assert(mo.get_allocator() == A()); - assert(mo.key_comp() == C(5)); - assert(mo.size() == 0); - assert(distance(mo.begin(), mo.end()) == 0); - } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -} diff --git a/libcxx/test/containers/associative/map/map.cons/move_alloc.pass.cpp b/libcxx/test/containers/associative/map/map.cons/move_alloc.pass.cpp deleted file mode 100644 index 1845e88b7a5..00000000000 --- a/libcxx/test/containers/associative/map/map.cons/move_alloc.pass.cpp +++ /dev/null @@ -1,186 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// map(map&& m, const allocator_type& a); - -#include <map> -#include <cassert> - -#include "../../../MoveOnly.h" -#include "../../../test_compare.h" -#include "test_allocator.h" -#include "min_allocator.h" - -int main() -{ -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - { - typedef std::pair<MoveOnly, MoveOnly> V; - typedef std::pair<const MoveOnly, MoveOnly> VC; - typedef test_compare<std::less<MoveOnly> > C; - typedef test_allocator<VC> A; - typedef std::map<MoveOnly, MoveOnly, C, A> M; - typedef std::move_iterator<V*> I; - V a1[] = - { - V(1, 1), - V(1, 2), - V(1, 3), - V(2, 1), - V(2, 2), - V(2, 3), - V(3, 1), - V(3, 2), - V(3, 3) - }; - M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7)); - V a2[] = - { - V(1, 1), - V(1, 2), - V(1, 3), - V(2, 1), - V(2, 2), - V(2, 3), - V(3, 1), - V(3, 2), - V(3, 3) - }; - M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A(7)); - M m3(std::move(m1), A(7)); - assert(m3 == m2); - assert(m3.get_allocator() == A(7)); - assert(m3.key_comp() == C(5)); - assert(m1.empty()); - } - { - typedef std::pair<MoveOnly, MoveOnly> V; - typedef std::pair<const MoveOnly, MoveOnly> VC; - typedef test_compare<std::less<MoveOnly> > C; - typedef test_allocator<VC> A; - typedef std::map<MoveOnly, MoveOnly, C, A> M; - typedef std::move_iterator<V*> I; - V a1[] = - { - V(1, 1), - V(1, 2), - V(1, 3), - V(2, 1), - V(2, 2), - V(2, 3), - V(3, 1), - V(3, 2), - V(3, 3) - }; - M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7)); - V a2[] = - { - V(1, 1), - V(1, 2), - V(1, 3), - V(2, 1), - V(2, 2), - V(2, 3), - V(3, 1), - V(3, 2), - V(3, 3) - }; - M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A(7)); - M m3(std::move(m1), A(5)); - assert(m3 == m2); - assert(m3.get_allocator() == A(5)); - assert(m3.key_comp() == C(5)); - assert(m1.empty()); - } - { - typedef std::pair<MoveOnly, MoveOnly> V; - typedef std::pair<const MoveOnly, MoveOnly> VC; - typedef test_compare<std::less<MoveOnly> > C; - typedef other_allocator<VC> A; - typedef std::map<MoveOnly, MoveOnly, C, A> M; - typedef std::move_iterator<V*> I; - V a1[] = - { - V(1, 1), - V(1, 2), - V(1, 3), - V(2, 1), - V(2, 2), - V(2, 3), - V(3, 1), - V(3, 2), - V(3, 3) - }; - M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7)); - V a2[] = - { - V(1, 1), - V(1, 2), - V(1, 3), - V(2, 1), - V(2, 2), - V(2, 3), - V(3, 1), - V(3, 2), - V(3, 3) - }; - M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A(7)); - M m3(std::move(m1), A(5)); - assert(m3 == m2); - assert(m3.get_allocator() == A(5)); - assert(m3.key_comp() == C(5)); - assert(m1.empty()); - } -#if __cplusplus >= 201103L - { - typedef std::pair<MoveOnly, MoveOnly> V; - typedef std::pair<const MoveOnly, MoveOnly> VC; - typedef test_compare<std::less<MoveOnly> > C; - typedef min_allocator<VC> A; - typedef std::map<MoveOnly, MoveOnly, C, A> M; - typedef std::move_iterator<V*> I; - V a1[] = - { - V(1, 1), - V(1, 2), - V(1, 3), - V(2, 1), - V(2, 2), - V(2, 3), - V(3, 1), - V(3, 2), - V(3, 3) - }; - M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A()); - V a2[] = - { - V(1, 1), - V(1, 2), - V(1, 3), - V(2, 1), - V(2, 2), - V(2, 3), - V(3, 1), - V(3, 2), - V(3, 3) - }; - M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A()); - M m3(std::move(m1), A()); - assert(m3 == m2); - assert(m3.get_allocator() == A()); - assert(m3.key_comp() == C(5)); - assert(m1.empty()); - } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -} diff --git a/libcxx/test/containers/associative/map/map.cons/move_assign.pass.cpp b/libcxx/test/containers/associative/map/map.cons/move_assign.pass.cpp deleted file mode 100644 index 6d285fce000..00000000000 --- a/libcxx/test/containers/associative/map/map.cons/move_assign.pass.cpp +++ /dev/null @@ -1,190 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// map& operator=(map&& m); - -#include <map> -#include <cassert> - -#include "../../../MoveOnly.h" -#include "../../../test_compare.h" -#include "test_allocator.h" -#include "min_allocator.h" - -int main() -{ -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - { - typedef std::pair<MoveOnly, MoveOnly> V; - typedef std::pair<const MoveOnly, MoveOnly> VC; - typedef test_compare<std::less<MoveOnly> > C; - typedef test_allocator<VC> A; - typedef std::map<MoveOnly, MoveOnly, C, A> M; - typedef std::move_iterator<V*> I; - V a1[] = - { - V(1, 1), - V(1, 2), - V(1, 3), - V(2, 1), - V(2, 2), - V(2, 3), - V(3, 1), - V(3, 2), - V(3, 3) - }; - M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7)); - V a2[] = - { - V(1, 1), - V(1, 2), - V(1, 3), - V(2, 1), - V(2, 2), - V(2, 3), - V(3, 1), - V(3, 2), - V(3, 3) - }; - M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A(7)); - M m3(C(3), A(7)); - m3 = std::move(m1); - assert(m3 == m2); - assert(m3.get_allocator() == A(7)); - assert(m3.key_comp() == C(5)); - assert(m1.empty()); - } - { - typedef std::pair<MoveOnly, MoveOnly> V; - typedef std::pair<const MoveOnly, MoveOnly> VC; - typedef test_compare<std::less<MoveOnly> > C; - typedef test_allocator<VC> A; - typedef std::map<MoveOnly, MoveOnly, C, A> M; - typedef std::move_iterator<V*> I; - V a1[] = - { - V(1, 1), - V(1, 2), - V(1, 3), - V(2, 1), - V(2, 2), - V(2, 3), - V(3, 1), - V(3, 2), - V(3, 3) - }; - M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7)); - V a2[] = - { - V(1, 1), - V(1, 2), - V(1, 3), - V(2, 1), - V(2, 2), - V(2, 3), - V(3, 1), - V(3, 2), - V(3, 3) - }; - M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A(7)); - M m3(C(3), A(5)); - m3 = std::move(m1); - assert(m3 == m2); - assert(m3.get_allocator() == A(5)); - assert(m3.key_comp() == C(5)); - assert(m1.empty()); - } - { - typedef std::pair<MoveOnly, MoveOnly> V; - typedef std::pair<const MoveOnly, MoveOnly> VC; - typedef test_compare<std::less<MoveOnly> > C; - typedef other_allocator<VC> A; - typedef std::map<MoveOnly, MoveOnly, C, A> M; - typedef std::move_iterator<V*> I; - V a1[] = - { - V(1, 1), - V(1, 2), - V(1, 3), - V(2, 1), - V(2, 2), - V(2, 3), - V(3, 1), - V(3, 2), - V(3, 3) - }; - M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A(7)); - V a2[] = - { - V(1, 1), - V(1, 2), - V(1, 3), - V(2, 1), - V(2, 2), - V(2, 3), - V(3, 1), - V(3, 2), - V(3, 3) - }; - M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A(7)); - M m3(C(3), A(5)); - m3 = std::move(m1); - assert(m3 == m2); - assert(m3.get_allocator() == A(7)); - assert(m3.key_comp() == C(5)); - assert(m1.empty()); - } -#if __cplusplus >= 201103L - { - typedef std::pair<MoveOnly, MoveOnly> V; - typedef std::pair<const MoveOnly, MoveOnly> VC; - typedef test_compare<std::less<MoveOnly> > C; - typedef min_allocator<VC> A; - typedef std::map<MoveOnly, MoveOnly, C, A> M; - typedef std::move_iterator<V*> I; - V a1[] = - { - V(1, 1), - V(1, 2), - V(1, 3), - V(2, 1), - V(2, 2), - V(2, 3), - V(3, 1), - V(3, 2), - V(3, 3) - }; - M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A()); - V a2[] = - { - V(1, 1), - V(1, 2), - V(1, 3), - V(2, 1), - V(2, 2), - V(2, 3), - V(3, 1), - V(3, 2), - V(3, 3) - }; - M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A()); - M m3(C(3), A()); - m3 = std::move(m1); - assert(m3 == m2); - assert(m3.get_allocator() == A()); - assert(m3.key_comp() == C(5)); - assert(m1.empty()); - } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -} diff --git a/libcxx/test/containers/associative/map/map.cons/move_assign_noexcept.pass.cpp b/libcxx/test/containers/associative/map/map.cons/move_assign_noexcept.pass.cpp deleted file mode 100644 index d12f9a9784f..00000000000 --- a/libcxx/test/containers/associative/map/map.cons/move_assign_noexcept.pass.cpp +++ /dev/null @@ -1,53 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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> - -// map& operator=(map&& c) -// noexcept( -// allocator_type::propagate_on_container_move_assignment::value && -// is_nothrow_move_assignable<allocator_type>::value && -// is_nothrow_move_assignable<key_compare>::value); - -// This tests a conforming extension - -#include <map> -#include <cassert> - -#include "../../../MoveOnly.h" -#include "test_allocator.h" - -template <class T> -struct some_comp -{ - typedef T value_type; - some_comp& operator=(const some_comp&); -}; - -int main() -{ -#if __has_feature(cxx_noexcept) - { - typedef std::map<MoveOnly, MoveOnly> C; - static_assert(std::is_nothrow_move_assignable<C>::value, ""); - } - { - typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C; - static_assert(!std::is_nothrow_move_assignable<C>::value, ""); - } - { - typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C; - static_assert(std::is_nothrow_move_assignable<C>::value, ""); - } - { - typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C; - static_assert(!std::is_nothrow_move_assignable<C>::value, ""); - } -#endif -} diff --git a/libcxx/test/containers/associative/map/map.cons/move_noexcept.pass.cpp b/libcxx/test/containers/associative/map/map.cons/move_noexcept.pass.cpp deleted file mode 100644 index 6de4b67b326..00000000000 --- a/libcxx/test/containers/associative/map/map.cons/move_noexcept.pass.cpp +++ /dev/null @@ -1,51 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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> - -// map(map&&) -// noexcept(is_nothrow_move_constructible<allocator_type>::value && -// is_nothrow_move_constructible<key_compare>::value); - -// This tests a conforming extension - -#include <map> -#include <cassert> - -#include "../../../MoveOnly.h" -#include "test_allocator.h" - -template <class T> -struct some_comp -{ - typedef T value_type; - some_comp(const some_comp&); -}; - -int main() -{ -#if __has_feature(cxx_noexcept) - { - typedef std::map<MoveOnly, MoveOnly> C; - static_assert(std::is_nothrow_move_constructible<C>::value, ""); - } - { - typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C; - static_assert(std::is_nothrow_move_constructible<C>::value, ""); - } - { - typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C; - static_assert(std::is_nothrow_move_constructible<C>::value, ""); - } - { - typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C; - static_assert(!std::is_nothrow_move_constructible<C>::value, ""); - } -#endif -} diff --git a/libcxx/test/containers/associative/map/map.modifiers/clear.pass.cpp b/libcxx/test/containers/associative/map/map.modifiers/clear.pass.cpp deleted file mode 100644 index c37499df307..00000000000 --- a/libcxx/test/containers/associative/map/map.modifiers/clear.pass.cpp +++ /dev/null @@ -1,63 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// void clear(); - -#include <map> -#include <cassert> - -#include "min_allocator.h" - -int main() -{ - { - typedef std::map<int, double> M; - typedef std::pair<int, double> P; - P ar[] = - { - P(1, 1.5), - P(2, 2.5), - P(3, 3.5), - P(4, 4.5), - P(5, 5.5), - P(6, 6.5), - P(7, 7.5), - P(8, 8.5), - }; - M m(ar, ar + sizeof(ar)/sizeof(ar[0])); - assert(m.size() == 8); - m.clear(); - assert(m.size() == 0); - } -#if __cplusplus >= 201103L - { - typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M; - typedef std::pair<int, double> P; - P ar[] = - { - P(1, 1.5), - P(2, 2.5), - P(3, 3.5), - P(4, 4.5), - P(5, 5.5), - P(6, 6.5), - P(7, 7.5), - P(8, 8.5), - }; - M m(ar, ar + sizeof(ar)/sizeof(ar[0])); - assert(m.size() == 8); - m.clear(); - assert(m.size() == 0); - } -#endif -} diff --git a/libcxx/test/containers/associative/map/map.modifiers/emplace.pass.cpp b/libcxx/test/containers/associative/map/map.modifiers/emplace.pass.cpp deleted file mode 100644 index 81846c6647c..00000000000 --- a/libcxx/test/containers/associative/map/map.modifiers/emplace.pass.cpp +++ /dev/null @@ -1,165 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// template <class... Args> -// pair<iterator, bool> emplace(Args&&... args); - -#include <map> -#include <cassert> -#include <tuple> - -#include "../../../Emplaceable.h" -#include "DefaultOnly.h" -#include "min_allocator.h" - -int main() -{ -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - { - typedef std::map<int, DefaultOnly> M; - typedef std::pair<M::iterator, bool> R; - M m; - assert(DefaultOnly::count == 0); - R r = m.emplace(); - assert(r.second); - assert(r.first == m.begin()); - assert(m.size() == 1); - assert(m.begin()->first == 0); - assert(m.begin()->second == DefaultOnly()); - assert(DefaultOnly::count == 1); - r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1), - std::forward_as_tuple()); - assert(r.second); - assert(r.first == next(m.begin())); - assert(m.size() == 2); - assert(next(m.begin())->first == 1); - assert(next(m.begin())->second == DefaultOnly()); - assert(DefaultOnly::count == 2); - r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1), - std::forward_as_tuple()); - assert(!r.second); - assert(r.first == next(m.begin())); - assert(m.size() == 2); - assert(next(m.begin())->first == 1); - assert(next(m.begin())->second == DefaultOnly()); - assert(DefaultOnly::count == 2); - } - assert(DefaultOnly::count == 0); - { - typedef std::map<int, Emplaceable> M; - typedef std::pair<M::iterator, bool> R; - M m; - R r = m.emplace(std::piecewise_construct, std::forward_as_tuple(2), - std::forward_as_tuple()); - assert(r.second); - assert(r.first == m.begin()); - assert(m.size() == 1); - assert(m.begin()->first == 2); - assert(m.begin()->second == Emplaceable()); - r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1), - std::forward_as_tuple(2, 3.5)); - assert(r.second); - assert(r.first == m.begin()); - assert(m.size() == 2); - assert(m.begin()->first == 1); - assert(m.begin()->second == Emplaceable(2, 3.5)); - r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1), - std::forward_as_tuple(2, 3.5)); - assert(!r.second); - assert(r.first == m.begin()); - assert(m.size() == 2); - assert(m.begin()->first == 1); - assert(m.begin()->second == Emplaceable(2, 3.5)); - } - { - typedef std::map<int, double> M; - typedef std::pair<M::iterator, bool> R; - M m; - R r = m.emplace(M::value_type(2, 3.5)); - assert(r.second); - assert(r.first == m.begin()); - assert(m.size() == 1); - assert(m.begin()->first == 2); - assert(m.begin()->second == 3.5); - } -#if __cplusplus >= 201103L - { - typedef std::map<int, DefaultOnly, std::less<int>, min_allocator<std::pair<const int, DefaultOnly>>> M; - typedef std::pair<M::iterator, bool> R; - M m; - assert(DefaultOnly::count == 0); - R r = m.emplace(); - assert(r.second); - assert(r.first == m.begin()); - assert(m.size() == 1); - assert(m.begin()->first == 0); - assert(m.begin()->second == DefaultOnly()); - assert(DefaultOnly::count == 1); - r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1), - std::forward_as_tuple()); - assert(r.second); - assert(r.first == next(m.begin())); - assert(m.size() == 2); - assert(next(m.begin())->first == 1); - assert(next(m.begin())->second == DefaultOnly()); - assert(DefaultOnly::count == 2); - r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1), - std::forward_as_tuple()); - assert(!r.second); - assert(r.first == next(m.begin())); - assert(m.size() == 2); - assert(next(m.begin())->first == 1); - assert(next(m.begin())->second == DefaultOnly()); - assert(DefaultOnly::count == 2); - } - assert(DefaultOnly::count == 0); - { - typedef std::map<int, Emplaceable, std::less<int>, min_allocator<std::pair<const int, Emplaceable>>> M; - typedef std::pair<M::iterator, bool> R; - M m; - R r = m.emplace(std::piecewise_construct, std::forward_as_tuple(2), - std::forward_as_tuple()); - assert(r.second); - assert(r.first == m.begin()); - assert(m.size() == 1); - assert(m.begin()->first == 2); - assert(m.begin()->second == Emplaceable()); - r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1), - std::forward_as_tuple(2, 3.5)); - assert(r.second); - assert(r.first == m.begin()); - assert(m.size() == 2); - assert(m.begin()->first == 1); - assert(m.begin()->second == Emplaceable(2, 3.5)); - r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1), - std::forward_as_tuple(2, 3.5)); - assert(!r.second); - assert(r.first == m.begin()); - assert(m.size() == 2); - assert(m.begin()->first == 1); - assert(m.begin()->second == Emplaceable(2, 3.5)); - } - { - typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M; - typedef std::pair<M::iterator, bool> R; - M m; - R r = m.emplace(M::value_type(2, 3.5)); - assert(r.second); - assert(r.first == m.begin()); - assert(m.size() == 1); - assert(m.begin()->first == 2); - assert(m.begin()->second == 3.5); - } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -} diff --git a/libcxx/test/containers/associative/map/map.modifiers/emplace_hint.pass.cpp b/libcxx/test/containers/associative/map/map.modifiers/emplace_hint.pass.cpp deleted file mode 100644 index 15f74b17e78..00000000000 --- a/libcxx/test/containers/associative/map/map.modifiers/emplace_hint.pass.cpp +++ /dev/null @@ -1,160 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// template <class... Args> -// iterator emplace_hint(const_iterator position, Args&&... args); - -#include <map> -#include <cassert> - -#include "../../../Emplaceable.h" -#include "DefaultOnly.h" -#include "min_allocator.h" - -int main() -{ -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - { - typedef std::map<int, DefaultOnly> M; - typedef M::iterator R; - M m; - assert(DefaultOnly::count == 0); - R r = m.emplace_hint(m.end()); - assert(r == m.begin()); - assert(m.size() == 1); - assert(m.begin()->first == 0); - assert(m.begin()->second == DefaultOnly()); - assert(DefaultOnly::count == 1); - r = m.emplace_hint(m.end(), std::piecewise_construct, - std::forward_as_tuple(1), - std::forward_as_tuple()); - assert(r == next(m.begin())); - assert(m.size() == 2); - assert(next(m.begin())->first == 1); - assert(next(m.begin())->second == DefaultOnly()); - assert(DefaultOnly::count == 2); - r = m.emplace_hint(m.end(), std::piecewise_construct, - std::forward_as_tuple(1), - std::forward_as_tuple()); - assert(r == next(m.begin())); - assert(m.size() == 2); - assert(next(m.begin())->first == 1); - assert(next(m.begin())->second == DefaultOnly()); - assert(DefaultOnly::count == 2); - } - assert(DefaultOnly::count == 0); - { - typedef std::map<int, Emplaceable> M; - typedef M::iterator R; - M m; - R r = m.emplace_hint(m.end(), std::piecewise_construct, - std::forward_as_tuple(2), - std::forward_as_tuple()); - assert(r == m.begin()); - assert(m.size() == 1); - assert(m.begin()->first == 2); - assert(m.begin()->second == Emplaceable()); - r = m.emplace_hint(m.end(), std::piecewise_construct, - std::forward_as_tuple(1), - std::forward_as_tuple(2, 3.5)); - assert(r == m.begin()); - assert(m.size() == 2); - assert(m.begin()->first == 1); - assert(m.begin()->second == Emplaceable(2, 3.5)); - r = m.emplace_hint(m.end(), std::piecewise_construct, - std::forward_as_tuple(1), - std::forward_as_tuple(2, 3.5)); - assert(r == m.begin()); - assert(m.size() == 2); - assert(m.begin()->first == 1); - assert(m.begin()->second == Emplaceable(2, 3.5)); - } - { - typedef std::map<int, double> M; - typedef M::iterator R; - M m; - R r = m.emplace_hint(m.end(), M::value_type(2, 3.5)); - assert(r == m.begin()); - assert(m.size() == 1); - assert(m.begin()->first == 2); - assert(m.begin()->second == 3.5); - } -#if __cplusplus >= 201103L - { - typedef std::map<int, DefaultOnly, std::less<int>, min_allocator<std::pair<const int, DefaultOnly>>> M; - typedef M::iterator R; - M m; - assert(DefaultOnly::count == 0); - R r = m.emplace_hint(m.end()); - assert(r == m.begin()); - assert(m.size() == 1); - assert(m.begin()->first == 0); - assert(m.begin()->second == DefaultOnly()); - assert(DefaultOnly::count == 1); - r = m.emplace_hint(m.end(), std::piecewise_construct, - std::forward_as_tuple(1), - std::forward_as_tuple()); - assert(r == next(m.begin())); - assert(m.size() == 2); - assert(next(m.begin())->first == 1); - assert(next(m.begin())->second == DefaultOnly()); - assert(DefaultOnly::count == 2); - r = m.emplace_hint(m.end(), std::piecewise_construct, - std::forward_as_tuple(1), - std::forward_as_tuple()); - assert(r == next(m.begin())); - assert(m.size() == 2); - assert(next(m.begin())->first == 1); - assert(next(m.begin())->second == DefaultOnly()); - assert(DefaultOnly::count == 2); - } - assert(DefaultOnly::count == 0); - { - typedef std::map<int, Emplaceable, std::less<int>, min_allocator<std::pair<const int, Emplaceable>>> M; - typedef M::iterator R; - M m; - R r = m.emplace_hint(m.end(), std::piecewise_construct, - std::forward_as_tuple(2), - std::forward_as_tuple()); - assert(r == m.begin()); - assert(m.size() == 1); - assert(m.begin()->first == 2); - assert(m.begin()->second == Emplaceable()); - r = m.emplace_hint(m.end(), std::piecewise_construct, - std::forward_as_tuple(1), - std::forward_as_tuple(2, 3.5)); - assert(r == m.begin()); - assert(m.size() == 2); - assert(m.begin()->first == 1); - assert(m.begin()->second == Emplaceable(2, 3.5)); - r = m.emplace_hint(m.end(), std::piecewise_construct, - std::forward_as_tuple(1), - std::forward_as_tuple(2, 3.5)); - assert(r == m.begin()); - assert(m.size() == 2); - assert(m.begin()->first == 1); - assert(m.begin()->second == Emplaceable(2, 3.5)); - } - { - typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M; - typedef M::iterator R; - M m; - R r = m.emplace_hint(m.end(), M::value_type(2, 3.5)); - assert(r == m.begin()); - assert(m.size() == 1); - assert(m.begin()->first == 2); - assert(m.begin()->second == 3.5); - } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -} diff --git a/libcxx/test/containers/associative/map/map.modifiers/erase_iter.pass.cpp b/libcxx/test/containers/associative/map/map.modifiers/erase_iter.pass.cpp deleted file mode 100644 index 05fb988e991..00000000000 --- a/libcxx/test/containers/associative/map/map.modifiers/erase_iter.pass.cpp +++ /dev/null @@ -1,237 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 erase(const_iterator position); - -#include <map> -#include <cassert> - -#include "min_allocator.h" - -int main() -{ - { - typedef std::map<int, double> M; - typedef std::pair<int, double> P; - typedef M::iterator I; - P ar[] = - { - P(1, 1.5), - P(2, 2.5), - P(3, 3.5), - P(4, 4.5), - P(5, 5.5), - P(6, 6.5), - P(7, 7.5), - P(8, 8.5), - }; - M m(ar, ar + sizeof(ar)/sizeof(ar[0])); - assert(m.size() == 8); - I i = m.erase(next(m.cbegin(), 3)); - assert(m.size() == 7); - assert(i == next(m.begin(), 3)); - assert(m.begin()->first == 1); - assert(m.begin()->second == 1.5); - assert(next(m.begin())->first == 2); - assert(next(m.begin())->second == 2.5); - assert(next(m.begin(), 2)->first == 3); - assert(next(m.begin(), 2)->second == 3.5); - assert(next(m.begin(), 3)->first == 5); - assert(next(m.begin(), 3)->second == 5.5); - assert(next(m.begin(), 4)->first == 6); - assert(next(m.begin(), 4)->second == 6.5); - assert(next(m.begin(), 5)->first == 7); - assert(next(m.begin(), 5)->second == 7.5); - assert(next(m.begin(), 6)->first == 8); - assert(next(m.begin(), 6)->second == 8.5); - - i = m.erase(next(m.cbegin(), 0)); - assert(m.size() == 6); - assert(i == m.begin()); - assert(m.begin()->first == 2); - assert(m.begin()->second == 2.5); - assert(next(m.begin())->first == 3); - assert(next(m.begin())->second == 3.5); - assert(next(m.begin(), 2)->first == 5); - assert(next(m.begin(), 2)->second == 5.5); - assert(next(m.begin(), 3)->first == 6); - assert(next(m.begin(), 3)->second == 6.5); - assert(next(m.begin(), 4)->first == 7); - assert(next(m.begin(), 4)->second == 7.5); - assert(next(m.begin(), 5)->first == 8); - assert(next(m.begin(), 5)->second == 8.5); - - i = m.erase(next(m.cbegin(), 5)); - assert(m.size() == 5); - assert(i == m.end()); - assert(m.begin()->first == 2); - assert(m.begin()->second == 2.5); - assert(next(m.begin())->first == 3); - assert(next(m.begin())->second == 3.5); - assert(next(m.begin(), 2)->first == 5); - assert(next(m.begin(), 2)->second == 5.5); - assert(next(m.begin(), 3)->first == 6); - assert(next(m.begin(), 3)->second == 6.5); - assert(next(m.begin(), 4)->first == 7); - assert(next(m.begin(), 4)->second == 7.5); - - i = m.erase(next(m.cbegin(), 1)); - assert(m.size() == 4); - assert(i == next(m.begin())); - assert(m.begin()->first == 2); - assert(m.begin()->second == 2.5); - assert(next(m.begin())->first == 5); - assert(next(m.begin())->second == 5.5); - assert(next(m.begin(), 2)->first == 6); - assert(next(m.begin(), 2)->second == 6.5); - assert(next(m.begin(), 3)->first == 7); - assert(next(m.begin(), 3)->second == 7.5); - - i = m.erase(next(m.cbegin(), 2)); - assert(m.size() == 3); - assert(i == next(m.begin(), 2)); - assert(m.begin()->first == 2); - assert(m.begin()->second == 2.5); - assert(next(m.begin())->first == 5); - assert(next(m.begin())->second == 5.5); - assert(next(m.begin(), 2)->first == 7); - assert(next(m.begin(), 2)->second == 7.5); - - i = m.erase(next(m.cbegin(), 2)); - assert(m.size() == 2); - assert(i == next(m.begin(), 2)); - assert(m.begin()->first == 2); - assert(m.begin()->second == 2.5); - assert(next(m.begin())->first == 5); - assert(next(m.begin())->second == 5.5); - - i = m.erase(next(m.cbegin(), 0)); - assert(m.size() == 1); - assert(i == next(m.begin(), 0)); - assert(m.begin()->first == 5); - assert(m.begin()->second == 5.5); - - i = m.erase(m.cbegin()); - assert(m.size() == 0); - assert(i == m.begin()); - assert(i == m.end()); - } -#if __cplusplus >= 201103L - { - typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M; - typedef std::pair<int, double> P; - typedef M::iterator I; - P ar[] = - { - P(1, 1.5), - P(2, 2.5), - P(3, 3.5), - P(4, 4.5), - P(5, 5.5), - P(6, 6.5), - P(7, 7.5), - P(8, 8.5), - }; - M m(ar, ar + sizeof(ar)/sizeof(ar[0])); - assert(m.size() == 8); - I i = m.erase(next(m.cbegin(), 3)); - assert(m.size() == 7); - assert(i == next(m.begin(), 3)); - assert(m.begin()->first == 1); - assert(m.begin()->second == 1.5); - assert(next(m.begin())->first == 2); - assert(next(m.begin())->second == 2.5); - assert(next(m.begin(), 2)->first == 3); - assert(next(m.begin(), 2)->second == 3.5); - assert(next(m.begin(), 3)->first == 5); - assert(next(m.begin(), 3)->second == 5.5); - assert(next(m.begin(), 4)->first == 6); - assert(next(m.begin(), 4)->second == 6.5); - assert(next(m.begin(), 5)->first == 7); - assert(next(m.begin(), 5)->second == 7.5); - assert(next(m.begin(), 6)->first == 8); - assert(next(m.begin(), 6)->second == 8.5); - - i = m.erase(next(m.cbegin(), 0)); - assert(m.size() == 6); - assert(i == m.begin()); - assert(m.begin()->first == 2); - assert(m.begin()->second == 2.5); - assert(next(m.begin())->first == 3); - assert(next(m.begin())->second == 3.5); - assert(next(m.begin(), 2)->first == 5); - assert(next(m.begin(), 2)->second == 5.5); - assert(next(m.begin(), 3)->first == 6); - assert(next(m.begin(), 3)->second == 6.5); - assert(next(m.begin(), 4)->first == 7); - assert(next(m.begin(), 4)->second == 7.5); - assert(next(m.begin(), 5)->first == 8); - assert(next(m.begin(), 5)->second == 8.5); - - i = m.erase(next(m.cbegin(), 5)); - assert(m.size() == 5); - assert(i == m.end()); - assert(m.begin()->first == 2); - assert(m.begin()->second == 2.5); - assert(next(m.begin())->first == 3); - assert(next(m.begin())->second == 3.5); - assert(next(m.begin(), 2)->first == 5); - assert(next(m.begin(), 2)->second == 5.5); - assert(next(m.begin(), 3)->first == 6); - assert(next(m.begin(), 3)->second == 6.5); - assert(next(m.begin(), 4)->first == 7); - assert(next(m.begin(), 4)->second == 7.5); - - i = m.erase(next(m.cbegin(), 1)); - assert(m.size() == 4); - assert(i == next(m.begin())); - assert(m.begin()->first == 2); - assert(m.begin()->second == 2.5); - assert(next(m.begin())->first == 5); - assert(next(m.begin())->second == 5.5); - assert(next(m.begin(), 2)->first == 6); - assert(next(m.begin(), 2)->second == 6.5); - assert(next(m.begin(), 3)->first == 7); - assert(next(m.begin(), 3)->second == 7.5); - - i = m.erase(next(m.cbegin(), 2)); - assert(m.size() == 3); - assert(i == next(m.begin(), 2)); - assert(m.begin()->first == 2); - assert(m.begin()->second == 2.5); - assert(next(m.begin())->first == 5); - assert(next(m.begin())->second == 5.5); - assert(next(m.begin(), 2)->first == 7); - assert(next(m.begin(), 2)->second == 7.5); - - i = m.erase(next(m.cbegin(), 2)); - assert(m.size() == 2); - assert(i == next(m.begin(), 2)); - assert(m.begin()->first == 2); - assert(m.begin()->second == 2.5); - assert(next(m.begin())->first == 5); - assert(next(m.begin())->second == 5.5); - - i = m.erase(next(m.cbegin(), 0)); - assert(m.size() == 1); - assert(i == next(m.begin(), 0)); - assert(m.begin()->first == 5); - assert(m.begin()->second == 5.5); - - i = m.erase(m.cbegin()); - assert(m.size() == 0); - assert(i == m.begin()); - assert(i == m.end()); - } -#endif -} diff --git a/libcxx/test/containers/associative/map/map.modifiers/erase_iter_iter.pass.cpp b/libcxx/test/containers/associative/map/map.modifiers/erase_iter_iter.pass.cpp deleted file mode 100644 index 1b49956d8a5..00000000000 --- a/libcxx/test/containers/associative/map/map.modifiers/erase_iter_iter.pass.cpp +++ /dev/null @@ -1,157 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 erase(const_iterator first, const_iterator last); - -#include <map> -#include <cassert> - -#include "min_allocator.h" - -int main() -{ - { - typedef std::map<int, double> M; - typedef std::pair<int, double> P; - typedef M::iterator I; - P ar[] = - { - P(1, 1.5), - P(2, 2.5), - P(3, 3.5), - P(4, 4.5), - P(5, 5.5), - P(6, 6.5), - P(7, 7.5), - P(8, 8.5), - }; - M m(ar, ar + sizeof(ar)/sizeof(ar[0])); - assert(m.size() == 8); - I i = m.erase(m.cbegin(), m.cbegin()); - assert(m.size() == 8); - assert(i == m.begin()); - assert(m.begin()->first == 1); - assert(m.begin()->second == 1.5); - assert(next(m.begin())->first == 2); - assert(next(m.begin())->second == 2.5); - assert(next(m.begin(), 2)->first == 3); - assert(next(m.begin(), 2)->second == 3.5); - assert(next(m.begin(), 3)->first == 4); - assert(next(m.begin(), 3)->second == 4.5); - assert(next(m.begin(), 4)->first == 5); - assert(next(m.begin(), 4)->second == 5.5); - assert(next(m.begin(), 5)->first == 6); - assert(next(m.begin(), 5)->second == 6.5); - assert(next(m.begin(), 6)->first == 7); - assert(next(m.begin(), 6)->second == 7.5); - assert(next(m.begin(), 7)->first == 8); - assert(next(m.begin(), 7)->second == 8.5); - - i = m.erase(m.cbegin(), next(m.cbegin(), 2)); - assert(m.size() == 6); - assert(i == m.begin()); - assert(next(m.begin(), 0)->first == 3); - assert(next(m.begin(), 0)->second == 3.5); - assert(next(m.begin(), 1)->first == 4); - assert(next(m.begin(), 1)->second == 4.5); - assert(next(m.begin(), 2)->first == 5); - assert(next(m.begin(), 2)->second == 5.5); - assert(next(m.begin(), 3)->first == 6); - assert(next(m.begin(), 3)->second == 6.5); - assert(next(m.begin(), 4)->first == 7); - assert(next(m.begin(), 4)->second == 7.5); - assert(next(m.begin(), 5)->first == 8); - assert(next(m.begin(), 5)->second == 8.5); - - i = m.erase(next(m.cbegin(), 2), next(m.cbegin(), 6)); - assert(m.size() == 2); - assert(i == next(m.begin(), 2)); - assert(next(m.begin(), 0)->first == 3); - assert(next(m.begin(), 0)->second == 3.5); - assert(next(m.begin(), 1)->first == 4); - assert(next(m.begin(), 1)->second == 4.5); - - i = m.erase(m.cbegin(), m.cend()); - assert(m.size() == 0); - assert(i == m.begin()); - assert(i == m.end()); - } -#if __cplusplus >= 201103L - { - typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M; - typedef std::pair<int, double> P; - typedef M::iterator I; - P ar[] = - { - P(1, 1.5), - P(2, 2.5), - P(3, 3.5), - P(4, 4.5), - P(5, 5.5), - P(6, 6.5), - P(7, 7.5), - P(8, 8.5), - }; - M m(ar, ar + sizeof(ar)/sizeof(ar[0])); - assert(m.size() == 8); - I i = m.erase(m.cbegin(), m.cbegin()); - assert(m.size() == 8); - assert(i == m.begin()); - assert(m.begin()->first == 1); - assert(m.begin()->second == 1.5); - assert(next(m.begin())->first == 2); - assert(next(m.begin())->second == 2.5); - assert(next(m.begin(), 2)->first == 3); - assert(next(m.begin(), 2)->second == 3.5); - assert(next(m.begin(), 3)->first == 4); - assert(next(m.begin(), 3)->second == 4.5); - assert(next(m.begin(), 4)->first == 5); - assert(next(m.begin(), 4)->second == 5.5); - assert(next(m.begin(), 5)->first == 6); - assert(next(m.begin(), 5)->second == 6.5); - assert(next(m.begin(), 6)->first == 7); - assert(next(m.begin(), 6)->second == 7.5); - assert(next(m.begin(), 7)->first == 8); - assert(next(m.begin(), 7)->second == 8.5); - - i = m.erase(m.cbegin(), next(m.cbegin(), 2)); - assert(m.size() == 6); - assert(i == m.begin()); - assert(next(m.begin(), 0)->first == 3); - assert(next(m.begin(), 0)->second == 3.5); - assert(next(m.begin(), 1)->first == 4); - assert(next(m.begin(), 1)->second == 4.5); - assert(next(m.begin(), 2)->first == 5); - assert(next(m.begin(), 2)->second == 5.5); - assert(next(m.begin(), 3)->first == 6); - assert(next(m.begin(), 3)->second == 6.5); - assert(next(m.begin(), 4)->first == 7); - assert(next(m.begin(), 4)->second == 7.5); - assert(next(m.begin(), 5)->first == 8); - assert(next(m.begin(), 5)->second == 8.5); - - i = m.erase(next(m.cbegin(), 2), next(m.cbegin(), 6)); - assert(m.size() == 2); - assert(i == next(m.begin(), 2)); - assert(next(m.begin(), 0)->first == 3); - assert(next(m.begin(), 0)->second == 3.5); - assert(next(m.begin(), 1)->first == 4); - assert(next(m.begin(), 1)->second == 4.5); - - i = m.erase(m.cbegin(), m.cend()); - assert(m.size() == 0); - assert(i == m.begin()); - assert(i == m.end()); - } -#endif -} diff --git a/libcxx/test/containers/associative/map/map.modifiers/erase_key.pass.cpp b/libcxx/test/containers/associative/map/map.modifiers/erase_key.pass.cpp deleted file mode 100644 index e41f5129140..00000000000 --- a/libcxx/test/containers/associative/map/map.modifiers/erase_key.pass.cpp +++ /dev/null @@ -1,275 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// size_type erase(const key_type& k); - -#include <map> -#include <cassert> - -#include "min_allocator.h" - -int main() -{ - { - typedef std::map<int, double> M; - typedef std::pair<int, double> P; - typedef M::size_type R; - P ar[] = - { - P(1, 1.5), - P(2, 2.5), - P(3, 3.5), - P(4, 4.5), - P(5, 5.5), - P(6, 6.5), - P(7, 7.5), - P(8, 8.5), - }; - M m(ar, ar + sizeof(ar)/sizeof(ar[0])); - assert(m.size() == 8); - R s = m.erase(9); - assert(s == 0); - assert(m.size() == 8); - assert(m.begin()->first == 1); - assert(m.begin()->second == 1.5); - assert(next(m.begin())->first == 2); - assert(next(m.begin())->second == 2.5); - assert(next(m.begin(), 2)->first == 3); - assert(next(m.begin(), 2)->second == 3.5); - assert(next(m.begin(), 3)->first == 4); - assert(next(m.begin(), 3)->second == 4.5); - assert(next(m.begin(), 4)->first == 5); - assert(next(m.begin(), 4)->second == 5.5); - assert(next(m.begin(), 5)->first == 6); - assert(next(m.begin(), 5)->second == 6.5); - assert(next(m.begin(), 6)->first == 7); - assert(next(m.begin(), 6)->second == 7.5); - assert(next(m.begin(), 7)->first == 8); - assert(next(m.begin(), 7)->second == 8.5); - - s = m.erase(4); - assert(m.size() == 7); - assert(s == 1); - assert(m.begin()->first == 1); - assert(m.begin()->second == 1.5); - assert(next(m.begin())->first == 2); - assert(next(m.begin())->second == 2.5); - assert(next(m.begin(), 2)->first == 3); - assert(next(m.begin(), 2)->second == 3.5); - assert(next(m.begin(), 3)->first == 5); - assert(next(m.begin(), 3)->second == 5.5); - assert(next(m.begin(), 4)->first == 6); - assert(next(m.begin(), 4)->second == 6.5); - assert(next(m.begin(), 5)->first == 7); - assert(next(m.begin(), 5)->second == 7.5); - assert(next(m.begin(), 6)->first == 8); - assert(next(m.begin(), 6)->second == 8.5); - - s = m.erase(1); - assert(m.size() == 6); - assert(s == 1); - assert(m.begin()->first == 2); - assert(m.begin()->second == 2.5); - assert(next(m.begin())->first == 3); - assert(next(m.begin())->second == 3.5); - assert(next(m.begin(), 2)->first == 5); - assert(next(m.begin(), 2)->second == 5.5); - assert(next(m.begin(), 3)->first == 6); - assert(next(m.begin(), 3)->second == 6.5); - assert(next(m.begin(), 4)->first == 7); - assert(next(m.begin(), 4)->second == 7.5); - assert(next(m.begin(), 5)->first == 8); - assert(next(m.begin(), 5)->second == 8.5); - - s = m.erase(8); - assert(m.size() == 5); - assert(s == 1); - assert(m.begin()->first == 2); - assert(m.begin()->second == 2.5); - assert(next(m.begin())->first == 3); - assert(next(m.begin())->second == 3.5); - assert(next(m.begin(), 2)->first == 5); - assert(next(m.begin(), 2)->second == 5.5); - assert(next(m.begin(), 3)->first == 6); - assert(next(m.begin(), 3)->second == 6.5); - assert(next(m.begin(), 4)->first == 7); - assert(next(m.begin(), 4)->second == 7.5); - - s = m.erase(3); - assert(m.size() == 4); - assert(s == 1); - assert(m.begin()->first == 2); - assert(m.begin()->second == 2.5); - assert(next(m.begin())->first == 5); - assert(next(m.begin())->second == 5.5); - assert(next(m.begin(), 2)->first == 6); - assert(next(m.begin(), 2)->second == 6.5); - assert(next(m.begin(), 3)->first == 7); - assert(next(m.begin(), 3)->second == 7.5); - - s = m.erase(6); - assert(m.size() == 3); - assert(s == 1); - assert(m.begin()->first == 2); - assert(m.begin()->second == 2.5); - assert(next(m.begin())->first == 5); - assert(next(m.begin())->second == 5.5); - assert(next(m.begin(), 2)->first == 7); - assert(next(m.begin(), 2)->second == 7.5); - - s = m.erase(7); - assert(m.size() == 2); - assert(s == 1); - assert(m.begin()->first == 2); - assert(m.begin()->second == 2.5); - assert(next(m.begin())->first == 5); - assert(next(m.begin())->second == 5.5); - - s = m.erase(2); - assert(m.size() == 1); - assert(s == 1); - assert(m.begin()->first == 5); - assert(m.begin()->second == 5.5); - - s = m.erase(5); - assert(m.size() == 0); - assert(s == 1); - } -#if __cplusplus >= 201103L - { - typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M; - typedef std::pair<int, double> P; - typedef M::size_type R; - P ar[] = - { - P(1, 1.5), - P(2, 2.5), - P(3, 3.5), - P(4, 4.5), - P(5, 5.5), - P(6, 6.5), - P(7, 7.5), - P(8, 8.5), - }; - M m(ar, ar + sizeof(ar)/sizeof(ar[0])); - assert(m.size() == 8); - R s = m.erase(9); - assert(s == 0); - assert(m.size() == 8); - assert(m.begin()->first == 1); - assert(m.begin()->second == 1.5); - assert(next(m.begin())->first == 2); - assert(next(m.begin())->second == 2.5); - assert(next(m.begin(), 2)->first == 3); - assert(next(m.begin(), 2)->second == 3.5); - assert(next(m.begin(), 3)->first == 4); - assert(next(m.begin(), 3)->second == 4.5); - assert(next(m.begin(), 4)->first == 5); - assert(next(m.begin(), 4)->second == 5.5); - assert(next(m.begin(), 5)->first == 6); - assert(next(m.begin(), 5)->second == 6.5); - assert(next(m.begin(), 6)->first == 7); - assert(next(m.begin(), 6)->second == 7.5); - assert(next(m.begin(), 7)->first == 8); - assert(next(m.begin(), 7)->second == 8.5); - - s = m.erase(4); - assert(m.size() == 7); - assert(s == 1); - assert(m.begin()->first == 1); - assert(m.begin()->second == 1.5); - assert(next(m.begin())->first == 2); - assert(next(m.begin())->second == 2.5); - assert(next(m.begin(), 2)->first == 3); - assert(next(m.begin(), 2)->second == 3.5); - assert(next(m.begin(), 3)->first == 5); - assert(next(m.begin(), 3)->second == 5.5); - assert(next(m.begin(), 4)->first == 6); - assert(next(m.begin(), 4)->second == 6.5); - assert(next(m.begin(), 5)->first == 7); - assert(next(m.begin(), 5)->second == 7.5); - assert(next(m.begin(), 6)->first == 8); - assert(next(m.begin(), 6)->second == 8.5); - - s = m.erase(1); - assert(m.size() == 6); - assert(s == 1); - assert(m.begin()->first == 2); - assert(m.begin()->second == 2.5); - assert(next(m.begin())->first == 3); - assert(next(m.begin())->second == 3.5); - assert(next(m.begin(), 2)->first == 5); - assert(next(m.begin(), 2)->second == 5.5); - assert(next(m.begin(), 3)->first == 6); - assert(next(m.begin(), 3)->second == 6.5); - assert(next(m.begin(), 4)->first == 7); - assert(next(m.begin(), 4)->second == 7.5); - assert(next(m.begin(), 5)->first == 8); - assert(next(m.begin(), 5)->second == 8.5); - - s = m.erase(8); - assert(m.size() == 5); - assert(s == 1); - assert(m.begin()->first == 2); - assert(m.begin()->second == 2.5); - assert(next(m.begin())->first == 3); - assert(next(m.begin())->second == 3.5); - assert(next(m.begin(), 2)->first == 5); - assert(next(m.begin(), 2)->second == 5.5); - assert(next(m.begin(), 3)->first == 6); - assert(next(m.begin(), 3)->second == 6.5); - assert(next(m.begin(), 4)->first == 7); - assert(next(m.begin(), 4)->second == 7.5); - - s = m.erase(3); - assert(m.size() == 4); - assert(s == 1); - assert(m.begin()->first == 2); - assert(m.begin()->second == 2.5); - assert(next(m.begin())->first == 5); - assert(next(m.begin())->second == 5.5); - assert(next(m.begin(), 2)->first == 6); - assert(next(m.begin(), 2)->second == 6.5); - assert(next(m.begin(), 3)->first == 7); - assert(next(m.begin(), 3)->second == 7.5); - - s = m.erase(6); - assert(m.size() == 3); - assert(s == 1); - assert(m.begin()->first == 2); - assert(m.begin()->second == 2.5); - assert(next(m.begin())->first == 5); - assert(next(m.begin())->second == 5.5); - assert(next(m.begin(), 2)->first == 7); - assert(next(m.begin(), 2)->second == 7.5); - - s = m.erase(7); - assert(m.size() == 2); - assert(s == 1); - assert(m.begin()->first == 2); - assert(m.begin()->second == 2.5); - assert(next(m.begin())->first == 5); - assert(next(m.begin())->second == 5.5); - - s = m.erase(2); - assert(m.size() == 1); - assert(s == 1); - assert(m.begin()->first == 5); - assert(m.begin()->second == 5.5); - - s = m.erase(5); - assert(m.size() == 0); - assert(s == 1); - } -#endif -} diff --git a/libcxx/test/containers/associative/map/map.modifiers/insert_cv.pass.cpp b/libcxx/test/containers/associative/map/map.modifiers/insert_cv.pass.cpp deleted file mode 100644 index 3d28242fd32..00000000000 --- a/libcxx/test/containers/associative/map/map.modifiers/insert_cv.pass.cpp +++ /dev/null @@ -1,89 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// pair<iterator, bool> insert(const value_type& v); - -#include <map> -#include <cassert> - -#include "min_allocator.h" - -int main() -{ - { - typedef std::map<int, double> M; - typedef std::pair<M::iterator, bool> R; - M m; - R r = m.insert(M::value_type(2, 2.5)); - assert(r.second); - assert(r.first == m.begin()); - assert(m.size() == 1); - assert(r.first->first == 2); - assert(r.first->second == 2.5); - - r = m.insert(M::value_type(1, 1.5)); - assert(r.second); - assert(r.first == m.begin()); - assert(m.size() == 2); - assert(r.first->first == 1); - assert(r.first->second == 1.5); - - r = m.insert(M::value_type(3, 3.5)); - assert(r.second); - assert(r.first == prev(m.end())); - assert(m.size() == 3); - assert(r.first->first == 3); - assert(r.first->second == 3.5); - - r = m.insert(M::value_type(3, 3.5)); - assert(!r.second); - assert(r.first == prev(m.end())); - assert(m.size() == 3); - assert(r.first->first == 3); - assert(r.first->second == 3.5); - } -#if __cplusplus >= 201103L - { - typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M; - typedef std::pair<M::iterator, bool> R; - M m; - R r = m.insert(M::value_type(2, 2.5)); - assert(r.second); - assert(r.first == m.begin()); - assert(m.size() == 1); - assert(r.first->first == 2); - assert(r.first->second == 2.5); - - r = m.insert(M::value_type(1, 1.5)); - assert(r.second); - assert(r.first == m.begin()); - assert(m.size() == 2); - assert(r.first->first == 1); - assert(r.first->second == 1.5); - - r = m.insert(M::value_type(3, 3.5)); - assert(r.second); - assert(r.first == prev(m.end())); - assert(m.size() == 3); - assert(r.first->first == 3); - assert(r.first->second == 3.5); - - r = m.insert(M::value_type(3, 3.5)); - assert(!r.second); - assert(r.first == prev(m.end())); - assert(m.size() == 3); - assert(r.first->first == 3); - assert(r.first->second == 3.5); - } -#endif -} diff --git a/libcxx/test/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp b/libcxx/test/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp deleted file mode 100644 index ab325ed45bf..00000000000 --- a/libcxx/test/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp +++ /dev/null @@ -1,71 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// void insert(initializer_list<value_type> il); - -#include <map> -#include <cassert> - -#include "min_allocator.h" - -int main() -{ -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - { - typedef std::pair<const int, double> V; - std::map<int, double> m = - { - {1, 1}, - {1, 1.5}, - {1, 2}, - {3, 1}, - {3, 1.5}, - {3, 2} - }; - m.insert({ - {2, 1}, - {2, 1.5}, - {2, 2}, - }); - assert(m.size() == 3); - assert(distance(m.begin(), m.end()) == 3); - assert(*m.begin() == V(1, 1)); - assert(*next(m.begin()) == V(2, 1)); - assert(*next(m.begin(), 2) == V(3, 1)); - } -#if __cplusplus >= 201103L - { - typedef std::pair<const int, double> V; - std::map<int, double, std::less<int>, min_allocator<V>> m = - { - {1, 1}, - {1, 1.5}, - {1, 2}, - {3, 1}, - {3, 1.5}, - {3, 2} - }; - m.insert({ - {2, 1}, - {2, 1.5}, - {2, 2}, - }); - assert(m.size() == 3); - assert(distance(m.begin(), m.end()) == 3); - assert(*m.begin() == V(1, 1)); - assert(*next(m.begin()) == V(2, 1)); - assert(*next(m.begin(), 2) == V(3, 1)); - } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS -} diff --git a/libcxx/test/containers/associative/map/map.modifiers/insert_iter_cv.pass.cpp b/libcxx/test/containers/associative/map/map.modifiers/insert_iter_cv.pass.cpp deleted file mode 100644 index 278db4631a8..00000000000 --- a/libcxx/test/containers/associative/map/map.modifiers/insert_iter_cv.pass.cpp +++ /dev/null @@ -1,81 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 insert(const_iterator position, const value_type& v); - -#include <map> -#include <cassert> - -#include "min_allocator.h" - -int main() -{ - { - typedef std::map<int, double> M; - typedef M::iterator R; - M m; - R r = m.insert(m.end(), M::value_type(2, 2.5)); - assert(r == m.begin()); - assert(m.size() == 1); - assert(r->first == 2); - assert(r->second == 2.5); - - r = m.insert(m.end(), M::value_type(1, 1.5)); - assert(r == m.begin()); - assert(m.size() == 2); - assert(r->first == 1); - assert(r->second == 1.5); - - r = m.insert(m.end(), M::value_type(3, 3.5)); - assert(r == prev(m.end())); - assert(m.size() == 3); - assert(r->first == 3); - assert(r->second == 3.5); - - r = m.insert(m.end(), M::value_type(3, 3.5)); - assert(r == prev(m.end())); - assert(m.size() == 3); - assert(r->first == 3); - assert(r->second == 3.5); - } -#if __cplusplus >= 201103L - { - typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M; - typedef M::iterator R; - M m; - R r = m.insert(m.end(), M::value_type(2, 2.5)); - assert(r == m.begin()); - assert(m.size() == 1); - assert(r->first == 2); - assert(r->second == 2.5); - - r = m.insert(m.end(), M::value_type(1, 1.5)); - assert(r == m.begin()); - assert(m.size() == 2); - assert(r->first == 1); - assert(r->second == 1.5); - - r = m.insert(m.end(), M::value_type(3, 3.5)); - assert(r == prev(m.end())); - assert(m.size() == 3); - assert(r->first == 3); - assert(r->second == 3.5); - - r = m.insert(m.end(), M::value_type(3, 3.5)); - assert(r == prev(m.end())); - assert(m.size() == 3); - assert(r->first == 3); - assert(r->second == 3.5); - } -#endif -} diff --git a/libcxx/test/containers/associative/map/map.modifiers/insert_iter_iter.pass.cpp b/libcxx/test/containers/associative/map/map.modifiers/insert_iter_iter.pass.cpp deleted file mode 100644 index 964738b4a68..00000000000 --- a/libcxx/test/containers/associative/map/map.modifiers/insert_iter_iter.pass.cpp +++ /dev/null @@ -1,77 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// template <class InputIterator> -// void insert(InputIterator first, InputIterator last); - -#include <map> -#include <cassert> - -#include "test_iterators.h" -#include "min_allocator.h" - -int main() -{ - { - typedef std::map<int, double> M; - typedef std::pair<int, double> P; - P ar[] = - { - P(1, 1), - P(1, 1.5), - P(1, 2), - P(2, 1), - P(2, 1.5), - P(2, 2), - P(3, 1), - P(3, 1.5), - P(3, 2), - }; - M m; - m.insert(input_iterator<P*>(ar), input_iterator<P*>(ar + sizeof(ar)/sizeof(ar[0]))); - assert(m.size() == 3); - assert(m.begin()->first == 1); - assert(m.begin()->second == 1); - assert(next(m.begin())->first == 2); - assert(next(m.begin())->second == 1); - assert(next(m.begin(), 2)->first == 3); - assert(next(m.begin(), 2)->second == 1); - } -#if __cplusplus >= 201103L - { - typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M; - typedef std::pair<int, double> P; - P ar[] = - { - P(1, 1), - P(1, 1.5), - P(1, 2), - P(2, 1), - P(2, 1.5), - P(2, 2), - P(3, 1), - P(3, 1.5), - P(3, 2), - }; - M m; - m.insert(input_iterator<P*>(ar), input_iterator<P*>(ar + sizeof(ar)/sizeof(ar[0]))); - assert(m.size() == 3); - assert(m.begin()->first == 1); - assert(m.begin()->second == 1); - assert(next(m.begin())->first == 2); - assert(next(m.begin())->second == 1); - assert(next(m.begin(), 2)->first == 3); - assert(next(m.begin(), 2)->second == 1); - } -#endif -} diff --git a/libcxx/test/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp b/libcxx/test/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp deleted file mode 100644 index 22164202932..00000000000 --- a/libcxx/test/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp +++ /dev/null @@ -1,87 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// template <class P> -// iterator insert(const_iterator position, P&& p); - -#include <map> -#include <cassert> - -#include "../../../MoveOnly.h" -#include "min_allocator.h" - -int main() -{ -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - { - typedef std::map<int, MoveOnly> M; - typedef std::pair<int, MoveOnly> P; - typedef M::iterator R; - M m; - R r = m.insert(m.end(), P(2, 2)); - assert(r == m.begin()); - assert(m.size() == 1); - assert(r->first == 2); - assert(r->second == 2); - - r = m.insert(m.end(), P(1, 1)); - assert(r == m.begin()); - assert(m.size() == 2); - assert(r->first == 1); - assert(r->second == 1); - - r = m.insert(m.end(), P(3, 3)); - assert(r == prev(m.end())); - assert(m.size() == 3); - assert(r->first == 3); - assert(r->second == 3); - - r = m.insert(m.end(), P(3, 3)); - assert(r == prev(m.end())); - assert(m.size() == 3); - assert(r->first == 3); - assert(r->second == 3); - } -#if __cplusplus >= 201103L - { - typedef std::map<int, MoveOnly, std::less<int>, min_allocator<std::pair<const int, MoveOnly>>> M; - typedef std::pair<int, MoveOnly> P; - typedef M::iterator R; - M m; - R r = m.insert(m.end(), P(2, 2)); - assert(r == m.begin()); - assert(m.size() == 1); - assert(r->first == 2); - assert(r->second == 2); - - r = m.insert(m.end(), P(1, 1)); - assert(r == m.begin()); - assert(m.size() == 2); - assert(r->first == 1); - assert(r->second == 1); - - r = m.insert(m.end(), P(3, 3)); - assert(r == prev(m.end())); - assert(m.size() == 3); - assert(r->first == 3); - assert(r->second == 3); - - r = m.insert(m.end(), P(3, 3)); - assert(r == prev(m.end())); - assert(m.size() == 3); - assert(r->first == 3); - assert(r->second == 3); - } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -} diff --git a/libcxx/test/containers/associative/map/map.modifiers/insert_rv.pass.cpp b/libcxx/test/containers/associative/map/map.modifiers/insert_rv.pass.cpp deleted file mode 100644 index fea88957a70..00000000000 --- a/libcxx/test/containers/associative/map/map.modifiers/insert_rv.pass.cpp +++ /dev/null @@ -1,93 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// template <class P> -// pair<iterator, bool> insert(P&& p); - -#include <map> -#include <cassert> - -#include "../../../MoveOnly.h" -#include "min_allocator.h" - -int main() -{ -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - { - typedef std::map<int, MoveOnly> M; - typedef std::pair<M::iterator, bool> R; - M m; - R r = m.insert(M::value_type(2, 2)); - assert(r.second); - assert(r.first == m.begin()); - assert(m.size() == 1); - assert(r.first->first == 2); - assert(r.first->second == 2); - - r = m.insert(M::value_type(1, 1)); - assert(r.second); - assert(r.first == m.begin()); - assert(m.size() == 2); - assert(r.first->first == 1); - assert(r.first->second == 1); - - r = m.insert(M::value_type(3, 3)); - assert(r.second); - assert(r.first == prev(m.end())); - assert(m.size() == 3); - assert(r.first->first == 3); - assert(r.first->second == 3); - - r = m.insert(M::value_type(3, 3)); - assert(!r.second); - assert(r.first == prev(m.end())); - assert(m.size() == 3); - assert(r.first->first == 3); - assert(r.first->second == 3); - } -#if __cplusplus >= 201103L - { - typedef std::map<int, MoveOnly, std::less<int>, min_allocator<std::pair<const int, MoveOnly>>> M; - typedef std::pair<M::iterator, bool> R; - M m; - R r = m.insert(M::value_type(2, 2)); - assert(r.second); - assert(r.first == m.begin()); - assert(m.size() == 1); - assert(r.first->first == 2); - assert(r.first->second == 2); - - r = m.insert(M::value_type(1, 1)); - assert(r.second); - assert(r.first == m.begin()); - assert(m.size() == 2); - assert(r.first->first == 1); - assert(r.first->second == 1); - - r = m.insert(M::value_type(3, 3)); - assert(r.second); - assert(r.first == prev(m.end())); - assert(m.size() == 3); - assert(r.first->first == 3); - assert(r.first->second == 3); - - r = m.insert(M::value_type(3, 3)); - assert(!r.second); - assert(r.first == prev(m.end())); - assert(m.size() == 3); - assert(r.first->first == 3); - assert(r.first->second == 3); - } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -} diff --git a/libcxx/test/containers/associative/map/map.ops/count.pass.cpp b/libcxx/test/containers/associative/map/map.ops/count.pass.cpp deleted file mode 100644 index 9668055b8bc..00000000000 --- a/libcxx/test/containers/associative/map/map.ops/count.pass.cpp +++ /dev/null @@ -1,173 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// size_type count(const key_type& k) const; - -#include <map> -#include <cassert> - -#include "min_allocator.h" -#include "private_constructor.hpp" - -int main() -{ - { - typedef std::pair<const int, double> V; - typedef std::map<int, double> M; - { - typedef M::size_type R; - V ar[] = - { - V(5, 5), - V(6, 6), - V(7, 7), - V(8, 8), - V(9, 9), - V(10, 10), - V(11, 11), - V(12, 12) - }; - const M m(ar, ar+sizeof(ar)/sizeof(ar[0])); - R r = m.count(5); - assert(r == 1); - r = m.count(6); - assert(r == 1); - r = m.count(7); - assert(r == 1); - r = m.count(8); - assert(r == 1); - r = m.count(9); - assert(r == 1); - r = m.count(10); - assert(r == 1); - r = m.count(11); - assert(r == 1); - r = m.count(12); - assert(r == 1); - r = m.count(4); - assert(r == 0); - } - } -#if __cplusplus >= 201103L - { - typedef std::pair<const int, double> V; - typedef std::map<int, double, std::less<int>, min_allocator<V>> M; - { - typedef M::size_type R; - V ar[] = - { - V(5, 5), - V(6, 6), - V(7, 7), - V(8, 8), - V(9, 9), - V(10, 10), - V(11, 11), - V(12, 12) - }; - const M m(ar, ar+sizeof(ar)/sizeof(ar[0])); - R r = m.count(5); - assert(r == 1); - r = m.count(6); - assert(r == 1); - r = m.count(7); - assert(r == 1); - r = m.count(8); - assert(r == 1); - r = m.count(9); - assert(r == 1); - r = m.count(10); - assert(r == 1); - r = m.count(11); - assert(r == 1); - r = m.count(12); - assert(r == 1); - r = m.count(4); - assert(r == 0); - } - } -#endif -#if _LIBCPP_STD_VER > 11 - { - typedef std::pair<const int, double> V; - typedef std::map<int, double, std::less <>> M; - typedef M::size_type R; - - V ar[] = - { - V(5, 5), - V(6, 6), - V(7, 7), - V(8, 8), - V(9, 9), - V(10, 10), - V(11, 11), - V(12, 12) - }; - const M m(ar, ar+sizeof(ar)/sizeof(ar[0])); - R r = m.count(5); - assert(r == 1); - r = m.count(6); - assert(r == 1); - r = m.count(7); - assert(r == 1); - r = m.count(8); - assert(r == 1); - r = m.count(9); - assert(r == 1); - r = m.count(10); - assert(r == 1); - r = m.count(11); - assert(r == 1); - r = m.count(12); - assert(r == 1); - r = m.count(4); - assert(r == 0); - } - - { - typedef PrivateConstructor PC; - typedef std::map<PC, double, std::less<>> M; - typedef M::size_type R; - - M m; - m [ PC::make(5) ] = 5; - m [ PC::make(6) ] = 6; - m [ PC::make(7) ] = 7; - m [ PC::make(8) ] = 8; - m [ PC::make(9) ] = 9; - m [ PC::make(10) ] = 10; - m [ PC::make(11) ] = 11; - m [ PC::make(12) ] = 12; - - R r = m.count(5); - assert(r == 1); - r = m.count(6); - assert(r == 1); - r = m.count(7); - assert(r == 1); - r = m.count(8); - assert(r == 1); - r = m.count(9); - assert(r == 1); - r = m.count(10); - assert(r == 1); - r = m.count(11); - assert(r == 1); - r = m.count(12); - assert(r == 1); - r = m.count(4); - assert(r == 0); - } -#endif -} diff --git a/libcxx/test/containers/associative/map/map.ops/equal_range.pass.cpp b/libcxx/test/containers/associative/map/map.ops/equal_range.pass.cpp deleted file mode 100644 index dff751c3724..00000000000 --- a/libcxx/test/containers/associative/map/map.ops/equal_range.pass.cpp +++ /dev/null @@ -1,437 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// pair<iterator,iterator> equal_range(const key_type& k); -// pair<const_iterator,const_iterator> equal_range(const key_type& k) const; - -#include <map> -#include <cassert> - -#include "min_allocator.h" -#include "private_constructor.hpp" - -int main() -{ - { - typedef std::pair<const int, double> V; - typedef std::map<int, double> M; - { - typedef std::pair<M::iterator, M::iterator> R; - V ar[] = - { - V(5, 5), - V(7, 6), - V(9, 7), - V(11, 8), - V(13, 9), - V(15, 10), - V(17, 11), - V(19, 12) - }; - M m(ar, ar+sizeof(ar)/sizeof(ar[0])); - R r = m.equal_range(5); - assert(r.first == next(m.begin(), 0)); - assert(r.second == next(m.begin(), 1)); - r = m.equal_range(7); - assert(r.first == next(m.begin(), 1)); - assert(r.second == next(m.begin(), 2)); - r = m.equal_range(9); - assert(r.first == next(m.begin(), 2)); - assert(r.second == next(m.begin(), 3)); - r = m.equal_range(11); - assert(r.first == next(m.begin(), 3)); - assert(r.second == next(m.begin(), 4)); - r = m.equal_range(13); - assert(r.first == next(m.begin(), 4)); - assert(r.second == next(m.begin(), 5)); - r = m.equal_range(15); - assert(r.first == next(m.begin(), 5)); - assert(r.second == next(m.begin(), 6)); - r = m.equal_range(17); - assert(r.first == next(m.begin(), 6)); - assert(r.second == next(m.begin(), 7)); - r = m.equal_range(19); - assert(r.first == next(m.begin(), 7)); - assert(r.second == next(m.begin(), 8)); - r = m.equal_range(4); - assert(r.first == next(m.begin(), 0)); - assert(r.second == next(m.begin(), 0)); - r = m.equal_range(6); - assert(r.first == next(m.begin(), 1)); - assert(r.second == next(m.begin(), 1)); - r = m.equal_range(8); - assert(r.first == next(m.begin(), 2)); - assert(r.second == next(m.begin(), 2)); - r = m.equal_range(10); - assert(r.first == next(m.begin(), 3)); - assert(r.second == next(m.begin(), 3)); - r = m.equal_range(12); - assert(r.first == next(m.begin(), 4)); - assert(r.second == next(m.begin(), 4)); - r = m.equal_range(14); - assert(r.first == next(m.begin(), 5)); - assert(r.second == next(m.begin(), 5)); - r = m.equal_range(16); - assert(r.first == next(m.begin(), 6)); - assert(r.second == next(m.begin(), 6)); - r = m.equal_range(18); - assert(r.first == next(m.begin(), 7)); - assert(r.second == next(m.begin(), 7)); - r = m.equal_range(20); - assert(r.first == next(m.begin(), 8)); - assert(r.second == next(m.begin(), 8)); - } - { - typedef std::pair<M::const_iterator, M::const_iterator> R; - V ar[] = - { - V(5, 5), - V(7, 6), - V(9, 7), - V(11, 8), - V(13, 9), - V(15, 10), - V(17, 11), - V(19, 12) - }; - const M m(ar, ar+sizeof(ar)/sizeof(ar[0])); - R r = m.equal_range(5); - assert(r.first == next(m.begin(), 0)); - assert(r.second == next(m.begin(), 1)); - r = m.equal_range(7); - assert(r.first == next(m.begin(), 1)); - assert(r.second == next(m.begin(), 2)); - r = m.equal_range(9); - assert(r.first == next(m.begin(), 2)); - assert(r.second == next(m.begin(), 3)); - r = m.equal_range(11); - assert(r.first == next(m.begin(), 3)); - assert(r.second == next(m.begin(), 4)); - r = m.equal_range(13); - assert(r.first == next(m.begin(), 4)); - assert(r.second == next(m.begin(), 5)); - r = m.equal_range(15); - assert(r.first == next(m.begin(), 5)); - assert(r.second == next(m.begin(), 6)); - r = m.equal_range(17); - assert(r.first == next(m.begin(), 6)); - assert(r.second == next(m.begin(), 7)); - r = m.equal_range(19); - assert(r.first == next(m.begin(), 7)); - assert(r.second == next(m.begin(), 8)); - r = m.equal_range(4); - assert(r.first == next(m.begin(), 0)); - assert(r.second == next(m.begin(), 0)); - r = m.equal_range(6); - assert(r.first == next(m.begin(), 1)); - assert(r.second == next(m.begin(), 1)); - r = m.equal_range(8); - assert(r.first == next(m.begin(), 2)); - assert(r.second == next(m.begin(), 2)); - r = m.equal_range(10); - assert(r.first == next(m.begin(), 3)); - assert(r.second == next(m.begin(), 3)); - r = m.equal_range(12); - assert(r.first == next(m.begin(), 4)); - assert(r.second == next(m.begin(), 4)); - r = m.equal_range(14); - assert(r.first == next(m.begin(), 5)); - assert(r.second == next(m.begin(), 5)); - r = m.equal_range(16); - assert(r.first == next(m.begin(), 6)); - assert(r.second == next(m.begin(), 6)); - r = m.equal_range(18); - assert(r.first == next(m.begin(), 7)); - assert(r.second == next(m.begin(), 7)); - r = m.equal_range(20); - assert(r.first == next(m.begin(), 8)); - assert(r.second == next(m.begin(), 8)); - } - } -#if __cplusplus >= 201103L - { - typedef std::pair<const int, double> V; - typedef std::map<int, double, std::less<int>, min_allocator<V>> M; - { - typedef std::pair<M::iterator, M::iterator> R; - V ar[] = - { - V(5, 5), - V(7, 6), - V(9, 7), - V(11, 8), - V(13, 9), - V(15, 10), - V(17, 11), - V(19, 12) - }; - M m(ar, ar+sizeof(ar)/sizeof(ar[0])); - R r = m.equal_range(5); - assert(r.first == next(m.begin(), 0)); - assert(r.second == next(m.begin(), 1)); - r = m.equal_range(7); - assert(r.first == next(m.begin(), 1)); - assert(r.second == next(m.begin(), 2)); - r = m.equal_range(9); - assert(r.first == next(m.begin(), 2)); - assert(r.second == next(m.begin(), 3)); - r = m.equal_range(11); - assert(r.first == next(m.begin(), 3)); - assert(r.second == next(m.begin(), 4)); - r = m.equal_range(13); - assert(r.first == next(m.begin(), 4)); - assert(r.second == next(m.begin(), 5)); - r = m.equal_range(15); - assert(r.first == next(m.begin(), 5)); - assert(r.second == next(m.begin(), 6)); - r = m.equal_range(17); - assert(r.first == next(m.begin(), 6)); - assert(r.second == next(m.begin(), 7)); - r = m.equal_range(19); - assert(r.first == next(m.begin(), 7)); - assert(r.second == next(m.begin(), 8)); - r = m.equal_range(4); - assert(r.first == next(m.begin(), 0)); - assert(r.second == next(m.begin(), 0)); - r = m.equal_range(6); - assert(r.first == next(m.begin(), 1)); - assert(r.second == next(m.begin(), 1)); - r = m.equal_range(8); - assert(r.first == next(m.begin(), 2)); - assert(r.second == next(m.begin(), 2)); - r = m.equal_range(10); - assert(r.first == next(m.begin(), 3)); - assert(r.second == next(m.begin(), 3)); - r = m.equal_range(12); - assert(r.first == next(m.begin(), 4)); - assert(r.second == next(m.begin(), 4)); - r = m.equal_range(14); - assert(r.first == next(m.begin(), 5)); - assert(r.second == next(m.begin(), 5)); - r = m.equal_range(16); - assert(r.first == next(m.begin(), 6)); - assert(r.second == next(m.begin(), 6)); - r = m.equal_range(18); - assert(r.first == next(m.begin(), 7)); - assert(r.second == next(m.begin(), 7)); - r = m.equal_range(20); - assert(r.first == next(m.begin(), 8)); - assert(r.second == next(m.begin(), 8)); - } - { - typedef std::pair<M::const_iterator, M::const_iterator> R; - V ar[] = - { - V(5, 5), - V(7, 6), - V(9, 7), - V(11, 8), - V(13, 9), - V(15, 10), - V(17, 11), - V(19, 12) - }; - const M m(ar, ar+sizeof(ar)/sizeof(ar[0])); - R r = m.equal_range(5); - assert(r.first == next(m.begin(), 0)); - assert(r.second == next(m.begin(), 1)); - r = m.equal_range(7); - assert(r.first == next(m.begin(), 1)); - assert(r.second == next(m.begin(), 2)); - r = m.equal_range(9); - assert(r.first == next(m.begin(), 2)); - assert(r.second == next(m.begin(), 3)); - r = m.equal_range(11); - assert(r.first == next(m.begin(), 3)); - assert(r.second == next(m.begin(), 4)); - r = m.equal_range(13); - assert(r.first == next(m.begin(), 4)); - assert(r.second == next(m.begin(), 5)); - r = m.equal_range(15); - assert(r.first == next(m.begin(), 5)); - assert(r.second == next(m.begin(), 6)); - r = m.equal_range(17); - assert(r.first == next(m.begin(), 6)); - assert(r.second == next(m.begin(), 7)); - r = m.equal_range(19); - assert(r.first == next(m.begin(), 7)); - assert(r.second == next(m.begin(), 8)); - r = m.equal_range(4); - assert(r.first == next(m.begin(), 0)); - assert(r.second == next(m.begin(), 0)); - r = m.equal_range(6); - assert(r.first == next(m.begin(), 1)); - assert(r.second == next(m.begin(), 1)); - r = m.equal_range(8); - assert(r.first == next(m.begin(), 2)); - assert(r.second == next(m.begin(), 2)); - r = m.equal_range(10); - assert(r.first == next(m.begin(), 3)); - assert(r.second == next(m.begin(), 3)); - r = m.equal_range(12); - assert(r.first == next(m.begin(), 4)); - assert(r.second == next(m.begin(), 4)); - r = m.equal_range(14); - assert(r.first == next(m.begin(), 5)); - assert(r.second == next(m.begin(), 5)); - r = m.equal_range(16); - assert(r.first == next(m.begin(), 6)); - assert(r.second == next(m.begin(), 6)); - r = m.equal_range(18); - assert(r.first == next(m.begin(), 7)); - assert(r.second == next(m.begin(), 7)); - r = m.equal_range(20); - assert(r.first == next(m.begin(), 8)); - assert(r.second == next(m.begin(), 8)); - } - } -#endif -#if _LIBCPP_STD_VER > 11 - { - typedef std::pair<const int, double> V; - typedef std::map<int, double, std::less<>> M; - typedef std::pair<M::iterator, M::iterator> R; - - V ar[] = - { - V(5, 5), - V(7, 6), - V(9, 7), - V(11, 8), - V(13, 9), - V(15, 10), - V(17, 11), - V(19, 12) - }; - M m(ar, ar+sizeof(ar)/sizeof(ar[0])); - R r = m.equal_range(5); - assert(r.first == next(m.begin(), 0)); - assert(r.second == next(m.begin(), 1)); - r = m.equal_range(7); - assert(r.first == next(m.begin(), 1)); - assert(r.second == next(m.begin(), 2)); - r = m.equal_range(9); - assert(r.first == next(m.begin(), 2)); - assert(r.second == next(m.begin(), 3)); - r = m.equal_range(11); - assert(r.first == next(m.begin(), 3)); - assert(r.second == next(m.begin(), 4)); - r = m.equal_range(13); - assert(r.first == next(m.begin(), 4)); - assert(r.second == next(m.begin(), 5)); - r = m.equal_range(15); - assert(r.first == next(m.begin(), 5)); - assert(r.second == next(m.begin(), 6)); - r = m.equal_range(17); - assert(r.first == next(m.begin(), 6)); - assert(r.second == next(m.begin(), 7)); - r = m.equal_range(19); - assert(r.first == next(m.begin(), 7)); - assert(r.second == next(m.begin(), 8)); - r = m.equal_range(4); - assert(r.first == next(m.begin(), 0)); - assert(r.second == next(m.begin(), 0)); - r = m.equal_range(6); - assert(r.first == next(m.begin(), 1)); - assert(r.second == next(m.begin(), 1)); - r = m.equal_range(8); - assert(r.first == next(m.begin(), 2)); - assert(r.second == next(m.begin(), 2)); - r = m.equal_range(10); - assert(r.first == next(m.begin(), 3)); - assert(r.second == next(m.begin(), 3)); - r = m.equal_range(12); - assert(r.first == next(m.begin(), 4)); - assert(r.second == next(m.begin(), 4)); - r = m.equal_range(14); - assert(r.first == next(m.begin(), 5)); - assert(r.second == next(m.begin(), 5)); - r = m.equal_range(16); - assert(r.first == next(m.begin(), 6)); - assert(r.second == next(m.begin(), 6)); - r = m.equal_range(18); - assert(r.first == next(m.begin(), 7)); - assert(r.second == next(m.begin(), 7)); - r = m.equal_range(20); - assert(r.first == next(m.begin(), 8)); - assert(r.second == next(m.begin(), 8)); - } - { - typedef PrivateConstructor PC; - typedef std::map<PC, double, std::less<>> M; - typedef std::pair<M::iterator, M::iterator> R; - - M m; - m [ PC::make(5) ] = 5; - m [ PC::make(7) ] = 6; - m [ PC::make(9) ] = 7; - m [ PC::make(11) ] = 8; - m [ PC::make(13) ] = 9; - m [ PC::make(15) ] = 10; - m [ PC::make(17) ] = 11; - m [ PC::make(19) ] = 12; - - R r = m.equal_range(5); - assert(r.first == next(m.begin(), 0)); - assert(r.second == next(m.begin(), 1)); - r = m.equal_range(7); - assert(r.first == next(m.begin(), 1)); - assert(r.second == next(m.begin(), 2)); - r = m.equal_range(9); - assert(r.first == next(m.begin(), 2)); - assert(r.second == next(m.begin(), 3)); - r = m.equal_range(11); - assert(r.first == next(m.begin(), 3)); - assert(r.second == next(m.begin(), 4)); - r = m.equal_range(13); - assert(r.first == next(m.begin(), 4)); - assert(r.second == next(m.begin(), 5)); - r = m.equal_range(15); - assert(r.first == next(m.begin(), 5)); - assert(r.second == next(m.begin(), 6)); - r = m.equal_range(17); - assert(r.first == next(m.begin(), 6)); - assert(r.second == next(m.begin(), 7)); - r = m.equal_range(19); - assert(r.first == next(m.begin(), 7)); - assert(r.second == next(m.begin(), 8)); - r = m.equal_range(4); - assert(r.first == next(m.begin(), 0)); - assert(r.second == next(m.begin(), 0)); - r = m.equal_range(6); - assert(r.first == next(m.begin(), 1)); - assert(r.second == next(m.begin(), 1)); - r = m.equal_range(8); - assert(r.first == next(m.begin(), 2)); - assert(r.second == next(m.begin(), 2)); - r = m.equal_range(10); - assert(r.first == next(m.begin(), 3)); - assert(r.second == next(m.begin(), 3)); - r = m.equal_range(12); - assert(r.first == next(m.begin(), 4)); - assert(r.second == next(m.begin(), 4)); - r = m.equal_range(14); - assert(r.first == next(m.begin(), 5)); - assert(r.second == next(m.begin(), 5)); - r = m.equal_range(16); - assert(r.first == next(m.begin(), 6)); - assert(r.second == next(m.begin(), 6)); - r = m.equal_range(18); - assert(r.first == next(m.begin(), 7)); - assert(r.second == next(m.begin(), 7)); - r = m.equal_range(20); - assert(r.first == next(m.begin(), 8)); - assert(r.second == next(m.begin(), 8)); - } -#endif -} diff --git a/libcxx/test/containers/associative/map/map.ops/find.pass.cpp b/libcxx/test/containers/associative/map/map.ops/find.pass.cpp deleted file mode 100644 index a7578449f5b..00000000000 --- a/libcxx/test/containers/associative/map/map.ops/find.pass.cpp +++ /dev/null @@ -1,240 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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; - -#include <map> -#include <cassert> - -#include "min_allocator.h" -#include "private_constructor.hpp" - -int main() -{ - { - typedef std::pair<const int, double> V; - typedef std::map<int, double> M; - { - typedef M::iterator R; - V ar[] = - { - V(5, 5), - V(6, 6), - V(7, 7), - V(8, 8), - V(9, 9), - V(10, 10), - V(11, 11), - V(12, 12) - }; - M m(ar, ar+sizeof(ar)/sizeof(ar[0])); - R r = m.find(5); - assert(r == m.begin()); - r = m.find(6); - assert(r == next(m.begin())); - r = m.find(7); - assert(r == next(m.begin(), 2)); - r = m.find(8); - assert(r == next(m.begin(), 3)); - r = m.find(9); - assert(r == next(m.begin(), 4)); - r = m.find(10); - assert(r == next(m.begin(), 5)); - r = m.find(11); - assert(r == next(m.begin(), 6)); - r = m.find(12); - assert(r == next(m.begin(), 7)); - r = m.find(4); - assert(r == next(m.begin(), 8)); - } - { - typedef M::const_iterator R; - V ar[] = - { - V(5, 5), - V(6, 6), - V(7, 7), - V(8, 8), - V(9, 9), - V(10, 10), - V(11, 11), - V(12, 12) - }; - const M m(ar, ar+sizeof(ar)/sizeof(ar[0])); - R r = m.find(5); - assert(r == m.begin()); - r = m.find(6); - assert(r == next(m.begin())); - r = m.find(7); - assert(r == next(m.begin(), 2)); - r = m.find(8); - assert(r == next(m.begin(), 3)); - r = m.find(9); - assert(r == next(m.begin(), 4)); - r = m.find(10); - assert(r == next(m.begin(), 5)); - r = m.find(11); - assert(r == next(m.begin(), 6)); - r = m.find(12); - assert(r == next(m.begin(), 7)); - r = m.find(4); - assert(r == next(m.begin(), 8)); - } - } -#if __cplusplus >= 201103L - { - typedef std::pair<const int, double> V; - typedef std::map<int, double, std::less<int>, min_allocator<V>> M; - { - typedef M::iterator R; - V ar[] = - { - V(5, 5), - V(6, 6), - V(7, 7), - V(8, 8), - V(9, 9), - V(10, 10), - V(11, 11), - V(12, 12) - }; - M m(ar, ar+sizeof(ar)/sizeof(ar[0])); - R r = m.find(5); - assert(r == m.begin()); - r = m.find(6); - assert(r == next(m.begin())); - r = m.find(7); - assert(r == next(m.begin(), 2)); - r = m.find(8); - assert(r == next(m.begin(), 3)); - r = m.find(9); - assert(r == next(m.begin(), 4)); - r = m.find(10); - assert(r == next(m.begin(), 5)); - r = m.find(11); - assert(r == next(m.begin(), 6)); - r = m.find(12); - assert(r == next(m.begin(), 7)); - r = m.find(4); - assert(r == next(m.begin(), 8)); - } - { - typedef M::const_iterator R; - V ar[] = - { - V(5, 5), - V(6, 6), - V(7, 7), - V(8, 8), - V(9, 9), - V(10, 10), - V(11, 11), - V(12, 12) - }; - const M m(ar, ar+sizeof(ar)/sizeof(ar[0])); - R r = m.find(5); - assert(r == m.begin()); - r = m.find(6); - assert(r == next(m.begin())); - r = m.find(7); - assert(r == next(m.begin(), 2)); - r = m.find(8); - assert(r == next(m.begin(), 3)); - r = m.find(9); - assert(r == next(m.begin(), 4)); - r = m.find(10); - assert(r == next(m.begin(), 5)); - r = m.find(11); - assert(r == next(m.begin(), 6)); - r = m.find(12); - assert(r == next(m.begin(), 7)); - r = m.find(4); - assert(r == next(m.begin(), 8)); - } - } -#endif -#if _LIBCPP_STD_VER > 11 - { - typedef std::pair<const int, double> V; - typedef std::map<int, double, std::less<>> M; - typedef M::iterator R; - - V ar[] = - { - V(5, 5), - V(6, 6), - V(7, 7), - V(8, 8), - V(9, 9), - V(10, 10), - V(11, 11), - V(12, 12) - }; - M m(ar, ar+sizeof(ar)/sizeof(ar[0])); - R r = m.find(5); - assert(r == m.begin()); - r = m.find(6); - assert(r == next(m.begin())); - r = m.find(7); - assert(r == next(m.begin(), 2)); - r = m.find(8); - assert(r == next(m.begin(), 3)); - r = m.find(9); - assert(r == next(m.begin(), 4)); - r = m.find(10); - assert(r == next(m.begin(), 5)); - r = m.find(11); - assert(r == next(m.begin(), 6)); - r = m.find(12); - assert(r == next(m.begin(), 7)); - r = m.find(4); - assert(r == next(m.begin(), 8)); - } - - { - typedef PrivateConstructor PC; - typedef std::map<PC, double, std::less<>> M; - typedef M::iterator R; - - M m; - m [ PC::make(5) ] = 5; - m [ PC::make(6) ] = 6; - m [ PC::make(7) ] = 7; - m [ PC::make(8) ] = 8; - m [ PC::make(9) ] = 9; - m [ PC::make(10) ] = 10; - m [ PC::make(11) ] = 11; - m [ PC::make(12) ] = 12; - - R r = m.find(5); - assert(r == m.begin()); - r = m.find(6); - assert(r == next(m.begin())); - r = m.find(7); - assert(r == next(m.begin(), 2)); - r = m.find(8); - assert(r == next(m.begin(), 3)); - r = m.find(9); - assert(r == next(m.begin(), 4)); - r = m.find(10); - assert(r == next(m.begin(), 5)); - r = m.find(11); - assert(r == next(m.begin(), 6)); - r = m.find(12); - assert(r == next(m.begin(), 7)); - r = m.find(4); - assert(r == next(m.begin(), 8)); - } -#endif -} diff --git a/libcxx/test/containers/associative/map/map.ops/lower_bound.pass.cpp b/libcxx/test/containers/associative/map/map.ops/lower_bound.pass.cpp deleted file mode 100644 index 87b84eef070..00000000000 --- a/libcxx/test/containers/associative/map/map.ops/lower_bound.pass.cpp +++ /dev/null @@ -1,336 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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; - -#include <map> -#include <cassert> - -#include "min_allocator.h" -#include "private_constructor.hpp" - -int main() -{ - { - typedef std::pair<const int, double> V; - typedef std::map<int, double> M; - { - typedef M::iterator R; - V ar[] = - { - V(5, 5), - V(7, 6), - V(9, 7), - V(11, 8), - V(13, 9), - V(15, 10), - V(17, 11), - V(19, 12) - }; - M m(ar, ar+sizeof(ar)/sizeof(ar[0])); - R r = m.lower_bound(5); - assert(r == m.begin()); - r = m.lower_bound(7); - assert(r == next(m.begin())); - r = m.lower_bound(9); - assert(r == next(m.begin(), 2)); - r = m.lower_bound(11); - assert(r == next(m.begin(), 3)); - r = m.lower_bound(13); - assert(r == next(m.begin(), 4)); - r = m.lower_bound(15); - assert(r == next(m.begin(), 5)); - r = m.lower_bound(17); - assert(r == next(m.begin(), 6)); - r = m.lower_bound(19); - assert(r == next(m.begin(), 7)); - r = m.lower_bound(4); - assert(r == next(m.begin(), 0)); - r = m.lower_bound(6); - assert(r == next(m.begin(), 1)); - r = m.lower_bound(8); - assert(r == next(m.begin(), 2)); - r = m.lower_bound(10); - assert(r == next(m.begin(), 3)); - r = m.lower_bound(12); - assert(r == next(m.begin(), 4)); - r = m.lower_bound(14); - assert(r == next(m.begin(), 5)); - r = m.lower_bound(16); - assert(r == next(m.begin(), 6)); - r = m.lower_bound(18); - assert(r == next(m.begin(), 7)); - r = m.lower_bound(20); - assert(r == next(m.begin(), 8)); - } - { - typedef M::const_iterator R; - V ar[] = - { - V(5, 5), - V(7, 6), - V(9, 7), - V(11, 8), - V(13, 9), - V(15, 10), - V(17, 11), - V(19, 12) - }; - const M m(ar, ar+sizeof(ar)/sizeof(ar[0])); - R r = m.lower_bound(5); - assert(r == m.begin()); - r = m.lower_bound(7); - assert(r == next(m.begin())); - r = m.lower_bound(9); - assert(r == next(m.begin(), 2)); - r = m.lower_bound(11); - assert(r == next(m.begin(), 3)); - r = m.lower_bound(13); - assert(r == next(m.begin(), 4)); - r = m.lower_bound(15); - assert(r == next(m.begin(), 5)); - r = m.lower_bound(17); - assert(r == next(m.begin(), 6)); - r = m.lower_bound(19); - assert(r == next(m.begin(), 7)); - r = m.lower_bound(4); - assert(r == next(m.begin(), 0)); - r = m.lower_bound(6); - assert(r == next(m.begin(), 1)); - r = m.lower_bound(8); - assert(r == next(m.begin(), 2)); - r = m.lower_bound(10); - assert(r == next(m.begin(), 3)); - r = m.lower_bound(12); - assert(r == next(m.begin(), 4)); - r = m.lower_bound(14); - assert(r == next(m.begin(), 5)); - r = m.lower_bound(16); - assert(r == next(m.begin(), 6)); - r = m.lower_bound(18); - assert(r == next(m.begin(), 7)); - r = m.lower_bound(20); - assert(r == next(m.begin(), 8)); - } - } -#if __cplusplus >= 201103L - { - typedef std::pair<const int, double> V; - typedef std::map<int, double, std::less<int>, min_allocator<V>> M; - { - typedef M::iterator R; - V ar[] = - { - V(5, 5), - V(7, 6), - V(9, 7), - V(11, 8), - V(13, 9), - V(15, 10), - V(17, 11), - V(19, 12) - }; - M m(ar, ar+sizeof(ar)/sizeof(ar[0])); - R r = m.lower_bound(5); - assert(r == m.begin()); - r = m.lower_bound(7); - assert(r == next(m.begin())); - r = m.lower_bound(9); - assert(r == next(m.begin(), 2)); - r = m.lower_bound(11); - assert(r == next(m.begin(), 3)); - r = m.lower_bound(13); - assert(r == next(m.begin(), 4)); - r = m.lower_bound(15); - assert(r == next(m.begin(), 5)); - r = m.lower_bound(17); - assert(r == next(m.begin(), 6)); - r = m.lower_bound(19); - assert(r == next(m.begin(), 7)); - r = m.lower_bound(4); - assert(r == next(m.begin(), 0)); - r = m.lower_bound(6); - assert(r == next(m.begin(), 1)); - r = m.lower_bound(8); - assert(r == next(m.begin(), 2)); - r = m.lower_bound(10); - assert(r == next(m.begin(), 3)); - r = m.lower_bound(12); - assert(r == next(m.begin(), 4)); - r = m.lower_bound(14); - assert(r == next(m.begin(), 5)); - r = m.lower_bound(16); - assert(r == next(m.begin(), 6)); - r = m.lower_bound(18); - assert(r == next(m.begin(), 7)); - r = m.lower_bound(20); - assert(r == next(m.begin(), 8)); - } - { - typedef M::const_iterator R; - V ar[] = - { - V(5, 5), - V(7, 6), - V(9, 7), - V(11, 8), - V(13, 9), - V(15, 10), - V(17, 11), - V(19, 12) - }; - const M m(ar, ar+sizeof(ar)/sizeof(ar[0])); - R r = m.lower_bound(5); - assert(r == m.begin()); - r = m.lower_bound(7); - assert(r == next(m.begin())); - r = m.lower_bound(9); - assert(r == next(m.begin(), 2)); - r = m.lower_bound(11); - assert(r == next(m.begin(), 3)); - r = m.lower_bound(13); - assert(r == next(m.begin(), 4)); - r = m.lower_bound(15); - assert(r == next(m.begin(), 5)); - r = m.lower_bound(17); - assert(r == next(m.begin(), 6)); - r = m.lower_bound(19); - assert(r == next(m.begin(), 7)); - r = m.lower_bound(4); - assert(r == next(m.begin(), 0)); - r = m.lower_bound(6); - assert(r == next(m.begin(), 1)); - r = m.lower_bound(8); - assert(r == next(m.begin(), 2)); - r = m.lower_bound(10); - assert(r == next(m.begin(), 3)); - r = m.lower_bound(12); - assert(r == next(m.begin(), 4)); - r = m.lower_bound(14); - assert(r == next(m.begin(), 5)); - r = m.lower_bound(16); - assert(r == next(m.begin(), 6)); - r = m.lower_bound(18); - assert(r == next(m.begin(), 7)); - r = m.lower_bound(20); - assert(r == next(m.begin(), 8)); - } - } -#endif -#if _LIBCPP_STD_VER > 11 - { - typedef std::pair<const int, double> V; - typedef std::map<int, double, std::less <>> M; - typedef M::iterator R; - - V ar[] = - { - V(5, 5), - V(7, 6), - V(9, 7), - V(11, 8), - V(13, 9), - V(15, 10), - V(17, 11), - V(19, 12) - }; - M m(ar, ar+sizeof(ar)/sizeof(ar[0])); - R r = m.lower_bound(5); - assert(r == m.begin()); - r = m.lower_bound(7); - assert(r == next(m.begin())); - r = m.lower_bound(9); - assert(r == next(m.begin(), 2)); - r = m.lower_bound(11); - assert(r == next(m.begin(), 3)); - r = m.lower_bound(13); - assert(r == next(m.begin(), 4)); - r = m.lower_bound(15); - assert(r == next(m.begin(), 5)); - r = m.lower_bound(17); - assert(r == next(m.begin(), 6)); - r = m.lower_bound(19); - assert(r == next(m.begin(), 7)); - r = m.lower_bound(4); - assert(r == next(m.begin(), 0)); - r = m.lower_bound(6); - assert(r == next(m.begin(), 1)); - r = m.lower_bound(8); - assert(r == next(m.begin(), 2)); - r = m.lower_bound(10); - assert(r == next(m.begin(), 3)); - r = m.lower_bound(12); - assert(r == next(m.begin(), 4)); - r = m.lower_bound(14); - assert(r == next(m.begin(), 5)); - r = m.lower_bound(16); - assert(r == next(m.begin(), 6)); - r = m.lower_bound(18); - assert(r == next(m.begin(), 7)); - r = m.lower_bound(20); - assert(r == next(m.begin(), 8)); - } - - { - typedef PrivateConstructor PC; - typedef std::map<PC, double, std::less<>> M; - typedef M::iterator R; - - M m; - m [ PC::make(5) ] = 5; - m [ PC::make(7) ] = 6; - m [ PC::make(9) ] = 7; - m [ PC::make(11) ] = 8; - m [ PC::make(13) ] = 9; - m [ PC::make(15) ] = 10; - m [ PC::make(17) ] = 11; - m [ PC::make(19) ] = 12; - - R r = m.lower_bound(5); - assert(r == m.begin()); - r = m.lower_bound(7); - assert(r == next(m.begin())); - r = m.lower_bound(9); - assert(r == next(m.begin(), 2)); - r = m.lower_bound(11); - assert(r == next(m.begin(), 3)); - r = m.lower_bound(13); - assert(r == next(m.begin(), 4)); - r = m.lower_bound(15); - assert(r == next(m.begin(), 5)); - r = m.lower_bound(17); - assert(r == next(m.begin(), 6)); - r = m.lower_bound(19); - assert(r == next(m.begin(), 7)); - r = m.lower_bound(4); - assert(r == next(m.begin(), 0)); - r = m.lower_bound(6); - assert(r == next(m.begin(), 1)); - r = m.lower_bound(8); - assert(r == next(m.begin(), 2)); - r = m.lower_bound(10); - assert(r == next(m.begin(), 3)); - r = m.lower_bound(12); - assert(r == next(m.begin(), 4)); - r = m.lower_bound(14); - assert(r == next(m.begin(), 5)); - r = m.lower_bound(16); - assert(r == next(m.begin(), 6)); - r = m.lower_bound(18); - assert(r == next(m.begin(), 7)); - r = m.lower_bound(20); - assert(r == next(m.begin(), 8)); - } -#endif -} diff --git a/libcxx/test/containers/associative/map/map.ops/upper_bound.pass.cpp b/libcxx/test/containers/associative/map/map.ops/upper_bound.pass.cpp deleted file mode 100644 index 037ceb962cd..00000000000 --- a/libcxx/test/containers/associative/map/map.ops/upper_bound.pass.cpp +++ /dev/null @@ -1,335 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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; - -#include <map> -#include <cassert> - -#include "min_allocator.h" -#include "private_constructor.hpp" - -int main() -{ - { - typedef std::pair<const int, double> V; - typedef std::map<int, double> M; - { - typedef M::iterator R; - V ar[] = - { - V(5, 5), - V(7, 6), - V(9, 7), - V(11, 8), - V(13, 9), - V(15, 10), - V(17, 11), - V(19, 12) - }; - M m(ar, ar+sizeof(ar)/sizeof(ar[0])); - R r = m.upper_bound(5); - assert(r == next(m.begin(), 1)); - r = m.upper_bound(7); - assert(r == next(m.begin(), 2)); - r = m.upper_bound(9); - assert(r == next(m.begin(), 3)); - r = m.upper_bound(11); - assert(r == next(m.begin(), 4)); - r = m.upper_bound(13); - assert(r == next(m.begin(), 5)); - r = m.upper_bound(15); - assert(r == next(m.begin(), 6)); - r = m.upper_bound(17); - assert(r == next(m.begin(), 7)); - r = m.upper_bound(19); - assert(r == next(m.begin(), 8)); - r = m.upper_bound(4); - assert(r == next(m.begin(), 0)); - r = m.upper_bound(6); - assert(r == next(m.begin(), 1)); - r = m.upper_bound(8); - assert(r == next(m.begin(), 2)); - r = m.upper_bound(10); - assert(r == next(m.begin(), 3)); - r = m.upper_bound(12); - assert(r == next(m.begin(), 4)); - r = m.upper_bound(14); - assert(r == next(m.begin(), 5)); - r = m.upper_bound(16); - assert(r == next(m.begin(), 6)); - r = m.upper_bound(18); - assert(r == next(m.begin(), 7)); - r = m.upper_bound(20); - assert(r == next(m.begin(), 8)); - } - { - typedef M::const_iterator R; - V ar[] = - { - V(5, 5), - V(7, 6), - V(9, 7), - V(11, 8), - V(13, 9), - V(15, 10), - V(17, 11), - V(19, 12) - }; - const M m(ar, ar+sizeof(ar)/sizeof(ar[0])); - R r = m.upper_bound(5); - assert(r == next(m.begin(), 1)); - r = m.upper_bound(7); - assert(r == next(m.begin(), 2)); - r = m.upper_bound(9); - assert(r == next(m.begin(), 3)); - r = m.upper_bound(11); - assert(r == next(m.begin(), 4)); - r = m.upper_bound(13); - assert(r == next(m.begin(), 5)); - r = m.upper_bound(15); - assert(r == next(m.begin(), 6)); - r = m.upper_bound(17); - assert(r == next(m.begin(), 7)); - r = m.upper_bound(19); - assert(r == next(m.begin(), 8)); - r = m.upper_bound(4); - assert(r == next(m.begin(), 0)); - r = m.upper_bound(6); - assert(r == next(m.begin(), 1)); - r = m.upper_bound(8); - assert(r == next(m.begin(), 2)); - r = m.upper_bound(10); - assert(r == next(m.begin(), 3)); - r = m.upper_bound(12); - assert(r == next(m.begin(), 4)); - r = m.upper_bound(14); - assert(r == next(m.begin(), 5)); - r = m.upper_bound(16); - assert(r == next(m.begin(), 6)); - r = m.upper_bound(18); - assert(r == next(m.begin(), 7)); - r = m.upper_bound(20); - assert(r == next(m.begin(), 8)); - } - } -#if __cplusplus >= 201103L - { - typedef std::pair<const int, double> V; - typedef std::map<int, double, std::less<int>, min_allocator<V>> M; - { - typedef M::iterator R; - V ar[] = - { - V(5, 5), - V(7, 6), - V(9, 7), - V(11, 8), - V(13, 9), - V(15, 10), - V(17, 11), - V(19, 12) - }; - M m(ar, ar+sizeof(ar)/sizeof(ar[0])); - R r = m.upper_bound(5); - assert(r == next(m.begin(), 1)); - r = m.upper_bound(7); - assert(r == next(m.begin(), 2)); - r = m.upper_bound(9); - assert(r == next(m.begin(), 3)); - r = m.upper_bound(11); - assert(r == next(m.begin(), 4)); - r = m.upper_bound(13); - assert(r == next(m.begin(), 5)); - r = m.upper_bound(15); - assert(r == next(m.begin(), 6)); - r = m.upper_bound(17); - assert(r == next(m.begin(), 7)); - r = m.upper_bound(19); - assert(r == next(m.begin(), 8)); - r = m.upper_bound(4); - assert(r == next(m.begin(), 0)); - r = m.upper_bound(6); - assert(r == next(m.begin(), 1)); - r = m.upper_bound(8); - assert(r == next(m.begin(), 2)); - r = m.upper_bound(10); - assert(r == next(m.begin(), 3)); - r = m.upper_bound(12); - assert(r == next(m.begin(), 4)); - r = m.upper_bound(14); - assert(r == next(m.begin(), 5)); - r = m.upper_bound(16); - assert(r == next(m.begin(), 6)); - r = m.upper_bound(18); - assert(r == next(m.begin(), 7)); - r = m.upper_bound(20); - assert(r == next(m.begin(), 8)); - } - { - typedef M::const_iterator R; - V ar[] = - { - V(5, 5), - V(7, 6), - V(9, 7), - V(11, 8), - V(13, 9), - V(15, 10), - V(17, 11), - V(19, 12) - }; - const M m(ar, ar+sizeof(ar)/sizeof(ar[0])); - R r = m.upper_bound(5); - assert(r == next(m.begin(), 1)); - r = m.upper_bound(7); - assert(r == next(m.begin(), 2)); - r = m.upper_bound(9); - assert(r == next(m.begin(), 3)); - r = m.upper_bound(11); - assert(r == next(m.begin(), 4)); - r = m.upper_bound(13); - assert(r == next(m.begin(), 5)); - r = m.upper_bound(15); - assert(r == next(m.begin(), 6)); - r = m.upper_bound(17); - assert(r == next(m.begin(), 7)); - r = m.upper_bound(19); - assert(r == next(m.begin(), 8)); - r = m.upper_bound(4); - assert(r == next(m.begin(), 0)); - r = m.upper_bound(6); - assert(r == next(m.begin(), 1)); - r = m.upper_bound(8); - assert(r == next(m.begin(), 2)); - r = m.upper_bound(10); - assert(r == next(m.begin(), 3)); - r = m.upper_bound(12); - assert(r == next(m.begin(), 4)); - r = m.upper_bound(14); - assert(r == next(m.begin(), 5)); - r = m.upper_bound(16); - assert(r == next(m.begin(), 6)); - r = m.upper_bound(18); - assert(r == next(m.begin(), 7)); - r = m.upper_bound(20); - assert(r == next(m.begin(), 8)); - } - } -#endif -#if _LIBCPP_STD_VER > 11 - { - typedef std::pair<const int, double> V; - typedef std::map<int, double, std::less<>> M; - typedef M::iterator R; - V ar[] = - { - V(5, 5), - V(7, 6), - V(9, 7), - V(11, 8), - V(13, 9), - V(15, 10), - V(17, 11), - V(19, 12) - }; - M m(ar, ar+sizeof(ar)/sizeof(ar[0])); - R r = m.upper_bound(5); - assert(r == next(m.begin(), 1)); - r = m.upper_bound(7); - assert(r == next(m.begin(), 2)); - r = m.upper_bound(9); - assert(r == next(m.begin(), 3)); - r = m.upper_bound(11); - assert(r == next(m.begin(), 4)); - r = m.upper_bound(13); - assert(r == next(m.begin(), 5)); - r = m.upper_bound(15); - assert(r == next(m.begin(), 6)); - r = m.upper_bound(17); - assert(r == next(m.begin(), 7)); - r = m.upper_bound(19); - assert(r == next(m.begin(), 8)); - r = m.upper_bound(4); - assert(r == next(m.begin(), 0)); - r = m.upper_bound(6); - assert(r == next(m.begin(), 1)); - r = m.upper_bound(8); - assert(r == next(m.begin(), 2)); - r = m.upper_bound(10); - assert(r == next(m.begin(), 3)); - r = m.upper_bound(12); - assert(r == next(m.begin(), 4)); - r = m.upper_bound(14); - assert(r == next(m.begin(), 5)); - r = m.upper_bound(16); - assert(r == next(m.begin(), 6)); - r = m.upper_bound(18); - assert(r == next(m.begin(), 7)); - r = m.upper_bound(20); - assert(r == next(m.begin(), 8)); - } - - { - typedef PrivateConstructor PC; - typedef std::map<PC, double, std::less<>> M; - typedef M::iterator R; - - M m; - m [ PC::make(5) ] = 5; - m [ PC::make(7) ] = 6; - m [ PC::make(9) ] = 7; - m [ PC::make(11) ] = 8; - m [ PC::make(13) ] = 9; - m [ PC::make(15) ] = 10; - m [ PC::make(17) ] = 11; - m [ PC::make(19) ] = 12; - - R r = m.upper_bound(5); - assert(r == next(m.begin(), 1)); - r = m.upper_bound(7); - assert(r == next(m.begin(), 2)); - r = m.upper_bound(9); - assert(r == next(m.begin(), 3)); - r = m.upper_bound(11); - assert(r == next(m.begin(), 4)); - r = m.upper_bound(13); - assert(r == next(m.begin(), 5)); - r = m.upper_bound(15); - assert(r == next(m.begin(), 6)); - r = m.upper_bound(17); - assert(r == next(m.begin(), 7)); - r = m.upper_bound(19); - assert(r == next(m.begin(), 8)); - r = m.upper_bound(4); - assert(r == next(m.begin(), 0)); - r = m.upper_bound(6); - assert(r == next(m.begin(), 1)); - r = m.upper_bound(8); - assert(r == next(m.begin(), 2)); - r = m.upper_bound(10); - assert(r == next(m.begin(), 3)); - r = m.upper_bound(12); - assert(r == next(m.begin(), 4)); - r = m.upper_bound(14); - assert(r == next(m.begin(), 5)); - r = m.upper_bound(16); - assert(r == next(m.begin(), 6)); - r = m.upper_bound(18); - assert(r == next(m.begin(), 7)); - r = m.upper_bound(20); - assert(r == next(m.begin(), 8)); - } -#endif -} diff --git a/libcxx/test/containers/associative/map/map.special/member_swap.pass.cpp b/libcxx/test/containers/associative/map/map.special/member_swap.pass.cpp deleted file mode 100644 index 4f7bd5154ed..00000000000 --- a/libcxx/test/containers/associative/map/map.special/member_swap.pass.cpp +++ /dev/null @@ -1,201 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// void swap(map& m); - -#include <map> -#include <cassert> - -#include "min_allocator.h" - -int main() -{ - { - typedef std::pair<const int, double> V; - typedef std::map<int, double> M; - { - V ar1[] = - { - }; - V ar2[] = - { - }; - M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0])); - M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0])); - M m1_save = m1; - M m2_save = m2; - m1.swap(m2); - assert(m1 == m2_save); - assert(m2 == m1_save); - } - { - V ar1[] = - { - }; - V ar2[] = - { - V(5, 5), - V(6, 6), - V(7, 7), - V(8, 8), - V(9, 9), - V(10, 10), - V(11, 11), - V(12, 12) - }; - M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0])); - M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0])); - M m1_save = m1; - M m2_save = m2; - m1.swap(m2); - assert(m1 == m2_save); - assert(m2 == m1_save); - } - { - V ar1[] = - { - V(1, 1), - V(2, 2), - V(3, 3), - V(4, 4) - }; - V ar2[] = - { - }; - M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0])); - M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0])); - M m1_save = m1; - M m2_save = m2; - m1.swap(m2); - assert(m1 == m2_save); - assert(m2 == m1_save); - } - { - V ar1[] = - { - V(1, 1), - V(2, 2), - V(3, 3), - V(4, 4) - }; - V ar2[] = - { - V(5, 5), - V(6, 6), - V(7, 7), - V(8, 8), - V(9, 9), - V(10, 10), - V(11, 11), - V(12, 12) - }; - M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0])); - M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0])); - M m1_save = m1; - M m2_save = m2; - m1.swap(m2); - assert(m1 == m2_save); - assert(m2 == m1_save); - } - } -#if __cplusplus >= 201103L - { - typedef std::pair<const int, double> V; - typedef std::map<int, double, std::less<int>, min_allocator<V>> M; - { - V ar1[] = - { - }; - V ar2[] = - { - }; - M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0])); - M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0])); - M m1_save = m1; - M m2_save = m2; - m1.swap(m2); - assert(m1 == m2_save); - assert(m2 == m1_save); - } - { - V ar1[] = - { - }; - V ar2[] = - { - V(5, 5), - V(6, 6), - V(7, 7), - V(8, 8), - V(9, 9), - V(10, 10), - V(11, 11), - V(12, 12) - }; - M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0])); - M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0])); - M m1_save = m1; - M m2_save = m2; - m1.swap(m2); - assert(m1 == m2_save); - assert(m2 == m1_save); - } - { - V ar1[] = - { - V(1, 1), - V(2, 2), - V(3, 3), - V(4, 4) - }; - V ar2[] = - { - }; - M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0])); - M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0])); - M m1_save = m1; - M m2_save = m2; - m1.swap(m2); - assert(m1 == m2_save); - assert(m2 == m1_save); - } - { - V ar1[] = - { - V(1, 1), - V(2, 2), - V(3, 3), - V(4, 4) - }; - V ar2[] = - { - V(5, 5), - V(6, 6), - V(7, 7), - V(8, 8), - V(9, 9), - V(10, 10), - V(11, 11), - V(12, 12) - }; - M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0])); - M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0])); - M m1_save = m1; - M m2_save = m2; - m1.swap(m2); - assert(m1 == m2_save); - assert(m2 == m1_save); - } - } -#endif -} diff --git a/libcxx/test/containers/associative/map/map.special/non_member_swap.pass.cpp b/libcxx/test/containers/associative/map/map.special/non_member_swap.pass.cpp deleted file mode 100644 index 57588e6ff16..00000000000 --- a/libcxx/test/containers/associative/map/map.special/non_member_swap.pass.cpp +++ /dev/null @@ -1,306 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// template <class Key, class T, class Compare, class Allocator> -// void -// swap(map<Key, T, Compare, Allocator>& x, map<Key, T, Compare, Allocator>& y); - -#include <map> -#include <cassert> -#include "test_allocator.h" -#include "../../../test_compare.h" -#include "min_allocator.h" - -int main() -{ - { - typedef std::pair<const int, double> V; - typedef std::map<int, double> M; - { - V ar1[] = - { - }; - V ar2[] = - { - }; - M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0])); - M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0])); - M m1_save = m1; - M m2_save = m2; - swap(m1, m2); - assert(m1 == m2_save); - assert(m2 == m1_save); - } - { - V ar1[] = - { - }; - V ar2[] = - { - V(5, 5), - V(6, 6), - V(7, 7), - V(8, 8), - V(9, 9), - V(10, 10), - V(11, 11), - V(12, 12) - }; - M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0])); - M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0])); - M m1_save = m1; - M m2_save = m2; - swap(m1, m2); - assert(m1 == m2_save); - assert(m2 == m1_save); - } - { - V ar1[] = - { - V(1, 1), - V(2, 2), - V(3, 3), - V(4, 4) - }; - V ar2[] = - { - }; - M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0])); - M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0])); - M m1_save = m1; - M m2_save = m2; - swap(m1, m2); - assert(m1 == m2_save); - assert(m2 == m1_save); - } - { - V ar1[] = - { - V(1, 1), - V(2, 2), - V(3, 3), - V(4, 4) - }; - V ar2[] = - { - V(5, 5), - V(6, 6), - V(7, 7), - V(8, 8), - V(9, 9), - V(10, 10), - V(11, 11), - V(12, 12) - }; - M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0])); - M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0])); - M m1_save = m1; - M m2_save = m2; - swap(m1, m2); - assert(m1 == m2_save); - assert(m2 == m1_save); - } - { - typedef test_allocator<V> A; - typedef test_compare<std::less<int> > C; - typedef std::map<int, double, C, A> M; - V ar1[] = - { - V(1, 1), - V(2, 2), - V(3, 3), - V(4, 4) - }; - V ar2[] = - { - V(5, 5), - V(6, 6), - V(7, 7), - V(8, 8), - V(9, 9), - V(10, 10), - V(11, 11), - V(12, 12) - }; - M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1)); - M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(2)); - M m1_save = m1; - M m2_save = m2; - swap(m1, m2); - assert(m1 == m2_save); - assert(m2 == m1_save); - assert(m1.key_comp() == C(2)); - assert(m1.get_allocator() == A(1)); - assert(m2.key_comp() == C(1)); - assert(m2.get_allocator() == A(2)); - } - { - typedef other_allocator<V> A; - typedef test_compare<std::less<int> > C; - typedef std::map<int, double, C, A> M; - V ar1[] = - { - V(1, 1), - V(2, 2), - V(3, 3), - V(4, 4) - }; - V ar2[] = - { - V(5, 5), - V(6, 6), - V(7, 7), - V(8, 8), - V(9, 9), - V(10, 10), - V(11, 11), - V(12, 12) - }; - M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1)); - M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(2)); - M m1_save = m1; - M m2_save = m2; - swap(m1, m2); - assert(m1 == m2_save); - assert(m2 == m1_save); - assert(m1.key_comp() == C(2)); - assert(m1.get_allocator() == A(2)); - assert(m2.key_comp() == C(1)); - assert(m2.get_allocator() == A(1)); - } - } -#if __cplusplus >= 201103L - { - typedef std::pair<const int, double> V; - typedef std::map<int, double, std::less<int>, min_allocator<V>> M; - { - V ar1[] = - { - }; - V ar2[] = - { - }; - M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0])); - M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0])); - M m1_save = m1; - M m2_save = m2; - swap(m1, m2); - assert(m1 == m2_save); - assert(m2 == m1_save); - } - { - V ar1[] = - { - }; - V ar2[] = - { - V(5, 5), - V(6, 6), - V(7, 7), - V(8, 8), - V(9, 9), - V(10, 10), - V(11, 11), - V(12, 12) - }; - M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0])); - M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0])); - M m1_save = m1; - M m2_save = m2; - swap(m1, m2); - assert(m1 == m2_save); - assert(m2 == m1_save); - } - { - V ar1[] = - { - V(1, 1), - V(2, 2), - V(3, 3), - V(4, 4) - }; - V ar2[] = - { - }; - M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0])); - M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0])); - M m1_save = m1; - M m2_save = m2; - swap(m1, m2); - assert(m1 == m2_save); - assert(m2 == m1_save); - } - { - V ar1[] = - { - V(1, 1), - V(2, 2), - V(3, 3), - V(4, 4) - }; - V ar2[] = - { - V(5, 5), - V(6, 6), - V(7, 7), - V(8, 8), - V(9, 9), - V(10, 10), - V(11, 11), - V(12, 12) - }; - M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0])); - M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0])); - M m1_save = m1; - M m2_save = m2; - swap(m1, m2); - assert(m1 == m2_save); - assert(m2 == m1_save); - } - { - typedef min_allocator<V> A; - typedef test_compare<std::less<int> > C; - typedef std::map<int, double, C, A> M; - V ar1[] = - { - V(1, 1), - V(2, 2), - V(3, 3), - V(4, 4) - }; - V ar2[] = - { - V(5, 5), - V(6, 6), - V(7, 7), - V(8, 8), - V(9, 9), - V(10, 10), - V(11, 11), - V(12, 12) - }; - M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A()); - M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A()); - M m1_save = m1; - M m2_save = m2; - swap(m1, m2); - assert(m1 == m2_save); - assert(m2 == m1_save); - assert(m1.key_comp() == C(2)); - assert(m1.get_allocator() == A()); - assert(m2.key_comp() == C(1)); - assert(m2.get_allocator() == A()); - } - } -#endif -} diff --git a/libcxx/test/containers/associative/map/map.special/swap_noexcept.pass.cpp b/libcxx/test/containers/associative/map/map.special/swap_noexcept.pass.cpp deleted file mode 100644 index b8b78635166..00000000000 --- a/libcxx/test/containers/associative/map/map.special/swap_noexcept.pass.cpp +++ /dev/null @@ -1,60 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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> - -// void swap(map& c) -// noexcept(!allocator_type::propagate_on_container_swap::value || -// __is_nothrow_swappable<allocator_type>::value); - -// This tests a conforming extension - -#include <map> -#include <cassert> - -#include "../../../MoveOnly.h" -#include "test_allocator.h" - -template <class T> -struct some_comp -{ - typedef T value_type; - - some_comp() {} - some_comp(const some_comp&) {} - void deallocate(void*, unsigned) {} - - typedef std::true_type propagate_on_container_swap; -}; - -int main() -{ -#if __has_feature(cxx_noexcept) - { - typedef std::map<MoveOnly, MoveOnly> C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); - } - { - typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); - } - { - typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C; - C c1, c2; - static_assert(noexcept(swap(c1, c2)), ""); - } - { - typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C; - C c1, c2; - static_assert(!noexcept(swap(c1, c2)), ""); - } -#endif -} diff --git a/libcxx/test/containers/associative/map/types.pass.cpp b/libcxx/test/containers/associative/map/types.pass.cpp deleted file mode 100644 index d117deff693..00000000000 --- a/libcxx/test/containers/associative/map/types.pass.cpp +++ /dev/null @@ -1,70 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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> - -// template <class Key, class T, class Compare = less<Key>, -// class Allocator = allocator<pair<const Key, T>>> -// class map -// { -// public: -// // types: -// typedef Key key_type; -// typedef T mapped_type; -// typedef pair<const key_type, mapped_type> value_type; -// typedef Compare key_compare; -// typedef Allocator allocator_type; -// typedef typename allocator_type::reference reference; -// typedef typename allocator_type::const_reference const_reference; -// typedef typename allocator_type::pointer pointer; -// typedef typename allocator_type::const_pointer const_pointer; -// typedef typename allocator_type::size_type size_type; -// typedef typename allocator_type::difference_type difference_type; -// ... -// }; - -#include <map> -#include <type_traits> - -#include "min_allocator.h" - -int main() -{ - { - typedef std::map<int, double> C; - static_assert((std::is_same<C::key_type, int>::value), ""); - static_assert((std::is_same<C::mapped_type, double>::value), ""); - static_assert((std::is_same<C::value_type, std::pair<const int, double> >::value), ""); - static_assert((std::is_same<C::key_compare, std::less<int> >::value), ""); - static_assert((std::is_same<C::allocator_type, std::allocator<std::pair<const int, double> > >::value), ""); - static_assert((std::is_same<C::reference, std::pair<const int, double>&>::value), ""); - static_assert((std::is_same<C::const_reference, const std::pair<const int, double>&>::value), ""); - static_assert((std::is_same<C::pointer, std::pair<const int, double>*>::value), ""); - static_assert((std::is_same<C::const_pointer, const std::pair<const int, double>*>::value), ""); - static_assert((std::is_same<C::size_type, std::size_t>::value), ""); - static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), ""); - } -#if __cplusplus >= 201103L - { - typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> C; - static_assert((std::is_same<C::key_type, int>::value), ""); - static_assert((std::is_same<C::mapped_type, double>::value), ""); - static_assert((std::is_same<C::value_type, std::pair<const int, double> >::value), ""); - static_assert((std::is_same<C::key_compare, std::less<int> >::value), ""); - static_assert((std::is_same<C::allocator_type, min_allocator<std::pair<const int, double> > >::value), ""); - static_assert((std::is_same<C::reference, std::pair<const int, double>&>::value), ""); - static_assert((std::is_same<C::const_reference, const std::pair<const int, double>&>::value), ""); - static_assert((std::is_same<C::pointer, min_pointer<std::pair<const int, double>>>::value), ""); - static_assert((std::is_same<C::const_pointer, min_pointer<const std::pair<const int, double>>>::value), ""); -// min_allocator doesn't have a size_type, so one gets synthesized - static_assert((std::is_same<C::size_type, std::make_unsigned<C::difference_type>::type>::value), ""); - static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), ""); - } -#endif -} diff --git a/libcxx/test/containers/associative/map/version.pass.cpp b/libcxx/test/containers/associative/map/version.pass.cpp deleted file mode 100644 index b2e3fa43e78..00000000000 --- a/libcxx/test/containers/associative/map/version.pass.cpp +++ /dev/null @@ -1,20 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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> - -#include <map> - -#ifndef _LIBCPP_VERSION -#error _LIBCPP_VERSION not defined -#endif - -int main() -{ -} |

