1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
13 #include "test_macros.h"
18 typedef std::ratio
<1, 1> R1
;
19 typedef std::ratio
<1, 1> R2
;
20 typedef std::ratio_divide
<R1
, R2
>::type R
;
21 static_assert(R::num
== 1 && R::den
== 1, "");
24 typedef std::ratio
<1, 2> R1
;
25 typedef std::ratio
<1, 1> R2
;
26 typedef std::ratio_divide
<R1
, R2
>::type R
;
27 static_assert(R::num
== 1 && R::den
== 2, "");
30 typedef std::ratio
<-1, 2> R1
;
31 typedef std::ratio
<1, 1> R2
;
32 typedef std::ratio_divide
<R1
, R2
>::type R
;
33 static_assert(R::num
== -1 && R::den
== 2, "");
36 typedef std::ratio
<1, -2> R1
;
37 typedef std::ratio
<1, 1> R2
;
38 typedef std::ratio_divide
<R1
, R2
>::type R
;
39 static_assert(R::num
== -1 && R::den
== 2, "");
42 typedef std::ratio
<1, 2> R1
;
43 typedef std::ratio
<-1, 1> R2
;
44 typedef std::ratio_divide
<R1
, R2
>::type R
;
45 static_assert(R::num
== -1 && R::den
== 2, "");
48 typedef std::ratio
<1, 2> R1
;
49 typedef std::ratio
<1, -1> R2
;
50 typedef std::ratio_divide
<R1
, R2
>::type R
;
51 static_assert(R::num
== -1 && R::den
== 2, "");
54 typedef std::ratio
<56987354, 467584654> R1
;
55 typedef std::ratio
<544668, 22145> R2
;
56 typedef std::ratio_divide
<R1
, R2
>::type R
;
57 static_assert(R::num
== 630992477165LL && R::den
== 127339199162436LL, "");