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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 19 jlechner
// 1999-08-16 bkoz
2
// 1999-11-01 bkoz
3
 
4
// Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation
5
//
6
// This file is part of the GNU ISO C++ Library.  This library is free
7
// software; you can redistribute it and/or modify it under the
8
// terms of the GNU General Public License as published by the
9
// Free Software Foundation; either version 2, or (at your option)
10
// any later version.
11
 
12
// This library is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
// GNU General Public License for more details.
16
 
17
// You should have received a copy of the GNU General Public License along
18
// with this library; see the file COPYING.  If not, write to the Free
19
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
20
// USA.
21
 
22
// 27.6.2.5.4 basic_ostream character inserters
23
// @require@ %-*.tst %-*.txt
24
// @diff@ %-*.tst %-*.txt
25
 
26
#include <ostream>
27
#include <sstream>
28
#include <fstream>
29
#include <testsuite_hooks.h>
30
 
31
const int size = 1000;
32
const char name_01[] = "ostream_inserter_other-1.tst";
33
const char name_02[] = "ostream_inserter_other-1.txt";
34
const char name_03[] = "ostream_inserter_other-2.tst";
35
const char name_04[] = "ostream_inserter_other-2.txt";
36
 
37
// fstream
38
void
39
test02()
40
{
41
  typedef std::ios_base::iostate iostate;
42
  bool test __attribute__((unused)) = true;
43
 
44
  // basic_ostream<_CharT, _Traits>::operator<<(__streambuf_type* __sb)
45
  // filebuf-> NULL 
46
  std::ifstream f_in1(name_01);
47
  std::ofstream f_out1(name_02);
48
  std::stringbuf* strbuf01 = NULL;
49
  iostate state01 = f_in1.rdstate();
50
  f_in1 >> strbuf01;
51
  iostate state02 = f_in1.rdstate();
52
  VERIFY( state01 != state02 );
53
  VERIFY( (state02 & std::ios_base::failbit) != 0 );
54
  state01 = f_out1.rdstate();
55
  f_out1 << strbuf01;
56
  state02 = f_out1.rdstate();
57
  VERIFY( state01 != state02 );
58
  VERIFY( (state02 & std::ios_base::badbit) != 0 );
59
 
60
  // filebuf->filebuf
61
  std::ifstream f_in(name_01);
62
  std::ofstream f_out(name_02);
63
  f_out << f_in.rdbuf();
64
  f_in.close();
65
  f_out.close();
66
 
67
  // filebuf->stringbuf->filebuf
68
  std::ifstream f_in2(name_03);
69
  std::ofstream f_out2(name_04); // should be different name
70
  std::stringbuf strbuf02;
71
  f_in2 >> &strbuf02;
72
  f_out2 << &strbuf02;
73
  f_in2.close();
74
  f_out2.close();
75
}
76
 
77
int
78
main()
79
{
80
  test02();
81
  return 0;
82
}

powered by: WebSVN 2.1.0

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