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_equal
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_equal<R1, R2>::value), "");
20     }
21     {
22     typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
23     typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
24     static_assert((std::ratio_equal<R1, R2>::value), "");
25     }
26     {
27     typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
28     typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
29     static_assert((std::ratio_equal<R1, R2>::value), "");
30     }
31     {
32     typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
33     typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R2;
34     static_assert((std::ratio_equal<R1, R2>::value), "");
35     }
36     {
37     typedef std::ratio<1, 1> R1;
38     typedef std::ratio<1, -1> R2;
39     static_assert((!std::ratio_equal<R1, R2>::value), "");
40     }
41     {
42     typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
43     typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
44     static_assert((!std::ratio_equal<R1, R2>::value), "");
45     }
46     {
47     typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
48     typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
49     static_assert((!std::ratio_equal<R1, R2>::value), "");
50     }
51     {
52     typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
53     typedef std::ratio<1, -0x7FFFFFFFFFFFFFFFLL> R2;
54     static_assert((!std::ratio_equal<R1, R2>::value), "");
55     }
56 }
57