]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/dr696.cc
1 // 2009-07-15 Paolo Carlini <paolo.carlini@oracle.com>
3 // Copyright (C) 2009-2023 Free Software Foundation, Inc.
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
8 // Free Software Foundation; either version 3, or (at your option)
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.
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING3. If not see
18 // <http://www.gnu.org/licenses/>.
20 // 27.6.1.2.2 arithmetic extractors
24 #include <testsuite_hooks.h>
33 oss1
<< numeric_limits
<short>::max();
34 istringstream
iss1(oss1
.str());
36 VERIFY( s1
== numeric_limits
<short>::max() );
37 VERIFY( !iss1
.fail() && iss1
.eof() );
41 oss2
<< static_cast<long long>(numeric_limits
<short>::max()) + 1;
42 istringstream
iss2(oss2
.str());
44 VERIFY( s2
== numeric_limits
<short>::max() );
45 VERIFY( iss2
.fail() && iss2
.eof() );
49 oss3
<< numeric_limits
<short>::min();
50 istringstream
iss3(oss3
.str());
52 VERIFY( s3
== numeric_limits
<short>::min() );
53 VERIFY( !iss3
.fail() && iss3
.eof() );
57 oss4
<< static_cast<long long>(numeric_limits
<short>::min()) - 1;
58 istringstream
iss4(oss4
.str());
60 VERIFY( s4
== numeric_limits
<short>::min() );
61 VERIFY( iss4
.fail() && iss4
.eof() );
65 oss5
<< numeric_limits
<int>::max();
66 istringstream
iss5(oss5
.str());
68 VERIFY( i1
== numeric_limits
<int>::max() );
69 VERIFY( !iss5
.fail() && iss5
.eof() );
73 oss6
<< static_cast<long long>(numeric_limits
<int>::max()) + 1;
74 istringstream
iss6(oss6
.str());
76 VERIFY( i1
== numeric_limits
<int>::max() );
77 VERIFY( iss6
.fail() && iss6
.eof() );
81 oss7
<< numeric_limits
<int>::min();
82 istringstream
iss7(oss7
.str());
84 VERIFY( i3
== numeric_limits
<int>::min() );
85 VERIFY( !iss7
.fail() && iss7
.eof() );
89 oss8
<< static_cast<long long>(numeric_limits
<int>::min()) - 1;
90 istringstream
iss8(oss8
.str());
92 VERIFY( i4
== numeric_limits
<int>::min() );
93 VERIFY( iss8
.fail() && iss8
.eof() );