summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/containers/sequences/vector
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2016-04-28 22:28:23 +0000
committerEric Fiselier <eric@efcs.ca>2016-04-28 22:28:23 +0000
commit1f4231f8cf138c810a55a398c07a422908add70f (patch)
tree37862fd2450b478ac9fcaf5742d8e2ccdd65be43 /libcxx/test/std/containers/sequences/vector
parent174f8b19815cef8507fe0dbf03e5e639f3a60ba9 (diff)
downloadbcm5719-llvm-1f4231f8cf138c810a55a398c07a422908add70f.tar.gz
bcm5719-llvm-1f4231f8cf138c810a55a398c07a422908add70f.zip
Guard libc++ specific c.__invariants() tests in LIBCPP_ASSERT macros
llvm-svn: 267947
Diffstat (limited to 'libcxx/test/std/containers/sequences/vector')
-rw-r--r--libcxx/test/std/containers/sequences/vector/vector.cons/construct_default.pass.cpp12
-rw-r--r--libcxx/test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp7
-rw-r--r--libcxx/test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp9
-rw-r--r--libcxx/test/std/containers/sequences/vector/vector.cons/construct_size.pass.cpp19
-rw-r--r--libcxx/test/std/containers/sequences/vector/vector.cons/construct_size_value.pass.cpp7
-rw-r--r--libcxx/test/std/containers/sequences/vector/vector.cons/construct_size_value_alloc.pass.cpp8
-rw-r--r--libcxx/test/std/containers/sequences/vector/vector.cons/copy.pass.cpp10
-rw-r--r--libcxx/test/std/containers/sequences/vector/vector.cons/copy_alloc.pass.cpp8
8 files changed, 43 insertions, 37 deletions
diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/construct_default.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/construct_default.pass.cpp
index 5e87c07ef70..e0542e751f4 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.cons/construct_default.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.cons/construct_default.pass.cpp
@@ -32,16 +32,16 @@ test0()
static_assert((noexcept(C()) == noexcept(typename C::allocator_type())), "" );
#endif
C c;
- assert(c.__invariants());
+ LIBCPP_ASSERT(c.__invariants());
assert(c.empty());
assert(c.get_allocator() == typename C::allocator_type());
- assert(is_contiguous_container_asan_correct(c));
+ LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
#if TEST_STD_VER >= 11
C c1 = {};
- assert(c1.__invariants());
+ LIBCPP_ASSERT(c1.__invariants());
assert(c1.empty());
assert(c1.get_allocator() == typename C::allocator_type());
- assert(is_contiguous_container_asan_correct(c1));
+ LIBCPP_ASSERT(is_contiguous_container_asan_correct(c1));
#endif
}
@@ -55,10 +55,10 @@ test1(const typename C::allocator_type& a)
static_assert((noexcept(C(typename C::allocator_type())) == std::is_nothrow_copy_constructible<typename C::allocator_type>::value), "" );
#endif
C c(a);
- assert(c.__invariants());
+ LIBCPP_ASSERT(c.__invariants());
assert(c.empty());
assert(c.get_allocator() == a);
- assert(is_contiguous_container_asan_correct(c));
+ LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
}
int main()
diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp
index 36e231acce1..5542e91059d 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp
@@ -14,6 +14,7 @@
#include <vector>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
#include "../../../stack_allocator.h"
#include "min_allocator.h"
@@ -24,9 +25,9 @@ void
test(Iterator first, Iterator last)
{
C c(first, last);
- assert(c.__invariants());
+ LIBCPP_ASSERT(c.__invariants());
assert(c.size() == std::distance(first, last));
- assert(is_contiguous_container_asan_correct(c));
+ LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i, ++first)
assert(*i == *first);
}
@@ -46,7 +47,7 @@ int main()
test<std::vector<int, stack_allocator<int, 18> > >(bidirectional_iterator<const int*>(a), bidirectional_iterator<const int*>(an));
test<std::vector<int, stack_allocator<int, 18> > >(random_access_iterator<const int*>(a), random_access_iterator<const int*>(an));
test<std::vector<int, stack_allocator<int, 18> > >(a, an);
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test<std::vector<int, min_allocator<int>> >(input_iterator<const int*>(a), input_iterator<const int*>(an));
test<std::vector<int, min_allocator<int>> >(forward_iterator<const int*>(a), forward_iterator<const int*>(an));
test<std::vector<int, min_allocator<int>> >(bidirectional_iterator<const int*>(a), bidirectional_iterator<const int*>(an));
diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp
index fcb6205d087..f40088ea3e8 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp
@@ -15,6 +15,7 @@
#include <vector>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
#include "../../../stack_allocator.h"
#include "min_allocator.h"
@@ -25,14 +26,14 @@ void
test(Iterator first, Iterator last, const A& a)
{
C c(first, last, a);
- assert(c.__invariants());
+ LIBCPP_ASSERT(c.__invariants());
assert(c.size() == std::distance(first, last));
- assert(is_contiguous_container_asan_correct(c));
+ LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i, ++first)
assert(*i == *first);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
template <class T>
struct implicit_conv_allocator : min_allocator<T>
@@ -55,7 +56,7 @@ int main()
test<std::vector<int> >(random_access_iterator<const int*>(a), random_access_iterator<const int*>(an), alloc);
test<std::vector<int> >(a, an, alloc);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int a[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 1, 0};
int* an = a + sizeof(a)/sizeof(a[0]);
diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/construct_size.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/construct_size.pass.cpp
index e03389593f1..46e5ecdc9a5 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.cons/construct_size.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.cons/construct_size.pass.cpp
@@ -14,6 +14,7 @@
#include <vector>
#include <cassert>
+#include "test_macros.h"
#include "DefaultOnly.h"
#include "min_allocator.h"
#include "test_allocator.h"
@@ -23,16 +24,14 @@ template <class C>
void
test2(typename C::size_type n, typename C::allocator_type const& a = typename C::allocator_type ())
{
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER >= 14
C c(n, a);
- assert(c.__invariants());
+ LIBCPP_ASSERT(c.__invariants());
assert(c.size() == n);
assert(c.get_allocator() == a);
- assert(is_contiguous_container_asan_correct(c));
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i)
assert(*i == typename C::value_type());
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
}
@@ -41,14 +40,14 @@ void
test1(typename C::size_type n)
{
C c(n);
- assert(c.__invariants());
+ LIBCPP_ASSERT(c.__invariants());
assert(c.size() == n);
assert(c.get_allocator() == typename C::allocator_type());
- assert(is_contiguous_container_asan_correct(c));
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
+#if TEST_STD_VER >= 11
for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i)
assert(*i == typename C::value_type());
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
}
template <class C>
@@ -64,7 +63,7 @@ int main()
test<std::vector<int> >(50);
test<std::vector<DefaultOnly> >(500);
assert(DefaultOnly::count == 0);
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test<std::vector<int, min_allocator<int>> >(50);
test<std::vector<DefaultOnly, min_allocator<DefaultOnly>> >(500);
test2<std::vector<DefaultOnly, test_allocator<DefaultOnly>> >( 100, test_allocator<DefaultOnly>(23));
diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/construct_size_value.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/construct_size_value.pass.cpp
index 5b6c4985704..d3774d1a659 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.cons/construct_size_value.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.cons/construct_size_value.pass.cpp
@@ -14,6 +14,7 @@
#include <vector>
#include <cassert>
+#include "test_macros.h"
#include "../../../stack_allocator.h"
#include "min_allocator.h"
#include "asan_testing.h"
@@ -23,9 +24,9 @@ void
test(typename C::size_type n, const typename C::value_type& x)
{
C c(n, x);
- assert(c.__invariants());
+ LIBCPP_ASSERT(c.__invariants());
assert(c.size() == n);
- assert(is_contiguous_container_asan_correct(c));
+ LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i)
assert(*i == x);
}
@@ -34,7 +35,7 @@ int main()
{
test<std::vector<int> >(50, 3);
test<std::vector<int, stack_allocator<int, 50> > >(50, 5);
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test<std::vector<int, min_allocator<int>> >(50, 3);
#endif
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/construct_size_value_alloc.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/construct_size_value_alloc.pass.cpp
index c62b84104ab..4713aa15706 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.cons/construct_size_value_alloc.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.cons/construct_size_value_alloc.pass.cpp
@@ -13,6 +13,8 @@
#include <vector>
#include <cassert>
+
+#include "test_macros.h"
#include "min_allocator.h"
#include "asan_testing.h"
@@ -22,10 +24,10 @@ test(typename C::size_type n, const typename C::value_type& x,
const typename C::allocator_type& a)
{
C c(n, x, a);
- assert(c.__invariants());
+ LIBCPP_ASSERT(c.__invariants());
assert(a == c.get_allocator());
assert(c.size() == n);
- assert(is_contiguous_container_asan_correct(c));
+ LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i)
assert(*i == x);
}
@@ -33,7 +35,7 @@ test(typename C::size_type n, const typename C::value_type& x,
int main()
{
test<std::vector<int> >(50, 3, std::allocator<int>());
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test<std::vector<int, min_allocator<int>> >(50, 3, min_allocator<int>());
#endif
}
diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/copy.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/copy.pass.cpp
index 677963deeb8..1dd48b1816e 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.cons/copy.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.cons/copy.pass.cpp
@@ -13,6 +13,8 @@
#include <vector>
#include <cassert>
+
+#include "test_macros.h"
#include "test_allocator.h"
#include "min_allocator.h"
#include "asan_testing.h"
@@ -23,10 +25,10 @@ test(const C& x)
{
unsigned s = x.size();
C c(x);
- assert(c.__invariants());
+ LIBCPP_ASSERT(c.__invariants());
assert(c.size() == s);
assert(c == x);
- assert(is_contiguous_container_asan_correct(c));
+ LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
}
int main()
@@ -46,7 +48,7 @@ int main()
assert(is_contiguous_container_asan_correct(v));
assert(is_contiguous_container_asan_correct(v2));
}
-#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#if TEST_STD_VER >= 11
{
std::vector<int, other_allocator<int> > v(3, 2, other_allocator<int>(5));
std::vector<int, other_allocator<int> > v2 = v;
@@ -57,8 +59,6 @@ int main()
assert(is_contiguous_container_asan_correct(v));
assert(is_contiguous_container_asan_correct(v2));
}
-#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
-#if __cplusplus >= 201103L
{
int a[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 1, 0};
int* an = a + sizeof(a)/sizeof(a[0]);
diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/copy_alloc.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/copy_alloc.pass.cpp
index 128328c2a7d..47259c74733 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.cons/copy_alloc.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.cons/copy_alloc.pass.cpp
@@ -13,6 +13,8 @@
#include <vector>
#include <cassert>
+
+#include "test_macros.h"
#include "test_allocator.h"
#include "min_allocator.h"
#include "asan_testing.h"
@@ -23,10 +25,10 @@ test(const C& x, const typename C::allocator_type& a)
{
unsigned s = x.size();
C c(x, a);
- assert(c.__invariants());
+ LIBCPP_ASSERT(c.__invariants());
assert(c.size() == s);
assert(c == x);
- assert(is_contiguous_container_asan_correct(c));
+ LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
}
int main()
@@ -48,7 +50,7 @@ int main()
assert(l2 == l);
assert(l2.get_allocator() == other_allocator<int>(3));
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int a[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 1, 0};
int* an = a + sizeof(a)/sizeof(a[0]);
OpenPOWER on IntegriCloud