diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:47:26 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:47:26 +0000 |
| commit | 51072bd6bf79ef2bc6a922079bff57c31c1effbc (patch) | |
| tree | 91a2effbc9e6f80bdbbf9eb70e06c51ad0867ea0 /test/std/containers/sequences/deque | |
| parent | bb5e33f003797b67974a8893f7f2930fc51b8210 (diff) | |
Notes
Diffstat (limited to 'test/std/containers/sequences/deque')
49 files changed, 106 insertions, 94 deletions
diff --git a/test/std/containers/sequences/deque/deque.capacity/access.pass.cpp b/test/std/containers/sequences/deque/deque.capacity/access.pass.cpp index 996fc9a18fe7..a6a8e7424b25 100644 --- a/test/std/containers/sequences/deque/deque.capacity/access.pass.cpp +++ b/test/std/containers/sequences/deque/deque.capacity/access.pass.cpp @@ -68,7 +68,7 @@ int main() assert(c.front() == 0); assert(c.back() == 9); } -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 { std::deque<int, min_allocator<int>> c = make<std::deque<int, min_allocator<int>> >(10); for (unsigned i = 0; i < 10; ++i) diff --git a/test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp b/test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp index 84f04f9d52da..53c6bd3380a2 100644 --- a/test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp +++ b/test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp @@ -12,6 +12,8 @@ // void resize(size_type n); #include <deque> +#include <algorithm> +#include <iterator> #include <cassert> #include "test_macros.h" diff --git a/test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp b/test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp index 2bf2423fb9af..12af64386bd8 100644 --- a/test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp +++ b/test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp @@ -12,6 +12,8 @@ // void resize(size_type n, const value_type& v); #include <deque> +#include <algorithm> +#include <iterator> #include <cassert> #include "test_macros.h" diff --git a/test/std/containers/sequences/deque/deque.cons/alloc.pass.cpp b/test/std/containers/sequences/deque/deque.cons/alloc.pass.cpp index 841bfd9f8a7f..787c2394b38e 100644 --- a/test/std/containers/sequences/deque/deque.cons/alloc.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/alloc.pass.cpp @@ -31,7 +31,7 @@ int main() { test<int>(std::allocator<int>()); test<NotConstructible>(test_allocator<NotConstructible>(3)); -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 test<int>(min_allocator<int>()); test<NotConstructible>(min_allocator<NotConstructible>{}); #endif diff --git a/test/std/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp b/test/std/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp index c760b4372444..dea6492a515d 100644 --- a/test/std/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp @@ -28,7 +28,7 @@ int main() assert(d[2] == 5); assert(d[3] == 6); } -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 { std::deque<int, min_allocator<int>> d; d.assign({3, 4, 5, 6}); diff --git a/test/std/containers/sequences/deque/deque.cons/copy.pass.cpp b/test/std/containers/sequences/deque/deque.cons/copy.pass.cpp index fa0c1203ede9..ec73555b9c4f 100644 --- a/test/std/containers/sequences/deque/deque.cons/copy.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/copy.pass.cpp @@ -45,7 +45,7 @@ int main() assert(v2.get_allocator() == other_allocator<int>(-2)); } #endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 { int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45}; int* an = ab + sizeof(ab)/sizeof(ab[0]); diff --git a/test/std/containers/sequences/deque/deque.cons/copy_alloc.pass.cpp b/test/std/containers/sequences/deque/deque.cons/copy_alloc.pass.cpp index efea4948eba1..3a49a8bc0c66 100644 --- a/test/std/containers/sequences/deque/deque.cons/copy_alloc.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/copy_alloc.pass.cpp @@ -40,7 +40,7 @@ int main() test(std::deque<int, other_allocator<int> >(ab, an, other_allocator<int>(3)), other_allocator<int>(4)); } -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 { int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45}; int* an = ab + sizeof(ab)/sizeof(ab[0]); diff --git a/test/std/containers/sequences/deque/deque.cons/default.pass.cpp b/test/std/containers/sequences/deque/deque.cons/default.pass.cpp index b725dade70b2..7c42d9e7786e 100644 --- a/test/std/containers/sequences/deque/deque.cons/default.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/default.pass.cpp @@ -24,7 +24,7 @@ test() { std::deque<T, Allocator> d; assert(d.size() == 0); -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 std::deque<T, Allocator> d1 = {}; assert(d1.size() == 0); #endif @@ -34,7 +34,7 @@ int main() { test<int, std::allocator<int> >(); test<NotConstructible, stack_allocator<NotConstructible, 1> >(); -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 test<int, min_allocator<int> >(); test<NotConstructible, min_allocator<NotConstructible> >(); #endif diff --git a/test/std/containers/sequences/deque/deque.cons/default_noexcept.pass.cpp b/test/std/containers/sequences/deque/deque.cons/default_noexcept.pass.cpp index c612dbc5e838..30cca929da11 100644 --- a/test/std/containers/sequences/deque/deque.cons/default_noexcept.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/default_noexcept.pass.cpp @@ -14,9 +14,12 @@ // This tests a conforming extension +// UNSUPPORTED: c++98, c++03 + #include <deque> #include <cassert> +#include "test_macros.h" #include "MoveOnly.h" #include "test_allocator.h" @@ -29,14 +32,13 @@ struct some_alloc int main() { -#if __has_feature(cxx_noexcept) { typedef std::deque<MoveOnly> C; - static_assert(std::is_nothrow_default_constructible<C>::value, ""); + LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible<C>::value, ""); } { typedef std::deque<MoveOnly, test_allocator<MoveOnly>> C; - static_assert(std::is_nothrow_default_constructible<C>::value, ""); + LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible<C>::value, ""); } { typedef std::deque<MoveOnly, other_allocator<MoveOnly>> C; @@ -46,5 +48,4 @@ int main() typedef std::deque<MoveOnly, some_alloc<MoveOnly>> C; static_assert(!std::is_nothrow_default_constructible<C>::value, ""); } -#endif } diff --git a/test/std/containers/sequences/deque/deque.cons/dtor_noexcept.pass.cpp b/test/std/containers/sequences/deque/deque.cons/dtor_noexcept.pass.cpp index ecdc2404c855..503e1237e9eb 100644 --- a/test/std/containers/sequences/deque/deque.cons/dtor_noexcept.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/dtor_noexcept.pass.cpp @@ -11,14 +11,14 @@ // ~deque() // implied noexcept; +// UNSUPPORTED: c++98, c++03 + #include <deque> #include <cassert> #include "MoveOnly.h" #include "test_allocator.h" -#if __has_feature(cxx_noexcept) - template <class T> struct some_alloc { @@ -27,11 +27,8 @@ struct some_alloc ~some_alloc() noexcept(false); }; -#endif - int main() { -#if __has_feature(cxx_noexcept) { typedef std::deque<MoveOnly> C; static_assert(std::is_nothrow_destructible<C>::value, ""); @@ -48,5 +45,4 @@ int main() typedef std::deque<MoveOnly, some_alloc<MoveOnly>> C; static_assert(!std::is_nothrow_destructible<C>::value, ""); } -#endif } diff --git a/test/std/containers/sequences/deque/deque.cons/initializer_list.pass.cpp b/test/std/containers/sequences/deque/deque.cons/initializer_list.pass.cpp index a9e0218e2e0b..dbf27053a9f9 100644 --- a/test/std/containers/sequences/deque/deque.cons/initializer_list.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/initializer_list.pass.cpp @@ -27,7 +27,7 @@ int main() assert(d[2] == 5); assert(d[3] == 6); } -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 { std::deque<int, min_allocator<int>> d = {3, 4, 5, 6}; assert(d.size() == 4); diff --git a/test/std/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp b/test/std/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp index 36c5af60ee34..9be3c63a6b31 100644 --- a/test/std/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp @@ -29,7 +29,7 @@ int main() assert(d[2] == 5); assert(d[3] == 6); } -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 { std::deque<int, min_allocator<int>> d({3, 4, 5, 6}, min_allocator<int>()); assert(d.get_allocator() == min_allocator<int>()); diff --git a/test/std/containers/sequences/deque/deque.cons/iter_iter.pass.cpp b/test/std/containers/sequences/deque/deque.cons/iter_iter.pass.cpp index faadf2b1a1db..12a7faf686db 100644 --- a/test/std/containers/sequences/deque/deque.cons/iter_iter.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/iter_iter.pass.cpp @@ -56,7 +56,7 @@ int main() test(bidirectional_iterator<const int*>(ab), bidirectional_iterator<const int*>(an)); test(random_access_iterator<const int*>(ab), random_access_iterator<const int*>(an)); test<stack_allocator<int, 4096> >(ab, an); -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 test<min_allocator<int> >(ab, an); #endif } diff --git a/test/std/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp b/test/std/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp index b8c3e889929d..c8f7759a19d6 100644 --- a/test/std/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp @@ -42,7 +42,7 @@ int main() test(forward_iterator<const int*>(ab), forward_iterator<const int*>(an), test_allocator<int>(4)); test(bidirectional_iterator<const int*>(ab), bidirectional_iterator<const int*>(an), test_allocator<int>(5)); test(random_access_iterator<const int*>(ab), random_access_iterator<const int*>(an), test_allocator<int>(6)); -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 test(input_iterator<const int*>(ab), input_iterator<const int*>(an), min_allocator<int>()); test(forward_iterator<const int*>(ab), forward_iterator<const int*>(an), min_allocator<int>()); test(bidirectional_iterator<const int*>(ab), bidirectional_iterator<const int*>(an), min_allocator<int>()); diff --git a/test/std/containers/sequences/deque/deque.cons/move.pass.cpp b/test/std/containers/sequences/deque/deque.cons/move.pass.cpp index 4a7aa8a058eb..68875139da1a 100644 --- a/test/std/containers/sequences/deque/deque.cons/move.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/move.pass.cpp @@ -51,7 +51,7 @@ int main() assert(c1.size() == 0); assert(c3.get_allocator() == c1.get_allocator()); } -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 { int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45}; int* an = ab + sizeof(ab)/sizeof(ab[0]); diff --git a/test/std/containers/sequences/deque/deque.cons/move_alloc.pass.cpp b/test/std/containers/sequences/deque/deque.cons/move_alloc.pass.cpp index 1a5db6db6500..4aa0fa6827e7 100644 --- a/test/std/containers/sequences/deque/deque.cons/move_alloc.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/move_alloc.pass.cpp @@ -66,7 +66,7 @@ int main() assert(c3.get_allocator() == A(3)); assert(c1.size() != 0); } -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 { int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45}; int* an = ab + sizeof(ab)/sizeof(ab[0]); diff --git a/test/std/containers/sequences/deque/deque.cons/move_assign.pass.cpp b/test/std/containers/sequences/deque/deque.cons/move_assign.pass.cpp index e50cd8ed508d..ed8f1544bc8f 100644 --- a/test/std/containers/sequences/deque/deque.cons/move_assign.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/move_assign.pass.cpp @@ -69,7 +69,7 @@ int main() assert(c1.size() == 0); assert(c3.get_allocator() == A(5)); } -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 { int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45}; int* an = ab + sizeof(ab)/sizeof(ab[0]); diff --git a/test/std/containers/sequences/deque/deque.cons/move_assign_noexcept.pass.cpp b/test/std/containers/sequences/deque/deque.cons/move_assign_noexcept.pass.cpp index 24180b5b5bdd..cebf76a15a4a 100644 --- a/test/std/containers/sequences/deque/deque.cons/move_assign_noexcept.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/move_assign_noexcept.pass.cpp @@ -16,6 +16,8 @@ // This tests a conforming extension +// UNSUPPORTED: c++98, c++03 + #include <deque> #include <cassert> @@ -31,7 +33,6 @@ struct some_alloc int main() { -#if __has_feature(cxx_noexcept) { typedef std::deque<MoveOnly> C; static_assert(std::is_nothrow_move_assignable<C>::value, ""); @@ -48,5 +49,4 @@ int main() typedef std::deque<MoveOnly, some_alloc<MoveOnly>> C; static_assert(!std::is_nothrow_move_assignable<C>::value, ""); } -#endif } diff --git a/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp b/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp index 0ea0431be8e2..f53e1ba6c807 100644 --- a/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp @@ -14,6 +14,8 @@ // This tests a conforming extension +// UNSUPPORTED: c++98, c++03 + #include <deque> #include <cassert> @@ -29,7 +31,6 @@ struct some_alloc int main() { -#if __has_feature(cxx_noexcept) { typedef std::deque<MoveOnly> C; static_assert(std::is_nothrow_move_constructible<C>::value, ""); @@ -46,5 +47,4 @@ int main() typedef std::deque<MoveOnly, some_alloc<MoveOnly>> C; static_assert(!std::is_nothrow_move_constructible<C>::value, ""); } -#endif } diff --git a/test/std/containers/sequences/deque/deque.cons/op_equal.pass.cpp b/test/std/containers/sequences/deque/deque.cons/op_equal.pass.cpp index 3a6ec8370b84..6aac6b20c49e 100644 --- a/test/std/containers/sequences/deque/deque.cons/op_equal.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/op_equal.pass.cpp @@ -46,7 +46,7 @@ int main() assert(l2 == l); assert(l2.get_allocator() == other_allocator<int>(5)); } -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 { int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45}; int* an = ab + sizeof(ab)/sizeof(ab[0]); diff --git a/test/std/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp b/test/std/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp index 6468e4329bda..597f642db3ce 100644 --- a/test/std/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp @@ -28,7 +28,7 @@ int main() assert(d[2] == 5); assert(d[3] == 6); } -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 { std::deque<int, min_allocator<int>> d; d = {3, 4, 5, 6}; diff --git a/test/std/containers/sequences/deque/deque.cons/size.pass.cpp b/test/std/containers/sequences/deque/deque.cons/size.pass.cpp index d2e324b0e3f5..b3fccf6671c9 100644 --- a/test/std/containers/sequences/deque/deque.cons/size.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/size.pass.cpp @@ -100,7 +100,7 @@ int main() test1<DefaultOnly, stack_allocator<DefaultOnly, 4096> >(4095); -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 test<DefaultOnly, min_allocator<DefaultOnly> >(4095); #endif diff --git a/test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp b/test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp index 859deba1e1ae..aeda168d19d4 100644 --- a/test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp @@ -45,7 +45,7 @@ int main() test<int, std::allocator<int> >(4096, 1165); test<int, std::allocator<int> >(4097, 157); test<int, stack_allocator<int, 4096> >(4095, 90); -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 test<int, min_allocator<int> >(4095, 90); #endif } diff --git a/test/std/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp b/test/std/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp index 5693be702de7..ed8a7e13baa5 100644 --- a/test/std/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp @@ -47,7 +47,7 @@ int main() test(4096, 1165, a); test(4097, 157, a); } -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 { min_allocator<int> a; test(0, 5, a); diff --git a/test/std/containers/sequences/deque/deque.modifiers/emplace_back.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/emplace_back.pass.cpp index cf717c2e2f27..784b3a38553a 100644 --- a/test/std/containers/sequences/deque/deque.modifiers/emplace_back.pass.cpp +++ b/test/std/containers/sequences/deque/deque.modifiers/emplace_back.pass.cpp @@ -16,6 +16,7 @@ #include "../../../Emplaceable.h" #include "min_allocator.h" +#include "test_allocator.h" #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES @@ -74,7 +75,7 @@ int main() for (int j = 0; j < N; ++j) testN<std::deque<Emplaceable> >(rng[i], rng[j]); } -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049}; const int N = sizeof(rng)/sizeof(rng[0]); @@ -82,6 +83,17 @@ int main() for (int j = 0; j < N; ++j) testN<std::deque<Emplaceable, min_allocator<Emplaceable>> >(rng[i], rng[j]); } + { + std::deque<Tag_X, TaggingAllocator<Tag_X>> c; + c.emplace_back(); + assert(c.size() == 1); + c.emplace_back(1, 2, 3); + assert(c.size() == 2); + c.emplace_front(); + assert(c.size() == 3); + c.emplace_front(1, 2, 3); + assert(c.size() == 4); + } #endif #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/deque/deque.modifiers/emplace_front.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/emplace_front.pass.cpp index becf94ffb4ef..afc0e4972e38 100644 --- a/test/std/containers/sequences/deque/deque.modifiers/emplace_front.pass.cpp +++ b/test/std/containers/sequences/deque/deque.modifiers/emplace_front.pass.cpp @@ -74,7 +74,7 @@ int main() for (int j = 0; j < N; ++j) testN<std::deque<Emplaceable> >(rng[i], rng[j]); } -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049}; const int N = sizeof(rng)/sizeof(rng[0]); diff --git a/test/std/containers/sequences/deque/deque.modifiers/erase_iter.invalidation.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/erase_iter.invalidation.pass.cpp index 49465cddaef7..a7a93571f509 100644 --- a/test/std/containers/sequences/deque/deque.modifiers/erase_iter.invalidation.pass.cpp +++ b/test/std/containers/sequences/deque/deque.modifiers/erase_iter.invalidation.pass.cpp @@ -23,9 +23,9 @@ void del_at_start(C c) typename C::iterator first = c.begin(); typename C::iterator it1 = first + 1; typename C::iterator it2 = c.end() - 1; - + c.erase (first); - + typename C::iterator it3 = c.begin(); typename C::iterator it4 = c.end() - 1; assert( it1 == it3); @@ -42,7 +42,7 @@ void del_at_end(C c) typename C::iterator first = c.end() - 1; typename C::iterator it1 = c.begin(); typename C::iterator it2 = first - 1; - + c.erase (first); typename C::iterator it3 = c.begin(); @@ -60,7 +60,7 @@ int main() std::deque<int> queue; for (int i = 0; i < 20; ++i) queue.push_back(i); - + while (queue.size() > 1) { del_at_start(queue); diff --git a/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp index a45b75d25c9c..116ed9aa4b5a 100644 --- a/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp +++ b/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp @@ -12,6 +12,8 @@ // iterator erase(const_iterator p) #include <deque> +#include <algorithm> +#include <iterator> #include <cassert> #include "min_allocator.h" @@ -78,7 +80,7 @@ int main() for (int j = 0; j < N; ++j) testN<std::deque<int> >(rng[i], rng[j]); } -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049}; const int N = sizeof(rng)/sizeof(rng[0]); diff --git a/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.invalidation.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.invalidation.pass.cpp index c785e264db06..a0ccd200bfb7 100644 --- a/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.invalidation.pass.cpp +++ b/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.invalidation.pass.cpp @@ -26,9 +26,9 @@ void del_at_start(C c, size_t num) typename C::iterator last = first + num; typename C::iterator it1 = last; typename C::iterator it2 = c.end() - 1; - + c.erase (first, last); - + typename C::iterator it3 = c.begin(); typename C::iterator it4 = c.end() - 1; assert( it1 == it3); @@ -38,7 +38,7 @@ void del_at_start(C c, size_t num) assert( *it2 == *it4); assert(&*it2 == &*it4); } - + template <typename C> void del_at_end(C c, size_t num) { @@ -46,7 +46,7 @@ void del_at_end(C c, size_t num) typename C::iterator first = last - num; typename C::iterator it1 = c.begin(); typename C::iterator it2 = first - 1; - + c.erase (first, last); typename C::iterator it3 = c.begin(); diff --git a/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp index 0576aca5c1a8..a53abaf85d33 100644 --- a/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp +++ b/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp @@ -14,6 +14,8 @@ // iterator erase(const_iterator f, const_iterator l) #include <deque> +#include <algorithm> +#include <iterator> #include <cassert> #include "min_allocator.h" @@ -84,7 +86,7 @@ int main() for (int j = 0; j < N; ++j) testN<std::deque<int> >(rng[i], rng[j]); } -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049}; const int N = sizeof(rng)/sizeof(rng[0]); diff --git a/test/std/containers/sequences/deque/deque.modifiers/pop_back.invalidation.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/pop_back.invalidation.pass.cpp index 1d84f73ccb56..0f5f8e67a24b 100644 --- a/test/std/containers/sequences/deque/deque.modifiers/pop_back.invalidation.pass.cpp +++ b/test/std/containers/sequences/deque/deque.modifiers/pop_back.invalidation.pass.cpp @@ -22,9 +22,9 @@ void test(C c) { typename C::iterator it1 = c.begin(); typename C::iterator it2 = c.end() - 2; - + c.pop_back(); - + typename C::iterator it3 = c.begin(); typename C::iterator it4 = c.end() - 1; assert( it1 == it3); @@ -40,7 +40,7 @@ int main() std::deque<int> queue; for (int i = 0; i < 20; ++i) queue.push_back(i); - + while (queue.size() > 1) { test(queue); diff --git a/test/std/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp index b345faaf89e9..aeb62c9d996a 100644 --- a/test/std/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp +++ b/test/std/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp @@ -72,7 +72,7 @@ int main() for (int j = 0; j < N; ++j) testN<std::deque<int> >(rng[i], rng[j]); } -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049}; const int N = sizeof(rng)/sizeof(rng[0]); diff --git a/test/std/containers/sequences/deque/deque.modifiers/pop_front.invalidation.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/pop_front.invalidation.pass.cpp index 78317f3a3f9c..d7fd910cca5f 100644 --- a/test/std/containers/sequences/deque/deque.modifiers/pop_front.invalidation.pass.cpp +++ b/test/std/containers/sequences/deque/deque.modifiers/pop_front.invalidation.pass.cpp @@ -22,9 +22,9 @@ void test(C c) { typename C::iterator it1 = c.begin() + 1; typename C::iterator it2 = c.end() - 1; - + c.pop_front(); - + typename C::iterator it3 = c.begin(); typename C::iterator it4 = c.end() - 1; assert( it1 == it3); @@ -40,7 +40,7 @@ int main() std::deque<int> queue; for (int i = 0; i < 20; ++i) queue.push_back(i); - + while (queue.size() > 1) { test(queue); diff --git a/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp index d570ec333715..c7a3a625eab6 100644 --- a/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp +++ b/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp @@ -72,7 +72,7 @@ int main() for (int j = 0; j < N; ++j) testN<std::deque<int> >(rng[i], rng[j]); } -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049}; const int N = sizeof(rng)/sizeof(rng[0]); diff --git a/test/std/containers/sequences/deque/deque.modifiers/push_back.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/push_back.pass.cpp index 96df6097d994..198cbcf67cc7 100644 --- a/test/std/containers/sequences/deque/deque.modifiers/push_back.pass.cpp +++ b/test/std/containers/sequences/deque/deque.modifiers/push_back.pass.cpp @@ -62,7 +62,7 @@ int main() for (int j = 0; j < N; ++j) test<std::deque<int> >(rng[j]); } -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049, 4094, 4095, 4096}; const int N = sizeof(rng)/sizeof(rng[0]); diff --git a/test/std/containers/sequences/deque/deque.modifiers/push_back_exception_safety.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/push_back_exception_safety.pass.cpp index b37e961e442f..1fe1da102f37 100644 --- a/test/std/containers/sequences/deque/deque.modifiers/push_back_exception_safety.pass.cpp +++ b/test/std/containers/sequences/deque/deque.modifiers/push_back_exception_safety.pass.cpp @@ -26,11 +26,11 @@ class CMyClass { bool equal(const CMyClass &rhs) const { return fTag == rhs.fTag && fMagicValue == rhs.fMagicValue; } - + private: int fMagicValue; int fTag; - + private: static int kStartedConstructionMagicValue; private: static int kFinishedConstructionMagicValue; }; @@ -84,7 +84,7 @@ int main() assert(vec==vec2); } } - + { typedef std::deque<CMyClass, test_allocator<CMyClass> > C; C vec; diff --git a/test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp index d4ab0d3e2f26..b5c881064a95 100644 --- a/test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp +++ b/test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp @@ -68,7 +68,7 @@ int main() for (int j = 0; j < N; ++j) test<std::deque<MoveOnly> >(rng[j]); } -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049, 4094, 4095, 4096}; const int N = sizeof(rng)/sizeof(rng[0]); diff --git a/test/std/containers/sequences/deque/deque.modifiers/push_front.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/push_front.pass.cpp index 4d6443b1f967..ee4f3d7f9ed7 100644 --- a/test/std/containers/sequences/deque/deque.modifiers/push_front.pass.cpp +++ b/test/std/containers/sequences/deque/deque.modifiers/push_front.pass.cpp @@ -71,7 +71,7 @@ int main() for (int j = 0; j < N; ++j) testN<std::deque<int> >(rng[i], rng[j]); } -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049}; const int N = sizeof(rng)/sizeof(rng[0]); diff --git a/test/std/containers/sequences/deque/deque.modifiers/push_front_exception_safety.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/push_front_exception_safety.pass.cpp index b4caa947aed8..7464870f07e1 100644 --- a/test/std/containers/sequences/deque/deque.modifiers/push_front_exception_safety.pass.cpp +++ b/test/std/containers/sequences/deque/deque.modifiers/push_front_exception_safety.pass.cpp @@ -30,7 +30,7 @@ class CMyClass { private: int fMagicValue; int fTag; - + private: static int kStartedConstructionMagicValue; private: static int kFinishedConstructionMagicValue; }; @@ -84,7 +84,7 @@ int main() assert(vec==vec2); } } - + { typedef std::deque<CMyClass, test_allocator<CMyClass> > C; C vec; diff --git a/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp index ea91ec1b0a44..ab15ca3326bf 100644 --- a/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp +++ b/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp @@ -77,7 +77,7 @@ int main() for (int j = 0; j < N; ++j) testN<std::deque<MoveOnly> >(rng[i], rng[j]); } -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049}; const int N = sizeof(rng)/sizeof(rng[0]); diff --git a/test/std/containers/sequences/deque/deque.special/copy.pass.cpp b/test/std/containers/sequences/deque/deque.special/copy.pass.cpp index 3a9962b330a4..846d87c6b664 100644 --- a/test/std/containers/sequences/deque/deque.special/copy.pass.cpp +++ b/test/std/containers/sequences/deque/deque.special/copy.pass.cpp @@ -76,7 +76,7 @@ int main() for (int j = 0; j < N; ++j) testN<std::deque<int> >(rng[i], rng[j]); } -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049}; const int N = sizeof(rng)/sizeof(rng[0]); diff --git a/test/std/containers/sequences/deque/deque.special/copy_backward.pass.cpp b/test/std/containers/sequences/deque/deque.special/copy_backward.pass.cpp index ccb30a9997d8..e7f37f98d270 100644 --- a/test/std/containers/sequences/deque/deque.special/copy_backward.pass.cpp +++ b/test/std/containers/sequences/deque/deque.special/copy_backward.pass.cpp @@ -75,7 +75,7 @@ int main() for (int j = 0; j < N; ++j) testN<std::deque<int> >(rng[i], rng[j]); } -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049}; const int N = sizeof(rng)/sizeof(rng[0]); diff --git a/test/std/containers/sequences/deque/deque.special/move.pass.cpp b/test/std/containers/sequences/deque/deque.special/move.pass.cpp index abd8e079975a..1bdbeaf9d5c6 100644 --- a/test/std/containers/sequences/deque/deque.special/move.pass.cpp +++ b/test/std/containers/sequences/deque/deque.special/move.pass.cpp @@ -75,7 +75,7 @@ int main() for (int j = 0; j < N; ++j) testN<std::deque<int> >(rng[i], rng[j]); } -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049}; const int N = sizeof(rng)/sizeof(rng[0]); diff --git a/test/std/containers/sequences/deque/deque.special/move_backward.pass.cpp b/test/std/containers/sequences/deque/deque.special/move_backward.pass.cpp index ea04f6a15acf..8e909c63c912 100644 --- a/test/std/containers/sequences/deque/deque.special/move_backward.pass.cpp +++ b/test/std/containers/sequences/deque/deque.special/move_backward.pass.cpp @@ -75,7 +75,7 @@ int main() for (int j = 0; j < N; ++j) testN<std::deque<int> >(rng[i], rng[j]); } -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049}; const int N = sizeof(rng)/sizeof(rng[0]); diff --git a/test/std/containers/sequences/deque/deque.special/swap.pass.cpp b/test/std/containers/sequences/deque/deque.special/swap.pass.cpp index 26757c351f1a..ab21f434937e 100644 --- a/test/std/containers/sequences/deque/deque.special/swap.pass.cpp +++ b/test/std/containers/sequences/deque/deque.special/swap.pass.cpp @@ -85,7 +85,7 @@ int main() assert((c2 == std::deque<int, A>(a1, a1+sizeof(a1)/sizeof(a1[0])))); assert(c2.get_allocator() == A(1)); } -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049}; const int N = sizeof(rng)/sizeof(rng[0]); diff --git a/test/std/containers/sequences/deque/deque.special/swap_noexcept.pass.cpp b/test/std/containers/sequences/deque/deque.special/swap_noexcept.pass.cpp index 83bcac8997ed..2f999e9a7a5d 100644 --- a/test/std/containers/sequences/deque/deque.special/swap_noexcept.pass.cpp +++ b/test/std/containers/sequences/deque/deque.special/swap_noexcept.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <deque> // void swap(deque& c) @@ -21,6 +23,7 @@ #include <deque> #include <cassert> +#include "test_macros.h" #include "MoveOnly.h" #include "test_allocator.h" @@ -28,7 +31,7 @@ template <class T> struct some_alloc { typedef T value_type; - + some_alloc() {} some_alloc(const some_alloc&); void deallocate(void*, unsigned) {} @@ -40,7 +43,7 @@ template <class T> struct some_alloc2 { typedef T value_type; - + some_alloc2() {} some_alloc2(const some_alloc2&); void deallocate(void*, unsigned) {} @@ -51,7 +54,6 @@ struct some_alloc2 int main() { -#if __has_feature(cxx_noexcept) { typedef std::deque<MoveOnly> C; C c1, c2; @@ -86,5 +88,4 @@ int main() } #endif -#endif } diff --git a/test/std/containers/sequences/deque/iterators.pass.cpp b/test/std/containers/sequences/deque/iterators.pass.cpp index 8ec491fae4da..19d7996f824f 100644 --- a/test/std/containers/sequences/deque/iterators.pass.cpp +++ b/test/std/containers/sequences/deque/iterators.pass.cpp @@ -33,7 +33,7 @@ int main() j = c.cbegin(); assert(i == j); } -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 { typedef std::deque<int, min_allocator<int>> C; C c; @@ -68,7 +68,7 @@ int main() assert ( (cii >= ii1 )); assert (cii - ii1 == 0); assert (ii1 - cii == 0); - + // std::deque<int> c; // assert ( ii1 != c.cbegin()); // assert ( cii != c.begin()); diff --git a/test/std/containers/sequences/deque/types.pass.cpp b/test/std/containers/sequences/deque/types.pass.cpp index da9470d8a6c6..53b33d9e6be9 100644 --- a/test/std/containers/sequences/deque/types.pass.cpp +++ b/test/std/containers/sequences/deque/types.pass.cpp @@ -64,6 +64,12 @@ test() static_assert((std::is_same< typename C::const_reverse_iterator, std::reverse_iterator<typename C::const_iterator> >::value), ""); + static_assert((std::is_signed<typename C::difference_type>::value), ""); + static_assert((std::is_unsigned<typename C::size_type>::value), ""); + static_assert((std::is_same<typename C::difference_type, + typename std::iterator_traits<typename C::iterator>::difference_type>::value), ""); + static_assert((std::is_same<typename C::difference_type, + typename std::iterator_traits<typename C::const_iterator>::difference_type>::value), ""); } int main() @@ -73,7 +79,8 @@ int main() test<Copyable, test_allocator<Copyable> >(); static_assert((std::is_same<std::deque<char>::allocator_type, std::allocator<char> >::value), ""); -#if __cplusplus >= 201103L + +#if TEST_STD_VER >= 11 { typedef std::deque<short, min_allocator<short>> C; static_assert((std::is_same<C::value_type, short>::value), ""); @@ -85,6 +92,13 @@ int main() // 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), ""); + + static_assert((std::is_signed<typename C::difference_type>::value), ""); + static_assert((std::is_unsigned<typename C::size_type>::value), ""); + static_assert((std::is_same<typename C::difference_type, + typename std::iterator_traits<typename C::iterator>::difference_type>::value), ""); + static_assert((std::is_same<typename C::difference_type, + typename std::iterator_traits<typename C::const_iterator>::difference_type>::value), ""); } #endif } diff --git a/test/std/containers/sequences/deque/version.pass.cpp b/test/std/containers/sequences/deque/version.pass.cpp deleted file mode 100644 index 22e663d9bc22..000000000000 --- a/test/std/containers/sequences/deque/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. -// -//===----------------------------------------------------------------------===// - -// <deque> - -#include <deque> - -#ifndef _LIBCPP_VERSION -#error _LIBCPP_VERSION not defined -#endif - -int main() -{ -} |
