]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/ratio/test/ratio_arithmetic/ratio_multiply_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
14 // test ratio_multiply
16 #include <boost/ratio/ratio.hpp>
17 #if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
24 typedef boost::ratio
<1, 1> R1
;
25 typedef boost::ratio
<1, 1> R2
;
26 typedef boost::ratio_multiply
<R1
, R2
> R
;
27 BOOST_RATIO_STATIC_ASSERT(R::num
== 1 && R::den
== 1, NOTHING
, ());
30 typedef boost::ratio
<1, 2> R1
;
31 typedef boost::ratio
<1, 1> R2
;
32 typedef boost::ratio_multiply
<R1
, R2
> R
;
33 BOOST_RATIO_STATIC_ASSERT(R::num
== 1 && R::den
== 2, NOTHING
, ());
36 typedef boost::ratio
<-1, 2> R1
;
37 typedef boost::ratio
<1, 1> R2
;
38 typedef boost::ratio_multiply
<R1
, R2
> R
;
39 BOOST_RATIO_STATIC_ASSERT(R::num
== -1 && R::den
== 2, NOTHING
, ());
42 typedef boost::ratio
<1, -2> R1
;
43 typedef boost::ratio
<1, 1> R2
;
44 typedef boost::ratio_multiply
<R1
, R2
> R
;
45 BOOST_RATIO_STATIC_ASSERT(R::num
== -1 && R::den
== 2, NOTHING
, ());
48 typedef boost::ratio
<1, 2> R1
;
49 typedef boost::ratio
<-1, 1> R2
;
50 typedef boost::ratio_multiply
<R1
, R2
> R
;
51 BOOST_RATIO_STATIC_ASSERT(R::num
== -1 && R::den
== 2, NOTHING
, ());
54 typedef boost::ratio
<1, 2> R1
;
55 typedef boost::ratio
<1, -1> R2
;
56 typedef boost::ratio_multiply
<R1
, R2
> R
;
57 BOOST_RATIO_STATIC_ASSERT(R::num
== -1 && R::den
== 2, NOTHING
, ());
60 typedef boost::ratio
<56987354, 467584654> R1
;
61 typedef boost::ratio
<544668, 22145> R2
;
62 typedef boost::ratio_multiply
<R1
, R2
> R
;
63 BOOST_RATIO_STATIC_ASSERT(R::num
== 15519594064236LL && R::den
== 5177331081415LL, NOTHING
, ());