diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
commit | 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch) | |
tree | e5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/boost/libs/ratio/test/ratio_extensions | |
parent | Initial commit. (diff) | |
download | ceph-upstream.tar.xz ceph-upstream.zip |
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/libs/ratio/test/ratio_extensions')
17 files changed, 938 insertions, 0 deletions
diff --git a/src/boost/libs/ratio/test/ratio_extensions/mpl_abs_pass.cpp b/src/boost/libs/ratio/test/ratio_extensions/mpl_abs_pass.cpp new file mode 100644 index 00000000..35d0cea9 --- /dev/null +++ b/src/boost/libs/ratio/test/ratio_extensions/mpl_abs_pass.cpp @@ -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. +// +//===----------------------------------------------------------------------===// +// Adaptation to Boost of the libcxx +// Copyright 2010 Vicente J. Botet Escriba +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// test mpl::abs + +#define BOOST_RATIO_EXTENSIONS + +#include <boost/ratio/mpl/abs.hpp> +#if !defined(BOOST_NO_CXX11_STATIC_ASSERT) +#define NOTHING "" +#endif + +void test() +{ + + { + typedef boost::ratio<0> R1; + typedef boost::mpl::abs<R1> R; + BOOST_RATIO_STATIC_ASSERT(R::num == 0 && R::den == 1, NOTHING, ()); + } + { + typedef boost::ratio<1, 1> R1; + typedef boost::mpl::abs<R1> R; + BOOST_RATIO_STATIC_ASSERT(R::num == 1 && R::den == 1, NOTHING, ()); + } + { + typedef boost::ratio<1, 2> R1; + typedef boost::mpl::abs<R1> R; + BOOST_RATIO_STATIC_ASSERT(R::num == 1 && R::den == 2, NOTHING, ()); + } + { + typedef boost::ratio<-1, 2> R1; + typedef boost::mpl::abs<R1> R; + BOOST_RATIO_STATIC_ASSERT(R::num == 1 && R::den == 2, NOTHING, ()); + } + { + typedef boost::ratio<1, -2> R1; + typedef boost::mpl::abs<R1> R; + BOOST_RATIO_STATIC_ASSERT(R::num == 1 && R::den == 2, NOTHING, ()); + } +} diff --git a/src/boost/libs/ratio/test/ratio_extensions/mpl_arithmetic_pass.cpp b/src/boost/libs/ratio/test/ratio_extensions/mpl_arithmetic_pass.cpp new file mode 100644 index 00000000..c5e62b26 --- /dev/null +++ b/src/boost/libs/ratio/test/ratio_extensions/mpl_arithmetic_pass.cpp @@ -0,0 +1,13 @@ +//===----------------------------------------------------------------------===// +// Copyright 2011 Vicente J. Botet Escriba +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +#define BOOST_RATIO_EXTENSIONS + +#include <boost/ratio/mpl/arithmetic.hpp> + +void test() +{ + +} diff --git a/src/boost/libs/ratio/test/ratio_extensions/mpl_comparison_pass.cpp b/src/boost/libs/ratio/test/ratio_extensions/mpl_comparison_pass.cpp new file mode 100644 index 00000000..57750a9c --- /dev/null +++ b/src/boost/libs/ratio/test/ratio_extensions/mpl_comparison_pass.cpp @@ -0,0 +1,13 @@ +//===----------------------------------------------------------------------===// +// Copyright 2011 Vicente J. Botet Escriba +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +#define BOOST_RATIO_EXTENSIONS + +#include <boost/ratio/mpl/comparison.hpp> + +void test() +{ + +} diff --git a/src/boost/libs/ratio/test/ratio_extensions/mpl_divides_pass.cpp b/src/boost/libs/ratio/test/ratio_extensions/mpl_divides_pass.cpp new file mode 100644 index 00000000..2afdf9e1 --- /dev/null +++ b/src/boost/libs/ratio/test/ratio_extensions/mpl_divides_pass.cpp @@ -0,0 +1,67 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// +// Adaptation to Boost of the libcxx +// Copyright 2010 Vicente J. Botet Escriba +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// test mpl::divides + +#define BOOST_RATIO_EXTENSIONS + +#include <boost/ratio/mpl/divides.hpp> +#if !defined(BOOST_NO_CXX11_STATIC_ASSERT) +#define NOTHING "" +#endif + +void test() +{ + { + typedef boost::ratio<1, 1> R1; + typedef boost::ratio<1, 1> R2; + typedef boost::mpl::divides<R1, R2> R; + BOOST_RATIO_STATIC_ASSERT(R::num == 1 && R::den == 1, NOTHING, ()); + } + { + typedef boost::ratio<1, 2> R1; + typedef boost::ratio<1, 1> R2; + typedef boost::mpl::divides<R1, R2> R; + BOOST_RATIO_STATIC_ASSERT(R::num == 1 && R::den == 2, NOTHING, ()); + } + { + typedef boost::ratio<-1, 2> R1; + typedef boost::ratio<1, 1> R2; + typedef boost::mpl::divides<R1, R2> R; + BOOST_RATIO_STATIC_ASSERT(R::num == -1 && R::den == 2, NOTHING, ()); + } + { + typedef boost::ratio<1, -2> R1; + typedef boost::ratio<1, 1> R2; + typedef boost::mpl::divides<R1, R2> R; + BOOST_RATIO_STATIC_ASSERT(R::num == -1 && R::den == 2, NOTHING, ()); + } + { + typedef boost::ratio<1, 2> R1; + typedef boost::ratio<-1, 1> R2; + typedef boost::mpl::divides<R1, R2> R; + BOOST_RATIO_STATIC_ASSERT(R::num == -1 && R::den == 2, NOTHING, ()); + } + { + typedef boost::ratio<1, 2> R1; + typedef boost::ratio<1, -1> R2; + typedef boost::mpl::divides<R1, R2> R; + BOOST_RATIO_STATIC_ASSERT(R::num == -1 && R::den == 2, NOTHING, ()); + } + { + typedef boost::ratio<56987354, 467584654> R1; + typedef boost::ratio<544668, 22145> R2; + typedef boost::mpl::divides<R1, R2> R; + BOOST_RATIO_STATIC_ASSERT(R::num == 630992477165LL && R::den == 127339199162436LL, NOTHING, ()); + } +} diff --git a/src/boost/libs/ratio/test/ratio_extensions/mpl_equal_to_pass.cpp b/src/boost/libs/ratio/test/ratio_extensions/mpl_equal_to_pass.cpp new file mode 100644 index 00000000..e86c31c7 --- /dev/null +++ b/src/boost/libs/ratio/test/ratio_extensions/mpl_equal_to_pass.cpp @@ -0,0 +1,66 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// +// Adaptation to Boost of the libcxx +// Copyright 2010 Vicente J. Botet Escriba +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// test mpl::equal_to + +#define BOOST_RATIO_EXTENSIONS + +#include <boost/ratio/mpl/equal_to.hpp> +#if !defined(BOOST_NO_CXX11_STATIC_ASSERT) +#define NOTHING "" +#endif + + +void test() +{ + { + typedef boost::ratio<1, 1> R1; + typedef boost::ratio<1, 1> R2; + BOOST_RATIO_STATIC_ASSERT((boost::mpl::equal_to<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R1; + typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R2; + BOOST_RATIO_STATIC_ASSERT((boost::mpl::equal_to<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R1; + typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R2; + BOOST_RATIO_STATIC_ASSERT((boost::mpl::equal_to<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R1; + typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R2; + BOOST_RATIO_STATIC_ASSERT((boost::mpl::equal_to<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<1, 1> R1; + typedef boost::ratio<1, -1> R2; + BOOST_RATIO_STATIC_ASSERT((!boost::mpl::equal_to<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R1; + typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R2; + BOOST_RATIO_STATIC_ASSERT((!boost::mpl::equal_to<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R1; + typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R2; + BOOST_RATIO_STATIC_ASSERT((!boost::mpl::equal_to<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R1; + typedef boost::ratio<1, -BOOST_RATIO_INTMAX_T_MAX> R2; + BOOST_RATIO_STATIC_ASSERT((!boost::mpl::equal_to<R1, R2>::value), NOTHING, ()); + } +} diff --git a/src/boost/libs/ratio/test/ratio_extensions/mpl_greater_equal_pass.cpp b/src/boost/libs/ratio/test/ratio_extensions/mpl_greater_equal_pass.cpp new file mode 100644 index 00000000..e9c33060 --- /dev/null +++ b/src/boost/libs/ratio/test/ratio_extensions/mpl_greater_equal_pass.cpp @@ -0,0 +1,69 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// +// Adaptation to Boost of the libcxx +// Copyright 2010 Vicente J. Botet Escriba +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +#define BOOST_RATIO_EXTENSIONS + +#include <boost/ratio/mpl/greater_equal.hpp> +#if !defined(BOOST_NO_CXX11_STATIC_ASSERT) +#define NOTHING "" +#endif + + +void test() +{ + { + typedef boost::ratio<1, 1> R1; + typedef boost::ratio<1, 1> R2; + BOOST_RATIO_STATIC_ASSERT((boost::mpl::greater_equal<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R1; + typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R2; + BOOST_RATIO_STATIC_ASSERT((boost::mpl::greater_equal<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<1,BOOST_RATIO_INTMAX_T_MAX> R1; + typedef boost::ratio<1,BOOST_RATIO_INTMAX_T_MAX> R2; + BOOST_RATIO_STATIC_ASSERT((boost::mpl::greater_equal<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R1; + typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R2; + BOOST_RATIO_STATIC_ASSERT((boost::mpl::greater_equal<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R1; + typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R2; + BOOST_RATIO_STATIC_ASSERT((boost::mpl::greater_equal<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<1, 1> R1; + typedef boost::ratio<1, -1> R2; + BOOST_RATIO_STATIC_ASSERT((boost::mpl::greater_equal<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R1; + typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R2; + BOOST_RATIO_STATIC_ASSERT((boost::mpl::greater_equal<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R1; + typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R2; + BOOST_RATIO_STATIC_ASSERT((!boost::mpl::greater_equal<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R1; + typedef boost::ratio<1, -BOOST_RATIO_INTMAX_T_MAX> R2; + BOOST_RATIO_STATIC_ASSERT((boost::mpl::greater_equal<R1, R2>::value), NOTHING, ()); + } +} diff --git a/src/boost/libs/ratio/test/ratio_extensions/mpl_greater_pass.cpp b/src/boost/libs/ratio/test/ratio_extensions/mpl_greater_pass.cpp new file mode 100644 index 00000000..dd910831 --- /dev/null +++ b/src/boost/libs/ratio/test/ratio_extensions/mpl_greater_pass.cpp @@ -0,0 +1,63 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// +// Adaptation to Boost of the libcxx +// Copyright 2010 Vicente J. Botet Escriba +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +#define BOOST_RATIO_EXTENSIONS + +#include <boost/ratio/mpl/greater.hpp> +#if !defined(BOOST_NO_CXX11_STATIC_ASSERT) +#define NOTHING "" +#endif + +void test() +{ + { + typedef boost::ratio<1, 1> R1; + typedef boost::ratio<1, 1> R2; + BOOST_RATIO_STATIC_ASSERT((!boost::mpl::greater<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R1; + typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R2; + BOOST_RATIO_STATIC_ASSERT((!boost::mpl::greater<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R1; + typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R2; + BOOST_RATIO_STATIC_ASSERT((!boost::mpl::greater<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R1; + typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R2; + BOOST_RATIO_STATIC_ASSERT((!boost::mpl::greater<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<1, 1> R1; + typedef boost::ratio<1, -1> R2; + BOOST_RATIO_STATIC_ASSERT((boost::mpl::greater<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R1; + typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R2; + BOOST_RATIO_STATIC_ASSERT((boost::mpl::greater<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R1; + typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R2; + BOOST_RATIO_STATIC_ASSERT((!boost::mpl::greater<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R1; + typedef boost::ratio<1, -BOOST_RATIO_INTMAX_T_MAX> R2; + BOOST_RATIO_STATIC_ASSERT((boost::mpl::greater<R1, R2>::value), NOTHING, ()); + } +} diff --git a/src/boost/libs/ratio/test/ratio_extensions/mpl_less_equal_pass.cpp b/src/boost/libs/ratio/test/ratio_extensions/mpl_less_equal_pass.cpp new file mode 100644 index 00000000..2443c258 --- /dev/null +++ b/src/boost/libs/ratio/test/ratio_extensions/mpl_less_equal_pass.cpp @@ -0,0 +1,63 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// +// Adaptation to Boost of the libcxx +// Copyright 2010 Vicente J. Botet Escriba +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +#define BOOST_RATIO_EXTENSIONS + +#include <boost/ratio/mpl/less_equal.hpp> +#if !defined(BOOST_NO_CXX11_STATIC_ASSERT) +#define NOTHING "" +#endif + +void test() +{ + { + typedef boost::ratio<1, 1> R1; + typedef boost::ratio<1, 1> R2; + BOOST_RATIO_STATIC_ASSERT((boost::mpl::less_equal<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R1; + typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R2; + BOOST_RATIO_STATIC_ASSERT((boost::mpl::less_equal<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R1; + typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R2; + BOOST_RATIO_STATIC_ASSERT((boost::mpl::less_equal<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R1; + typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R2; + BOOST_RATIO_STATIC_ASSERT((boost::mpl::less_equal<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<1, 1> R1; + typedef boost::ratio<1, -1> R2; + BOOST_RATIO_STATIC_ASSERT((!boost::mpl::less_equal<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R1; + typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R2; + BOOST_RATIO_STATIC_ASSERT((!boost::mpl::less_equal<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R1; + typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R2; + BOOST_RATIO_STATIC_ASSERT((boost::mpl::less_equal<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R1; + typedef boost::ratio<1, -BOOST_RATIO_INTMAX_T_MAX> R2; + BOOST_RATIO_STATIC_ASSERT((!boost::mpl::less_equal<R1, R2>::value), NOTHING, ()); + } +} diff --git a/src/boost/libs/ratio/test/ratio_extensions/mpl_less_pass.cpp b/src/boost/libs/ratio/test/ratio_extensions/mpl_less_pass.cpp new file mode 100644 index 00000000..89032e1c --- /dev/null +++ b/src/boost/libs/ratio/test/ratio_extensions/mpl_less_pass.cpp @@ -0,0 +1,93 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// +// Adaptation to Boost of the libcxx +// Copyright 2010 Vicente J. Botet Escriba +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +#define BOOST_RATIO_EXTENSIONS + +#include <boost/ratio/mpl/less.hpp> +#if !defined(BOOST_NO_CXX11_STATIC_ASSERT) +#define NOTHING "" +#endif + +void test() +{ + { + typedef boost::ratio<1, 1> R1; + typedef boost::ratio<1, 1> R2; + BOOST_RATIO_STATIC_ASSERT((!boost::mpl::less<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R1; + typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R2; + BOOST_RATIO_STATIC_ASSERT((!boost::mpl::less<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R1; + typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R2; + BOOST_RATIO_STATIC_ASSERT((!boost::mpl::less<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R1; + typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R2; + BOOST_RATIO_STATIC_ASSERT((!boost::mpl::less<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<1, 1> R1; + typedef boost::ratio<1, -1> R2; + BOOST_RATIO_STATIC_ASSERT((!boost::mpl::less<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R1; + typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R2; + BOOST_RATIO_STATIC_ASSERT((!boost::mpl::less<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R1; + typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R2; + BOOST_RATIO_STATIC_ASSERT((boost::mpl::less<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R1; + typedef boost::ratio<1, -BOOST_RATIO_INTMAX_T_MAX> R2; + BOOST_RATIO_STATIC_ASSERT((!boost::mpl::less<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 0x7FFFFFFFFFFFFFFELL> R1; + typedef boost::ratio<0x7FFFFFFFFFFFFFFDLL, 0x7FFFFFFFFFFFFFFCLL> R2; + BOOST_RATIO_STATIC_ASSERT((boost::mpl::less<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<0x7FFFFFFFFFFFFFFDLL, 0x7FFFFFFFFFFFFFFCLL> R1; + typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 0x7FFFFFFFFFFFFFFELL> R2; + BOOST_RATIO_STATIC_ASSERT((!boost::mpl::less<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<-0x7FFFFFFFFFFFFFFDLL, 0x7FFFFFFFFFFFFFFCLL> R1; + typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 0x7FFFFFFFFFFFFFFELL> R2; + BOOST_RATIO_STATIC_ASSERT((boost::mpl::less<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 0x7FFFFFFFFFFFFFFELL> R1; + typedef boost::ratio<0x7FFFFFFFFFFFFFFELL, 0x7FFFFFFFFFFFFFFDLL> R2; + BOOST_RATIO_STATIC_ASSERT((boost::mpl::less<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<641981, 1339063> R1; + typedef boost::ratio<1291640, 2694141LL> R2; + BOOST_RATIO_STATIC_ASSERT((!boost::mpl::less<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<1291640, 2694141LL> R1; + typedef boost::ratio<641981, 1339063> R2; + BOOST_RATIO_STATIC_ASSERT((boost::mpl::less<R1, R2>::value), NOTHING, ()); + } +} diff --git a/src/boost/libs/ratio/test/ratio_extensions/mpl_minus_pass.cpp b/src/boost/libs/ratio/test/ratio_extensions/mpl_minus_pass.cpp new file mode 100644 index 00000000..ca335716 --- /dev/null +++ b/src/boost/libs/ratio/test/ratio_extensions/mpl_minus_pass.cpp @@ -0,0 +1,68 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// +// Adaptation to Boost of the libcxx +// Copyright 2010 Vicente J. Botet Escriba +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// test mpl::minus + +#define BOOST_RATIO_EXTENSIONS + +#include <boost/ratio/mpl/minus.hpp> +#if !defined(BOOST_NO_CXX11_STATIC_ASSERT) +#define NOTHING "" +#endif + +void test() +{ + + { + typedef boost::ratio<1, 1> R1; + typedef boost::ratio<1, 1> R2; + typedef boost::mpl::minus<R1, R2> R; + BOOST_RATIO_STATIC_ASSERT(R::num == 0 && R::den == 1, NOTHING, ()); + } + { + typedef boost::ratio<1, 2> R1; + typedef boost::ratio<1, 1> R2; + typedef boost::mpl::minus<R1, R2> R; + BOOST_RATIO_STATIC_ASSERT(R::num == -1 && R::den == 2, NOTHING, ()); + } + { + typedef boost::ratio<-1, 2> R1; + typedef boost::ratio<1, 1> R2; + typedef boost::mpl::minus<R1, R2> R; + BOOST_RATIO_STATIC_ASSERT(R::num == -3 && R::den == 2, NOTHING, ()); + } + { + typedef boost::ratio<1, -2> R1; + typedef boost::ratio<1, 1> R2; + typedef boost::mpl::minus<R1, R2> R; + BOOST_RATIO_STATIC_ASSERT(R::num == -3 && R::den == 2, NOTHING, ()); + } + { + typedef boost::ratio<1, 2> R1; + typedef boost::ratio<-1, 1> R2; + typedef boost::mpl::minus<R1, R2> R; + BOOST_RATIO_STATIC_ASSERT(R::num == 3 && R::den == 2, NOTHING, ()); + } + { + typedef boost::ratio<1, 2> R1; + typedef boost::ratio<1, -1> R2; + typedef boost::mpl::minus<R1, R2> R; + BOOST_RATIO_STATIC_ASSERT(R::num == 3 && R::den == 2, NOTHING, ()); + } + { + typedef boost::ratio<56987354, 467584654> R1; + typedef boost::ratio<544668, 22145> R2; + typedef boost::mpl::minus<R1, R2> R; + BOOST_RATIO_STATIC_ASSERT(R::num == -126708206685271LL && R::den == 5177331081415LL, NOTHING, ()); + } +} diff --git a/src/boost/libs/ratio/test/ratio_extensions/mpl_negate_pass.cpp b/src/boost/libs/ratio/test/ratio_extensions/mpl_negate_pass.cpp new file mode 100644 index 00000000..87f75f30 --- /dev/null +++ b/src/boost/libs/ratio/test/ratio_extensions/mpl_negate_pass.cpp @@ -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. +// +//===----------------------------------------------------------------------===// +// Adaptation to Boost of the libcxx +// Copyright 2010 Vicente J. Botet Escriba +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// test mpl::negate + +#define BOOST_RATIO_EXTENSIONS + +#include <boost/ratio/mpl/negate.hpp> +#if !defined(BOOST_NO_CXX11_STATIC_ASSERT) +#define NOTHING "" +#endif + +void test() +{ + + { + typedef boost::ratio<0> R1; + typedef boost::mpl::negate<R1> R; + BOOST_RATIO_STATIC_ASSERT(R::num == 0 && R::den == 1, NOTHING, ()); + } + { + typedef boost::ratio<1, 1> R1; + typedef boost::mpl::negate<R1> R; + BOOST_RATIO_STATIC_ASSERT(R::num == -1 && R::den == 1, NOTHING, ()); + } + { + typedef boost::ratio<1, 2> R1; + typedef boost::mpl::negate<R1> R; + BOOST_RATIO_STATIC_ASSERT(R::num == -1 && R::den == 2, NOTHING, ()); + } + { + typedef boost::ratio<-1, 2> R1; + typedef boost::mpl::negate<R1> R; + BOOST_RATIO_STATIC_ASSERT(R::num == 1 && R::den == 2, NOTHING, ()); + } + { + typedef boost::ratio<1, -2> R1; + typedef boost::mpl::negate<R1> R; + BOOST_RATIO_STATIC_ASSERT(R::num == 1 && R::den == 2, NOTHING, ()); + } +} diff --git a/src/boost/libs/ratio/test/ratio_extensions/mpl_not_equal_to_pass.cpp b/src/boost/libs/ratio/test/ratio_extensions/mpl_not_equal_to_pass.cpp new file mode 100644 index 00000000..3e4c662d --- /dev/null +++ b/src/boost/libs/ratio/test/ratio_extensions/mpl_not_equal_to_pass.cpp @@ -0,0 +1,63 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// +// Adaptation to Boost of the libcxx +// Copyright 2010 Vicente J. Botet Escriba +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +#define BOOST_RATIO_EXTENSIONS + +#include <boost/ratio/mpl/not_equal_to.hpp> +#if !defined(BOOST_NO_CXX11_STATIC_ASSERT) +#define NOTHING "" +#endif + +void test() +{ + { + typedef boost::ratio<1, 1> R1; + typedef boost::ratio<1, 1> R2; + BOOST_RATIO_STATIC_ASSERT((!boost::mpl::not_equal_to<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R1; + typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R2; + BOOST_RATIO_STATIC_ASSERT((!boost::mpl::not_equal_to<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R1; + typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R2; + BOOST_RATIO_STATIC_ASSERT((!boost::mpl::not_equal_to<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R1; + typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R2; + BOOST_RATIO_STATIC_ASSERT((!boost::mpl::not_equal_to<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<1, 1> R1; + typedef boost::ratio<1, -1> R2; + BOOST_RATIO_STATIC_ASSERT((boost::mpl::not_equal_to<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R1; + typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R2; + BOOST_RATIO_STATIC_ASSERT((boost::mpl::not_equal_to<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R1; + typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R2; + BOOST_RATIO_STATIC_ASSERT((boost::mpl::not_equal_to<R1, R2>::value), NOTHING, ()); + } + { + typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R1; + typedef boost::ratio<1, -BOOST_RATIO_INTMAX_T_MAX> R2; + BOOST_RATIO_STATIC_ASSERT((boost::mpl::not_equal_to<R1, R2>::value), NOTHING, ()); + } +} diff --git a/src/boost/libs/ratio/test/ratio_extensions/mpl_plus_pass.cpp b/src/boost/libs/ratio/test/ratio_extensions/mpl_plus_pass.cpp new file mode 100644 index 00000000..ccf03c38 --- /dev/null +++ b/src/boost/libs/ratio/test/ratio_extensions/mpl_plus_pass.cpp @@ -0,0 +1,97 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// +// Adaptation to Boost of the libcxx +// Copyright 2010 Vicente J. Botet Escriba +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// test mpl::plus + +#define BOOST_RATIO_EXTENSIONS + +#include <boost/ratio/mpl/plus.hpp> +#if !defined(BOOST_NO_CXX11_STATIC_ASSERT) +#define NOTHING "" +#endif + +void test() +{ + { + typedef boost::ratio<1, 1> R1; + typedef boost::mpl::int_<1> R2; + typedef boost::mpl::plus<R1, R2> R; + BOOST_RATIO_STATIC_ASSERT(R::num == 2 && R::den == 1, NOTHING, ()); + typedef boost::mpl::plus<R, R2> RR; + BOOST_RATIO_STATIC_ASSERT(RR::num == 3 && RR::den == 1, NOTHING, ()); + } + { + typedef boost::mpl::int_<1> R1; + typedef boost::ratio<1, 2> R2; + typedef boost::mpl::plus<R1, R2> R; + BOOST_RATIO_STATIC_ASSERT(R::num == 3 && R::den == 2, NOTHING, ()); + } + { + typedef boost::ratio<-1, 2> R1; + typedef boost::ratio<1, 1> R2; + typedef boost::mpl::int_<0> R3; + typedef boost::mpl::plus<R1, R2, R3> R; + BOOST_RATIO_STATIC_ASSERT(R::num == 1 && R::den == 2, NOTHING, ()); + } + { + typedef boost::ratio<1, -2> R1; + typedef boost::ratio<1, 1> R2; + typedef boost::mpl::int_<0> R3; + typedef boost::mpl::plus<R1, R2, R3> R; + BOOST_RATIO_STATIC_ASSERT(R::num == 1 && R::den == 2, NOTHING, ()); + } + { + typedef boost::ratio<1, 2> R1; + typedef boost::ratio<-1, 1> R2; + typedef boost::mpl::int_<0> R3; + typedef boost::mpl::plus<R1, R2, R3> R; + BOOST_RATIO_STATIC_ASSERT(R::num == -1 && R::den == 2, NOTHING, ()); + } + { + typedef boost::ratio<1, 2> R1; + typedef boost::ratio<1, -1> R2; + typedef boost::mpl::int_<0> R3; + typedef boost::mpl::plus<R1, R2, R3> R; + BOOST_RATIO_STATIC_ASSERT(R::num == -1 && R::den == 2, NOTHING, ()); + } + { + typedef boost::ratio<56987354, 467584654> R1; + typedef boost::ratio<544668, 22145> R2; + typedef boost::mpl::int_<0> R3; + typedef boost::mpl::plus<R1, R2, R3> R; + BOOST_RATIO_STATIC_ASSERT(R::num == 127970191639601LL && R::den == 5177331081415LL, NOTHING, ()); + } + { + typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R1; + typedef boost::ratio<-1, 1> R2; + typedef boost::mpl::int_<0> R3; + typedef boost::mpl::plus<R1, R2, R3>::type RT; + } + +} + +boost::intmax_t func(boost::ratio<5,6> s) { + return s.num; +} + + +boost::intmax_t test_conversion() { + return func( + boost::mpl::plus< + boost::ratio<1,2>, + boost::ratio<1,3> + > + () + ); +} + diff --git a/src/boost/libs/ratio/test/ratio_extensions/mpl_rational_constant_pass.cpp b/src/boost/libs/ratio/test/ratio_extensions/mpl_rational_constant_pass.cpp new file mode 100644 index 00000000..57750a9c --- /dev/null +++ b/src/boost/libs/ratio/test/ratio_extensions/mpl_rational_constant_pass.cpp @@ -0,0 +1,13 @@ +//===----------------------------------------------------------------------===// +// Copyright 2011 Vicente J. Botet Escriba +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +#define BOOST_RATIO_EXTENSIONS + +#include <boost/ratio/mpl/comparison.hpp> + +void test() +{ + +} diff --git a/src/boost/libs/ratio/test/ratio_extensions/mpl_sign_pass.cpp b/src/boost/libs/ratio/test/ratio_extensions/mpl_sign_pass.cpp new file mode 100644 index 00000000..f78d2b4f --- /dev/null +++ b/src/boost/libs/ratio/test/ratio_extensions/mpl_sign_pass.cpp @@ -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. +// +//===----------------------------------------------------------------------===// +// Adaptation to Boost of the libcxx +// Copyright 2010 Vicente J. Botet Escriba +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// test mpl::sign + +#define BOOST_RATIO_EXTENSIONS + +#include <boost/ratio/mpl/sign.hpp> +#if !defined(BOOST_NO_CXX11_STATIC_ASSERT) +#define NOTHING "" +#endif + +void test() +{ + + { + typedef boost::ratio<0> R1; + typedef boost::mpl::sign<R1> R; + BOOST_RATIO_STATIC_ASSERT(R::value == 0, NOTHING, ()); + } + { + typedef boost::ratio<1, 1> R1; + typedef boost::mpl::sign<R1> R; + BOOST_RATIO_STATIC_ASSERT(R::value == 1, NOTHING, ()); + } + { + typedef boost::ratio<1, 2> R1; + typedef boost::mpl::sign<R1> R; + BOOST_RATIO_STATIC_ASSERT(R::value == 1, NOTHING, ()); + } + { + typedef boost::ratio<-1, 2> R1; + typedef boost::mpl::sign<R1> R; + BOOST_RATIO_STATIC_ASSERT(R::value == -1, NOTHING, ()); + } + { + typedef boost::ratio<1, -2> R1; + typedef boost::mpl::sign<R1> R; + BOOST_RATIO_STATIC_ASSERT(R::value == -1, NOTHING, ()); + } +} diff --git a/src/boost/libs/ratio/test/ratio_extensions/mpl_times_pass.cpp b/src/boost/libs/ratio/test/ratio_extensions/mpl_times_pass.cpp new file mode 100644 index 00000000..5f8a2a47 --- /dev/null +++ b/src/boost/libs/ratio/test/ratio_extensions/mpl_times_pass.cpp @@ -0,0 +1,67 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// +// Adaptation to Boost of the libcxx +// Copyright 2010 Vicente J. Botet Escriba +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// test mpl::times + +#define BOOST_RATIO_EXTENSIONS + +#include <boost/ratio/mpl/times.hpp> +#if !defined(BOOST_NO_CXX11_STATIC_ASSERT) +#define NOTHING "" +#endif + +void test() +{ + { + typedef boost::ratio<1, 1> R1; + typedef boost::ratio<1, 1> R2; + typedef boost::mpl::times<R1, R2> R; + BOOST_RATIO_STATIC_ASSERT(R::num == 1 && R::den == 1, NOTHING, ()); + } + { + typedef boost::ratio<1, 2> R1; + typedef boost::ratio<1, 1> R2; + typedef boost::mpl::times<R1, R2> R; + BOOST_RATIO_STATIC_ASSERT(R::num == 1 && R::den == 2, NOTHING, ()); + } + { + typedef boost::ratio<-1, 2> R1; + typedef boost::ratio<1, 1> R2; + typedef boost::mpl::times<R1, R2> R; + BOOST_RATIO_STATIC_ASSERT(R::num == -1 && R::den == 2, NOTHING, ()); + } + { + typedef boost::ratio<1, -2> R1; + typedef boost::ratio<1, 1> R2; + typedef boost::mpl::times<R1, R2> R; + BOOST_RATIO_STATIC_ASSERT(R::num == -1 && R::den == 2, NOTHING, ()); + } + { + typedef boost::ratio<1, 2> R1; + typedef boost::ratio<-1, 1> R2; + typedef boost::mpl::times<R1, R2> R; + BOOST_RATIO_STATIC_ASSERT(R::num == -1 && R::den == 2, NOTHING, ()); + } + { + typedef boost::ratio<1, 2> R1; + typedef boost::ratio<1, -1> R2; + typedef boost::mpl::times<R1, R2> R; + BOOST_RATIO_STATIC_ASSERT(R::num == -1 && R::den == 2, NOTHING, ()); + } + { + typedef boost::ratio<56987354, 467584654> R1; + typedef boost::ratio<544668, 22145> R2; + typedef boost::mpl::times<R1, R2> R; + BOOST_RATIO_STATIC_ASSERT(R::num == 15519594064236LL && R::den == 5177331081415LL, NOTHING, ()); + } +} diff --git a/src/boost/libs/ratio/test/ratio_extensions/ratio_ext_pass.cpp b/src/boost/libs/ratio/test/ratio_extensions/ratio_ext_pass.cpp new file mode 100644 index 00000000..a2fccff0 --- /dev/null +++ b/src/boost/libs/ratio/test/ratio_extensions/ratio_ext_pass.cpp @@ -0,0 +1,30 @@ +// Copyright 2011 Vicente J. Botet Escriba +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// test ratio: equivalent ratios convert with BOOST_RATIO_EXTENSIONS + +#define BOOST_RATIO_EXTENSIONS +#include <boost/ratio/ratio.hpp> +#include <boost/core/lightweight_test.hpp> + +boost::intmax_t func(boost::ratio<5,6> s); + +boost::intmax_t func(boost::ratio<5,6> s) { + return s.num; +} + +void test(); + +void test() { + boost::ratio<10,12> r; + BOOST_TEST(( + func(r)==5 + )); +} + +int main() +{ + test(); + return boost::report_errors(); +} |