diff options
Diffstat (limited to 'libcxx/test/utilities/function.objects/bitwise.operations')
5 files changed, 0 insertions, 268 deletions
diff --git a/libcxx/test/utilities/function.objects/bitwise.operations/bit_and.pass.cpp b/libcxx/test/utilities/function.objects/bitwise.operations/bit_and.pass.cpp deleted file mode 100644 index 66544781d9d..00000000000 --- a/libcxx/test/utilities/function.objects/bitwise.operations/bit_and.pass.cpp +++ /dev/null @@ -1,57 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// <functional> - -// bit_and - -#include <functional> -#include <type_traits> -#include <cassert> - -int main() -{ - typedef std::bit_and<int> F; - const F f = F(); - static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), ""); - assert(f(0xEA95, 0xEA95) == 0xEA95); - assert(f(0xEA95, 0x58D3) == 0x4891); - assert(f(0x58D3, 0xEA95) == 0x4891); - assert(f(0x58D3, 0) == 0); - assert(f(0xFFFF, 0x58D3) == 0x58D3); -#if _LIBCPP_STD_VER > 11 - typedef std::bit_and<> F2; - const F2 f2 = F2(); - assert(f2(0xEA95, 0xEA95) == 0xEA95); - assert(f2(0xEA95L, 0xEA95) == 0xEA95); - assert(f2(0xEA95, 0xEA95L) == 0xEA95); - - assert(f2(0xEA95, 0x58D3) == 0x4891); - assert(f2(0xEA95L, 0x58D3) == 0x4891); - assert(f2(0xEA95, 0x58D3L) == 0x4891); - - assert(f2(0x58D3, 0xEA95) == 0x4891); - assert(f2(0x58D3L, 0xEA95) == 0x4891); - assert(f2(0x58D3, 0xEA95L) == 0x4891); - - assert(f2(0x58D3, 0) == 0); - assert(f2(0x58D3L, 0) == 0); - assert(f2(0x58D3, 0L) == 0); - - assert(f2(0xFFFF, 0x58D3) == 0x58D3); - assert(f2(0xFFFFL, 0x58D3) == 0x58D3); - assert(f2(0xFFFF, 0x58D3L) == 0x58D3); - - constexpr int foo = std::bit_and<int> () (0x58D3, 0xEA95); - static_assert ( foo == 0x4891, "" ); - - constexpr int bar = std::bit_and<> () (0x58D3L, 0xEA95); - static_assert ( bar == 0x4891, "" ); -#endif -} diff --git a/libcxx/test/utilities/function.objects/bitwise.operations/bit_not.pass.cpp b/libcxx/test/utilities/function.objects/bitwise.operations/bit_not.pass.cpp deleted file mode 100644 index 82efcbc29fa..00000000000 --- a/libcxx/test/utilities/function.objects/bitwise.operations/bit_not.pass.cpp +++ /dev/null @@ -1,46 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// <functional> - -// bit_not - -#include <functional> -#include <type_traits> -#include <cassert> - -int main() -{ -#if _LIBCPP_STD_VER > 11 - typedef std::bit_not<int> F; - const F f = F(); - static_assert((std::is_base_of<std::unary_function<int, int>, F>::value), ""); - assert((f(0xEA95) & 0xFFFF ) == 0x156A); - assert((f(0x58D3) & 0xFFFF ) == 0xA72C); - assert((f(0) & 0xFFFF ) == 0xFFFF); - assert((f(0xFFFF) & 0xFFFF ) == 0); - - typedef std::bit_not<> F2; - const F2 f2 = F2(); - assert((f2(0xEA95) & 0xFFFF ) == 0x156A); - assert((f2(0xEA95L) & 0xFFFF ) == 0x156A); - assert((f2(0x58D3) & 0xFFFF ) == 0xA72C); - assert((f2(0x58D3L) & 0xFFFF ) == 0xA72C); - assert((f2(0) & 0xFFFF ) == 0xFFFF); - assert((f2(0L) & 0xFFFF ) == 0xFFFF); - assert((f2(0xFFFF) & 0xFFFF ) == 0); - assert((f2(0xFFFFL) & 0xFFFF ) == 0); - - constexpr int foo = std::bit_not<int> () (0xEA95) & 0xFFFF; - static_assert ( foo == 0x156A, "" ); - - constexpr int bar = std::bit_not<> () (0xEA95) & 0xFFFF; - static_assert ( bar == 0x156A, "" ); -#endif -} diff --git a/libcxx/test/utilities/function.objects/bitwise.operations/bit_or.pass.cpp b/libcxx/test/utilities/function.objects/bitwise.operations/bit_or.pass.cpp deleted file mode 100644 index 6ae3c3ac978..00000000000 --- a/libcxx/test/utilities/function.objects/bitwise.operations/bit_or.pass.cpp +++ /dev/null @@ -1,57 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// <functional> - -// bit_or - -#include <functional> -#include <type_traits> -#include <cassert> - -int main() -{ - typedef std::bit_or<int> F; - const F f = F(); - static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), ""); - assert(f(0xEA95, 0xEA95) == 0xEA95); - assert(f(0xEA95, 0x58D3) == 0xFAD7); - assert(f(0x58D3, 0xEA95) == 0xFAD7); - assert(f(0x58D3, 0) == 0x58D3); - assert(f(0xFFFF, 0x58D3) == 0xFFFF); -#if _LIBCPP_STD_VER > 11 - typedef std::bit_or<> F2; - const F2 f2 = F2(); - assert(f2(0xEA95, 0xEA95) == 0xEA95); - assert(f2(0xEA95L, 0xEA95) == 0xEA95); - assert(f2(0xEA95, 0xEA95L) == 0xEA95); - - assert(f2(0xEA95, 0x58D3) == 0xFAD7); - assert(f2(0xEA95L, 0x58D3) == 0xFAD7); - assert(f2(0xEA95, 0x58D3L) == 0xFAD7); - - assert(f2(0x58D3, 0xEA95) == 0xFAD7); - assert(f2(0x58D3L, 0xEA95) == 0xFAD7); - assert(f2(0x58D3, 0xEA95L) == 0xFAD7); - - assert(f2(0x58D3, 0) == 0x58D3); - assert(f2(0x58D3L, 0) == 0x58D3); - assert(f2(0x58D3, 0L) == 0x58D3); - - assert(f2(0xFFFF, 0x58D3) == 0xFFFF); - assert(f2(0xFFFFL, 0x58D3) == 0xFFFF); - assert(f2(0xFFFF, 0x58D3L) == 0xFFFF); - - constexpr int foo = std::bit_or<int> () (0x58D3, 0xEA95); - static_assert ( foo == 0xFAD7, "" ); - - constexpr int bar = std::bit_or<> () (0x58D3L, 0xEA95); - static_assert ( bar == 0xFAD7, "" ); -#endif -} diff --git a/libcxx/test/utilities/function.objects/bitwise.operations/bit_xor.pass.cpp b/libcxx/test/utilities/function.objects/bitwise.operations/bit_xor.pass.cpp deleted file mode 100644 index e7bb5e49f94..00000000000 --- a/libcxx/test/utilities/function.objects/bitwise.operations/bit_xor.pass.cpp +++ /dev/null @@ -1,57 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// <functional> - -// bit_xor - -#include <functional> -#include <type_traits> -#include <cassert> - -int main() -{ - typedef std::bit_xor<int> F; - const F f = F(); - static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), ""); - assert(f(0xEA95, 0xEA95) == 0); - assert(f(0xEA95, 0x58D3) == 0xB246); - assert(f(0x58D3, 0xEA95) == 0xB246); - assert(f(0x58D3, 0) == 0x58D3); - assert(f(0xFFFF, 0x58D3) == 0xA72C); -#if _LIBCPP_STD_VER > 11 - typedef std::bit_xor<> F2; - const F2 f2 = F2(); - assert(f(0xEA95, 0xEA95) == 0); - assert(f(0xEA95L, 0xEA95) == 0); - assert(f(0xEA95, 0xEA95L) == 0); - - assert(f(0xEA95, 0x58D3) == 0xB246); - assert(f(0xEA95L, 0x58D3) == 0xB246); - assert(f(0xEA95, 0x58D3L) == 0xB246); - - assert(f(0x58D3, 0xEA95) == 0xB246); - assert(f(0x58D3L, 0xEA95) == 0xB246); - assert(f(0x58D3, 0xEA95L) == 0xB246); - - assert(f(0x58D3, 0) == 0x58D3); - assert(f(0x58D3L, 0) == 0x58D3); - assert(f(0x58D3, 0L) == 0x58D3); - - assert(f(0xFFFF, 0x58D3) == 0xA72C); - assert(f(0xFFFFL, 0x58D3) == 0xA72C); - assert(f(0xFFFF, 0x58D3L) == 0xA72C); - - constexpr int foo = std::bit_xor<int> () (0x58D3, 0xEA95); - static_assert ( foo == 0xB246, "" ); - - constexpr int bar = std::bit_xor<> () (0x58D3L, 0xEA95); - static_assert ( bar == 0xB246, "" ); -#endif -} diff --git a/libcxx/test/utilities/function.objects/bitwise.operations/transparent.pass.cpp b/libcxx/test/utilities/function.objects/bitwise.operations/transparent.pass.cpp deleted file mode 100644 index 9f8e15dd55f..00000000000 --- a/libcxx/test/utilities/function.objects/bitwise.operations/transparent.pass.cpp +++ /dev/null @@ -1,51 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 <functional> -#include <string> - -template <class _Tp> -struct is_transparent -{ -private: - struct __two {char __lx; char __lxx;}; - template <class _Up> static __two __test(...); - template <class _Up> static char __test(typename _Up::is_transparent* = 0); -public: - static const bool value = sizeof(__test<_Tp>(0)) == 1; -}; - - -int main () { -#if _LIBCPP_STD_VER > 11 - - static_assert ( !is_transparent<std::bit_and<int>>::value, "" ); - static_assert ( !is_transparent<std::bit_and<std::string>>::value, "" ); - static_assert ( is_transparent<std::bit_and<void>>::value, "" ); - static_assert ( is_transparent<std::bit_and<>>::value, "" ); - - static_assert ( !is_transparent<std::bit_or<int>>::value, "" ); - static_assert ( !is_transparent<std::bit_or<std::string>>::value, "" ); - static_assert ( is_transparent<std::bit_or<void>>::value, "" ); - static_assert ( is_transparent<std::bit_or<>>::value, "" ); - - static_assert ( !is_transparent<std::bit_xor<int>>::value, "" ); - static_assert ( !is_transparent<std::bit_xor<std::string>>::value, "" ); - static_assert ( is_transparent<std::bit_xor<void>>::value, "" ); - static_assert ( is_transparent<std::bit_xor<>>::value, "" ); - - static_assert ( !is_transparent<std::bit_not<int>>::value, "" ); - static_assert ( !is_transparent<std::bit_not<std::string>>::value, "" ); - static_assert ( is_transparent<std::bit_not<void>>::value, "" ); - static_assert ( is_transparent<std::bit_not<>>::value, "" ); - -#endif - - return 0; - } |