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/] [char/] [1.cc] - Blame information for rev 19

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 19 jlechner
// 1999-07-22 bkoz
2
 
3
// Copyright (C) 1994, 1999, 2001, 2003 Free Software Foundation, Inc.
4
//
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)
9
// any later version.
10
 
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.
15
 
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,
19
// USA.
20
 
21
// 27.6.1.4 standard basic_istream manipulators
22
 
23
#include <istream>
24
#include <sstream>
25
#include <stdexcept>
26
#include <testsuite_hooks.h>
27
 
28
void test01(void)
29
{
30
  bool test __attribute__((unused)) = true;
31
 
32
  const char str_lit01[] = "  venice ";
33
  const std::string str01(" santa barbara ");
34
  std::string str02(str_lit01);
35
  std::string str04;
36
  std::string str05;
37
  std::ios_base::iostate flag3, flag4, flag5;
38
 
39
  // template<_CharT, _Traits>
40
  //  basic_istream<_CharT, _Traits>& ws(basic_istream<_Char, _Traits>& is)
41
  std::istringstream iss01(str01);
42
  std::istringstream iss02(str01);
43
 
44
  iss01 >> str04;
45
  VERIFY( str04.size() != str01.size() );
46
  VERIFY( str04 == "santa" );
47
 
48
  iss02 >> std::ws;
49
  iss02 >> str05;
50
  VERIFY( str05.size() != str01.size() );
51
  VERIFY( str05 == "santa" );
52
  VERIFY( str05 == str04 );
53
 
54
  iss01 >> str04;
55
  VERIFY( str04.size() != str01.size() );
56
  VERIFY( str04 == "barbara" );
57
 
58
  iss02 >> std::ws;
59
  iss02 >> str05;
60
  VERIFY( str05.size() != str01.size() );
61
  VERIFY( str05 == "barbara" );
62
  VERIFY( str05 == str04 );
63
 
64
  flag3 = std::ios_base::eofbit;
65
  flag4 = std::ios_base::badbit;
66
  flag5 = std::ios_base::failbit;
67
  VERIFY( !iss01.fail() );
68
  VERIFY( !iss02.fail() );
69
  VERIFY( !iss01.eof() );
70
  VERIFY( !iss02.eof() );
71
 
72
  iss01 >> std::ws;
73
  VERIFY( !iss01.fail() );
74
  VERIFY( iss01.eof() );
75
}
76
 
77
int main()
78
{
79
  test01();
80
  return 0;
81
}

powered by: WebSVN 2.1.0

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