OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libstdc++-v3/] [testsuite/] [20_util/] [ratio/] [operations/] [45866.cc] - Blame information for rev 742

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 742 jeremybenn
// { dg-options "-std=gnu++0x" }
2
// { dg-require-cstdint "" }
3
 
4
// 2010-10-18  Paolo Carlini  <paolo.carlini@oracle.com>
5
 
6
// Copyright (C) 2010 Free Software Foundation
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
// libstdc++/45866
27
void test01()
28
{
29
  bool test __attribute__((unused)) = true;
30
 
31
  typedef std::ratio<1, 4>::type r_type1;
32
  typedef std::ratio<3, 2>::type r_type2;
33
 
34
  typedef std::ratio_add<r_type1, r_type2> ra_type;
35
 
36
  VERIFY( ra_type::num == ra_type::type::num );
37
  VERIFY( ra_type::den == ra_type::type::den );
38
  VERIFY( ra_type::num == 7 );
39
  VERIFY( ra_type::den == 4 );
40
 
41
  typedef std::ratio_subtract<r_type1, r_type2> rs_type;
42
 
43
  VERIFY( rs_type::num == rs_type::type::num );
44
  VERIFY( rs_type::den == rs_type::type::den );
45
  VERIFY( rs_type::num == -5 );
46
  VERIFY( rs_type::den == 4 );
47
 
48
  typedef std::ratio_multiply<r_type1, r_type2> rm_type;
49
 
50
  VERIFY( rm_type::num == rm_type::type::num );
51
  VERIFY( rm_type::den == rm_type::type::den );
52
  VERIFY( rm_type::num == 3 );
53
  VERIFY( rm_type::den == 8 );
54
 
55
  typedef std::ratio_divide<r_type1, r_type2> rd_type;
56
 
57
  VERIFY( rd_type::num == rd_type::type::num );
58
  VERIFY( rd_type::den == rd_type::type::den );
59
  VERIFY( rd_type::num == 1 );
60
  VERIFY( rd_type::den == 6 );
61
}
62
 
63
int main()
64
{
65
  test01();
66
  return 0;
67
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.