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,39 @@
//===----------------------------------------------------------------------===//
//
// 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>
// equal_to
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::equal_to<int> F;
const F f = F();
static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
assert(f(36, 36));
assert(!f(36, 6));
#if _LIBCPP_STD_VER > 11
typedef std::equal_to<> F2;
const F2 f2 = F2();
assert(f2(36, 36));
assert(!f2(36, 6));
assert(f2(36, 36.0));
assert(f2(36.0, 36L));
constexpr bool foo = std::equal_to<int> () (36, 36);
static_assert ( foo, "" );
constexpr bool bar = std::equal_to<> () (36.0, 36);
static_assert ( bar, "" );
#endif
}

View File

@@ -0,0 +1,43 @@
//===----------------------------------------------------------------------===//
//
// 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>
// greater
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::greater<int> F;
const F f = F();
static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
assert(!f(36, 36));
assert(f(36, 6));
assert(!f(6, 36));
#if _LIBCPP_STD_VER > 11
typedef std::greater<> F2;
const F2 f2 = F2();
assert(!f2(36, 36));
assert(f2(36, 6));
assert(!f2(6, 36));
assert( f2(36, 6.0));
assert( f2(36.0, 6));
assert(!f2(6, 36.0));
assert(!f2(6.0, 36));
constexpr bool foo = std::greater<int> () (36, 36);
static_assert ( !foo, "" );
constexpr bool bar = std::greater<> () (36.0, 36);
static_assert ( !bar, "" );
#endif
}

View File

@@ -0,0 +1,43 @@
//===----------------------------------------------------------------------===//
//
// 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>
// greater_equal
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::greater_equal<int> F;
const F f = F();
static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
assert(f(36, 36));
assert(f(36, 6));
assert(!f(6, 36));
#if _LIBCPP_STD_VER > 11
typedef std::greater_equal<> F2;
const F2 f2 = F2();
assert(f2(36, 36));
assert(f2(36, 6));
assert(!f2(6, 36));
assert( f2(36, 6.0));
assert( f2(36.0, 6));
assert(!f2(6, 36.0));
assert(!f2(6.0, 36));
constexpr bool foo = std::greater_equal<int> () (36, 36);
static_assert ( foo, "" );
constexpr bool bar = std::greater_equal<> () (36.0, 36);
static_assert ( bar, "" );
#endif
}

View File

@@ -0,0 +1,43 @@
//===----------------------------------------------------------------------===//
//
// 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>
// less
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::less<int> F;
const F f = F();
static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
assert(!f(36, 36));
assert(!f(36, 6));
assert(f(6, 36));
#if _LIBCPP_STD_VER > 11
typedef std::less<> F2;
const F2 f2 = F2();
assert(!f2(36, 36));
assert(!f2(36, 6));
assert( f2(6, 36));
assert(!f2(36, 6.0));
assert(!f2(36.0, 6));
assert( f2(6, 36.0));
assert( f2(6.0, 36));
constexpr bool foo = std::less<int> () (36, 36);
static_assert ( !foo, "" );
constexpr bool bar = std::less<> () (36.0, 36);
static_assert ( !bar, "" );
#endif
}

View File

@@ -0,0 +1,43 @@
//===----------------------------------------------------------------------===//
//
// 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>
// less_equal
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::less_equal<int> F;
const F f = F();
static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
assert(f(36, 36));
assert(!f(36, 6));
assert(f(6, 36));
#if _LIBCPP_STD_VER > 11
typedef std::less_equal<> F2;
const F2 f2 = F2();
assert( f2(36, 36));
assert(!f2(36, 6));
assert( f2(6, 36));
assert(!f2(36, 6.0));
assert(!f2(36.0, 6));
assert( f2(6, 36.0));
assert( f2(6.0, 36));
constexpr bool foo = std::less_equal<int> () (36, 36);
static_assert ( foo, "" );
constexpr bool bar = std::less_equal<> () (36.0, 36);
static_assert ( bar, "" );
#endif
}

View File

@@ -0,0 +1,41 @@
//===----------------------------------------------------------------------===//
//
// 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>
// not_equal_to
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::not_equal_to<int> F;
const F f = F();
static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
assert(!f(36, 36));
assert(f(36, 6));
#if _LIBCPP_STD_VER > 11
typedef std::not_equal_to<> F2;
const F2 f2 = F2();
assert(!f2(36, 36));
assert( f2(36, 6));
assert( f2(36, 6.0));
assert( f2(36.0, 6));
assert(!f2(36.0, 36));
assert(!f2(36, 36.0));
constexpr bool foo = std::not_equal_to<int> () (36, 36);
static_assert ( !foo, "" );
constexpr bool bar = std::not_equal_to<> () (36.0, 36);
static_assert ( !bar, "" );
#endif
}

View File

@@ -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.
//
//===----------------------------------------------------------------------===//
#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::less<int>>::value, "" );
static_assert ( !is_transparent<std::less<std::string>>::value, "" );
static_assert ( is_transparent<std::less<void>>::value, "" );
static_assert ( is_transparent<std::less<>>::value, "" );
static_assert ( !is_transparent<std::less_equal<int>>::value, "" );
static_assert ( !is_transparent<std::less_equal<std::string>>::value, "" );
static_assert ( is_transparent<std::less_equal<void>>::value, "" );
static_assert ( is_transparent<std::less_equal<>>::value, "" );
static_assert ( !is_transparent<std::equal_to<int>>::value, "" );
static_assert ( !is_transparent<std::equal_to<std::string>>::value, "" );
static_assert ( is_transparent<std::equal_to<void>>::value, "" );
static_assert ( is_transparent<std::equal_to<>>::value, "" );
static_assert ( !is_transparent<std::not_equal_to<int>>::value, "" );
static_assert ( !is_transparent<std::not_equal_to<std::string>>::value, "" );
static_assert ( is_transparent<std::not_equal_to<void>>::value, "" );
static_assert ( is_transparent<std::not_equal_to<>>::value, "" );
static_assert ( !is_transparent<std::greater<int>>::value, "" );
static_assert ( !is_transparent<std::greater<std::string>>::value, "" );
static_assert ( is_transparent<std::greater<void>>::value, "" );
static_assert ( is_transparent<std::greater<>>::value, "" );
static_assert ( !is_transparent<std::greater_equal<int>>::value, "" );
static_assert ( !is_transparent<std::greater_equal<std::string>>::value, "" );
static_assert ( is_transparent<std::greater_equal<void>>::value, "" );
static_assert ( is_transparent<std::greater_equal<>>::value, "" );
#endif
return 0;
}