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/libcxx/experimental | |
parent | bb5e33f003797b67974a8893f7f2930fc51b8210 (diff) |
Notes
Diffstat (limited to 'test/libcxx/experimental')
38 files changed, 937 insertions, 93 deletions
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/alloc.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/alloc.pass.cpp index d274bc030881e..c6a83cc61bdcb 100644 --- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/alloc.pass.cpp +++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/alloc.pass.cpp @@ -7,6 +7,7 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03, c++11 // dynarray.cons // template <class Alloc> @@ -20,10 +21,8 @@ // ~dynarray(); - -#include <__config> -#if _LIBCPP_STD_VER > 11 +#include <__config> #include <experimental/dynarray> #include <cassert> @@ -44,7 +43,7 @@ void check_allocator ( const dynarray<T> &dyn, const Allocator &alloc ) { template <class T, class Allocator> void test ( const std::initializer_list<T> &vals, const Allocator &alloc ) { typedef dynarray<T> dynA; - + dynA d1 ( vals, alloc ); assert ( d1.size () == vals.size() ); assert ( std::equal ( vals.begin (), vals.end (), d1.begin (), d1.end ())); @@ -55,7 +54,7 @@ void test ( const std::initializer_list<T> &vals, const Allocator &alloc ) { template <class T, class Allocator> void test ( const T &val, const Allocator &alloc1, const Allocator &alloc2 ) { typedef dynarray<T> dynA; - + dynA d1 ( 4, alloc1 ); assert ( d1.size () == 4 ); assert ( std::all_of ( d1.begin (), d1.end (), []( const T &item ){ return item == T(); } )); @@ -68,19 +67,17 @@ void test ( const T &val, const Allocator &alloc1, const Allocator &alloc2 ) { dynA d3 ( d2, alloc2 ); assert ( d3.size () == 7 ); - assert ( std::all_of ( d3.begin (), d3.end (), [&val]( const T &item ){ return item == val; } )); + assert ( std::all_of ( d3.begin (), d3.end (), [&val]( const T &item ){ return item == val; } )); check_allocator ( d3, alloc2 ); } int main() { -// This test is waiting on the resolution of LWG issue #2235 +// This test is waiting on the resolution of LWG issue #2235 // typedef test_allocator<char> Alloc; // typedef std::basic_string<char, std::char_traits<char>, Alloc> nstr; -// +// // test ( nstr("fourteen"), Alloc(3), Alloc(4) ); // test ( { nstr("1"), nstr("1"), nstr("2"), nstr("3"), nstr("5"), nstr("8")}, Alloc(6)); } -#else -int main() {} -#endif + diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default.pass.cpp index 738c0c72592e3..cd5c56c7ac51a 100644 --- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default.pass.cpp +++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default.pass.cpp @@ -35,7 +35,7 @@ using std::experimental::dynarray; template <class T> void testInitList( const std::initializer_list<T> &vals ) { typedef dynarray<T> dynA; - + dynA d1 ( vals ); assert ( d1.size () == vals.size() ); assert ( std::equal ( vals.begin (), vals.end (), d1.begin (), d1.end ())); @@ -45,7 +45,7 @@ void testInitList( const std::initializer_list<T> &vals ) { template <class T> void test ( const T &val, bool DefaultValueIsIndeterminate = false) { typedef dynarray<T> dynA; - + dynA d1 ( 4 ); assert ( d1.size () == 4 ); if (!DefaultValueIsIndeterminate) { @@ -58,7 +58,7 @@ void test ( const T &val, bool DefaultValueIsIndeterminate = false) { dynA d3 ( d2 ); assert ( d3.size () == 7 ); - assert ( std::all_of ( d3.begin (), d3.end (), [&val]( const T &item ){ return item == val; } )); + assert ( std::all_of ( d3.begin (), d3.end (), [&val]( const T &item ){ return item == val; } )); } void test_bad_length () { @@ -76,12 +76,12 @@ int main() test<double> ( 14.0, true ); test<std::complex<double>> ( std::complex<double> ( 14, 0 )); test<std::string> ( "fourteen" ); - + testInitList( { 1, 1, 2, 3, 5, 8 } ); testInitList( { 1., 1., 2., 3., 5., 8. } ); testInitList( { std::string("1"), std::string("1"), std::string("2"), std::string("3"), std::string("5"), std::string("8")} ); - + // Make sure we don't pick up the Allocator version here dynarray<long> d1 ( 20, 3 ); assert ( d1.size() == 20 ); diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.data/default.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.data/default.pass.cpp index 1bbd8cde92fe1..84c602925cb49 100644 --- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.data/default.pass.cpp +++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.data/default.pass.cpp @@ -42,7 +42,7 @@ void dyn_test( dynarray<T> &dyn, bool CheckEquals = true) { } } - + template <class T> void test(const T &val, bool DefaultValueIsIndeterminate = false) { @@ -53,7 +53,7 @@ void test(const T &val, bool DefaultValueIsIndeterminate = false) { dynA d1(4); dyn_test(d1, CheckDefaultValues); dyn_test_const(d1, CheckDefaultValues); - + dynA d2 (7, val); dyn_test ( d2 ); dyn_test_const ( d2 ); diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.mutate/default.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.mutate/default.pass.cpp index c57887ddaf94c..376c94a6bcd8d 100644 --- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.mutate/default.pass.cpp +++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.mutate/default.pass.cpp @@ -7,15 +7,14 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03, c++11 // dynarray.data // void fill(const T& v); // const T* data() const noexcept; - -#include <__config> -#if _LIBCPP_STD_VER > 11 +#include <__config> #include <experimental/dynarray> #include <cassert> @@ -29,11 +28,11 @@ using std::experimental::dynarray; template <class T> void test ( const T &val ) { typedef dynarray<T> dynA; - + dynA d1 ( 4 ); d1.fill ( val ); - assert ( std::all_of ( d1.begin (), d1.end (), - [&val]( const T &item ){ return item == val; } )); + assert ( std::all_of ( d1.begin (), d1.end (), + [&val]( const T &item ){ return item == val; } )); } int main() @@ -43,6 +42,4 @@ int main() test<std::complex<double>> ( std::complex<double> ( 14, 0 )); test<std::string> ( "fourteen" ); } -#else -int main() {} -#endif + diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp index 8c0d085387166..a6825b68d0f17 100644 --- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp +++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp @@ -7,15 +7,14 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03, c++11 // XFAIL: libcpp-no-exceptions // dynarray.overview // const_reference at(size_type n) const; // reference at(size_type n); - -#include <__config> -#if _LIBCPP_STD_VER > 11 +#include <__config> #include <experimental/dynarray> #include <cassert> @@ -73,7 +72,7 @@ void dyn_test ( dynarray<T> &dyn, const std::initializer_list<T> &vals ) { template <class T> void test ( std::initializer_list<T> vals ) { typedef dynarray<T> dynA; - + dynA d1 ( vals ); dyn_test ( d1, vals ); dyn_test_const ( d1, vals ); @@ -83,13 +82,11 @@ int main() { test ( { 1, 1, 2, 3, 5, 8 } ); test ( { 1., 1., 2., 3., 5., 8. } ); - test ( { std::string("1"), std::string("1"), std::string("2"), std::string("3"), + test ( { std::string("1"), std::string("1"), std::string("2"), std::string("3"), std::string("5"), std::string("8")} ); test<int> ( {} ); test<std::complex<double>> ( {} ); test<std::string> ( {} ); } -#else -int main() {} -#endif + diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp index 695e1aa9f14ae..fe425b7e8c185 100644 --- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp +++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp @@ -7,6 +7,7 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03, c++11 // dynarray.overview @@ -16,7 +17,7 @@ // iterator end() noexcept; // const_iterator end() const noexcept; // const_iterator cend() const noexcept; -// +// // reverse_iterator rbegin() noexcept; // const_reverse_iterator rbegin() const noexcept; // const_reverse_iterator crbegin() const noexcept; @@ -24,10 +25,8 @@ // const_reverse_iterator rend() const noexcept; // const_reverse_iterator crend() const noexcept; - -#include <__config> -#if _LIBCPP_STD_VER > 11 +#include <__config> #include <experimental/dynarray> #include <cassert> @@ -86,11 +85,11 @@ void dyn_test ( dynarray<T> &dyn ) { template <class T> void test ( const T &val ) { typedef dynarray<T> dynA; - + dynA d1 ( 4 ); dyn_test ( d1 ); dyn_test_const ( d1 ); - + dynA d2 ( 7, val ); dyn_test ( d2 ); dyn_test_const ( d2 ); @@ -103,6 +102,4 @@ int main() test<std::complex<double>> ( std::complex<double> ( 14, 0 )); test<std::string> ( "fourteen" ); } -#else -int main() {} -#endif + diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/capacity.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/capacity.pass.cpp index 6d28eef1b0578..95262aab1bdcc 100644 --- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/capacity.pass.cpp +++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/capacity.pass.cpp @@ -7,16 +7,15 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03, c++11 // dynarray.overview // size_type size() const noexcept; // size_type max_size() const noexcept; -// bool empty() const noexcept; +// bool empty() const noexcept; #include <__config> -#if _LIBCPP_STD_VER > 11 - #include <experimental/dynarray> #include <cassert> @@ -36,7 +35,7 @@ void dyn_test ( const dynarray<T> &dyn, size_t sz ) { template <class T> void test ( std::initializer_list<T> vals ) { typedef dynarray<T> dynA; - + dynA d1 ( vals ); dyn_test ( d1, vals.size ()); } @@ -45,13 +44,11 @@ int main() { test ( { 1, 1, 2, 3, 5, 8 } ); test ( { 1., 1., 2., 3., 5., 8. } ); - test ( { std::string("1"), std::string("1"), std::string("2"), std::string("3"), + test ( { std::string("1"), std::string("1"), std::string("2"), std::string("3"), std::string("5"), std::string("8")} ); test<int> ( {} ); test<std::complex<double>> ( {} ); test<std::string> ( {} ); } -#else -int main() {} -#endif + diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/front_back.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/front_back.pass.cpp index 2af862a5530fb..4f1d0978dd11f 100644 --- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/front_back.pass.cpp +++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/front_back.pass.cpp @@ -58,7 +58,7 @@ void test ( const T &val, bool DefaultValueIsIndeterminate = false) { dynA d1 ( 4 ); dyn_test ( d1, CheckDefaultValues ); dyn_test_const ( d1, CheckDefaultValues ); - + dynA d2 ( 7, val ); dyn_test ( d2 ); dyn_test_const ( d2 ); diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/indexing.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/indexing.pass.cpp index 7317a2023cb1e..4bcb229ebce02 100644 --- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/indexing.pass.cpp +++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/indexing.pass.cpp @@ -7,14 +7,13 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03, c++11 // dynarray.overview // const_reference at(size_type n) const; // reference at(size_type n); - -#include <__config> -#if _LIBCPP_STD_VER > 11 +#include <__config> #include <experimental/dynarray> #include <cassert> @@ -49,7 +48,7 @@ void dyn_test ( dynarray<T> &dyn, const std::initializer_list<T> &vals ) { template <class T> void test ( std::initializer_list<T> vals ) { typedef dynarray<T> dynA; - + dynA d1 ( vals ); dyn_test ( d1, vals ); dyn_test_const ( d1, vals ); @@ -59,13 +58,11 @@ int main() { test ( { 1, 1, 2, 3, 5, 8 } ); test ( { 1., 1., 2., 3., 5., 8. } ); - test ( { std::string("1"), std::string("1"), std::string("2"), std::string("3"), + test ( { std::string("1"), std::string("1"), std::string("2"), std::string("3"), std::string("5"), std::string("8")} ); test<int> ( {} ); test<std::complex<double>> ( {} ); test<std::string> ( {} ); } -#else -int main() {} -#endif + diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.traits/default.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.traits/default.pass.cpp index 9b8240d4cd82f..48da6d885773f 100644 --- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.traits/default.pass.cpp +++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.traits/default.pass.cpp @@ -7,15 +7,14 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03, c++11 // dynarray.data // template <class Type, class Alloc> // struct uses_allocator<dynarray<Type>, Alloc> : true_type { }; - -#include <__config> -#if _LIBCPP_STD_VER > 11 +#include <__config> #include <experimental/dynarray> #include "test_allocator.h" @@ -26,6 +25,4 @@ int main() { static_assert ( std::uses_allocator<dynarray<int>, test_allocator<int>>::value, "" ); } -#else -int main() {} -#endif + diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.zero/default.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.zero/default.pass.cpp index 93f3b18f192f5..c0e0180930e9b 100644 --- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.zero/default.pass.cpp +++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.zero/default.pass.cpp @@ -7,18 +7,17 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03, c++11 // dynarray.zero // dynarray shall provide support for the special case of construction with a size of zero. -// In the case that the size is zero, begin() == end() == unique value. -// The return value of data() is unspecified. +// In the case that the size is zero, begin() == end() == unique value. +// The return value of data() is unspecified. // The effect of calling front() or back() for a zero-sized dynarray is undefined. - -#include <__config> -#if _LIBCPP_STD_VER > 11 +#include <__config> #include <experimental/dynarray> #include <cassert> @@ -32,7 +31,7 @@ using std::experimental::dynarray; template <class T> void test ( ) { typedef dynarray<T> dynA; - + dynA d1 ( 0 ); assert ( d1.size() == 0 ); assert ( d1.begin() == d1.end ()); @@ -45,6 +44,4 @@ int main() test<std::complex<double>> (); test<std::string> (); } -#else -int main() {} -#endif + diff --git a/test/libcxx/experimental/filesystem/class.path/path.req/is_pathable.pass.cpp b/test/libcxx/experimental/filesystem/class.path/path.req/is_pathable.pass.cpp new file mode 100644 index 0000000000000..94de2108f8b59 --- /dev/null +++ b/test/libcxx/experimental/filesystem/class.path/path.req/is_pathable.pass.cpp @@ -0,0 +1,101 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03 + +// <experimental/filesystem> + +// template <class Tp> struct __is_pathable + +// [path.req] +// In addition to the requirements (5), function template parameters named +// `Source` shall be one of: +// * basic_string<_ECharT, _Traits, _Alloc> +// * InputIterator with a value_type of _ECharT +// * A character array, which points to a NTCTS after array-to-pointer decay. + + +#include <experimental/filesystem> +#include <type_traits> +#include <cassert> + +#include "test_macros.h" +#include "test_iterators.h" +#include "min_allocator.h" + +namespace fs = std::experimental::filesystem; + +using fs::__is_pathable; + +template <class Tp> +struct Identity { typedef Tp type; }; + +template <class Source> +Identity<Source> CheckSourceType(Source const&); + +template <class Tp> +using GetSourceType = typename decltype(CheckSourceType(std::declval<Tp>()))::type; + +template <class Tp, class Exp, + class ExpQual = typename std::remove_const<Exp>::type> +using CheckPass = std::is_same<ExpQual, GetSourceType<Tp>>; + +template <class Source> +using CheckPassSource = std::integral_constant<bool, + CheckPass<Source&, Source>::value && + CheckPass<Source const&, Source>::value && + CheckPass<Source&&, Source>::value && + CheckPass<Source const&&, Source>::value + >; + +template <class CharT> +struct MakeTestType { + using value_type = CharT; + using string_type = std::basic_string<CharT>; + using string_type2 = std::basic_string<CharT, std::char_traits<CharT>, min_allocator<CharT>>; + using cstr_type = CharT* const; + using const_cstr_type = const CharT*; + using array_type = CharT[25]; + using const_array_type = const CharT[25]; + using iter_type = input_iterator<CharT*>; + using bad_iter_type = input_iterator<signed char*>; + + template <class TestT> + static void AssertPathable() { + static_assert(__is_pathable<TestT>::value, ""); + static_assert(CheckPassSource<TestT>::value, "cannot pass as Source const&"); + ASSERT_SAME_TYPE(CharT, typename __is_pathable<TestT>::__char_type); + } + + template <class TestT> + static void AssertNotPathable() { + static_assert(!__is_pathable<TestT>::value, ""); + } + + static void Test() { + AssertPathable<string_type>(); + AssertPathable<string_type2>(); + AssertPathable<cstr_type>(); + AssertPathable<const_cstr_type>(); + AssertPathable<array_type>(); + AssertPathable<const_array_type>(); + AssertPathable<iter_type>(); + + AssertNotPathable<CharT>(); + AssertNotPathable<bad_iter_type>(); + AssertNotPathable<signed char*>(); + } +}; + +int main() { + MakeTestType<char>::Test(); + MakeTestType<wchar_t>::Test(); + MakeTestType<char16_t>::Test(); + MakeTestType<char32_t>::Test(); +} diff --git a/test/libcxx/experimental/filesystem/lit.local.cfg b/test/libcxx/experimental/filesystem/lit.local.cfg new file mode 100644 index 0000000000000..3d9360431f486 --- /dev/null +++ b/test/libcxx/experimental/filesystem/lit.local.cfg @@ -0,0 +1,3 @@ +# Disable all of the filesystem tests if the correct feature is not available. +if 'c++filesystem' not in config.available_features: + config.unsupported = True diff --git a/test/libcxx/experimental/filesystem/version.pass.cpp b/test/libcxx/experimental/filesystem/version.pass.cpp new file mode 100644 index 0000000000000..723380a26fbae --- /dev/null +++ b/test/libcxx/experimental/filesystem/version.pass.cpp @@ -0,0 +1,22 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03 + +// <experimental/filesystem> + +#include <experimental/filesystem> + +#ifndef _LIBCPP_VERSION +#error _LIBCPP_VERSION not defined +#endif + +int main() +{ +} diff --git a/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp b/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp new file mode 100644 index 0000000000000..83b3041963719 --- /dev/null +++ b/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp @@ -0,0 +1,178 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03 + +// <experimental/memory_resource> + +// template <class T> class polymorphic_allocator + +// template <class U1, class U2, class ...Args1, class ...Args2> +// void polymorphic_allocator<T>::construct(pair<T1, T2>*, piecewise_construct_t +// tuple<Args1...> x, tuple<Args2...>) + +// The stardard specifiers a tranformation to uses-allocator construction as +// follows: +// - If uses_allocator_v<T1,memory_resource*> is false and +// is_constructible_v<T,Args1...> is true, then xprime is x. +// - Otherwise, if uses_allocator_v<T1,memory_resource*> is true and +// is_constructible_v<T1,allocator_arg_t,memory_resource*,Args1...> is true, +// then xprime is +// tuple_cat(make_tuple(allocator_arg, this->resource()), std::move(x)). +// - Otherwise, if uses_allocator_v<T1,memory_resource*> is true and +// is_constructible_v<T1,Args1...,memory_resource*> is true, then xprime is +// tuple_cat(std::move(x), make_tuple(this->resource())). +// - Otherwise the program is ill formed. +// +// The use of "xprime = tuple_cat(..., std::move(x), ...)" causes all of the +// objects in 'x' to be copied into 'xprime'. If 'x' contains any types which +// are stored by value this causes an unessary copy to occur. To prevent this +// libc++ changes this call into +// "xprime = forward_as_tuple(..., std::get<Idx>(std::move(x))..., ...)". +// 'xprime' contains references to the values in 'x' instead of copying them. + +// This test checks the number of copies incurred to the elements in +// 'tuple<Args1...>' and 'tuple<Args2...>'. + +#include <experimental/memory_resource> +#include <type_traits> +#include <utility> +#include <tuple> +#include <cassert> +#include <cstdlib> +#include "test_memory_resource.hpp" + +namespace ex = std::experimental::pmr; + +template <class T> +struct TestHarness { + TestResource R; + ex::memory_resource * M = &R; + ex::polymorphic_allocator<T> A = M; + bool constructed = false; + T * ptr; + + TestHarness() : ptr(A.allocate(1)) {} + + template <class ...Args> + void construct(Args&&... args) { + A.construct(ptr, std::forward<Args>(args)...); + constructed = true; + } + + ~TestHarness() { + if (constructed) A.destroy(ptr); + A.deallocate(ptr, 1); + } +}; + +struct CountCopies { + int count; + CountCopies() : count(0) {} + CountCopies(CountCopies const& o) : count(o.count + 1) {} +}; + +struct CountCopiesAllocV1 { + typedef ex::memory_resource* allocator_type; + allocator_type alloc; + int count; + CountCopiesAllocV1() : alloc(nullptr), count(0) {} + CountCopiesAllocV1(std::allocator_arg_t, allocator_type const& a, + CountCopiesAllocV1 const& o) : alloc(a), count(o.count + 1) + {} + + CountCopiesAllocV1(CountCopiesAllocV1 const& o) : count(o.count + 1) {} +}; + + +struct CountCopiesAllocV2 { + typedef ex::memory_resource* allocator_type; + allocator_type alloc; + int count; + CountCopiesAllocV2() : alloc(nullptr), count(0) {} + CountCopiesAllocV2(CountCopiesAllocV2 const& o, allocator_type const& a) + : alloc(a), count(o.count + 1) + { } + + CountCopiesAllocV2(CountCopiesAllocV2 const& o) : count(o.count + 1) {} +}; + + +int main() +{ + using PMR = ex::memory_resource*; + using PMA = ex::polymorphic_allocator<char>; + + { + using T = CountCopies; + using U = CountCopiesAllocV1; + using P = std::pair<T, U>; + using TH = TestHarness<P>; + + std::tuple<T> t1; + std::tuple<U> t2; + + TestHarness<P> h; + h.construct(std::piecewise_construct, t1, t2); + P const& p = *h.ptr; + assert(p.first.count == 2); + assert(p.second.count == 2); + assert(p.second.alloc == h.M); + } + { + using T = CountCopiesAllocV1; + using U = CountCopiesAllocV2; + using P = std::pair<T, U>; + using TH = TestHarness<P>; + + std::tuple<T> t1; + std::tuple<U> t2; + + TestHarness<P> h; + h.construct(std::piecewise_construct, std::move(t1), std::move(t2)); + P const& p = *h.ptr; + assert(p.first.count == 2); + assert(p.first.alloc == h.M); + assert(p.second.count == 2); + assert(p.second.alloc == h.M); + } + { + using T = CountCopiesAllocV2; + using U = CountCopiesAllocV1; + using P = std::pair<T, U>; + using TH = TestHarness<P>; + + std::tuple<T> t1; + std::tuple<U> t2; + + TestHarness<P> h; + h.construct(std::piecewise_construct, std::move(t1), std::move(t2)); + P const& p = *h.ptr; + assert(p.first.count == 2); + assert(p.first.alloc == h.M); + assert(p.second.count == 2); + assert(p.second.alloc == h.M); + } + { + using T = CountCopiesAllocV2; + using U = CountCopies; + using P = std::pair<T, U>; + using TH = TestHarness<P>; + + std::tuple<T> t1; + std::tuple<U> t2; + + TestHarness<P> h; + h.construct(std::piecewise_construct, t1, t2); + P const& p = *h.ptr; + assert(p.first.count == 2); + assert(p.first.alloc == h.M); + assert(p.second.count == 2); + } +} diff --git a/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/db_deallocate.pass.cpp b/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/db_deallocate.pass.cpp new file mode 100644 index 0000000000000..020133fc40481 --- /dev/null +++ b/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/db_deallocate.pass.cpp @@ -0,0 +1,42 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03 + +// <experimental/memory_resource> + +// template <class T> class polymorphic_allocator + +// T* polymorphic_allocator<T>::deallocate(T*, size_t size) + +int AssertCount = 0; + +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : (void)::AssertCount++) +#define _LIBCPP_DEBUG 0 +#include <experimental/memory_resource> +#include <type_traits> +#include <cassert> + +#include "test_memory_resource.hpp" + +namespace ex = std::experimental::pmr; + +int main() +{ + using Alloc = ex::polymorphic_allocator<int>; + using Traits = std::allocator_traits<Alloc>; + NullResource R; + Alloc a(&R); + const std::size_t maxSize = Traits::max_size(a); + + a.deallocate(nullptr, maxSize); + assert(AssertCount == 0); + a.deallocate(nullptr, maxSize + 1); + assert(AssertCount == 1); +} diff --git a/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/max_size.pass.cpp b/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/max_size.pass.cpp new file mode 100644 index 0000000000000..ac685a99be494 --- /dev/null +++ b/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/max_size.pass.cpp @@ -0,0 +1,65 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// REQUIRES: c++experimental +// UNSUPPORTED: c++98, c++03 + +// <experimental/memory_resource> + +// template <class T> class polymorphic_allocator + +// EXTENSION +// std::size_t polymorphic_allocator<T>::max_size() const noexcept + +#include <experimental/memory_resource> +#include <type_traits> +#include <cassert> + +#include "test_memory_resource.hpp" + +namespace ex = std::experimental::pmr; + +template <std::size_t S> +std::size_t getMaxSize() { + using T = typename std::aligned_storage<S>::type; + static_assert(sizeof(T) == S, "Required for test"); + return ex::polymorphic_allocator<T>{}.max_size(); +} + +template <std::size_t S, std::size_t A> +std::size_t getMaxSize() { + using T = typename std::aligned_storage<S, A>::type; + static_assert(sizeof(T) == S, "Required for test"); + return ex::polymorphic_allocator<T>{}.max_size(); +} + +int main() +{ + { + using Alloc = ex::polymorphic_allocator<int>; + using Traits = std::allocator_traits<Alloc>; + const Alloc a; + static_assert(std::is_same<decltype(a.max_size()), Traits::size_type>::value, ""); + static_assert(noexcept(a.max_size()), ""); + } + { + constexpr std::size_t Max = std::numeric_limits<std::size_t>::max(); + assert(getMaxSize<1>() == Max); + assert(getMaxSize<2>() == Max / 2); + assert(getMaxSize<4>() == Max / 4); + assert(getMaxSize<8>() == Max / 8); + assert(getMaxSize<16>() == Max / 16); + assert(getMaxSize<32>() == Max / 32); + assert(getMaxSize<64>() == Max / 64); + assert(getMaxSize<1024>() == Max / 1024); + + assert((getMaxSize<6, 2>() == Max / 6)); + assert((getMaxSize<12, 4>() == Max / 12)); + } +} diff --git a/test/libcxx/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/db_deallocate.pass.cpp b/test/libcxx/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/db_deallocate.pass.cpp new file mode 100644 index 0000000000000..ccb9b710e5dcd --- /dev/null +++ b/test/libcxx/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/db_deallocate.pass.cpp @@ -0,0 +1,45 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03 + +// <experimental/memory_resource> + +// template <class T> class polymorphic_allocator + +// T* polymorphic_allocator<T>::deallocate(T*, size_t size) + +int AssertCount = 0; + +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : (void)::AssertCount++) +#define _LIBCPP_DEBUG 0 +#include <experimental/memory_resource> +#include <type_traits> +#include <cassert> + +#include "test_memory_resource.hpp" + +namespace ex = std::experimental::pmr; + +int main() +{ + using Alloc = NullAllocator<char>; + using R = ex::resource_adaptor<Alloc>; + AllocController P; + ex::resource_adaptor<Alloc> r(Alloc{P}); + ex::memory_resource & m1 = r; + + std::size_t maxSize = std::numeric_limits<std::size_t>::max() + - alignof(std::max_align_t); + + m1.deallocate(nullptr, maxSize); + assert(AssertCount == 0); + m1.deallocate(nullptr, maxSize + 1); + assert(AssertCount >= 1); +} diff --git a/test/libcxx/experimental/memory/memory.resource.aliases/header_deque_libcpp_version.pass.cpp b/test/libcxx/experimental/memory/memory.resource.aliases/header_deque_libcpp_version.pass.cpp new file mode 100644 index 0000000000000..04b361dfe5a43 --- /dev/null +++ b/test/libcxx/experimental/memory/memory.resource.aliases/header_deque_libcpp_version.pass.cpp @@ -0,0 +1,22 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03 + +// <experimental/deque> + +#include <experimental/deque> + +#ifndef _LIBCPP_VERSION +#error header must provide _LIBCPP_VERSION +#endif + +int main() +{ +} diff --git a/test/libcxx/experimental/memory/memory.resource.aliases/header_forward_list_libcpp_version.pass.cpp b/test/libcxx/experimental/memory/memory.resource.aliases/header_forward_list_libcpp_version.pass.cpp new file mode 100644 index 0000000000000..11fc21b3b03cb --- /dev/null +++ b/test/libcxx/experimental/memory/memory.resource.aliases/header_forward_list_libcpp_version.pass.cpp @@ -0,0 +1,22 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03 + +// <experimental/forward_list> + +#include <experimental/forward_list> + +#ifndef _LIBCPP_VERSION +#error header must provide _LIBCPP_VERSION +#endif + +int main() +{ +} diff --git a/test/libcxx/experimental/memory/memory.resource.aliases/header_list_libcpp_version.pass.cpp b/test/libcxx/experimental/memory/memory.resource.aliases/header_list_libcpp_version.pass.cpp new file mode 100644 index 0000000000000..9a72979e0af04 --- /dev/null +++ b/test/libcxx/experimental/memory/memory.resource.aliases/header_list_libcpp_version.pass.cpp @@ -0,0 +1,22 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03 + +// <experimental/list> + +#include <experimental/list> + +#ifndef _LIBCPP_VERSION +#error header must provide _LIBCPP_VERSION +#endif + +int main() +{ +} diff --git a/test/libcxx/experimental/memory/memory.resource.aliases/header_map_libcpp_version.pass.cpp b/test/libcxx/experimental/memory/memory.resource.aliases/header_map_libcpp_version.pass.cpp new file mode 100644 index 0000000000000..24a1bf3042c1a --- /dev/null +++ b/test/libcxx/experimental/memory/memory.resource.aliases/header_map_libcpp_version.pass.cpp @@ -0,0 +1,22 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03 + +// <experimental/map> + +#include <experimental/map> + +#ifndef _LIBCPP_VERSION +#error header must provide _LIBCPP_VERSION +#endif + +int main() +{ +} diff --git a/test/libcxx/experimental/memory/memory.resource.aliases/header_regex_libcpp_version.pass.cpp b/test/libcxx/experimental/memory/memory.resource.aliases/header_regex_libcpp_version.pass.cpp new file mode 100644 index 0000000000000..ff81bc09b850d --- /dev/null +++ b/test/libcxx/experimental/memory/memory.resource.aliases/header_regex_libcpp_version.pass.cpp @@ -0,0 +1,22 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03 + +// <experimental/regex> + +#include <experimental/regex> + +#ifndef _LIBCPP_VERSION +#error header must provide _LIBCPP_VERSION +#endif + +int main() +{ +} diff --git a/test/libcxx/experimental/memory/memory.resource.aliases/header_set_libcpp_version.pass.cpp b/test/libcxx/experimental/memory/memory.resource.aliases/header_set_libcpp_version.pass.cpp new file mode 100644 index 0000000000000..6b02f46b4f73c --- /dev/null +++ b/test/libcxx/experimental/memory/memory.resource.aliases/header_set_libcpp_version.pass.cpp @@ -0,0 +1,22 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03 + +// <experimental/set> + +#include <experimental/set> + +#ifndef _LIBCPP_VERSION +#error header must provide _LIBCPP_VERSION +#endif + +int main() +{ +} diff --git a/test/libcxx/experimental/memory/memory.resource.aliases/header_string_libcpp_version.pass.cpp b/test/libcxx/experimental/memory/memory.resource.aliases/header_string_libcpp_version.pass.cpp new file mode 100644 index 0000000000000..b4b7fdf10f592 --- /dev/null +++ b/test/libcxx/experimental/memory/memory.resource.aliases/header_string_libcpp_version.pass.cpp @@ -0,0 +1,22 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03 + +// <experimental/string> + +#include <experimental/string> + +#ifndef _LIBCPP_VERSION +#error header must provide _LIBCPP_VERSION +#endif + +int main() +{ +} diff --git a/test/libcxx/experimental/memory/memory.resource.aliases/header_unordered_map_libcpp_version.pass.cpp b/test/libcxx/experimental/memory/memory.resource.aliases/header_unordered_map_libcpp_version.pass.cpp new file mode 100644 index 0000000000000..ab9cc189b73d0 --- /dev/null +++ b/test/libcxx/experimental/memory/memory.resource.aliases/header_unordered_map_libcpp_version.pass.cpp @@ -0,0 +1,22 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03 + +// <experimental/unordered_map> + +#include <experimental/unordered_map> + +#ifndef _LIBCPP_VERSION +#error header must provide _LIBCPP_VERSION +#endif + +int main() +{ +} diff --git a/test/libcxx/experimental/memory/memory.resource.aliases/header_unordered_set_libcpp_version.pass.cpp b/test/libcxx/experimental/memory/memory.resource.aliases/header_unordered_set_libcpp_version.pass.cpp new file mode 100644 index 0000000000000..37533c7fd87c4 --- /dev/null +++ b/test/libcxx/experimental/memory/memory.resource.aliases/header_unordered_set_libcpp_version.pass.cpp @@ -0,0 +1,22 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03 + +// <experimental/unordered_set> + +#include <experimental/unordered_set> + +#ifndef _LIBCPP_VERSION +#error header must provide _LIBCPP_VERSION +#endif + +int main() +{ +} diff --git a/test/libcxx/experimental/memory/memory.resource.aliases/header_vector_libcpp_version.pass.cpp b/test/libcxx/experimental/memory/memory.resource.aliases/header_vector_libcpp_version.pass.cpp new file mode 100644 index 0000000000000..103d32becf9c1 --- /dev/null +++ b/test/libcxx/experimental/memory/memory.resource.aliases/header_vector_libcpp_version.pass.cpp @@ -0,0 +1,22 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03 + +// <experimental/vector> + +#include <experimental/vector> + +#ifndef _LIBCPP_VERSION +#error header must provide _LIBCPP_VERSION +#endif + +int main() +{ +} diff --git a/test/libcxx/experimental/memory/memory.resource.global/global_memory_resource_lifetime.pass.cpp b/test/libcxx/experimental/memory/memory.resource.global/global_memory_resource_lifetime.pass.cpp new file mode 100644 index 0000000000000..341a88c0bab12 --- /dev/null +++ b/test/libcxx/experimental/memory/memory.resource.global/global_memory_resource_lifetime.pass.cpp @@ -0,0 +1,61 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// REQUIRES: c++experimental +// UNSUPPORTED: c++98, c++03 + +// <experimental/memory_resource> + +// memory_resource * new_delete_resource() + +// The lifetime of the value returned by 'new_delete_resource()' should +// never end, even very late into program termination. This test constructs +// attempts to use 'new_delete_resource()' very late in program termination +// to detect lifetime issues. + +#include <experimental/memory_resource> +#include <type_traits> +#include <cassert> + +namespace ex = std::experimental::pmr; + +struct POSType { + ex::memory_resource* res = nullptr; + void* ptr = nullptr; + int n = 0; + POSType() {} + POSType(ex::memory_resource* r, void* p, int s) : res(r), ptr(p), n(s) {} + ~POSType() { + if (ptr) { + if (!res) res = ex::get_default_resource(); + res->deallocate(ptr, n); + } + } +}; + +void swap(POSType & L, POSType & R) { + std::swap(L.res, R.res); + std::swap(L.ptr, R.ptr); + std::swap(L.n, R.n); +} + +POSType constructed_before_resources; +POSType constructed_before_resources2; + +// Constructs resources +ex::memory_resource* resource = ex::get_default_resource(); + +POSType constructed_after_resources(resource, resource->allocate(1024), 1024); +POSType constructed_after_resources2(nullptr, resource->allocate(1024), 1024); + +int main() +{ + swap(constructed_after_resources, constructed_before_resources); + swap(constructed_before_resources2, constructed_after_resources2); +} diff --git a/test/libcxx/experimental/memory/memory.resource.global/new_delete_resource_lifetime.pass.cpp b/test/libcxx/experimental/memory/memory.resource.global/new_delete_resource_lifetime.pass.cpp new file mode 100644 index 0000000000000..9b92d02bc4374 --- /dev/null +++ b/test/libcxx/experimental/memory/memory.resource.global/new_delete_resource_lifetime.pass.cpp @@ -0,0 +1,53 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// REQUIRES: c++experimental +// UNSUPPORTED: c++98, c++03 + +// <experimental/memory_resource> + +// memory_resource * new_delete_resource() + +// The lifetime of the value returned by 'new_delete_resource()' should +// never end, even very late into program termination. This test constructs +// attempts to use 'new_delete_resource()' very late in program termination +// to detect lifetime issues. + +#include <experimental/memory_resource> +#include <type_traits> +#include <cassert> + +namespace ex = std::experimental::pmr; + +struct POSType { + ex::memory_resource* res = nullptr; + void* ptr = nullptr; + int n = 0; + POSType() {res = ex::new_delete_resource(); ptr = res->allocate(42); n = 42; } + POSType(ex::memory_resource* r, void* p, int s) : res(r), ptr(p), n(s) {} + ~POSType() { if (ptr) res->deallocate(ptr, n); } +}; + +void swap(POSType & L, POSType & R) { + std::swap(L.res, R.res); + std::swap(L.ptr, R.ptr); + std::swap(L.n, R.n); +} + +POSType constructed_before_resources; + +// Constructs resources +ex::memory_resource* resource = ex::new_delete_resource(); + +POSType constructed_after_resources(resource, resource->allocate(1024), 1024); + +int main() +{ + swap(constructed_after_resources, constructed_before_resources); +} diff --git a/test/libcxx/experimental/memory/memory.resource.synop/version.pass.cpp b/test/libcxx/experimental/memory/memory.resource.synop/version.pass.cpp new file mode 100644 index 0000000000000..d05575e8849e5 --- /dev/null +++ b/test/libcxx/experimental/memory/memory.resource.synop/version.pass.cpp @@ -0,0 +1,22 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03 + +// <experimental/memory_resource> + +#include <experimental/memory_resource> + +#ifndef _LIBCPP_VERSION +#error _LIBCPP_VERSION not defined +#endif + +int main() +{ +} diff --git a/test/libcxx/experimental/optional/version.pass.cpp b/test/libcxx/experimental/optional/version.pass.cpp new file mode 100644 index 0000000000000..585b7a24eea5a --- /dev/null +++ b/test/libcxx/experimental/optional/version.pass.cpp @@ -0,0 +1,20 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// <optional> + +#include <experimental/optional> + +#ifndef _LIBCPP_VERSION +#error _LIBCPP_VERSION not defined +#endif + +int main() +{ +} diff --git a/test/libcxx/experimental/utilities/meta/version.pass.cpp b/test/libcxx/experimental/utilities/meta/version.pass.cpp new file mode 100644 index 0000000000000..593fb52a4c3b2 --- /dev/null +++ b/test/libcxx/experimental/utilities/meta/version.pass.cpp @@ -0,0 +1,20 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// <experimental/type_traits> + +#include <experimental/type_traits> + +#ifndef _LIBCPP_VERSION +#error _LIBCPP_VERSION not defined +#endif + +int main() +{ +} diff --git a/test/libcxx/experimental/utilities/ratio/header.ratio.synop/includes.pass.cpp b/test/libcxx/experimental/utilities/ratio/header.ratio.synop/includes.pass.cpp index db9026aebd84f..ea7ef6cbc1088 100644 --- a/test/libcxx/experimental/utilities/ratio/header.ratio.synop/includes.pass.cpp +++ b/test/libcxx/experimental/utilities/ratio/header.ratio.synop/includes.pass.cpp @@ -7,16 +7,15 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03, c++11 // <experimental/ratio> // Test that <ratio> is included. #include <experimental/ratio> -#if _LIBCPP_STD_VER > 11 -# ifndef _LIBCPP_RATIO -# error " <experimental/ratio> must include <ratio>" -# endif +#ifndef _LIBCPP_RATIO +# error " <experimental/ratio> must include <ratio>" #endif int main() diff --git a/test/libcxx/experimental/utilities/syserror/header.system_error.synop/includes.pass.cpp b/test/libcxx/experimental/utilities/syserror/header.system_error.synop/includes.pass.cpp index 88c7458395d4b..be3aacdc362ca 100644 --- a/test/libcxx/experimental/utilities/syserror/header.system_error.synop/includes.pass.cpp +++ b/test/libcxx/experimental/utilities/syserror/header.system_error.synop/includes.pass.cpp @@ -7,14 +7,13 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03, c++11 // <experimental/system_error> #include <experimental/system_error> -#if _LIBCPP_STD_VER > 11 -# ifndef _LIBCPP_SYSTEM_ERROR -# error "<experimental/system_error> must include <system_error>" -# endif +#ifndef _LIBCPP_SYSTEM_ERROR +# error "<experimental/system_error> must include <system_error>" #endif int main() diff --git a/test/libcxx/experimental/utilities/time/header.chrono.synop/includes.pass.cpp b/test/libcxx/experimental/utilities/time/header.chrono.synop/includes.pass.cpp index ad4a79105b0b8..e91068c742e18 100644 --- a/test/libcxx/experimental/utilities/time/header.chrono.synop/includes.pass.cpp +++ b/test/libcxx/experimental/utilities/time/header.chrono.synop/includes.pass.cpp @@ -7,14 +7,13 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03, c++11 // <experimental/chrono> #include <experimental/chrono> -#if _LIBCPP_STD_VER > 11 -# ifndef _LIBCPP_CHRONO -# error "<experimental/chrono> must include <chrono>" -# endif +#ifndef _LIBCPP_CHRONO +# error "<experimental/chrono> must include <chrono>" #endif int main() diff --git a/test/libcxx/experimental/utilities/tuple/header.tuple.synop/includes.pass.cpp b/test/libcxx/experimental/utilities/tuple/header.tuple.synop/includes.pass.cpp index 544ddfb269f2c..defa454d68f75 100644 --- a/test/libcxx/experimental/utilities/tuple/header.tuple.synop/includes.pass.cpp +++ b/test/libcxx/experimental/utilities/tuple/header.tuple.synop/includes.pass.cpp @@ -7,15 +7,14 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03, c++11 // <experimental/tuple> #include <experimental/tuple> int main() { -#if _LIBCPP_STD_VER > 11 -# ifndef _LIBCPP_TUPLE -# error "<experimental/tuple> must include <tuple>" -# endif -#endif /* _LIBCPP_STD_VER > 11 */ +#ifndef _LIBCPP_TUPLE +# error "<experimental/tuple> must include <tuple>" +#endif } diff --git a/test/libcxx/experimental/utilities/utility/version.pass.cpp b/test/libcxx/experimental/utilities/utility/version.pass.cpp new file mode 100644 index 0000000000000..437712454ae5c --- /dev/null +++ b/test/libcxx/experimental/utilities/utility/version.pass.cpp @@ -0,0 +1,20 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// <experimental/utility> + +#include <experimental/utility> + +#ifndef _LIBCPP_VERSION +#error _LIBCPP_VERSION not defined +#endif + +int main() +{ +} |