Move test into test/std subdirectory.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224658 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Fiselier
2014-12-20 01:40:03 +00:00
parent 669a8a5a19
commit a90c6dd460
4817 changed files with 13 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
//===----------------------------------------------------------------------===//
//
// 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
}

View File

@@ -0,0 +1,46 @@
//===----------------------------------------------------------------------===//
//
// 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
}

View File

@@ -0,0 +1,57 @@
//===----------------------------------------------------------------------===//
//
// 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
}

View File

@@ -0,0 +1,57 @@
//===----------------------------------------------------------------------===//
//
// 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
}

View File

@@ -0,0 +1,51 @@
//===----------------------------------------------------------------------===//
//
// 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;
}