OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [libstdc++-v3/] [testsuite/] [27_io/] [basic_istream/] [ws/] [wchar_t/] [1.cc] - Blame information for rev 19

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 19 jlechner
// 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.
8
 
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.
13
 
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.
18
 
19
// 27.6.1.4 standard basic_istream manipulators
20
 
21
#include <istream>
22
#include <sstream>
23
#include <stdexcept>
24
#include <testsuite_hooks.h>
25
 
26
void test01(void)
27
{
28
  bool test __attribute__((unused)) = true;
29
 
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;
36
 
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);
41
 
42
  iss01 >> str04;
43
  VERIFY( str04.size() != str01.size() );
44
  VERIFY( str04 == L"santa" );
45
 
46
  iss02 >> std::ws;
47
  iss02 >> str05;
48
  VERIFY( str05.size() != str01.size() );
49
  VERIFY( str05 == L"santa" );
50
  VERIFY( str05 == str04 );
51
 
52
  iss01 >> str04;
53
  VERIFY( str04.size() != str01.size() );
54
  VERIFY( str04 == L"barbara" );
55
 
56
  iss02 >> std::ws;
57
  iss02 >> str05;
58
  VERIFY( str05.size() != str01.size() );
59
  VERIFY( str05 == L"barbara" );
60
  VERIFY( str05 == str04 );
61
 
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() );
69
 
70
  iss01 >> std::ws;
71
  VERIFY( !iss01.fail() );
72
  VERIFY( iss01.eof() );
73
}
74
 
75
int main()
76
{
77
  test01();
78
  return 0;
79
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.