OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libstdc++-v3/] [testsuite/] [27_io/] [basic_ostream/] [inserters_character/] [wchar_t/] [5.cc] - Blame information for rev 742

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 742 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
 
20
#include <string>
21
#include <ostream>
22
#include <sstream>
23
#include <testsuite_hooks.h>
24
 
25
// ostringstream and large strings number 2
26
void
27
test05()
28
{
29
  bool test __attribute__((unused)) = true;
30
  std::wstring str05, str10;
31
 
32
  typedef std::wostream::pos_type       pos_type;
33
  typedef std::wostream::off_type       off_type;
34
  std::wstring str01;
35
  const int size = 1000;
36
 
37
  // initialize string
38
  for(int i=0 ; i < size; i++) {
39
    str01 += L'1';
40
    str01 += L'2';
41
    str01 += L'3';
42
    str01 += L'4';
43
    str01 += L'5';
44
    str01 += L'6';
45
    str01 += L'7';
46
    str01 += L'8';
47
    str01 += L'9';
48
    str01 += L'\n';
49
  }
50
 
51
  // test 1: out
52
  std::wostringstream sstr01(str01, std::ios_base::out);
53
  std::wostringstream sstr02;
54
  sstr02 << str01;
55
  str05 = sstr01.str();
56
  str10 = sstr02.str();
57
  VERIFY( str05 == str01 );
58
  VERIFY( str10 == str01 );
59
 
60
  // test 2: in | out 
61
  std::wostringstream sstr04(str01,  std::ios_base::out | std::ios_base::in);
62
  std::wostringstream sstr05(std::ios_base::in | std::ios_base::out);
63
  sstr05 << str01;
64
  str05 = sstr04.str();
65
  str10 = sstr05.str();
66
  VERIFY( str05 == str01 );
67
  VERIFY( str10 == str01 );
68
}
69
 
70
int main()
71
{
72
  test05();
73
  return 0;
74
}

powered by: WebSVN 2.1.0

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