3 // Copyright (C) 1999, 2003 Free Software Foundation
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, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
21 // 27.6.1.2.3 character extractors
25 #include <testsuite_hooks.h>
29 typedef std::ios::traits_type ctraits_type
;
31 bool test
__attribute__((unused
)) = true;
33 const std::string
str_02("or coltrane playing tunji with jimmy garrison");
34 const std::string
str_03("coltrane");
36 std::stringbuf
isbuf_01(std::ios_base::in
);
37 std::stringbuf
isbuf_02(str_02
, std::ios_base::in
);
38 std::istream
is_01(NULL
);
39 std::istream
is_02(&isbuf_02
);
40 std::ios_base::iostate state1
, state2
, statefail
;
41 statefail
= std::ios_base::failbit
;
43 // template<_CharT, _Traits>
44 // basic_istream& operator>>(istream&, _CharT&)
45 char c1
= 'c', c2
= 'c';
46 state1
= is_01
.rdstate();
48 state2
= is_01
.rdstate();
49 VERIFY( state1
!= state2
);
51 VERIFY( static_cast<bool>(state2
& statefail
) );
53 state1
= is_02
.rdstate();
55 state2
= is_02
.rdstate();
56 VERIFY( state1
== state2
);
61 VERIFY( !static_cast<bool>(state2
& statefail
) );
63 // template<_CharT, _Traits>
64 // basic_istream& operator>>(istream&, unsigned char&)
65 unsigned char uc1
= 'c';
66 state1
= is_02
.rdstate();
68 state2
= is_02
.rdstate();
69 VERIFY( state1
== state2
);
75 // template<_CharT, _Traits>
76 // basic_istream& operator>>(istream&, signed char&)
77 signed char sc1
= 'c';
78 state1
= is_02
.rdstate();
80 state2
= is_02
.rdstate();
81 VERIFY( state1
== state2
);