diff options
Diffstat (limited to 'libcxx/test/std/input.output/filesystems/fs.enum')
7 files changed, 0 insertions, 386 deletions
diff --git a/libcxx/test/std/input.output/filesystems/fs.enum/check_bitmask_types.hpp b/libcxx/test/std/input.output/filesystems/fs.enum/check_bitmask_types.hpp deleted file mode 100644 index 77b136f3fca..00000000000 --- a/libcxx/test/std/input.output/filesystems/fs.enum/check_bitmask_types.hpp +++ /dev/null @@ -1,75 +0,0 @@ -#ifndef TEST_BITMASK_TYPE_HPP -#define TEST_BITMASK_TYPE_HPP - -#include <type_traits> -#include <cassert> - -#include "test_macros.h" - - -template <class EnumType, EnumType Val1, EnumType Val2, - class UT = typename std::underlying_type<EnumType>::type, - UT UVal1 = static_cast<UT>(Val1), - UT UVal2 = static_cast<UT>(Val2), - UT UZero = static_cast<UT>(0), - EnumType Zero = static_cast<EnumType>(0) - > -struct check_bitmask_type { - - static constexpr UT dcast(EnumType e) { return static_cast<UT>(e); } - static constexpr UT unpromote(decltype((~UZero)) promoted) { return static_cast<UT>(promoted); } - // We need two values that are non-zero and share at least one bit. - static_assert(Val1 != Zero && Val2 != Zero, ""); - static_assert(Val1 != Val2, ""); - static_assert((UVal1 & UVal2) == 0, ""); - - - static bool check() - { - { - EnumType ValRef = Val1; - ASSERT_SAME_TYPE(EnumType, decltype(Val1 & Val2)); - ASSERT_SAME_TYPE(EnumType, decltype(Val1 | Val2)); - ASSERT_SAME_TYPE(EnumType, decltype(Val1 ^ Val2)); - ASSERT_SAME_TYPE(EnumType, decltype((~Val1))); - ASSERT_SAME_TYPE(EnumType&, decltype(ValRef &= Val2)); - ASSERT_SAME_TYPE(EnumType&, decltype(ValRef |= Val2)); - ASSERT_SAME_TYPE(EnumType&, decltype(ValRef ^= Val2)); - } - - static_assert((Val1 & Zero) == Zero, ""); - static_assert((Val1 & Val1) == Val1, ""); - static_assert(dcast(Val1 & Val2) == (UVal1 & UVal2), ""); - - static_assert((Val1 | Zero) == Val1, ""); - static_assert(dcast(Val1 | Val2) == (UVal1 | UVal2), ""); - - static_assert((Val1 ^ Zero) == Val1, ""); - static_assert(dcast(Val1 ^ Val2) == (UVal1 ^ UVal2), ""); - - static_assert(dcast(~Zero) == unpromote(~UZero), ""); - static_assert(dcast(~Val1) == unpromote(~UVal1), ""); - - { - EnumType e = Val1; - EnumType& eref = (e &= Val2); - assert(&eref == &e); - assert(dcast(eref) == (UVal1 & UVal2)); - } - { - EnumType e = Val1; - EnumType& eref = (e |= Val2); - assert(&eref == &e); - assert(dcast(eref) == (UVal1 | UVal2)); - } - { - EnumType e = Val1; - EnumType& eref = (e ^= Val2); - assert(&eref == &e); - assert(dcast(eref) == (UVal1 ^ UVal2)); - } - return true; - } -}; - -#endif // TEST_BITMASK_TYPE diff --git a/libcxx/test/std/input.output/filesystems/fs.enum/enum.copy_options.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.enum/enum.copy_options.pass.cpp deleted file mode 100644 index b949960df11..00000000000 --- a/libcxx/test/std/input.output/filesystems/fs.enum/enum.copy_options.pass.cpp +++ /dev/null @@ -1,64 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03 - -// <filesystem> - -// enum class copy_options; - -#include "filesystem_include.hpp" -#include <type_traits> -#include <cassert> - -#include "check_bitmask_types.hpp" -#include "test_macros.h" - - -constexpr fs::copy_options ME(int val) { return static_cast<fs::copy_options>(val); } - -int main(int, char**) { - typedef fs::copy_options E; - static_assert(std::is_enum<E>::value, ""); - - // Check that E is a scoped enum by checking for conversions. - typedef std::underlying_type<E>::type UT; - static_assert(!std::is_convertible<E, UT>::value, ""); - - static_assert(std::is_same<UT, unsigned short>::value, ""); // Implementation detail - - typedef check_bitmask_type<E, E::skip_existing, E::update_existing> BitmaskTester; - assert(BitmaskTester::check()); - - static_assert( - E::none == ME(0), - "Expected enumeration values do not match"); - // Option group for copy_file - static_assert( - E::skip_existing == ME(1) && - E::overwrite_existing == ME(2) && - E::update_existing == ME(4), - "Expected enumeration values do not match"); - // Option group for copy on directories - static_assert( - E::recursive == ME(8), - "Expected enumeration values do not match"); - // Option group for copy on symlinks - static_assert( - E::copy_symlinks == ME(16) && - E::skip_symlinks == ME(32), - "Expected enumeration values do not match"); - // Option group for changing form of copy - static_assert( - E::directories_only == ME(64) && - E::create_symlinks == ME(128) && - E::create_hard_links == ME(256), - "Expected enumeration values do not match"); - - return 0; -} diff --git a/libcxx/test/std/input.output/filesystems/fs.enum/enum.directory_options.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.enum/enum.directory_options.pass.cpp deleted file mode 100644 index 43b0945978e..00000000000 --- a/libcxx/test/std/input.output/filesystems/fs.enum/enum.directory_options.pass.cpp +++ /dev/null @@ -1,46 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03 - -// <filesystem> - -// enum class directory_options; - -#include "filesystem_include.hpp" -#include <type_traits> -#include <cassert> -#include <sys/stat.h> - -#include "test_macros.h" -#include "check_bitmask_types.hpp" - - -constexpr fs::directory_options ME(int val) { return static_cast<fs::directory_options>(val); } - -int main(int, char**) { - typedef fs::directory_options E; - static_assert(std::is_enum<E>::value, ""); - - // Check that E is a scoped enum by checking for conversions. - typedef std::underlying_type<E>::type UT; - static_assert(!std::is_convertible<E, UT>::value, ""); - static_assert(std::is_same<UT, unsigned char>::value, ""); - - typedef check_bitmask_type<E, E::follow_directory_symlink, E::skip_permission_denied> BitmaskTester; - assert(BitmaskTester::check()); - - static_assert( - E::none == ME(0) && - E::follow_directory_symlink == ME(1) && - E::skip_permission_denied == ME(2), - "Expected enumeration values do not match"); - - - return 0; -} diff --git a/libcxx/test/std/input.output/filesystems/fs.enum/enum.file_type.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.enum/enum.file_type.pass.cpp deleted file mode 100644 index c1f16079a5d..00000000000 --- a/libcxx/test/std/input.output/filesystems/fs.enum/enum.file_type.pass.cpp +++ /dev/null @@ -1,48 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03 - -// <filesystem> - -// enum class file_type; - -#include "filesystem_include.hpp" -#include <type_traits> -#include <cassert> - -#include "test_macros.h" - - -constexpr fs::file_type ME(int val) { return static_cast<fs::file_type>(val); } - -int main(int, char**) { - typedef fs::file_type E; - static_assert(std::is_enum<E>::value, ""); - - // Check that E is a scoped enum by checking for conversions. - typedef std::underlying_type<E>::type UT; - static_assert(!std::is_convertible<E, UT>::value, ""); - - static_assert(std::is_same<UT, signed char>::value, ""); // Implementation detail - - static_assert( - E::none == ME(0) && - E::not_found == ME(-1) && - E::regular == ME(1) && - E::directory == ME(2) && - E::symlink == ME(3) && - E::block == ME(4) && - E::character == ME(5) && - E::fifo == ME(6) && - E::socket == ME(7) && - E::unknown == ME(8), - "Expected enumeration values do not match"); - - return 0; -} diff --git a/libcxx/test/std/input.output/filesystems/fs.enum/enum.path.format.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.enum/enum.path.format.pass.cpp deleted file mode 100644 index d60225d4ff6..00000000000 --- a/libcxx/test/std/input.output/filesystems/fs.enum/enum.path.format.pass.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03 - -// <filesystem> - -// class path; -// enum class format; - -#include "filesystem_include.hpp" -#include <type_traits> -#include <cassert> - -#include "test_macros.h" - -int main(int, char**) { - typedef fs::path::format E; - static_assert(std::is_enum<E>::value, ""); - - // Check that E is a scoped enum by checking for conversions. - typedef std::underlying_type<E>::type UT; - static_assert(!std::is_convertible<E, UT>::value, ""); - - LIBCPP_ONLY(static_assert(std::is_same<UT, unsigned char>::value, "")); // Implementation detail - - static_assert( - E::auto_format != E::native_format && - E::auto_format != E::generic_format && - E::native_format != E::generic_format, - "Expected enumeration values are not unique"); - - return 0; -} diff --git a/libcxx/test/std/input.output/filesystems/fs.enum/enum.perm_options.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.enum/enum.perm_options.pass.cpp deleted file mode 100644 index 1fd353d041f..00000000000 --- a/libcxx/test/std/input.output/filesystems/fs.enum/enum.perm_options.pass.cpp +++ /dev/null @@ -1,49 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03 - -// <filesystem> - -// enum class perm_options; - -#include "filesystem_include.hpp" -#include <type_traits> -#include <cassert> -#include <sys/stat.h> - -#include "test_macros.h" -#include "check_bitmask_types.hpp" - - -constexpr fs::perm_options ME(int val) { - return static_cast<fs::perm_options>(val); -} - -int main(int, char**) { - typedef fs::perm_options E; - static_assert(std::is_enum<E>::value, ""); - - // Check that E is a scoped enum by checking for conversions. - typedef std::underlying_type<E>::type UT; - static_assert(!std::is_convertible<E, UT>::value, ""); - - static_assert(std::is_same<UT, unsigned char >::value, ""); // Implementation detail - - typedef check_bitmask_type<E, E::replace, E::nofollow> BitmaskTester; - assert(BitmaskTester::check()); - - static_assert( - E::replace == ME(1) && - E::add == ME(2) && - E::remove == ME(4) && - E::nofollow == ME(8), - "Expected enumeration values do not match"); - - return 0; -} diff --git a/libcxx/test/std/input.output/filesystems/fs.enum/enum.perms.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.enum/enum.perms.pass.cpp deleted file mode 100644 index 93b5278fdd4..00000000000 --- a/libcxx/test/std/input.output/filesystems/fs.enum/enum.perms.pass.cpp +++ /dev/null @@ -1,65 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03 - -// <filesystem> - -// enum class perms; - -#include "filesystem_include.hpp" -#include <type_traits> -#include <cassert> -#include <sys/stat.h> - -#include "test_macros.h" -#include "check_bitmask_types.hpp" - - -constexpr fs::perms ME(int val) { return static_cast<fs::perms>(val); } - -int main(int, char**) { - typedef fs::perms E; - static_assert(std::is_enum<E>::value, ""); - - // Check that E is a scoped enum by checking for conversions. - typedef std::underlying_type<E>::type UT; - static_assert(!std::is_convertible<E, UT>::value, ""); - - static_assert(std::is_same<UT, unsigned >::value, ""); // Implementation detail - - typedef check_bitmask_type<E, E::group_all, E::owner_all> BitmaskTester; - assert(BitmaskTester::check()); - - static_assert( - E::none == ME(0) && - - E::owner_read == ME(0400) && - E::owner_write == ME(0200) && - E::owner_exec == ME(0100) && - E::owner_all == ME(0700) && - - E::group_read == ME(040) && - E::group_write == ME(020) && - E::group_exec == ME(010) && - E::group_all == ME(070) && - - E::others_read == ME(04) && - E::others_write == ME(02) && - E::others_exec == ME(01) && - E::others_all == ME(07) && - E::all == ME(0777) && - E::set_uid == ME(04000) && - E::set_gid == ME(02000) && - E::sticky_bit == ME(01000) && - E::mask == ME(07777) && - E::unknown == ME(0xFFFF), - "Expected enumeration values do not match"); - - return 0; -} |