diff options
Diffstat (limited to 'libcxx/test/containers/associative/map/map.modifiers')
12 files changed, 0 insertions, 1555 deletions
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 -} |

