OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [libstdc++-v3/] [testsuite/] [18_support/] [numeric_limits/] [lowest.cc] - Blame information for rev 490

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 424 jeremybenn
// { dg-options "-std=gnu++0x" }
2
// { dg-add-options ieee }
3 490 jeremybenn
// { dg-xfail-if "" { ! wchar } { "*" } { "" } }
4 424 jeremybenn
 
5
// 2010-02-25  Ed Smith-Rowland
6
 
7
// Copyright (C) 2010 Free Software Foundation
8
//
9
// This file is part of the GNU ISO C++ Library.  This library is free
10
// software; you can redistribute it and/or modify it under the
11
// terms of the GNU General Public License as published by the
12
// Free Software Foundation; either version 3, or (at your option)
13
// any later version.
14
 
15
// This library is distributed in the hope that it will be useful,
16
// but WITHOUT ANY WARRANTY; without even the implied warranty of
17
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
// GNU General Public License for more details.
19
 
20
// You should have received a copy of the GNU General Public License along
21
// with this library; see the file COPYING3.  If not see
22
// <http://www.gnu.org/licenses/>.
23
 
24
// 18.2.1.1 template class numeric_limits
25
 
26
#include <limits>
27
#include <type_traits>
28
#include <testsuite_hooks.h>
29
 
30
template<typename T>
31
  void
32
  do_test(std::true_type)
33
  {
34
    bool test __attribute__((unused)) = true;
35
    T limits_min = std::numeric_limits<T>::min();
36
    VERIFY( std::numeric_limits<T>::lowest() == limits_min );
37
  }
38
 
39
template<typename T>
40
  void
41
  do_test(std::false_type)
42
  {
43
    bool test __attribute__((unused)) = true;
44
    T limits_max = std::numeric_limits<T>::max();
45
    VERIFY( std::numeric_limits<T>::lowest() == -limits_max );
46
  }
47
 
48
template<typename Tp>
49
  void
50
  do_test()
51
  { do_test<Tp>(typename std::is_integral<Tp>::type()); }
52
 
53
void test01()
54
{
55
  do_test<char>();
56
  do_test<signed char>();
57
  do_test<unsigned char>();
58
  do_test<wchar_t>();
59
  do_test<char16_t>();
60
  do_test<char32_t>();
61
 
62
  do_test<short>();
63
  do_test<unsigned short>();
64
 
65
  do_test<int>();
66
  do_test<unsigned int>();
67
 
68
  do_test<long>();
69
  do_test<unsigned long>();
70
 
71
  do_test<long long>();
72
  do_test<unsigned long long>();
73
 
74
  do_test<float>();
75
  do_test<double>();
76
  do_test<long double>();
77
}
78
 
79
int main()
80
{
81
  test01();
82
  return 0;
83
}

powered by: WebSVN 2.1.0

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