aboutsummaryrefslogtreecommitdiff
path: root/test/std/containers/sequences/list/list.special
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/containers/sequences/list/list.special')
-rw-r--r--test/std/containers/sequences/list/list.special/db_swap_1.pass.cpp59
-rw-r--r--test/std/containers/sequences/list/list.special/swap.pass.cpp12
-rw-r--r--test/std/containers/sequences/list/list.special/swap_noexcept.pass.cpp9
3 files changed, 8 insertions, 72 deletions
diff --git a/test/std/containers/sequences/list/list.special/db_swap_1.pass.cpp b/test/std/containers/sequences/list/list.special/db_swap_1.pass.cpp
deleted file mode 100644
index f7171795cd5f..000000000000
--- a/test/std/containers/sequences/list/list.special/db_swap_1.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.
-//
-//===----------------------------------------------------------------------===//
-
-// <list>
-
-// template <class T, class Alloc>
-// void swap(list<T,Alloc>& x, list<T,Alloc>& y);
-
-#if _LIBCPP_DEBUG >= 1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-#endif
-
-#include <list>
-#include <cassert>
-
-#include <__debug>
-#include "min_allocator.h"
-
-int main()
-{
-#if _LIBCPP_DEBUG >= 1
- {
- int a1[] = {1, 3, 7, 9, 10};
- int a2[] = {0, 2, 4, 5, 6, 8, 11};
- std::list<int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
- std::list<int> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
- std::list<int>::iterator i1 = c1.begin();
- std::list<int>::iterator i2 = c2.begin();
- swap(c1, c2);
- c1.erase(i2);
- c2.erase(i1);
- std::list<int>::iterator j = i1;
- c1.erase(i1);
- assert(false);
- }
-#if __cplusplus >= 201103L
- {
- int a1[] = {1, 3, 7, 9, 10};
- int a2[] = {0, 2, 4, 5, 6, 8, 11};
- std::list<int, min_allocator<int>> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
- std::list<int, min_allocator<int>> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
- std::list<int, min_allocator<int>>::iterator i1 = c1.begin();
- std::list<int, min_allocator<int>>::iterator i2 = c2.begin();
- swap(c1, c2);
- c1.erase(i2);
- c2.erase(i1);
- std::list<int, min_allocator<int>>::iterator j = i1;
- c1.erase(i1);
- assert(false);
- }
-#endif
-#endif
-}
diff --git a/test/std/containers/sequences/list/list.special/swap.pass.cpp b/test/std/containers/sequences/list/list.special/swap.pass.cpp
index bc5f4857edc7..54b262572ded 100644
--- a/test/std/containers/sequences/list/list.special/swap.pass.cpp
+++ b/test/std/containers/sequences/list/list.special/swap.pass.cpp
@@ -59,21 +59,18 @@ int main()
assert(c2.empty());
assert(distance(c2.begin(), c2.end()) == 0);
}
-#ifndef _LIBCPP_DEBUG_LEVEL
-// This test known to result in undefined behavior detected by _LIBCPP_DEBUG_LEVEL >= 1
{
int a1[] = {1, 3, 7, 9, 10};
int a2[] = {0, 2, 4, 5, 6, 8, 11};
typedef test_allocator<int> A;
std::list<int, A> c1(a1, a1+sizeof(a1)/sizeof(a1[0]), A(1));
- std::list<int, A> c2(a2, a2+sizeof(a2)/sizeof(a2[0]), A(2));
+ std::list<int, A> c2(a2, a2+sizeof(a2)/sizeof(a2[0]), A(1));
swap(c1, c2);
assert((c1 == std::list<int, A>(a2, a2+sizeof(a2)/sizeof(a2[0]))));
assert(c1.get_allocator() == A(1));
assert((c2 == std::list<int, A>(a1, a1+sizeof(a1)/sizeof(a1[0]))));
- assert(c2.get_allocator() == A(2));
+ assert(c2.get_allocator() == A(1));
}
-#endif
{
int a1[] = {1, 3, 7, 9, 10};
int a2[] = {0, 2, 4, 5, 6, 8, 11};
@@ -86,7 +83,7 @@ int main()
assert((c2 == std::list<int, A>(a1, a1+sizeof(a1)/sizeof(a1[0]))));
assert(c2.get_allocator() == A(1));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int a1[] = {1, 3, 7, 9, 10};
int a2[] = {0, 2, 4, 5, 6, 8, 11};
@@ -127,8 +124,6 @@ int main()
assert(c2.empty());
assert(distance(c2.begin(), c2.end()) == 0);
}
-#ifndef _LIBCPP_DEBUG_LEVEL
-// This test known to result in undefined behavior detected by _LIBCPP_DEBUG_LEVEL >= 1
{
int a1[] = {1, 3, 7, 9, 10};
int a2[] = {0, 2, 4, 5, 6, 8, 11};
@@ -142,5 +137,4 @@ int main()
assert(c2.get_allocator() == A());
}
#endif
-#endif
}
diff --git a/test/std/containers/sequences/list/list.special/swap_noexcept.pass.cpp b/test/std/containers/sequences/list/list.special/swap_noexcept.pass.cpp
index 9c83ad58fed4..820da4c78f81 100644
--- a/test/std/containers/sequences/list/list.special/swap_noexcept.pass.cpp
+++ b/test/std/containers/sequences/list/list.special/swap_noexcept.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <list>
// void swap(list& c)
@@ -21,6 +23,7 @@
#include <list>
#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::list<MoveOnly> C;
C c1, c2;
@@ -86,5 +88,4 @@ int main()
}
#endif
-#endif
}