libstdc++.exp (check_v3_target_stdint): New.
[official-gcc.git] / libstdc++-v3 / testsuite / 20_util / ratio / comparisons / comp1.cc
blobc916b3099984089da00205f6319a1d278e73a61f
1 // { dg-options "-std=gnu++0x" }
2 // { dg-require-cstdint "" }
4 // Copyright (C) 2008 Free Software Foundation
5 //
6 // This file is part of the GNU ISO C++ Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 2, or (at your option)
10 // any later version.
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this library; see the file COPYING. If not, write to
19 // the Free Software Foundation, 51 Franklin Street, Fifth Floor,
20 // Boston, MA 02110-1301, USA.
22 #include <ratio>
23 #include <testsuite_hooks.h>
25 void
26 test01()
28 bool test __attribute__((unused)) = true;
30 VERIFY(( std::ratio_equal<std::ratio<2,6>, std::ratio<1,3>>::value == 1 ));
31 VERIFY(( std::ratio_equal<std::ratio<2,6>, std::ratio<1,4>>::value == 0 ));
33 VERIFY( (std::ratio_not_equal<std::ratio<2,6>,
34 std::ratio<1,3>>::value == 0) );
35 VERIFY( (std::ratio_not_equal<std::ratio<2,6>,
36 std::ratio<1,4>>::value == 1) );
39 void
40 test02()
42 bool test __attribute__((unused)) = true;
44 VERIFY( (std::ratio_less<std::ratio<1,4>, std::ratio<1,3>>::value == 1) );
45 VERIFY( (std::ratio_less<std::ratio<-1,3>, std::ratio<1,3>>::value == 1) );
47 VERIFY( (std::ratio_less<std::ratio<1,3>, std::ratio<1,4>>::value == 0) );
48 VERIFY( (std::ratio_less<std::ratio<1,3>, std::ratio<-1,3>>::value == 0) );
50 VERIFY( (std::ratio_less_equal<std::ratio<-1,3>,
51 std::ratio<-1,3>>::value == 1) );
52 VERIFY( ( std::ratio_less_equal<std::ratio<1,4>,
53 std::ratio<1,3>>::value == 1) );
55 VERIFY( (std::ratio_less_equal<std::ratio<1,4>,
56 std::ratio<-1,3>>::value == 0) );
57 VERIFY( (std::ratio_less_equal<std::ratio<1,3>,
58 std::ratio<-1,3>>::value == 0) );
60 VERIFY( (std::ratio_greater<std::ratio<1,3>, std::ratio<1,4>>::value == 1) );
61 VERIFY( (std::ratio_greater<std::ratio<1,3>, std::ratio<-1,3>>::value == 1) );
63 VERIFY( (std::ratio_greater<std::ratio<1,4>, std::ratio<1,3>>::value == 0) );
64 VERIFY( (std::ratio_greater<std::ratio<-1,3>, std::ratio<1,3>>::value == 0) );
66 VERIFY( (std::ratio_greater_equal<std::ratio<1,3>,
67 std::ratio<1,3>>::value == 1) );
68 VERIFY( (std::ratio_greater_equal<std::ratio<1,3>,
69 std::ratio<-1,3>>::value == 1) );
71 VERIFY( (std::ratio_greater_equal<std::ratio<-1,3>,
72 std::ratio<1,3>>::value == 0) );
73 VERIFY( (std::ratio_greater_equal<std::ratio<1,4>,
74 std::ratio<1,3>>::value == 0) );
77 int main()
79 test01();
80 test02();
81 return 0;