]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/ratio/test/ratio_arithmetic/ratio_add_pass.cpp
1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
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
16 #include <boost/ratio/ratio.hpp>
17 #if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
24 typedef boost::ratio
<0> R1
;
25 typedef boost::ratio
<0> R2
;
26 typedef boost::ratio_add
<R1
, R2
> R
;
27 BOOST_RATIO_STATIC_ASSERT(R::num
== 0 && R::den
== 1, NOTHING
, ());
30 typedef boost::ratio
<1, 1> R1
;
31 typedef boost::ratio
<1, 1> R2
;
32 typedef boost::ratio_add
<R1
, R2
> R
;
33 BOOST_RATIO_STATIC_ASSERT(R::num
== 2 && R::den
== 1, NOTHING
, ());
34 typedef boost::ratio_add
<R
, R2
> RR
;
35 BOOST_RATIO_STATIC_ASSERT(RR::num
== 3 && RR::den
== 1, NOTHING
, ());
38 typedef boost::ratio
<1, 2> R1
;
39 typedef boost::ratio
<1, 1> R2
;
40 typedef boost::ratio_add
<R1
, R2
> R
;
41 BOOST_RATIO_STATIC_ASSERT(R::num
== 3 && R::den
== 2, NOTHING
, ());
44 typedef boost::ratio
<-1, 2> R1
;
45 typedef boost::ratio
<1, 1> R2
;
46 typedef boost::ratio_add
<R1
, R2
> R
;
47 BOOST_RATIO_STATIC_ASSERT(R::num
== 1 && R::den
== 2, NOTHING
, ());
50 typedef boost::ratio
<1, -2> R1
;
51 typedef boost::ratio
<1, 1> R2
;
52 typedef boost::ratio_add
<R1
, R2
> R
;
53 BOOST_RATIO_STATIC_ASSERT(R::num
== 1 && R::den
== 2, NOTHING
, ());
56 typedef boost::ratio
<1, 2> R1
;
57 typedef boost::ratio
<-1, 1> R2
;
58 typedef boost::ratio_add
<R1
, R2
> R
;
59 BOOST_RATIO_STATIC_ASSERT(R::num
== -1 && R::den
== 2, NOTHING
, ());
62 typedef boost::ratio
<1, 2> R1
;
63 typedef boost::ratio
<1, -1> R2
;
64 typedef boost::ratio_add
<R1
, R2
> R
;
65 BOOST_RATIO_STATIC_ASSERT(R::num
== -1 && R::den
== 2, NOTHING
, ());
68 typedef boost::ratio
<56987354, 467584654> R1
;
69 typedef boost::ratio
<544668, 22145> R2
;
70 typedef boost::ratio_add
<R1
, R2
> R
;
71 BOOST_RATIO_STATIC_ASSERT(R::num
== 127970191639601LL && R::den
== 5177331081415LL, NOTHING
, ());
74 typedef boost::ratio
<BOOST_RATIO_INTMAX_T_MAX
, 1> R1
;
75 typedef boost::ratio
<-1, 1> R2
;
76 typedef boost::ratio_add
<R1
, R2
>::type RT
;
81 boost::intmax_t func(boost::ratio
<5,6> s
) {
86 boost::intmax_t test_conversion() {