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_divide
11
12#include <ratio>
13
14int main()
15{
16    {
17    typedef std::ratio<1, 1> R1;
18    typedef std::ratio<1, 1> R2;
19    typedef std::ratio_divide<R1, R2>::type R;
20    static_assert(R::num == 1 && R::den == 1, "");
21    }
22    {
23    typedef std::ratio<1, 2> R1;
24    typedef std::ratio<1, 1> R2;
25    typedef std::ratio_divide<R1, R2>::type R;
26    static_assert(R::num == 1 && R::den == 2, "");
27    }
28    {
29    typedef std::ratio<-1, 2> R1;
30    typedef std::ratio<1, 1> R2;
31    typedef std::ratio_divide<R1, R2>::type R;
32    static_assert(R::num == -1 && R::den == 2, "");
33    }
34    {
35    typedef std::ratio<1, -2> R1;
36    typedef std::ratio<1, 1> R2;
37    typedef std::ratio_divide<R1, R2>::type R;
38    static_assert(R::num == -1 && R::den == 2, "");
39    }
40    {
41    typedef std::ratio<1, 2> R1;
42    typedef std::ratio<-1, 1> R2;
43    typedef std::ratio_divide<R1, R2>::type R;
44    static_assert(R::num == -1 && R::den == 2, "");
45    }
46    {
47    typedef std::ratio<1, 2> R1;
48    typedef std::ratio<1, -1> R2;
49    typedef std::ratio_divide<R1, R2>::type R;
50    static_assert(R::num == -1 && R::den == 2, "");
51    }
52    {
53    typedef std::ratio<56987354, 467584654> R1;
54    typedef std::ratio<544668, 22145> R2;
55    typedef std::ratio_divide<R1, R2>::type R;
56    static_assert(R::num == 630992477165LL && R::den == 127339199162436LL, "");
57    }
58}
59