diff options
Diffstat (limited to 'libcxx/test/std')
18 files changed, 57 insertions, 56 deletions
diff --git a/libcxx/test/std/containers/associative/map/map.cons/copy.pass.cpp b/libcxx/test/std/containers/associative/map/map.cons/copy.pass.cpp index a1de1b13aed..081c8f7c0a8 100644 --- a/libcxx/test/std/containers/associative/map/map.cons/copy.pass.cpp +++ b/libcxx/test/std/containers/associative/map/map.cons/copy.pass.cpp @@ -16,6 +16,7 @@ #include <map> #include <cassert> +#include "test_macros.h" #include "../../../test_compare.h" #include "test_allocator.h" #include "min_allocator.h" @@ -56,7 +57,7 @@ int main() assert(*next(mo.begin()) == V(2, 1)); assert(*next(mo.begin(), 2) == V(3, 1)); } -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE +#if TEST_STD_VER >= 11 { typedef std::pair<const int, double> V; V ar[] = @@ -91,8 +92,6 @@ int main() assert(*next(mo.begin()) == V(2, 1)); assert(*next(mo.begin(), 2) == V(3, 1)); } -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE -#if TEST_STD_VER >= 11 { typedef std::pair<const int, double> V; V ar[] = diff --git a/libcxx/test/std/containers/associative/multimap/multimap.cons/copy.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/copy.pass.cpp index 97dcf39e10c..b7f5c66ad93 100644 --- a/libcxx/test/std/containers/associative/multimap/multimap.cons/copy.pass.cpp +++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/copy.pass.cpp @@ -16,6 +16,7 @@ #include <map> #include <cassert> +#include "test_macros.h" #include "../../../test_compare.h" #include "test_allocator.h" #include "min_allocator.h" @@ -47,7 +48,7 @@ int main() assert(mo.get_allocator() == A(7)); assert(mo.key_comp() == C(5)); } -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE +#if TEST_STD_VER >= 11 { typedef std::pair<const int, double> V; V ar[] = @@ -73,8 +74,6 @@ int main() assert(mo.get_allocator() == A(7)); assert(mo.key_comp() == C(5)); } -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE -#if TEST_STD_VER >= 11 { typedef std::pair<const int, double> V; V ar[] = diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/copy.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/copy.pass.cpp index dde36287210..6349dde1e81 100644 --- a/libcxx/test/std/containers/associative/multiset/multiset.cons/copy.pass.cpp +++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/copy.pass.cpp @@ -16,6 +16,7 @@ #include <set> #include <cassert> +#include "test_macros.h" #include "../../../test_compare.h" #include "test_allocator.h" @@ -67,7 +68,7 @@ int main() assert(*next(mo.begin(), 7) == 3); assert(*next(mo.begin(), 8) == 3); } -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE +#if TEST_STD_VER >= 11 { typedef int V; V ar[] = @@ -114,5 +115,5 @@ int main() assert(*next(mo.begin(), 7) == 3); assert(*next(mo.begin(), 8) == 3); } -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE +#endif } diff --git a/libcxx/test/std/containers/associative/set/set.cons/copy.pass.cpp b/libcxx/test/std/containers/associative/set/set.cons/copy.pass.cpp index a0e34e48de4..7bd6342fcc6 100644 --- a/libcxx/test/std/containers/associative/set/set.cons/copy.pass.cpp +++ b/libcxx/test/std/containers/associative/set/set.cons/copy.pass.cpp @@ -16,6 +16,7 @@ #include <set> #include <cassert> +#include "test_macros.h" #include "../../../test_compare.h" #include "test_allocator.h" @@ -55,7 +56,7 @@ int main() assert(*next(mo.begin()) == 2); assert(*next(mo.begin(), 2) == 3); } -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE +#if TEST_STD_VER >= 11 { typedef int V; V ar[] = @@ -90,5 +91,5 @@ int main() assert(*next(mo.begin()) == 2); assert(*next(mo.begin(), 2) == 3); } -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE +#endif } diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/copy.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/copy.pass.cpp index ec73555b9c4..1840545680d 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.cons/copy.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.cons/copy.pass.cpp @@ -13,6 +13,8 @@ #include <deque> #include <cassert> + +#include "test_macros.h" #include "test_allocator.h" #include "min_allocator.h" @@ -37,15 +39,13 @@ int main() assert(v2 == v); assert(v2.get_allocator() == v.get_allocator()); } -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE +#if TEST_STD_VER >= 11 { std::deque<int, other_allocator<int> > v(3, 2, other_allocator<int>(5)); std::deque<int, other_allocator<int> > v2 = v; assert(v2 == v); assert(v2.get_allocator() == other_allocator<int>(-2)); } -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE -#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/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/copy.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/copy.pass.cpp index 5240afa82b8..6a70d72042f 100644 --- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/copy.pass.cpp +++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/copy.pass.cpp @@ -15,6 +15,7 @@ #include <cassert> #include <iterator> +#include "test_macros.h" #include "test_allocator.h" #include "min_allocator.h" @@ -34,7 +35,7 @@ int main() assert(c == c0); assert(c.get_allocator() == A(10)); } -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE +#if TEST_STD_VER >= 11 { typedef int T; typedef other_allocator<int> A; @@ -49,8 +50,6 @@ int main() assert(c == c0); assert(c.get_allocator() == A(-2)); } -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE -#if TEST_STD_VER >= 11 { typedef int T; typedef min_allocator<int> A; diff --git a/libcxx/test/std/containers/sequences/list/list.cons/copy.pass.cpp b/libcxx/test/std/containers/sequences/list/list.cons/copy.pass.cpp index a6abd1f3c30..fb583a5dd85 100644 --- a/libcxx/test/std/containers/sequences/list/list.cons/copy.pass.cpp +++ b/libcxx/test/std/containers/sequences/list/list.cons/copy.pass.cpp @@ -13,6 +13,8 @@ #include <list> #include <cassert> + +#include "test_macros.h" #include "DefaultOnly.h" #include "test_allocator.h" #include "min_allocator.h" @@ -30,15 +32,13 @@ int main() assert(l2 == l); assert(l2.get_allocator() == l.get_allocator()); } -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE +#if TEST_STD_VER >= 11 { std::list<int, other_allocator<int> > l(3, 2, other_allocator<int>(5)); std::list<int, other_allocator<int> > l2 = l; assert(l2 == l); assert(l2.get_allocator() == other_allocator<int>(-2)); } -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE -#if TEST_STD_VER >= 11 { std::list<int, min_allocator<int>> l(3, 2); std::list<int, min_allocator<int>> l2 = l; diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/copy.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/copy.pass.cpp index 1bbc600a290..d951e1d2f03 100644 --- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/copy.pass.cpp +++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/copy.pass.cpp @@ -68,7 +68,7 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE +#if TEST_STD_VER >= 11 { typedef std::unordered_map<int, std::string, test_hash<std::hash<int> >, @@ -108,8 +108,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE -#if TEST_STD_VER >= 11 { typedef std::unordered_map<int, std::string, test_hash<std::hash<int> >, diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy.pass.cpp index 5527b1d4efe..a5777be918e 100644 --- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy.pass.cpp +++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy.pass.cpp @@ -82,7 +82,7 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE +#if TEST_STD_VER >= 11 { typedef std::unordered_multimap<int, std::string, test_hash<std::hash<int> >, @@ -136,8 +136,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE -#if TEST_STD_VER >= 11 { typedef std::unordered_multimap<int, std::string, test_hash<std::hash<int> >, diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy.pass.cpp index a8d076415aa..b9d6785db5a 100644 --- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy.pass.cpp +++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy.pass.cpp @@ -74,7 +74,7 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE +#if TEST_STD_VER >= 11 { typedef std::unordered_multiset<int, test_hash<std::hash<int> >, @@ -121,8 +121,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE -#if TEST_STD_VER >= 11 { typedef std::unordered_multiset<int, test_hash<std::hash<int> >, diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/copy.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/copy.pass.cpp index 493c62cfe01..ba0d8e36398 100644 --- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/copy.pass.cpp +++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/copy.pass.cpp @@ -66,7 +66,7 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE +#if TEST_STD_VER >= 11 { typedef std::unordered_set<int, test_hash<std::hash<int> >, @@ -105,8 +105,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE -#if TEST_STD_VER >= 11 { typedef std::unordered_set<int, test_hash<std::hash<int> >, diff --git a/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp b/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp index 71f39d8deeb..808284261f7 100644 --- a/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp +++ b/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp @@ -20,6 +20,8 @@ #include <cstdint> #include <cassert> +#include "test_macros.h" + template <class T> struct A { @@ -52,10 +54,10 @@ struct B int main() { -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE +#if TEST_STD_VER >= 11 A<int> a; assert(std::allocator_traits<A<int> >::allocate(a, 10, nullptr) == reinterpret_cast<int*>(static_cast<std::uintptr_t>(0xDEADBEEF))); -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE +#endif B<int> b; assert(std::allocator_traits<B<int> >::allocate(b, 11, nullptr) == reinterpret_cast<int*>(static_cast<std::uintptr_t>(0xFEADBEEF))); } diff --git a/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/construct.pass.cpp b/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/construct.pass.cpp index 634019758e7..46075f62c6c 100644 --- a/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/construct.pass.cpp +++ b/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/construct.pass.cpp @@ -22,6 +22,8 @@ #include <type_traits> #include <cassert> +#include "test_macros.h" + template <class T> struct A { @@ -36,14 +38,14 @@ struct B { typedef T value_type; -#ifndef _LIBCPP_HAS_NO_VARIADICS +#if TEST_STD_VER >= 11 template <class U, class ...Args> void construct(U* p, Args&& ...args) { ++b_construct; ::new ((void*)p) U(std::forward<Args>(args)...); } -#endif // _LIBCPP_HAS_NO_VARIADICS +#endif }; struct A0 @@ -105,7 +107,7 @@ int main() std::allocator_traits<A<int> >::construct(a, (A2*)&a2, 'd', 5); assert(A2::count == 1); } -#ifndef _LIBCPP_HAS_NO_VARIADICS +#if TEST_STD_VER >= 11 { A0::count = 0; b_construct = 0; @@ -139,5 +141,5 @@ int main() assert(A2::count == 1); assert(b_construct == 1); } -#endif // _LIBCPP_HAS_NO_VARIADICS +#endif } diff --git a/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp b/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp index 54726c929ef..2ee64b8b4a0 100644 --- a/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp +++ b/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp @@ -22,6 +22,8 @@ #include <type_traits> #include <cassert> +#include "test_macros.h" + template <class T> struct A { @@ -63,7 +65,7 @@ int main() std::allocator_traits<A<int> >::destroy(a, (A0*)&a0); assert(A0::count == 1); } -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE +#if TEST_STD_VER >= 11 { A0::count = 0; b_destroy = 0; @@ -76,5 +78,5 @@ int main() assert(A0::count == 1); assert(b_destroy == 1); } -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE +#endif } diff --git a/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp b/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp index bbc6b470174..d2c9a9826e1 100644 --- a/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp +++ b/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp @@ -43,7 +43,15 @@ struct B int main() { -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE + { + B<int> b; + assert(std::allocator_traits<B<int> >::max_size(b) == 100); + } + { + const B<int> b = {}; + assert(std::allocator_traits<B<int> >::max_size(b) == 100); + } +#if TEST_STD_VER >= 11 { A<int> a; assert(std::allocator_traits<A<int> >::max_size(a) == @@ -54,16 +62,6 @@ int main() assert(std::allocator_traits<A<int> >::max_size(a) == std::numeric_limits<std::size_t>::max() / sizeof(int)); } -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE - { - B<int> b; - assert(std::allocator_traits<B<int> >::max_size(b) == 100); - } - { - const B<int> b = {}; - assert(std::allocator_traits<B<int> >::max_size(b) == 100); - } -#if TEST_STD_VER >= 11 { std::allocator<int> a; static_assert(noexcept(std::allocator_traits<std::allocator<int>>::max_size(a)) == true, ""); diff --git a/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/select_on_container_copy_construction.pass.cpp b/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/select_on_container_copy_construction.pass.cpp index 29fe2be126f..2e970303789 100644 --- a/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/select_on_container_copy_construction.pass.cpp +++ b/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/select_on_container_copy_construction.pass.cpp @@ -22,6 +22,8 @@ #include <type_traits> #include <cassert> +#include "test_macros.h" + template <class T> struct A { @@ -55,7 +57,7 @@ int main() const A<int> a(0); assert(std::allocator_traits<A<int> >::select_on_container_copy_construction(a).id == 0); } -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE +#if TEST_STD_VER >= 11 { B<int> b; assert(std::allocator_traits<B<int> >::select_on_container_copy_construction(b).id == 100); @@ -64,5 +66,5 @@ int main() const B<int> b(0); assert(std::allocator_traits<B<int> >::select_on_container_copy_construction(b).id == 100); } -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE +#endif } diff --git a/libcxx/test/std/utilities/memory/allocator.traits/rebind_traits.pass.cpp b/libcxx/test/std/utilities/memory/allocator.traits/rebind_traits.pass.cpp index 87da9a0a85d..af4f5bc3fb4 100644 --- a/libcxx/test/std/utilities/memory/allocator.traits/rebind_traits.pass.cpp +++ b/libcxx/test/std/utilities/memory/allocator.traits/rebind_traits.pass.cpp @@ -19,6 +19,8 @@ #include <memory> #include <type_traits> +#include "test_macros.h" + template <class T> struct ReboundA {}; @@ -63,17 +65,17 @@ struct E int main() { -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#if TEST_STD_VER >= 11 static_assert((std::is_same<std::allocator_traits<A<char> >::rebind_traits<double>, std::allocator_traits<ReboundA<double> > >::value), ""); static_assert((std::is_same<std::allocator_traits<B<int, char> >::rebind_traits<double>, std::allocator_traits<ReboundB<double, char> > >::value), ""); static_assert((std::is_same<std::allocator_traits<C<char> >::rebind_traits<double>, std::allocator_traits<C<double> > >::value), ""); static_assert((std::is_same<std::allocator_traits<D<int, char> >::rebind_traits<double>, std::allocator_traits<D<double, char> > >::value), ""); static_assert((std::is_same<std::allocator_traits<E<char> >::rebind_traits<double>, std::allocator_traits<E<double> > >::value), ""); -#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#else static_assert((std::is_same<std::allocator_traits<A<char> >::rebind_traits<double>::other, std::allocator_traits<ReboundA<double> > >::value), ""); static_assert((std::is_same<std::allocator_traits<B<int, char> >::rebind_traits<double>::other, std::allocator_traits<ReboundB<double, char> > >::value), ""); static_assert((std::is_same<std::allocator_traits<C<char> >::rebind_traits<double>::other, std::allocator_traits<C<double> > >::value), ""); static_assert((std::is_same<std::allocator_traits<D<int, char> >::rebind_traits<double>::other, std::allocator_traits<D<double, char> > >::value), ""); static_assert((std::is_same<std::allocator_traits<E<char> >::rebind_traits<double>::other, std::allocator_traits<E<double> > >::value), ""); -#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#endif } diff --git a/libcxx/test/std/utilities/memory/pointer.traits/rebind.pass.cpp b/libcxx/test/std/utilities/memory/pointer.traits/rebind.pass.cpp index 8716c05f333..4caf4f65029 100644 --- a/libcxx/test/std/utilities/memory/pointer.traits/rebind.pass.cpp +++ b/libcxx/test/std/utilities/memory/pointer.traits/rebind.pass.cpp @@ -19,9 +19,11 @@ #include <memory> #include <type_traits> +#include "test_macros.h" + int main() { -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#if TEST_STD_VER >= 11 static_assert((std::is_same<std::pointer_traits<int*>::rebind<double>, double*>::value), ""); #else static_assert((std::is_same<std::pointer_traits<int*>::rebind<double>::other, double*>::value), ""); |