]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/20_util/ratio/comparisons/comp1.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 20_util / ratio / comparisons / comp1.cc
CommitLineData
52066eae 1// { dg-do run { target c++11 } }
4acedca1 2
8d9254fc 3// Copyright (C) 2008-2020 Free Software Foundation, Inc.
4acedca1
CF
4//
5// This file is part of the GNU ISO C++ Library. This library is free
6// software; you can redistribute it and/or modify it under the
7// terms of the GNU General Public License as published by the
748086b7 8// Free Software Foundation; either version 3, or (at your option)
4acedca1
CF
9// any later version.
10
11// This library is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15
16// You should have received a copy of the GNU General Public License
748086b7
JJ
17// along with this library; see the file COPYING3. If not see
18// <http://www.gnu.org/licenses/>.
4acedca1
CF
19
20#include <ratio>
21#include <testsuite_hooks.h>
22
4acedca1
CF
23void
24test01()
25{
4acedca1
CF
26 VERIFY(( std::ratio_equal<std::ratio<2,6>, std::ratio<1,3>>::value == 1 ));
27 VERIFY(( std::ratio_equal<std::ratio<2,6>, std::ratio<1,4>>::value == 0 ));
28
a7543cfd
PC
29 VERIFY( (std::ratio_not_equal<std::ratio<2,6>,
30 std::ratio<1,3>>::value == 0) );
31 VERIFY( (std::ratio_not_equal<std::ratio<2,6>,
32 std::ratio<1,4>>::value == 1) );
4acedca1
CF
33}
34
35void
36test02()
37{
a7543cfd
PC
38 VERIFY( (std::ratio_less<std::ratio<1,4>, std::ratio<1,3>>::value == 1) );
39 VERIFY( (std::ratio_less<std::ratio<-1,3>, std::ratio<1,3>>::value == 1) );
4acedca1 40
a7543cfd
PC
41 VERIFY( (std::ratio_less<std::ratio<1,3>, std::ratio<1,4>>::value == 0) );
42 VERIFY( (std::ratio_less<std::ratio<1,3>, std::ratio<-1,3>>::value == 0) );
cd6b4a4b
PC
43
44 VERIFY( (std::ratio_less<std::ratio<-1,3>, std::ratio<-1,4>>::value == 1) );
45 VERIFY( (std::ratio_less<std::ratio<0,4>, std::ratio<0,3>>::value == 0) );
46 VERIFY( (std::ratio_less<std::ratio<1,3>, std::ratio<0,3>>::value == 0) );
47 VERIFY( (std::ratio_less<std::ratio<0,3>, std::ratio<-1,4>>::value == 0) );
48
a7543cfd
PC
49 VERIFY( (std::ratio_less_equal<std::ratio<-1,3>,
50 std::ratio<-1,3>>::value == 1) );
51 VERIFY( ( std::ratio_less_equal<std::ratio<1,4>,
52 std::ratio<1,3>>::value == 1) );
4acedca1 53
a7543cfd
PC
54 VERIFY( (std::ratio_less_equal<std::ratio<1,4>,
55 std::ratio<-1,3>>::value == 0) );
56 VERIFY( (std::ratio_less_equal<std::ratio<1,3>,
57 std::ratio<-1,3>>::value == 0) );
4acedca1 58
a7543cfd
PC
59 VERIFY( (std::ratio_greater<std::ratio<1,3>, std::ratio<1,4>>::value == 1) );
60 VERIFY( (std::ratio_greater<std::ratio<1,3>, std::ratio<-1,3>>::value == 1) );
4acedca1 61
a7543cfd
PC
62 VERIFY( (std::ratio_greater<std::ratio<1,4>, std::ratio<1,3>>::value == 0) );
63 VERIFY( (std::ratio_greater<std::ratio<-1,3>, std::ratio<1,3>>::value == 0) );
4acedca1 64
a7543cfd
PC
65 VERIFY( (std::ratio_greater_equal<std::ratio<1,3>,
66 std::ratio<1,3>>::value == 1) );
67 VERIFY( (std::ratio_greater_equal<std::ratio<1,3>,
68 std::ratio<-1,3>>::value == 1) );
4acedca1 69
a7543cfd
PC
70 VERIFY( (std::ratio_greater_equal<std::ratio<-1,3>,
71 std::ratio<1,3>>::value == 0) );
72 VERIFY( (std::ratio_greater_equal<std::ratio<1,4>,
73 std::ratio<1,3>>::value == 0) );
74}
4acedca1
CF
75
76int main()
77{
4acedca1
CF
78 test01();
79 test02();
4acedca1
CF
80 return 0;
81}