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 
10 // test ratio_less
11 
12 #include <ratio>
13 
main()14 int main()
15 {
16     {
17     typedef std::ratio<1, 1> R1;
18     typedef std::ratio<1, 1> R2;
19     static_assert((!std::ratio_less<R1, R2>::value), "");
20     }
21     {
22     typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
23     typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
24     static_assert((!std::ratio_less<R1, R2>::value), "");
25     }
26     {
27     typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
28     typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
29     static_assert((!std::ratio_less<R1, R2>::value), "");
30     }
31     {
32     typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
33     typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R2;
34     static_assert((!std::ratio_less<R1, R2>::value), "");
35     }
36     {
37     typedef std::ratio<1, 1> R1;
38     typedef std::ratio<1, -1> R2;
39     static_assert((!std::ratio_less<R1, R2>::value), "");
40     }
41     {
42     typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
43     typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
44     static_assert((!std::ratio_less<R1, R2>::value), "");
45     }
46     {
47     typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
48     typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
49     static_assert((std::ratio_less<R1, R2>::value), "");
50     }
51     {
52     typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
53     typedef std::ratio<1, -0x7FFFFFFFFFFFFFFFLL> R2;
54     static_assert((!std::ratio_less<R1, R2>::value), "");
55     }
56     {
57     typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFELL> R1;
58     typedef std::ratio<0x7FFFFFFFFFFFFFFDLL, 0x7FFFFFFFFFFFFFFCLL> R2;
59     static_assert((std::ratio_less<R1, R2>::value), "");
60     }
61     {
62     typedef std::ratio<0x7FFFFFFFFFFFFFFDLL, 0x7FFFFFFFFFFFFFFCLL> R1;
63     typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFELL> R2;
64     static_assert((!std::ratio_less<R1, R2>::value), "");
65     }
66     {
67     typedef std::ratio<-0x7FFFFFFFFFFFFFFDLL, 0x7FFFFFFFFFFFFFFCLL> R1;
68     typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFELL> R2;
69     static_assert((std::ratio_less<R1, R2>::value), "");
70     }
71     {
72     typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFELL> R1;
73     typedef std::ratio<0x7FFFFFFFFFFFFFFELL, 0x7FFFFFFFFFFFFFFDLL> R2;
74     static_assert((std::ratio_less<R1, R2>::value), "");
75     }
76     {
77     typedef std::ratio<641981, 1339063> R1;
78     typedef std::ratio<1291640, 2694141LL> R2;
79     static_assert((!std::ratio_less<R1, R2>::value), "");
80     }
81     {
82     typedef std::ratio<1291640, 2694141LL> R1;
83     typedef std::ratio<641981, 1339063> R2;
84     static_assert((std::ratio_less<R1, R2>::value), "");
85     }
86 }
87