From 5a83710e371fe68a06e6e3876c6a2c8b820a8976 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sat, 20 Dec 2014 01:40:03 +0000 Subject: Move test into test/std subdirectory. llvm-svn: 224658 --- .../meta/meta.type.synop/includes.pass.cpp | 22 + .../meta/meta.type.synop/meta.rel.pass.cpp | 65 +++ .../meta/meta.type.synop/meta.unary.cat.pass.cpp | 181 ++++++++ .../meta/meta.type.synop/meta.unary.comp.pass.cpp | 102 +++++ .../meta/meta.type.synop/meta.unary.prop.pass.cpp | 489 +++++++++++++++++++++ .../meta.type.synop/meta.unary.prop.query.pass.cpp | 66 +++ .../experimental/utilities/meta/version.pass.cpp | 20 + .../experimental/utilities/nothing_to_do.pass.cpp | 13 + .../utility.erased.type/erased_type.pass.cpp | 17 + .../utility/utility.synop/includes.pass.cpp | 20 + .../utilities/utility/version.pass.cpp | 20 + 11 files changed, 1015 insertions(+) create mode 100644 libcxx/test/std/experimental/utilities/meta/meta.type.synop/includes.pass.cpp create mode 100644 libcxx/test/std/experimental/utilities/meta/meta.type.synop/meta.rel.pass.cpp create mode 100644 libcxx/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.cat.pass.cpp create mode 100644 libcxx/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.comp.pass.cpp create mode 100644 libcxx/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.pass.cpp create mode 100644 libcxx/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.query.pass.cpp create mode 100644 libcxx/test/std/experimental/utilities/meta/version.pass.cpp create mode 100644 libcxx/test/std/experimental/utilities/nothing_to_do.pass.cpp create mode 100644 libcxx/test/std/experimental/utilities/utility/utility.erased.type/erased_type.pass.cpp create mode 100644 libcxx/test/std/experimental/utilities/utility/utility.synop/includes.pass.cpp create mode 100644 libcxx/test/std/experimental/utilities/utility/version.pass.cpp (limited to 'libcxx/test/std/experimental/utilities') diff --git a/libcxx/test/std/experimental/utilities/meta/meta.type.synop/includes.pass.cpp b/libcxx/test/std/experimental/utilities/meta/meta.type.synop/includes.pass.cpp new file mode 100644 index 00000000000..2c90dd64181 --- /dev/null +++ b/libcxx/test/std/experimental/utilities/meta/meta.type.synop/includes.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. +// +//===----------------------------------------------------------------------===// + +// + +#include + +#if _LIBCPP_STD_VER > 11 +# ifndef _LIBCPP_TYPE_TRAITS +# error " must include " +# endif +#endif + +int main() +{ +} diff --git a/libcxx/test/std/experimental/utilities/meta/meta.type.synop/meta.rel.pass.cpp b/libcxx/test/std/experimental/utilities/meta/meta.type.synop/meta.rel.pass.cpp new file mode 100644 index 00000000000..96af4b67618 --- /dev/null +++ b/libcxx/test/std/experimental/utilities/meta/meta.type.synop/meta.rel.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. +// +//===----------------------------------------------------------------------===// + +// + +#include + +#if _LIBCPP_STD_VER > 11 + +namespace ex = std::experimental; + +struct base_type {}; +struct derived_type : base_type {}; + +int main() +{ + { + typedef int T; + typedef int U; + static_assert(ex::is_same_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_same_v == std::is_same::value, ""); + } + { + typedef int T; + typedef long U; + static_assert(!ex::is_same_v, ""); + static_assert(ex::is_same_v == std::is_same::value, ""); + } + { + typedef base_type T; + typedef derived_type U; + static_assert(ex::is_base_of_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_base_of_v == std::is_base_of::value, ""); + } + { + typedef int T; + typedef int U; + static_assert(!ex::is_base_of_v, ""); + static_assert(ex::is_base_of_v == std::is_base_of::value, ""); + } + { + typedef int T; + typedef long U; + static_assert(ex::is_convertible_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_convertible_v == std::is_convertible::value, ""); + } + { + typedef void T; + typedef int U; + static_assert(!ex::is_convertible_v, ""); + static_assert(ex::is_convertible_v == std::is_convertible::value, ""); + } +} +#else /* _LIBCPP_STD_VER <= 11 */ +int main() {} +#endif /* _LIBCPP_STD_VER > 11 */ diff --git a/libcxx/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.cat.pass.cpp b/libcxx/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.cat.pass.cpp new file mode 100644 index 00000000000..2d1e706f67d --- /dev/null +++ b/libcxx/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.cat.pass.cpp @@ -0,0 +1,181 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +#include + +#if _LIBCPP_STD_VER > 11 + +namespace ex = std::experimental; + +struct class_type {}; +enum enum_type {}; +union union_type {}; + +int main() +{ + { + typedef void T; + static_assert(ex::is_void_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_void_v == std::is_void::value, ""); + } + { + typedef int T; + static_assert(!ex::is_void_v, ""); + static_assert(ex::is_void_v == std::is_void::value, ""); + } + { + typedef decltype(nullptr) T; + static_assert(ex::is_null_pointer_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_null_pointer_v == std::is_null_pointer::value, ""); + } + { + typedef int T; + static_assert(!ex::is_null_pointer_v, ""); + static_assert(ex::is_null_pointer_v == std::is_null_pointer::value, ""); + } + { + typedef int T; + static_assert(ex::is_integral_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_integral_v == std::is_integral::value, ""); + } + { + typedef void T; + static_assert(!ex::is_integral_v, ""); + static_assert(ex::is_integral_v == std::is_integral::value, ""); + } + { + typedef float T; + static_assert(ex::is_floating_point_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_floating_point_v == std::is_floating_point::value, ""); + } + { + typedef int T; + static_assert(!ex::is_floating_point_v, ""); + static_assert(ex::is_floating_point_v == std::is_floating_point::value, ""); + } + { + typedef int(T)[42]; + static_assert(ex::is_array_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_array_v == std::is_array::value, ""); + } + { + typedef int T; + static_assert(!ex::is_array_v, ""); + static_assert(ex::is_array_v == std::is_array::value, ""); + } + { + typedef void* T; + static_assert(ex::is_pointer_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_pointer_v == std::is_pointer::value, ""); + } + { + typedef int T; + static_assert(!ex::is_pointer_v, ""); + static_assert(ex::is_pointer_v == std::is_pointer::value, ""); + } + { + typedef int & T; + static_assert(ex::is_lvalue_reference_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_lvalue_reference_v == std::is_lvalue_reference::value, ""); + } + { + typedef int T; + static_assert(!ex::is_lvalue_reference_v, ""); + static_assert(ex::is_lvalue_reference_v == std::is_lvalue_reference::value, ""); + } + { + typedef int && T; + static_assert(ex::is_rvalue_reference_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_rvalue_reference_v == std::is_rvalue_reference::value, ""); + } + { + typedef int T; + static_assert(!ex::is_rvalue_reference_v, ""); + static_assert(ex::is_rvalue_reference_v == std::is_rvalue_reference::value, ""); + } + { + typedef int class_type::*T; + static_assert(ex::is_member_object_pointer_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_member_object_pointer_v == std::is_member_object_pointer::value, ""); + } + { + typedef int T; + static_assert(!ex::is_member_object_pointer_v, ""); + static_assert(ex::is_member_object_pointer_v == std::is_member_object_pointer::value, ""); + } + { + typedef void(class_type::*T)(); + static_assert(ex::is_member_function_pointer_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_member_function_pointer_v == std::is_member_function_pointer::value, ""); + } + { + typedef int T; + static_assert(!ex::is_member_function_pointer_v, ""); + static_assert(ex::is_member_function_pointer_v == std::is_member_function_pointer::value, ""); + } + { + typedef enum_type T; + static_assert(ex::is_enum_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_enum_v == std::is_enum::value, ""); + } + { + typedef int T; + static_assert(!ex::is_enum_v, ""); + static_assert(ex::is_enum_v == std::is_enum::value, ""); + } + { + typedef union_type T; + static_assert(ex::is_union_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_union_v == std::is_union::value, ""); + } + { + typedef int T; + static_assert(!ex::is_union_v, ""); + static_assert(ex::is_union_v == std::is_union::value, ""); + } + { + typedef class_type T; + static_assert(ex::is_class_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_class_v == std::is_class::value, ""); + } + { + typedef int T; + static_assert(!ex::is_class_v, ""); + static_assert(ex::is_class_v == std::is_class::value, ""); + } + { + typedef void(T)(); + static_assert(ex::is_function_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_function_v == std::is_function::value, ""); + } + { + typedef int T; + static_assert(!ex::is_function_v, ""); + static_assert(ex::is_function_v == std::is_function::value, ""); + } +} +#else /* _LIBCPP_STD_VER <= 11 */ +int main() {} +#endif /* _LIBCPP_STD_VER > 11 */ diff --git a/libcxx/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.comp.pass.cpp b/libcxx/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.comp.pass.cpp new file mode 100644 index 00000000000..814f450f4e0 --- /dev/null +++ b/libcxx/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.comp.pass.cpp @@ -0,0 +1,102 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +#include + +#if _LIBCPP_STD_VER > 11 + +namespace ex = std::experimental; + +struct class_type {}; + +int main() +{ + { + typedef int & T; + static_assert(ex::is_reference_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_reference_v == std::is_reference::value, ""); + } + { + typedef int T; + static_assert(!ex::is_reference_v, ""); + static_assert(ex::is_reference_v == std::is_reference::value, ""); + } + { + typedef int T; + static_assert(ex::is_arithmetic_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_arithmetic_v == std::is_arithmetic::value, ""); + } + { + typedef void* T; + static_assert(!ex::is_arithmetic_v, ""); + static_assert(ex::is_arithmetic_v == std::is_arithmetic::value, ""); + } + { + typedef int T; + static_assert(ex::is_fundamental_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_fundamental_v == std::is_fundamental::value, ""); + } + { + typedef class_type T; + static_assert(!ex::is_fundamental_v, ""); + static_assert(ex::is_fundamental_v == std::is_fundamental::value, ""); + } + { + typedef class_type T; + static_assert(ex::is_object_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_object_v == std::is_object::value, ""); + } + { + typedef void T; + static_assert(!ex::is_object_v, ""); + static_assert(ex::is_object_v == std::is_object::value, ""); + } + { + typedef int T; + static_assert(ex::is_scalar_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_scalar_v == std::is_scalar::value, ""); + } + { + typedef void T; + static_assert(!ex::is_scalar_v, ""); + static_assert(ex::is_scalar_v == std::is_scalar::value, ""); + } + { + typedef void* T; + static_assert(ex::is_compound_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_compound_v == std::is_compound::value, ""); + } + { + typedef void T; + static_assert(!ex::is_compound_v, ""); + static_assert(ex::is_compound_v == std::is_compound::value, ""); + } + { + typedef int class_type::*T; + static_assert(ex::is_member_pointer_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_member_pointer_v == std::is_member_pointer::value, ""); + } + { + typedef int T; + static_assert(!ex::is_member_pointer_v, ""); + static_assert(ex::is_member_pointer_v == std::is_member_pointer::value, ""); + } +} +#else /* _LIBCPP_STD_VER <= 11 */ +int main() {} +#endif /* _LIBCPP_STD_VER > 11 */ diff --git a/libcxx/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.pass.cpp b/libcxx/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.pass.cpp new file mode 100644 index 00000000000..41cb27fced3 --- /dev/null +++ b/libcxx/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.pass.cpp @@ -0,0 +1,489 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +#include + +#if _LIBCPP_STD_VER > 11 + +namespace ex = std::experimental; + +struct non_literal_type { non_literal_type() {} }; +struct empty_type {}; + +struct polymorphic_type +{ + virtual void foo() {} +}; + +struct abstract_type +{ + virtual void foo() = 0; +}; + +struct final_type final {}; + +struct virtual_dtor_type +{ + virtual ~virtual_dtor_type() {} +}; + +void type_properties_test() +{ + { + typedef const int T; + static_assert(ex::is_const_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_const_v == std::is_const::value, ""); + } + { + typedef int T; + static_assert(!ex::is_const_v, ""); + static_assert(ex::is_const_v == std::is_const::value, ""); + } + { + typedef volatile int T; + static_assert(ex::is_volatile_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_volatile_v == std::is_volatile::value, ""); + } + { + typedef int T; + static_assert(!ex::is_volatile_v, ""); + static_assert(ex::is_volatile_v == std::is_volatile::value, ""); + } + { + typedef int T; + static_assert(ex::is_trivial_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_trivial_v == std::is_trivial::value, ""); + } + { + typedef int & T; + static_assert(!ex::is_trivial_v, ""); + static_assert(ex::is_trivial_v == std::is_trivial::value, ""); + } + { + typedef int T; + static_assert(ex::is_trivially_copyable_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_trivially_copyable_v == std::is_trivially_copyable::value, ""); + } + { + typedef int & T; + static_assert(!ex::is_trivially_copyable_v, ""); + static_assert(ex::is_trivially_copyable_v == std::is_trivially_copyable::value, ""); + } + { + typedef int T; + static_assert(ex::is_standard_layout_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_standard_layout_v == std::is_standard_layout::value, ""); + } + { + typedef int & T; + static_assert(!ex::is_standard_layout_v, ""); + static_assert(ex::is_standard_layout_v == std::is_standard_layout::value, ""); + } + { + typedef int T; + static_assert(ex::is_pod_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_pod_v == std::is_pod::value, ""); + } + { + typedef int & T; + static_assert(!ex::is_pod_v, ""); + static_assert(ex::is_pod_v == std::is_pod::value, ""); + } + { + typedef int T; + static_assert(ex::is_literal_type_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_literal_type_v == std::is_literal_type::value, ""); + } + { + typedef non_literal_type T; + static_assert(!ex::is_literal_type_v, ""); + static_assert(ex::is_literal_type_v == std::is_literal_type::value, ""); + } + { + typedef empty_type T; + static_assert(ex::is_empty_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_empty_v == std::is_empty::value, ""); + } + { + typedef int T; + static_assert(!ex::is_empty_v, ""); + static_assert(ex::is_empty_v == std::is_empty::value, ""); + } + { + typedef polymorphic_type T; + static_assert(ex::is_polymorphic_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_polymorphic_v == std::is_polymorphic::value, ""); + } + { + typedef int T; + static_assert(!ex::is_polymorphic_v, ""); + static_assert(ex::is_polymorphic_v == std::is_polymorphic::value, ""); + } + { + typedef abstract_type T; + static_assert(ex::is_abstract_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_abstract_v == std::is_abstract::value, ""); + } + { + typedef int T; + static_assert(!ex::is_abstract_v, ""); + static_assert(ex::is_abstract_v == std::is_abstract::value, ""); + } + { + typedef final_type T; + static_assert(ex::is_final_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_final_v == std::is_final::value, ""); + } + { + typedef int T; + static_assert(!ex::is_final_v, ""); + static_assert(ex::is_final_v == std::is_final::value, ""); + } + { + typedef int T; + static_assert(ex::is_signed_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_signed_v == std::is_signed::value, ""); + } + { + typedef unsigned T; + static_assert(!ex::is_signed_v, ""); + static_assert(ex::is_signed_v == std::is_signed::value, ""); + } + { + typedef unsigned T; + static_assert(ex::is_unsigned_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_unsigned_v == std::is_unsigned::value, ""); + } + { + typedef int T; + static_assert(!ex::is_unsigned_v, ""); + static_assert(ex::is_unsigned_v == std::is_unsigned::value, ""); + } +} + +void is_constructible_and_assignable_test() +{ + { + typedef int T; + static_assert(ex::is_constructible_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_constructible_v == std::is_constructible::value, ""); + } + { + typedef void T; + static_assert(!ex::is_constructible_v, ""); + static_assert(ex::is_constructible_v == std::is_constructible::value, ""); + } + { + typedef int T; + static_assert(ex::is_default_constructible_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_default_constructible_v == std::is_default_constructible::value, ""); + } + { + typedef int & T; + static_assert(!ex::is_default_constructible_v, ""); + static_assert(ex::is_default_constructible_v == std::is_default_constructible::value, ""); + } + { + typedef int T; + static_assert(ex::is_copy_constructible_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_copy_constructible_v == std::is_copy_constructible::value, ""); + } + { + typedef void T; + static_assert(!ex::is_copy_constructible_v, ""); + static_assert(ex::is_copy_constructible_v == std::is_copy_constructible::value, ""); + } + { + typedef int T; + static_assert(ex::is_move_constructible_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_move_constructible_v == std::is_move_constructible::value, ""); + } + { + typedef void T; + static_assert(!ex::is_move_constructible_v, ""); + static_assert(ex::is_move_constructible_v == std::is_move_constructible::value, ""); + } + { + typedef int & T; + typedef int U; + static_assert(ex::is_assignable_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_assignable_v == std::is_assignable::value, ""); + } + { + typedef int & T; + typedef void U; + static_assert(!ex::is_assignable_v, ""); + static_assert(ex::is_assignable_v == std::is_assignable::value, ""); + } + { + typedef int T; + static_assert(ex::is_copy_assignable_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_copy_assignable_v == std::is_copy_assignable::value, ""); + } + { + typedef void T; + static_assert(!ex::is_copy_assignable_v, ""); + static_assert(ex::is_copy_assignable_v == std::is_copy_assignable::value, ""); + } + { + typedef int T; + static_assert(ex::is_move_assignable_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_move_assignable_v == std::is_move_assignable::value, ""); + } + { + typedef void T; + static_assert(!ex::is_move_assignable_v, ""); + static_assert(ex::is_move_assignable_v == std::is_move_assignable::value, ""); + } + { + typedef int T; + static_assert(ex::is_destructible_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_destructible_v == std::is_destructible::value, ""); + } + { + typedef void T; + static_assert(!ex::is_destructible_v, ""); + static_assert(ex::is_destructible_v == std::is_destructible::value, ""); + } +} + +void is_trivially_constructible_and_assignable_test() +{ + { + typedef int T; + static_assert(ex::is_trivially_constructible_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_trivially_constructible_v == std::is_constructible::value, ""); + } + { + typedef void T; + static_assert(!ex::is_trivially_constructible_v, ""); + static_assert(ex::is_trivially_constructible_v == std::is_constructible::value, ""); + } + { + typedef int T; + static_assert(ex::is_trivially_default_constructible_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_trivially_default_constructible_v == std::is_default_constructible::value, ""); + } + { + typedef int & T; + static_assert(!ex::is_trivially_default_constructible_v, ""); + static_assert(ex::is_trivially_default_constructible_v == std::is_default_constructible::value, ""); + } + { + typedef int T; + static_assert(ex::is_trivially_copy_constructible_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_trivially_copy_constructible_v == std::is_copy_constructible::value, ""); + } + { + typedef void T; + static_assert(!ex::is_trivially_copy_constructible_v, ""); + static_assert(ex::is_trivially_copy_constructible_v == std::is_copy_constructible::value, ""); + } + { + typedef int T; + static_assert(ex::is_trivially_move_constructible_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_trivially_move_constructible_v == std::is_move_constructible::value, ""); + } + { + typedef void T; + static_assert(!ex::is_trivially_move_constructible_v, ""); + static_assert(ex::is_trivially_move_constructible_v == std::is_move_constructible::value, ""); + } + { + typedef int & T; + typedef int U; + static_assert(ex::is_trivially_assignable_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_trivially_assignable_v == std::is_assignable::value, ""); + } + { + typedef int & T; + typedef void U; + static_assert(!ex::is_trivially_assignable_v, ""); + static_assert(ex::is_trivially_assignable_v == std::is_assignable::value, ""); + } + { + typedef int T; + static_assert(ex::is_trivially_copy_assignable_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_trivially_copy_assignable_v == std::is_copy_assignable::value, ""); + } + { + typedef void T; + static_assert(!ex::is_trivially_copy_assignable_v, ""); + static_assert(ex::is_trivially_copy_assignable_v == std::is_copy_assignable::value, ""); + } + { + typedef int T; + static_assert(ex::is_trivially_move_assignable_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_trivially_move_assignable_v == std::is_move_assignable::value, ""); + } + { + typedef void T; + static_assert(!ex::is_trivially_move_assignable_v, ""); + static_assert(ex::is_trivially_move_assignable_v == std::is_move_assignable::value, ""); + } + { + typedef int T; + static_assert(ex::is_trivially_destructible_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_trivially_destructible_v == std::is_destructible::value, ""); + } + { + typedef void T; + static_assert(!ex::is_trivially_destructible_v, ""); + static_assert(ex::is_trivially_destructible_v == std::is_destructible::value, ""); + } +} + + + +void is_nothrow_constructible_and_assignable_test() +{ + { + typedef int T; + static_assert(ex::is_nothrow_constructible_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_nothrow_constructible_v == std::is_constructible::value, ""); + } + { + typedef void T; + static_assert(!ex::is_nothrow_constructible_v, ""); + static_assert(ex::is_nothrow_constructible_v == std::is_constructible::value, ""); + } + { + typedef int T; + static_assert(ex::is_nothrow_default_constructible_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_nothrow_default_constructible_v == std::is_default_constructible::value, ""); + } + { + typedef int & T; + static_assert(!ex::is_nothrow_default_constructible_v, ""); + static_assert(ex::is_nothrow_default_constructible_v == std::is_default_constructible::value, ""); + } + { + typedef int T; + static_assert(ex::is_nothrow_copy_constructible_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_nothrow_copy_constructible_v == std::is_copy_constructible::value, ""); + } + { + typedef void T; + static_assert(!ex::is_nothrow_copy_constructible_v, ""); + static_assert(ex::is_nothrow_copy_constructible_v == std::is_copy_constructible::value, ""); + } + { + typedef int T; + static_assert(ex::is_nothrow_move_constructible_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_nothrow_move_constructible_v == std::is_move_constructible::value, ""); + } + { + typedef void T; + static_assert(!ex::is_nothrow_move_constructible_v, ""); + static_assert(ex::is_nothrow_move_constructible_v == std::is_move_constructible::value, ""); + } + { + typedef int & T; + typedef int U; + static_assert(ex::is_nothrow_assignable_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_nothrow_assignable_v == std::is_assignable::value, ""); + } + { + typedef int & T; + typedef void U; + static_assert(!ex::is_nothrow_assignable_v, ""); + static_assert(ex::is_nothrow_assignable_v == std::is_assignable::value, ""); + } + { + typedef int T; + static_assert(ex::is_nothrow_copy_assignable_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_nothrow_copy_assignable_v == std::is_copy_assignable::value, ""); + } + { + typedef void T; + static_assert(!ex::is_nothrow_copy_assignable_v, ""); + static_assert(ex::is_nothrow_copy_assignable_v == std::is_copy_assignable::value, ""); + } + { + typedef int T; + static_assert(ex::is_nothrow_move_assignable_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_nothrow_move_assignable_v == std::is_move_assignable::value, ""); + } + { + typedef void T; + static_assert(!ex::is_nothrow_move_assignable_v, ""); + static_assert(ex::is_nothrow_move_assignable_v == std::is_move_assignable::value, ""); + } + { + typedef int T; + static_assert(ex::is_nothrow_destructible_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::is_nothrow_destructible_v == std::is_destructible::value, ""); + } + { + typedef void T; + static_assert(!ex::is_nothrow_destructible_v, ""); + static_assert(ex::is_nothrow_destructible_v == std::is_destructible::value, ""); + } +} + +int main() +{ + type_properties_test(); + is_constructible_and_assignable_test(); + is_trivially_constructible_and_assignable_test(); + is_nothrow_constructible_and_assignable_test(); + { + typedef virtual_dtor_type T; + static_assert(ex::has_virtual_destructor_v, ""); + static_assert(std::is_same), const bool>::value, ""); + static_assert(ex::has_virtual_destructor_v == std::has_virtual_destructor::value, ""); + } + { + typedef int T; + static_assert(!ex::has_virtual_destructor_v, ""); + static_assert(ex::has_virtual_destructor_v == std::has_virtual_destructor::value, ""); + } +} +#else /* _LIBCPP_STD_VER <= 11 */ +int main() {} +#endif /* _LIBCPP_STD_VER > 11 */ diff --git a/libcxx/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.query.pass.cpp b/libcxx/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.query.pass.cpp new file mode 100644 index 00000000000..aedd369e5ac --- /dev/null +++ b/libcxx/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.query.pass.cpp @@ -0,0 +1,66 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +#include + +#if _LIBCPP_STD_VER > 11 + +namespace ex = std::experimental; + +int main() +{ + { + typedef char T; + static_assert(ex::alignment_of_v == 1, ""); + static_assert(std::is_same), const std::size_t>::value, ""); + static_assert(ex::alignment_of_v == std::alignment_of::value, ""); + } + { + typedef char(T)[1][1][1]; + static_assert(ex::rank_v == 3, ""); + static_assert(std::is_same), const std::size_t>::value, ""); + static_assert(ex::rank_v == std::rank::value, ""); + } + { + typedef void T; + static_assert(ex::rank_v == 0, ""); + static_assert(ex::rank_v == std::rank::value, ""); + } + { + typedef char(T)[2][3][4]; + static_assert(ex::extent_v == 2, ""); + static_assert(std::is_same), const std::size_t>::value, ""); + static_assert(ex::extent_v == std::extent::value, ""); + } + { + typedef char(T)[2][3][4]; + static_assert(ex::extent_v == 2, ""); + static_assert(ex::extent_v == std::extent::value, ""); + } + { + typedef char(T)[2][3][4]; + static_assert(ex::extent_v == 3, ""); + static_assert(ex::extent_v == std::extent::value, ""); + } + { + typedef char(T)[2][3][4]; + static_assert(ex::extent_v == 0, ""); + static_assert(ex::extent_v == std::extent::value, ""); + } + { + typedef void T; + static_assert(ex::extent_v == 0, ""); + static_assert(ex::extent_v == std::extent::value, ""); + } +} +#else /* _LIBCPP_STD_VER <= 11 */ +int main() {} +#endif /* _LIBCPP_STD_VER > 11 */ diff --git a/libcxx/test/std/experimental/utilities/meta/version.pass.cpp b/libcxx/test/std/experimental/utilities/meta/version.pass.cpp new file mode 100644 index 00000000000..593fb52a4c3 --- /dev/null +++ b/libcxx/test/std/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. +// +//===----------------------------------------------------------------------===// + +// + +#include + +#ifndef _LIBCPP_VERSION +#error _LIBCPP_VERSION not defined +#endif + +int main() +{ +} diff --git a/libcxx/test/std/experimental/utilities/nothing_to_do.pass.cpp b/libcxx/test/std/experimental/utilities/nothing_to_do.pass.cpp new file mode 100644 index 00000000000..9a59227abdd --- /dev/null +++ b/libcxx/test/std/experimental/utilities/nothing_to_do.pass.cpp @@ -0,0 +1,13 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +int main() +{ +} diff --git a/libcxx/test/std/experimental/utilities/utility/utility.erased.type/erased_type.pass.cpp b/libcxx/test/std/experimental/utilities/utility/utility.erased.type/erased_type.pass.cpp new file mode 100644 index 00000000000..3e38d5ec503 --- /dev/null +++ b/libcxx/test/std/experimental/utilities/utility/utility.erased.type/erased_type.pass.cpp @@ -0,0 +1,17 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +#include + +int main() +{ + std::experimental::erased_type e(); +} diff --git a/libcxx/test/std/experimental/utilities/utility/utility.synop/includes.pass.cpp b/libcxx/test/std/experimental/utilities/utility/utility.synop/includes.pass.cpp new file mode 100644 index 00000000000..2583d434540 --- /dev/null +++ b/libcxx/test/std/experimental/utilities/utility/utility.synop/includes.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. +// +//===----------------------------------------------------------------------===// + +// + +#include + +#ifndef _LIBCPP_UTILITY +# error " must include " +#endif + +int main() +{ +} diff --git a/libcxx/test/std/experimental/utilities/utility/version.pass.cpp b/libcxx/test/std/experimental/utilities/utility/version.pass.cpp new file mode 100644 index 00000000000..437712454ae --- /dev/null +++ b/libcxx/test/std/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. +// +//===----------------------------------------------------------------------===// + +// + +#include + +#ifndef _LIBCPP_VERSION +#error _LIBCPP_VERSION not defined +#endif + +int main() +{ +} -- cgit v1.2.3