• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #define BOOST_RATIO_EXTENSIONS
15 
16 #include <boost/ratio/mpl/less.hpp>
17 #if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
18 #define NOTHING ""
19 #endif
20 
test()21 void test()
22 {
23     {
24     typedef boost::ratio<1, 1> R1;
25     typedef boost::ratio<1, 1> R2;
26     BOOST_RATIO_STATIC_ASSERT((!boost::mpl::less<R1, R2>::value), NOTHING, ());
27     }
28     {
29     typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R1;
30     typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R2;
31     BOOST_RATIO_STATIC_ASSERT((!boost::mpl::less<R1, R2>::value), NOTHING, ());
32     }
33     {
34     typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R1;
35     typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R2;
36     BOOST_RATIO_STATIC_ASSERT((!boost::mpl::less<R1, R2>::value), NOTHING, ());
37     }
38     {
39     typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R1;
40     typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R2;
41     BOOST_RATIO_STATIC_ASSERT((!boost::mpl::less<R1, R2>::value), NOTHING, ());
42     }
43     {
44     typedef boost::ratio<1, 1> R1;
45     typedef boost::ratio<1, -1> R2;
46     BOOST_RATIO_STATIC_ASSERT((!boost::mpl::less<R1, R2>::value), NOTHING, ());
47     }
48     {
49     typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R1;
50     typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R2;
51     BOOST_RATIO_STATIC_ASSERT((!boost::mpl::less<R1, R2>::value), NOTHING, ());
52     }
53     {
54     typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 1> R1;
55     typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 1> R2;
56     BOOST_RATIO_STATIC_ASSERT((boost::mpl::less<R1, R2>::value), NOTHING, ());
57     }
58     {
59     typedef boost::ratio<1, BOOST_RATIO_INTMAX_T_MAX> R1;
60     typedef boost::ratio<1, -BOOST_RATIO_INTMAX_T_MAX> R2;
61     BOOST_RATIO_STATIC_ASSERT((!boost::mpl::less<R1, R2>::value), NOTHING, ());
62     }
63     {
64     typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 0x7FFFFFFFFFFFFFFELL> R1;
65     typedef boost::ratio<0x7FFFFFFFFFFFFFFDLL, 0x7FFFFFFFFFFFFFFCLL> R2;
66     BOOST_RATIO_STATIC_ASSERT((boost::mpl::less<R1, R2>::value), NOTHING, ());
67     }
68     {
69     typedef boost::ratio<0x7FFFFFFFFFFFFFFDLL, 0x7FFFFFFFFFFFFFFCLL> R1;
70     typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 0x7FFFFFFFFFFFFFFELL> R2;
71     BOOST_RATIO_STATIC_ASSERT((!boost::mpl::less<R1, R2>::value), NOTHING, ());
72     }
73     {
74     typedef boost::ratio<-0x7FFFFFFFFFFFFFFDLL, 0x7FFFFFFFFFFFFFFCLL> R1;
75     typedef boost::ratio<-BOOST_RATIO_INTMAX_T_MAX, 0x7FFFFFFFFFFFFFFELL> R2;
76     BOOST_RATIO_STATIC_ASSERT((boost::mpl::less<R1, R2>::value), NOTHING, ());
77     }
78     {
79     typedef boost::ratio<BOOST_RATIO_INTMAX_T_MAX, 0x7FFFFFFFFFFFFFFELL> R1;
80     typedef boost::ratio<0x7FFFFFFFFFFFFFFELL, 0x7FFFFFFFFFFFFFFDLL> R2;
81     BOOST_RATIO_STATIC_ASSERT((boost::mpl::less<R1, R2>::value), NOTHING, ());
82     }
83     {
84     typedef boost::ratio<641981, 1339063> R1;
85     typedef boost::ratio<1291640, 2694141LL> R2;
86     BOOST_RATIO_STATIC_ASSERT((!boost::mpl::less<R1, R2>::value), NOTHING, ());
87     }
88     {
89     typedef boost::ratio<1291640, 2694141LL> R1;
90     typedef boost::ratio<641981, 1339063> R2;
91     BOOST_RATIO_STATIC_ASSERT((boost::mpl::less<R1, R2>::value), NOTHING, ());
92     }
93 }
94