]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/10.cc
3 // Copyright (C) 1999, 2000, 2002, 2003 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 2, 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 COPYING. If not, write to the Free
18 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21 // 27.6.1.2.2 arithmetic extractors
26 #include <testsuite_hooks.h>
30 std::string
str_01("0 00 000 +0 +0 -0");
31 std::stringbuf
isbuf_01(str_01
);
32 std::istream
is_01(&isbuf_01
);
34 bool test
__attribute__((unused
)) = true;
54 VERIFY( is_01
.rdstate() == std::ios_base::eofbit
);
56 std::string
str_02("0x32 0X33 033 33");
57 std::stringbuf
isbuf_02(str_02
);
58 std::istream
is_02(&isbuf_02
);
59 is_02
.unsetf(std::ios_base::basefield
);
68 VERIFY( is_02
.rdstate() == std::ios_base::eofbit
);
70 std::stringbuf
isbuf_03(str_02
);
71 std::istream
is_03(&isbuf_03
);
75 is_03
>> std::dec
>> n
>> c
>> m
;
80 is_03
>> std::oct
>> m
>> c
>> n
;
85 is_03
>> std::dec
>> m
>> n
;
88 VERIFY( is_03
.rdstate() == std::ios_base::eofbit
);
90 std::string
str_04("3. 4.5E+2a5E-3 .6E1");
91 std::stringbuf
isbuf_04(str_04
);
92 std::istream
is_04(&isbuf_04
);
101 VERIFY( f
== 0.005 );
104 VERIFY( is_03
.rdstate() == std::ios_base::eofbit
);
106 std::string
str_05("0E20 5Ea E16");
107 std::stringbuf
isbuf_05(str_05
);
108 std::istream
is_05(&isbuf_05
);
114 VERIFY( is_05
.rdstate() == std::ios_base::goodbit
);
120 VERIFY( is_05
.rdstate() == std::ios_base::failbit
);