Imported Upstream version 1.57.0
[platform/upstream/boost.git] / libs / ratio / test / ratio_extensions / mpl_times_pass.cpp
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 //  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
13
14 // test mpl::times
15
16 #define BOOST_RATIO_EXTENSIONS
17
18 #include <boost/ratio/mpl/times.hpp>
19 #if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
20 #define NOTHING ""
21 #endif
22
23 void test()
24 {
25     {
26     typedef boost::ratio<1, 1> R1;
27     typedef boost::ratio<1, 1> R2;
28     typedef boost::mpl::times<R1, R2> R;
29     BOOST_RATIO_STATIC_ASSERT(R::num == 1 && R::den == 1, NOTHING, ());
30     }
31     {
32     typedef boost::ratio<1, 2> R1;
33     typedef boost::ratio<1, 1> R2;
34     typedef boost::mpl::times<R1, R2> R;
35     BOOST_RATIO_STATIC_ASSERT(R::num == 1 && R::den == 2, NOTHING, ());
36     }
37     {
38     typedef boost::ratio<-1, 2> R1;
39     typedef boost::ratio<1, 1> R2;
40     typedef boost::mpl::times<R1, R2> R;
41     BOOST_RATIO_STATIC_ASSERT(R::num == -1 && R::den == 2, NOTHING, ());
42     }
43     {
44     typedef boost::ratio<1, -2> R1;
45     typedef boost::ratio<1, 1> R2;
46     typedef boost::mpl::times<R1, R2> R;
47     BOOST_RATIO_STATIC_ASSERT(R::num == -1 && R::den == 2, NOTHING, ());
48     }
49     {
50     typedef boost::ratio<1, 2> R1;
51     typedef boost::ratio<-1, 1> R2;
52     typedef boost::mpl::times<R1, R2> R;
53     BOOST_RATIO_STATIC_ASSERT(R::num == -1 && R::den == 2, NOTHING, ());
54     }
55     {
56     typedef boost::ratio<1, 2> R1;
57     typedef boost::ratio<1, -1> R2;
58     typedef boost::mpl::times<R1, R2> R;
59     BOOST_RATIO_STATIC_ASSERT(R::num == -1 && R::den == 2, NOTHING, ());
60     }
61     {
62     typedef boost::ratio<56987354, 467584654> R1;
63     typedef boost::ratio<544668, 22145> R2;
64     typedef boost::mpl::times<R1, R2> R;
65     BOOST_RATIO_STATIC_ASSERT(R::num == 15519594064236LL && R::den == 5177331081415LL, NOTHING, ());
66     }
67 }