Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / libstdc++-v3 / testsuite / 27_io / basic_istream / ws / wchar_t / 1.cc
blob4c3618df42f5f00c2e3bb24ae39d69eecd941025
1 // Copyright (C) 2004 Free Software Foundation, Inc.
2 //
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 2, or (at your option)
7 // any later version.
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 COPYING. If not, write to the Free
16 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
17 // USA.
19 // 27.6.1.4 standard basic_istream manipulators
21 #include <istream>
22 #include <sstream>
23 #include <stdexcept>
24 #include <testsuite_hooks.h>
26 void test01(void)
28 bool test __attribute__((unused)) = true;
30 const wchar_t str_lit01[] = L" venice ";
31 const std::wstring str01(L" santa barbara ");
32 std::wstring str02(str_lit01);
33 std::wstring str04;
34 std::wstring str05;
35 std::ios_base::iostate flag3, flag4, flag5;
37 // template<_CharT, _Traits>
38 // basic_istream<_CharT, _Traits>& ws(basic_istream<_Char, _Traits>& is)
39 std::wistringstream iss01(str01);
40 std::wistringstream iss02(str01);
42 iss01 >> str04;
43 VERIFY( str04.size() != str01.size() );
44 VERIFY( str04 == L"santa" );
46 iss02 >> std::ws;
47 iss02 >> str05;
48 VERIFY( str05.size() != str01.size() );
49 VERIFY( str05 == L"santa" );
50 VERIFY( str05 == str04 );
52 iss01 >> str04;
53 VERIFY( str04.size() != str01.size() );
54 VERIFY( str04 == L"barbara" );
56 iss02 >> std::ws;
57 iss02 >> str05;
58 VERIFY( str05.size() != str01.size() );
59 VERIFY( str05 == L"barbara" );
60 VERIFY( str05 == str04 );
62 flag3 = std::ios_base::eofbit;
63 flag4 = std::ios_base::badbit;
64 flag5 = std::ios_base::failbit;
65 VERIFY( !iss01.fail() );
66 VERIFY( !iss02.fail() );
67 VERIFY( !iss01.eof() );
68 VERIFY( !iss02.eof() );
70 iss01 >> std::ws;
71 VERIFY( !iss01.fail() );
72 VERIFY( iss01.eof() );
75 int main()
77 test01();
78 return 0;