1 // Copyright (C) 2004, 2009, 2010 Free Software Foundation, Inc.
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 3, or (at your option)
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING3. If not see
16 // <http://www.gnu.org/licenses/>.
18 // 27.6.1.2.2 arithmetic extractors
20 #include <cstdio> // for printf
24 #include <testsuite_hooks.h>
27 std::wstring
str_02(L
"true false 0 1 110001");
28 std::wstring
str_03(L
"-19999999 777777 -234234 233 -234 33 1 66300.25 .315 1.5");
29 std::wstring
str_04(L
"0123");
31 std::wstringbuf
isbuf_01(std::ios_base::in
);
32 std::wstringbuf
isbuf_02(str_02
, std::ios_base::in
);
33 std::wstringbuf
isbuf_03(str_03
, std::ios_base::in
);
34 std::wstringbuf
isbuf_04(str_04
, std::ios_base::in
);
36 std::wistream
is_01(0);
37 std::wistream
is_02(&isbuf_02
);
38 std::wistream
is_03(&isbuf_03
);
39 std::wistream
is_04(&isbuf_04
);
40 std::wstringstream
ss_01(str_01
);
42 // minimal sanity check
45 bool test
__attribute__((unused
)) = true;
52 unsigned short us1
= 0;
54 unsigned long ul1
= 0;
56 // Floating-point Types:
61 // process alphanumeric versions of bool values
62 is_02
.setf(std::ios_base::boolalpha
);
69 // process numeric versions of of bool values
70 is_02
.unsetf(std::ios_base::boolalpha
);
77 // is_03 == "-19999999 777777 -234234 233 -234 33 1 66300.25 .315 1.5"
79 VERIFY( l1
== -19999999 );
81 VERIFY( ul1
== 777777 );
83 VERIFY( i1
== -234234 );
93 VERIFY( ld1
== 66300.25 );
99 is_04
>> std::hex
>> i1
;
100 std::printf ("%d %d %d\n", i1
, i1
== 0x123, test
);
101 VERIFY( i1
== 0x123 );
102 std::printf ("%d %d %d\n", i1
, i1
== 0x123, test
);
104 // test void pointers
111 std::printf ("%p %p\n", pi
, po
);