diff options
Diffstat (limited to 'libcxx/test/utilities/function.objects/arithmetic.operations')
7 files changed, 0 insertions, 283 deletions
diff --git a/libcxx/test/utilities/function.objects/arithmetic.operations/divides.pass.cpp b/libcxx/test/utilities/function.objects/arithmetic.operations/divides.pass.cpp deleted file mode 100644 index 74298f23b7c..00000000000 --- a/libcxx/test/utilities/function.objects/arithmetic.operations/divides.pass.cpp +++ /dev/null @@ -1,37 +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> - -// divides - -#include <functional> -#include <type_traits> -#include <cassert> - -int main() -{ - typedef std::divides<int> F; - const F f = F(); - static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), ""); - assert(f(36, 4) == 9); -#if _LIBCPP_STD_VER > 11 - typedef std::divides<> F2; - const F2 f2 = F2(); - assert(f2(36, 4) == 9); - assert(f2(36.0, 4) == 9); - assert(f2(18, 4.0) == 4.5); // exact in binary - - constexpr int foo = std::divides<int> () (3, 2); - static_assert ( foo == 1, "" ); - - constexpr int bar = std::divides<> () (3.0, 2); - static_assert ( bar == 1, "" ); -#endif -} diff --git a/libcxx/test/utilities/function.objects/arithmetic.operations/minus.pass.cpp b/libcxx/test/utilities/function.objects/arithmetic.operations/minus.pass.cpp deleted file mode 100644 index 9a496a8066c..00000000000 --- a/libcxx/test/utilities/function.objects/arithmetic.operations/minus.pass.cpp +++ /dev/null @@ -1,37 +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> - -// minus - -#include <functional> -#include <type_traits> -#include <cassert> - -int main() -{ - typedef std::minus<int> F; - const F f = F(); - static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), ""); - assert(f(3, 2) == 1); -#if _LIBCPP_STD_VER > 11 - typedef std::minus<> F2; - const F2 f2 = F2(); - assert(f2(3,2) == 1); - assert(f2(3.0, 2) == 1); - assert(f2(3, 2.5) == 0.5); - - constexpr int foo = std::minus<int> () (3, 2); - static_assert ( foo == 1, "" ); - - constexpr int bar = std::minus<> () (3.0, 2); - static_assert ( bar == 1, "" ); -#endif -} diff --git a/libcxx/test/utilities/function.objects/arithmetic.operations/modulus.pass.cpp b/libcxx/test/utilities/function.objects/arithmetic.operations/modulus.pass.cpp deleted file mode 100644 index 3c178819231..00000000000 --- a/libcxx/test/utilities/function.objects/arithmetic.operations/modulus.pass.cpp +++ /dev/null @@ -1,37 +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> - -// modulus - -#include <functional> -#include <type_traits> -#include <cassert> - -int main() -{ - typedef std::modulus<int> F; - const F f = F(); - static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), ""); - assert(f(36, 8) == 4); -#if _LIBCPP_STD_VER > 11 - typedef std::modulus<> F2; - const F2 f2 = F2(); - assert(f2(36, 8) == 4); - assert(f2(36L, 8) == 4); - assert(f2(36, 8L) == 4); - - constexpr int foo = std::modulus<int> () (3, 2); - static_assert ( foo == 1, "" ); - - constexpr int bar = std::modulus<> () (3L, 2); - static_assert ( bar == 1, "" ); -#endif -} diff --git a/libcxx/test/utilities/function.objects/arithmetic.operations/multiplies.pass.cpp b/libcxx/test/utilities/function.objects/arithmetic.operations/multiplies.pass.cpp deleted file mode 100644 index 97287e6c8da..00000000000 --- a/libcxx/test/utilities/function.objects/arithmetic.operations/multiplies.pass.cpp +++ /dev/null @@ -1,37 +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> - -// multiplies - -#include <functional> -#include <type_traits> -#include <cassert> - -int main() -{ - typedef std::multiplies<int> F; - const F f = F(); - static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), ""); - assert(f(3, 2) == 6); -#if _LIBCPP_STD_VER > 11 - typedef std::multiplies<> F2; - const F2 f2 = F2(); - assert(f2(3,2) == 6); - assert(f2(3.0, 2) == 6); - assert(f2(3, 2.5) == 7.5); // exact in binary - - constexpr int foo = std::multiplies<int> () (3, 2); - static_assert ( foo == 6, "" ); - - constexpr int bar = std::multiplies<> () (3.0, 2); - static_assert ( bar == 6, "" ); -#endif -} diff --git a/libcxx/test/utilities/function.objects/arithmetic.operations/negate.pass.cpp b/libcxx/test/utilities/function.objects/arithmetic.operations/negate.pass.cpp deleted file mode 100644 index 3ffb7051bfd..00000000000 --- a/libcxx/test/utilities/function.objects/arithmetic.operations/negate.pass.cpp +++ /dev/null @@ -1,37 +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> - -// negate - -#include <functional> -#include <type_traits> -#include <cassert> - -int main() -{ - typedef std::negate<int> F; - const F f = F(); - static_assert((std::is_base_of<std::unary_function<int, int>, F>::value), ""); - assert(f(36) == -36); -#if _LIBCPP_STD_VER > 11 - typedef std::negate<> F2; - const F2 f2 = F2(); - assert(f2(36) == -36); - assert(f2(36L) == -36); - assert(f2(36.0) == -36); - - constexpr int foo = std::negate<int> () (3); - static_assert ( foo == -3, "" ); - - constexpr int bar = std::negate<> () (3.0); - static_assert ( bar == -3, "" ); -#endif -} diff --git a/libcxx/test/utilities/function.objects/arithmetic.operations/plus.pass.cpp b/libcxx/test/utilities/function.objects/arithmetic.operations/plus.pass.cpp deleted file mode 100644 index 44001a0e5f4..00000000000 --- a/libcxx/test/utilities/function.objects/arithmetic.operations/plus.pass.cpp +++ /dev/null @@ -1,37 +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> - -// plus - -#include <functional> -#include <type_traits> -#include <cassert> - -int main() -{ - typedef std::plus<int> F; - const F f = F(); - static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), ""); - assert(f(3, 2) == 5); -#if _LIBCPP_STD_VER > 11 - typedef std::plus<> F2; - const F2 f2 = F2(); - assert(f2(3,2) == 5); - assert(f2(3.0, 2) == 5); - assert(f2(3, 2.5) == 5.5); - - constexpr int foo = std::plus<int> () (3, 2); - static_assert ( foo == 5, "" ); - - constexpr int bar = std::plus<> () (3.0, 2); - static_assert ( bar == 5, "" ); -#endif -} diff --git a/libcxx/test/utilities/function.objects/arithmetic.operations/transparent.pass.cpp b/libcxx/test/utilities/function.objects/arithmetic.operations/transparent.pass.cpp deleted file mode 100644 index 72b4b4a0a1f..00000000000 --- a/libcxx/test/utilities/function.objects/arithmetic.operations/transparent.pass.cpp +++ /dev/null @@ -1,61 +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::plus<int>>::value, "" ); - static_assert ( !is_transparent<std::plus<std::string>>::value, "" ); - static_assert ( is_transparent<std::plus<void>>::value, "" ); - static_assert ( is_transparent<std::plus<>>::value, "" ); - - static_assert ( !is_transparent<std::minus<int>>::value, "" ); - static_assert ( !is_transparent<std::minus<std::string>>::value, "" ); - static_assert ( is_transparent<std::minus<void>>::value, "" ); - static_assert ( is_transparent<std::minus<>>::value, "" ); - - static_assert ( !is_transparent<std::multiplies<int>>::value, "" ); - static_assert ( !is_transparent<std::multiplies<std::string>>::value, "" ); - static_assert ( is_transparent<std::multiplies<void>>::value, "" ); - static_assert ( is_transparent<std::multiplies<>>::value, "" ); - - static_assert ( !is_transparent<std::divides<int>>::value, "" ); - static_assert ( !is_transparent<std::divides<std::string>>::value, "" ); - static_assert ( is_transparent<std::divides<void>>::value, "" ); - static_assert ( is_transparent<std::divides<>>::value, "" ); - - static_assert ( !is_transparent<std::modulus<int>>::value, "" ); - static_assert ( !is_transparent<std::modulus<std::string>>::value, "" ); - static_assert ( is_transparent<std::modulus<void>>::value, "" ); - static_assert ( is_transparent<std::modulus<>>::value, "" ); - - static_assert ( !is_transparent<std::negate<int>>::value, "" ); - static_assert ( !is_transparent<std::negate<std::string>>::value, "" ); - static_assert ( is_transparent<std::negate<void>>::value, "" ); - static_assert ( is_transparent<std::negate<>>::value, "" ); - -#endif - - return 0; - } |