dbe6a5373b63b19f9d9b6a99c8135cd93e1ff395
[platform/upstream/boost.git] / libs / ratio / test / ratio_comparison / ratio_greater_equal_pass.cpp
1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //  Adaptation to Boost of the libcxx
10 //  Copyright 2010 Vicente J. Botet Escriba
11 //  Distributed under the Boost Software License, Version 1.0.
12 //  See http://www.boost.org/LICENSE_1_0.txt
13
14 #include <boost/ratio/ratio.hpp>
15 #if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
16 #define NOTHING ""
17 #endif
18
19
20 void test()
21 {
22     {
23     typedef boost::ratio<1, 1> R1;
24     typedef boost::ratio<1, 1> R2;
25     BOOST_RATIO_STATIC_ASSERT((boost::ratio_greater_equal<R1, R2>::value), NOTHING, ());
26     }
27     {
28     typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R1;
29     typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R2;
30     BOOST_RATIO_STATIC_ASSERT((boost::ratio_greater_equal<R1, R2>::value), NOTHING, ());
31     }
32     {
33     typedef boost::ratio<1,BOOST_RATIO_INTMAX_T_MAX> R1;
34     typedef boost::ratio<1,BOOST_RATIO_INTMAX_T_MAX> R2;
35     BOOST_RATIO_STATIC_ASSERT((boost::ratio_greater_equal<R1, R2>::value), NOTHING, ());
36     }
37     {
38     typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R1;
39     typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R2;
40     BOOST_RATIO_STATIC_ASSERT((boost::ratio_greater_equal<R1, R2>::value), NOTHING, ());
41     }
42     {
43     typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R1;
44     typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R2;
45     BOOST_RATIO_STATIC_ASSERT((boost::ratio_greater_equal<R1, R2>::value), NOTHING, ());
46     }
47     {
48     typedef boost::ratio<1, 1> R1;
49     typedef boost::ratio<1, -1> R2;
50     BOOST_RATIO_STATIC_ASSERT((boost::ratio_greater_equal<R1, R2>::value), NOTHING, ());
51     }
52     {
53     typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R1;
54     typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R2;
55     BOOST_RATIO_STATIC_ASSERT((boost::ratio_greater_equal<R1, R2>::value), NOTHING, ());
56     }
57     {
58     typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R1;
59     typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R2;
60     BOOST_RATIO_STATIC_ASSERT((!boost::ratio_greater_equal<R1, R2>::value), NOTHING, ());
61     }
62     {
63     typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R1;
64     typedef boost::ratio<1, -BOOST_RATIO_INTMAX_T_MAX> R2;
65     BOOST_RATIO_STATIC_ASSERT((boost::ratio_greater_equal<R1, R2>::value), NOTHING, ());
66     }
67 }