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_ostream/] [inserters_other/] [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) 2005 Free Software Foundation
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.2.5.4 basic_ostream character inserters
20
// @require@ %-*.tst %-*.txt
21
// @diff@ %-*.tst %-*.txt
22
 
23
#include <ostream>
24
#include <sstream>
25
#include <fstream>
26
#include <testsuite_hooks.h>
27
 
28
const int size = 1000;
29
const char name_01[] = "wostream_inserter_other-1.tst";
30
const char name_02[] = "wostream_inserter_other-1.txt";
31
const char name_03[] = "wostream_inserter_other-2.tst";
32
const char name_04[] = "wostream_inserter_other-2.txt";
33
 
34
// fstream
35
void
36
test02()
37
{
38
  typedef std::ios_base::iostate iostate;
39
  bool test __attribute__((unused)) = true;
40
 
41
  // basic_ostream<_CharT, _Traits>::operator<<(__streambuf_type* __sb)
42
  // filebuf-> NULL 
43
  std::wifstream f_in1(name_01);
44
  std::wofstream f_out1(name_02);
45
  std::wstringbuf* strbuf01 = NULL;
46
  iostate state01 = f_in1.rdstate();
47
  f_in1 >> strbuf01;
48
  iostate state02 = f_in1.rdstate();
49
  VERIFY( state01 != state02 );
50
  VERIFY( (state02 & std::ios_base::failbit) != 0 );
51
  state01 = f_out1.rdstate();
52
  f_out1 << strbuf01;
53
  state02 = f_out1.rdstate();
54
  VERIFY( state01 != state02 );
55
  VERIFY( (state02 & std::ios_base::badbit) != 0 );
56
 
57
  // filebuf->filebuf
58
  std::wifstream f_in(name_01);
59
  std::wofstream f_out(name_02);
60
  f_out << f_in.rdbuf();
61
  f_in.close();
62
  f_out.close();
63
 
64
  // filebuf->stringbuf->filebuf
65
  std::wifstream f_in2(name_03);
66
  std::wofstream f_out2(name_04); // should be different name
67
  std::wstringbuf strbuf02;
68
  f_in2 >> &strbuf02;
69
  f_out2 << &strbuf02;
70
  f_in2.close();
71
  f_out2.close();
72
}
73
 
74
int
75
main()
76
{
77
  test02();
78
  return 0;
79
}

powered by: WebSVN 2.1.0

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