Imported Upstream version 4.8.1
[platform/upstream/gcc48.git] / libstdc++-v3 / testsuite / 20_util / ratio / comparisons / comp3.cc
1 // { dg-options "-std=gnu++0x" }
2 // { dg-require-cstdint "" }
3
4 // 2011-02-28  Paolo Carlini  <paolo.carlini@oracle.com>
5
6 // Copyright (C) 2011-2013 Free Software Foundation, Inc.
7 //
8 // This file is part of the GNU ISO C++ Library.  This library is free
9 // software; you can redistribute it and/or modify it under the
10 // terms of the GNU General Public License as published by the
11 // Free Software Foundation; either version 3, or (at your option)
12 // any later version.
13
14 // This library is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 // GNU General Public License for more details.
18
19 // You should have received a copy of the GNU General Public License
20 // along with this library; see the file COPYING3.  If not see
21 // <http://www.gnu.org/licenses/>.
22
23 #include <ratio>
24 #include <testsuite_hooks.h>
25
26 void
27 test01()
28 {
29   bool test __attribute__((unused)) = true;
30
31   VERIFY( (std::ratio_less<std::ratio<59, 29131>,
32                            std::ratio<59, 29129>>::value == 1) );
33   VERIFY( (std::ratio_less<std::ratio<4733, 13>,
34                            std::ratio<4751, 13>>::value == 1) );
35   VERIFY( (std::ratio_less<std::ratio<25703, 25717>,
36                            std::ratio<25733, 25741>>::value == 1) );
37   VERIFY( (std::ratio_less<std::ratio<631, 769>,
38                            std::ratio<673, 773>>::value == 1) );
39   VERIFY( (std::ratio_less<std::ratio<8353, 16903>,
40                            std::ratio<17891, 32099>>::value == 1) );
41   VERIFY( (std::ratio_less<std::ratio<2311, 18701>,
42                            std::ratio<18457, 19571>>::value == 1) );
43
44   VERIFY( (std::ratio_less<std::ratio<60, 29132>,
45                            std::ratio<60, 29130>>::value == 1) );
46   VERIFY( (std::ratio_less<std::ratio<4734, 14>,
47                            std::ratio<4752, 14>>::value == 1) );
48   VERIFY( (std::ratio_less<std::ratio<25704, 25718>,
49                            std::ratio<25732, 25742>>::value == 1) );
50   VERIFY( (std::ratio_less<std::ratio<632, 770>,
51                            std::ratio<674, 774>>::value == 1) );
52   VERIFY( (std::ratio_less<std::ratio<8352, 16904>,
53                            std::ratio<17892, 32100>>::value == 1) );
54   VERIFY( (std::ratio_less<std::ratio<2312, 18702>,
55                            std::ratio<18458, 19572>>::value == 1) );
56
57   VERIFY( (std::ratio_less<std::ratio<58, 29130>,
58                            std::ratio<58, 29128>>::value == 1) );
59   VERIFY( (std::ratio_less<std::ratio<4732, 12>,
60                            std::ratio<4750, 12>>::value == 1) );
61   VERIFY( (std::ratio_less<std::ratio<25702, 25716>,
62                            std::ratio<25734, 25740>>::value == 1) );
63   VERIFY( (std::ratio_less<std::ratio<630, 768>,
64                            std::ratio<672, 772>>::value == 1) );
65   VERIFY( (std::ratio_less<std::ratio<8354, 16902>,
66                            std::ratio<17890, 32102>>::value == 1) );
67   VERIFY( (std::ratio_less<std::ratio<2310, 18700>,
68                            std::ratio<18456, 19570>>::value == 1) );
69 }
70
71 int main()
72 {
73   test01();
74   return 0;
75 }