]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/20_util/ratio/operations/ops1.cc
Update copyright years in libstdc++-v3/
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 20_util / ratio / operations / ops1.cc
CommitLineData
4acedca1 1// { dg-options "-std=gnu++0x" }
a7543cfd 2// { dg-require-cstdint "" }
4acedca1
CF
3
4// 2008-07-03 Chris Fairles <chris.fairles@gmail.com>
5
aa118a03 6// Copyright (C) 2008-2014 Free Software Foundation, Inc.
4acedca1
CF
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
748086b7 11// Free Software Foundation; either version 3, or (at your option)
4acedca1
CF
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
748086b7
JJ
20// along with this library; see the file COPYING3. If not see
21// <http://www.gnu.org/licenses/>.
4acedca1
CF
22
23#include <ratio>
24#include <testsuite_hooks.h>
25
4acedca1
CF
26void
27test01()
28{
29 bool test __attribute__((unused)) = true;
30
31 std::ratio_add<std::ratio<3,8>, std::ratio<5,12>>::type r;
32
a7543cfd
PC
33 VERIFY( r.num == 19 );
34 VERIFY( r.den == 24 );
4acedca1
CF
35}
36
37void
38test02()
39{
40 bool test __attribute__((unused)) = true;
41 std::ratio_subtract<std::ratio<3,8>, std::ratio<5,12>>::type r;
42
a7543cfd
PC
43 VERIFY( r.num == -1 );
44 VERIFY( r.den == 24 );
4acedca1
CF
45}
46
47void
48test03()
49{
50 bool test __attribute__((unused)) = true;
51 std::ratio_multiply<std::ratio<3,8>, std::ratio<5,12>>::type r;
52
a7543cfd
PC
53 VERIFY( r.num == 5 );
54 VERIFY( r.den == 32 );
4acedca1
CF
55}
56
57void
58test04()
59{
60 bool test __attribute__((unused)) = true;
61 std::ratio_divide<std::ratio<3,8>, std::ratio<5,12>>::type r;
62
a7543cfd
PC
63 VERIFY( r.num == 9 );
64 VERIFY( r.den == 10 );
4acedca1
CF
65}
66
4acedca1
CF
67int main()
68{
4acedca1
CF
69 test01();
70 test02();
71 test03();
72 test04();
4acedca1
CF
73 return 0;
74}