]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/10.cc
3 // Copyright (C) 1999-2013 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
25 #include <testsuite_hooks.h>
29 std::string
str_01("0 00 000 +0 +0 -0");
30 std::stringbuf
isbuf_01(str_01
);
31 std::istream
is_01(&isbuf_01
);
33 bool test
__attribute__((unused
)) = true;
53 VERIFY( is_01
.rdstate() == std::ios_base::eofbit
);
55 std::string
str_02("0x32 0X33 033 33");
56 std::stringbuf
isbuf_02(str_02
);
57 std::istream
is_02(&isbuf_02
);
58 is_02
.unsetf(std::ios_base::basefield
);
67 VERIFY( is_02
.rdstate() == std::ios_base::eofbit
);
69 std::stringbuf
isbuf_03(str_02
);
70 std::istream
is_03(&isbuf_03
);
74 is_03
>> std::dec
>> n
>> c
>> m
;
79 is_03
>> std::oct
>> m
>> c
>> n
;
84 is_03
>> std::dec
>> m
>> n
;
87 VERIFY( is_03
.rdstate() == std::ios_base::eofbit
);
89 std::string
str_04("3. 4.5E+2a5E-3 .6E1");
90 std::stringbuf
isbuf_04(str_04
);
91 std::istream
is_04(&isbuf_04
);
100 VERIFY( f
== 0.005 );
103 VERIFY( is_03
.rdstate() == std::ios_base::eofbit
);
105 std::string
str_05("0E20 5Ea E16");
106 std::stringbuf
isbuf_05(str_05
);
107 std::istream
is_05(&isbuf_05
);
114 VERIFY( is_05
.rdstate() == std::ios_base::failbit
);
121 VERIFY( is_05
.rdstate() == std::ios_base::failbit
);