OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [libstdc++-v3/] [testsuite/] [27_io/] [basic_ostream/] [inserters_other/] [wchar_t/] [1.cc] - Blame information for rev 565

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 424 jeremybenn
// Copyright (C) 2005, 2009 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 3, 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 COPYING3.  If not see
16
// <http://www.gnu.org/licenses/>.
17
 
18
// 27.6.2.5.4 basic_ostream character inserters
19
// @require@ %-*.tst %-*.txt
20
// @diff@ %-*.tst %-*.txt
21
 
22 565 jeremybenn
// { dg-xfail-run-if "not supported on OR32 newlib" { or32-*-elf } }
23
 
24 424 jeremybenn
#include <ostream>
25
#include <sstream>
26
#include <fstream>
27
#include <testsuite_hooks.h>
28
 
29
const int size = 1000;
30
const char name_01[] = "wostream_inserter_other-1.tst";
31
const char name_02[] = "wostream_inserter_other-1.txt";
32
const char name_03[] = "wostream_inserter_other-2.tst";
33
const char name_04[] = "wostream_inserter_other-2.txt";
34
 
35
// fstream
36
void
37
test02()
38
{
39
  typedef std::ios_base::iostate iostate;
40
  bool test __attribute__((unused)) = true;
41
 
42
  // basic_ostream<_CharT, _Traits>::operator<<(__streambuf_type* __sb)
43
  // filebuf-> NULL 
44
  std::wifstream f_in1(name_01);
45
  std::wofstream f_out1(name_02);
46
  std::wstringbuf* strbuf01 = NULL;
47
  iostate state01 = f_in1.rdstate();
48
  f_in1 >> strbuf01;
49
  iostate state02 = f_in1.rdstate();
50
  VERIFY( state01 != state02 );
51
  VERIFY( (state02 & std::ios_base::failbit) != 0 );
52
  state01 = f_out1.rdstate();
53
  f_out1 << strbuf01;
54
  state02 = f_out1.rdstate();
55
  VERIFY( state01 != state02 );
56
  VERIFY( (state02 & std::ios_base::badbit) != 0 );
57
 
58
  // filebuf->filebuf
59
  std::wifstream f_in(name_01);
60
  std::wofstream f_out(name_02);
61
  f_out << f_in.rdbuf();
62
  f_in.close();
63
  f_out.close();
64
 
65
  // filebuf->stringbuf->filebuf
66
  std::wifstream f_in2(name_03);
67
  std::wofstream f_out2(name_04); // should be different name
68
  std::wstringbuf strbuf02;
69
  f_in2 >> &strbuf02;
70
  f_out2 << &strbuf02;
71
  f_in2.close();
72
  f_out2.close();
73
}
74
 
75
int
76
main()
77
{
78
  test02();
79
  return 0;
80
}

powered by: WebSVN 2.1.0

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