diff options
Diffstat (limited to 'libcxx/test/std/experimental/utilities')
8 files changed, 360 insertions, 0 deletions
diff --git a/libcxx/test/std/experimental/utilities/ratio/header.ratio.synop/includes.pass.cpp b/libcxx/test/std/experimental/utilities/ratio/header.ratio.synop/includes.pass.cpp new file mode 100644 index 00000000000..f19a8211cda --- /dev/null +++ b/libcxx/test/std/experimental/utilities/ratio/header.ratio.synop/includes.pass.cpp @@ -0,0 +1,21 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +// <experimental/ratio> + +// Test that <ratio> is included. + +#include <experimental/ratio> + +int main() +{ + std::ratio<100> x; +} diff --git a/libcxx/test/std/experimental/utilities/ratio/header.ratio.synop/ratio_equal_v.pass.cpp b/libcxx/test/std/experimental/utilities/ratio/header.ratio.synop/ratio_equal_v.pass.cpp new file mode 100644 index 00000000000..641e6ae22cc --- /dev/null +++ b/libcxx/test/std/experimental/utilities/ratio/header.ratio.synop/ratio_equal_v.pass.cpp @@ -0,0 +1,47 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +// <experimental/ratio> + +// template <class R1, class R2> constexpr bool ratio_equal_v; + +#include <experimental/ratio> +#include <type_traits> + +namespace ex = std::experimental; + +int main() +{ + { + typedef std::ratio<1, 1> R1; + typedef std::ratio<1, 1> R2; + static_assert( + ex::ratio_equal_v<R1, R2>, "" + ); + static_assert( + ex::ratio_equal_v<R1, R2> == std::ratio_equal<R1, R2>::value, "" + ); + static_assert( + std::is_same<decltype(ex::ratio_equal_v<R1, R2>), const bool>::value + , "" + ); + } + { + typedef std::ratio<1, 1> R1; + typedef std::ratio<1, -1> R2; + static_assert( + !ex::ratio_equal_v<R1, R2>, "" + ); + static_assert( + ex::ratio_equal_v<R1, R2> == std::ratio_equal<R1, R2>::value, "" + ); + } +} diff --git a/libcxx/test/std/experimental/utilities/ratio/header.ratio.synop/ratio_greater_equal_v.pass.cpp b/libcxx/test/std/experimental/utilities/ratio/header.ratio.synop/ratio_greater_equal_v.pass.cpp new file mode 100644 index 00000000000..3896d0ac64d --- /dev/null +++ b/libcxx/test/std/experimental/utilities/ratio/header.ratio.synop/ratio_greater_equal_v.pass.cpp @@ -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. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +// <experimental/ratio> + +// template <class R1, class R2> constexpr bool ratio_greater_equal_v; + +#include <experimental/ratio> +#include <type_traits> + +namespace ex = std::experimental; + +int main() +{ + { + typedef std::ratio<1, 2> R1; + typedef std::ratio<1, 1> R2; + static_assert( + !ex::ratio_greater_equal_v<R1, R2>, "" + ); + static_assert( + ex::ratio_greater_equal_v<R1, R2> + == std::ratio_greater_equal<R1, R2>::value, "" + ); + static_assert( + std::is_same< + decltype(ex::ratio_greater_equal_v<R1, R2>), const bool>::value + , "" + ); + } + { + typedef std::ratio<1, 1> R1; + typedef std::ratio<1, 1> R2; + static_assert( + ex::ratio_greater_equal_v<R1, R2>, "" + ); + static_assert( + ex::ratio_greater_equal_v<R1, R2> + == std::ratio_greater_equal<R1, R2>::value, "" + ); + } + { + typedef std::ratio<2, 1> R1; + typedef std::ratio<1, 1> R2; + static_assert( + ex::ratio_greater_equal_v<R1, R2>, "" + ); + static_assert( + ex::ratio_greater_equal_v<R1, R2> + == std::ratio_greater_equal<R1, R2>::value, "" + ); + } +} diff --git a/libcxx/test/std/experimental/utilities/ratio/header.ratio.synop/ratio_greater_v.pass.cpp b/libcxx/test/std/experimental/utilities/ratio/header.ratio.synop/ratio_greater_v.pass.cpp new file mode 100644 index 00000000000..bdc54515f62 --- /dev/null +++ b/libcxx/test/std/experimental/utilities/ratio/header.ratio.synop/ratio_greater_v.pass.cpp @@ -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. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +// <experimental/ratio> + +// template <class R1, class R2> constexpr bool ratio_greater_v; + +#include <experimental/ratio> +#include <type_traits> + +namespace ex = std::experimental; + +int main() +{ + { + typedef std::ratio<1, 2> R1; + typedef std::ratio<1, 1> R2; + static_assert( + !ex::ratio_greater_v<R1, R2>, "" + ); + static_assert( + ex::ratio_greater_v<R1, R2> == std::ratio_greater<R1, R2>::value, "" + ); + static_assert( + std::is_same<decltype(ex::ratio_greater_v<R1, R2>), const bool>::value + , "" + ); + } + { + typedef std::ratio<1, 1> R1; + typedef std::ratio<1, 1> R2; + static_assert( + !ex::ratio_greater_v<R1, R2>, "" + ); + static_assert( + ex::ratio_greater_v<R1, R2> == std::ratio_greater<R1, R2>::value, "" + ); + } + { + typedef std::ratio<2, 1> R1; + typedef std::ratio<1, 1> R2; + static_assert( + ex::ratio_greater_v<R1, R2>, "" + ); + static_assert( + ex::ratio_greater_v<R1, R2> == std::ratio_greater<R1, R2>::value, "" + ); + } +} diff --git a/libcxx/test/std/experimental/utilities/ratio/header.ratio.synop/ratio_less_equal_v.pass.cpp b/libcxx/test/std/experimental/utilities/ratio/header.ratio.synop/ratio_less_equal_v.pass.cpp new file mode 100644 index 00000000000..50f213b0133 --- /dev/null +++ b/libcxx/test/std/experimental/utilities/ratio/header.ratio.synop/ratio_less_equal_v.pass.cpp @@ -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. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +// <experimental/ratio> + +// template <class R1, class R2> constexpr bool ratio_less_equal_v; + +#include <experimental/ratio> +#include <type_traits> + +namespace ex = std::experimental; + +int main() +{ + { + typedef std::ratio<1, 2> R1; + typedef std::ratio<1, 1> R2; + static_assert( + ex::ratio_less_equal_v<R1, R2>, "" + ); + static_assert( + ex::ratio_less_equal_v<R1, R2> == std::ratio_less_equal<R1, R2>::value, "" + ); + static_assert( + std::is_same<decltype(ex::ratio_less_equal_v<R1, R2>), const bool>::value + , "" + ); + } + { + typedef std::ratio<1, 1> R1; + typedef std::ratio<1, 1> R2; + static_assert( + ex::ratio_less_equal_v<R1, R2>, "" + ); + static_assert( + ex::ratio_less_equal_v<R1, R2> == std::ratio_less_equal<R1, R2>::value, "" + ); + } + { + typedef std::ratio<2, 1> R1; + typedef std::ratio<1, 1> R2; + static_assert( + !ex::ratio_less_equal_v<R1, R2>, "" + ); + static_assert( + ex::ratio_less_equal_v<R1, R2> == std::ratio_less_equal<R1, R2>::value, "" + ); + } +} diff --git a/libcxx/test/std/experimental/utilities/ratio/header.ratio.synop/ratio_less_v.pass.cpp b/libcxx/test/std/experimental/utilities/ratio/header.ratio.synop/ratio_less_v.pass.cpp new file mode 100644 index 00000000000..7a6d7738bd9 --- /dev/null +++ b/libcxx/test/std/experimental/utilities/ratio/header.ratio.synop/ratio_less_v.pass.cpp @@ -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. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +// <experimental/ratio> + +// template <class R1, class R2> constexpr bool ratio_less_v; + +#include <experimental/ratio> +#include <type_traits> + +namespace ex = std::experimental; + +int main() +{ + { + typedef std::ratio<1, 2> R1; + typedef std::ratio<1, 1> R2; + static_assert( + ex::ratio_less_v<R1, R2>, "" + ); + static_assert( + ex::ratio_less_v<R1, R2> == std::ratio_less<R1, R2>::value, "" + ); + static_assert( + std::is_same<decltype(ex::ratio_less_v<R1, R2>), const bool>::value + , "" + ); + } + { + typedef std::ratio<1, 1> R1; + typedef std::ratio<1, 1> R2; + static_assert( + !ex::ratio_less_v<R1, R2>, "" + ); + static_assert( + ex::ratio_less_v<R1, R2> == std::ratio_less<R1, R2>::value, "" + ); + } + { + typedef std::ratio<2, 1> R1; + typedef std::ratio<1, 1> R2; + static_assert( + !ex::ratio_less_v<R1, R2>, "" + ); + static_assert( + ex::ratio_less_v<R1, R2> == std::ratio_less<R1, R2>::value, "" + ); + } +} diff --git a/libcxx/test/std/experimental/utilities/ratio/header.ratio.synop/ratio_not_equal_v.pass.cpp b/libcxx/test/std/experimental/utilities/ratio/header.ratio.synop/ratio_not_equal_v.pass.cpp new file mode 100644 index 00000000000..b5296ff24ef --- /dev/null +++ b/libcxx/test/std/experimental/utilities/ratio/header.ratio.synop/ratio_not_equal_v.pass.cpp @@ -0,0 +1,47 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +// <experimental/ratio> + +// template <class R1, class R2> constexpr bool ratio_not_equal_v; + +#include <experimental/ratio> +#include <type_traits> + +namespace ex = std::experimental; + +int main() +{ + { + typedef std::ratio<1, 1> R1; + typedef std::ratio<1, -1> R2; + static_assert( + ex::ratio_not_equal_v<R1, R2>, "" + ); + static_assert( + ex::ratio_not_equal_v<R1, R2> == std::ratio_not_equal<R1, R2>::value, "" + ); + static_assert( + std::is_same<decltype(ex::ratio_not_equal_v<R1, R2>), const bool>::value + , "" + ); + } + { + typedef std::ratio<1, 1> R1; + typedef std::ratio<1, 1> R2; + static_assert( + !ex::ratio_not_equal_v<R1, R2>, "" + ); + static_assert( + ex::ratio_not_equal_v<R1, R2> == std::ratio_not_equal<R1, R2>::value, "" + ); + } +} diff --git a/libcxx/test/std/experimental/utilities/ratio/nothing_to_do.pass.cpp b/libcxx/test/std/experimental/utilities/ratio/nothing_to_do.pass.cpp new file mode 100644 index 00000000000..9a59227abdd --- /dev/null +++ b/libcxx/test/std/experimental/utilities/ratio/nothing_to_do.pass.cpp @@ -0,0 +1,13 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +int main() +{ +} |