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_istream/] [ignore/] [wchar_t/] [3.cc] - Blame information for rev 565

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 424 jeremybenn
// Copyright (C) 2004, 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.1.3 unformatted input functions
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 <istream>
25
#include <fstream>
26
#include <limits>
27
#include <testsuite_hooks.h>
28
 
29
// istream& ignore(streamsize n)
30
void
31
test01()
32
{
33
  using namespace std;
34
  bool test __attribute__((unused)) = true;
35
 
36
  const char filename[] ="istream_unformatted-1.txt";
37
  ios_base::iostate state1, state2;
38
 
39
  wifstream ifstrm;
40
  ifstrm.open(filename);
41
 
42
  state1 = ifstrm.rdstate();
43
  VERIFY( state1 == ios_base::goodbit );
44
  VERIFY( ifstrm.peek() == L'1' );
45
  state2 = ifstrm.rdstate();
46
  VERIFY( state1 == state2 );
47
 
48
  state1 = ifstrm.rdstate();
49
  ifstrm.ignore(1);
50
  VERIFY( ifstrm.gcount() == 1 );
51
  state2 = ifstrm.rdstate();
52
  VERIFY( state1 == state2 );
53
  VERIFY( ifstrm.peek() == L'2' );
54
 
55
  state1 = ifstrm.rdstate();
56
  ifstrm.ignore(10);
57
  VERIFY( ifstrm.gcount() == 10 );
58
  state2 = ifstrm.rdstate();
59
  VERIFY( state1 == state2 );
60
  VERIFY( ifstrm.peek() == L'1' );
61
 
62
  state1 = ifstrm.rdstate();
63
  ifstrm.ignore(100);
64
  VERIFY( ifstrm.gcount() == 100 );
65
  state2 = ifstrm.rdstate();
66
  VERIFY( state1 == state2 );
67
  VERIFY( ifstrm.peek() == L'2' );
68
 
69
  state1 = ifstrm.rdstate();
70
  ifstrm.ignore(1000);
71
  VERIFY( ifstrm.gcount() == 1000 );
72
  state2 = ifstrm.rdstate();
73
  VERIFY( state1 == state2 );
74
  VERIFY( ifstrm.peek() == L'1' );
75
 
76
  state1 = ifstrm.rdstate();
77
  ifstrm.ignore(10000);
78
  VERIFY( ifstrm.gcount() == 10000 );
79
  state2 = ifstrm.rdstate();
80
  VERIFY( state1 == state2 );
81
  VERIFY( ifstrm.peek() == L'2' );
82
 
83
  state1 = ifstrm.rdstate();
84
  ifstrm.ignore(numeric_limits<streamsize>::max());
85
  VERIFY( ifstrm.gcount() == 5389 );
86
  state2 = ifstrm.rdstate();
87
  VERIFY( state1 != state2 );
88
  VERIFY( state2 == ios_base::eofbit );
89
}
90
 
91
int
92
main()
93
{
94
  test01();
95
  return 0;
96
}

powered by: WebSVN 2.1.0

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