]>
Commit | Line | Data |
---|---|---|
be58e01d | 1 | // { dg-do run { target c++11 } } |
b1098305 | 2 | |
3 | // 2008-07-03 Chris Fairles <chris.fairles@gmail.com> | |
4 | ||
fbd26352 | 5 | // Copyright (C) 2008-2019 Free Software Foundation, Inc. |
b1098305 | 6 | // |
7 | // This file is part of the GNU ISO C++ Library. This library is free | |
8 | // software; you can redistribute it and/or modify it under the | |
9 | // terms of the GNU General Public License as published by the | |
6bc9506f | 10 | // Free Software Foundation; either version 3, or (at your option) |
b1098305 | 11 | // any later version. |
12 | ||
13 | // This library is distributed in the hope that it will be useful, | |
14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | // GNU General Public License for more details. | |
17 | ||
18 | // You should have received a copy of the GNU General Public License | |
6bc9506f | 19 | // along with this library; see the file COPYING3. If not see |
20 | // <http://www.gnu.org/licenses/>. | |
b1098305 | 21 | |
22 | #include <ratio> | |
23 | #include <testsuite_hooks.h> | |
24 | ||
b1098305 | 25 | void |
26 | test01() | |
27 | { | |
b1098305 | 28 | std::ratio_add<std::ratio<3,8>, std::ratio<5,12>>::type r; |
29 | ||
652b2fbd | 30 | VERIFY( r.num == 19 ); |
31 | VERIFY( r.den == 24 ); | |
b1098305 | 32 | } |
33 | ||
34 | void | |
35 | test02() | |
36 | { | |
b1098305 | 37 | std::ratio_subtract<std::ratio<3,8>, std::ratio<5,12>>::type r; |
38 | ||
652b2fbd | 39 | VERIFY( r.num == -1 ); |
40 | VERIFY( r.den == 24 ); | |
b1098305 | 41 | } |
42 | ||
43 | void | |
44 | test03() | |
45 | { | |
b1098305 | 46 | std::ratio_multiply<std::ratio<3,8>, std::ratio<5,12>>::type r; |
47 | ||
652b2fbd | 48 | VERIFY( r.num == 5 ); |
49 | VERIFY( r.den == 32 ); | |
b1098305 | 50 | } |
51 | ||
52 | void | |
53 | test04() | |
54 | { | |
b1098305 | 55 | std::ratio_divide<std::ratio<3,8>, std::ratio<5,12>>::type r; |
56 | ||
652b2fbd | 57 | VERIFY( r.num == 9 ); |
58 | VERIFY( r.den == 10 ); | |
b1098305 | 59 | } |
60 | ||
b1098305 | 61 | int main() |
62 | { | |
b1098305 | 63 | test01(); |
64 | test02(); | |
65 | test03(); | |
66 | test04(); | |
b1098305 | 67 | return 0; |
68 | } |