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_character/] [wchar_t/] [6.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
 
21
#include <string>
22
#include <ostream>
23
#include <sstream>
24
#include <testsuite_hooks.h>
25
 
26
// ostringstream and positioning, multiple writes
27
// http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00326.html
28
void test06()
29
{
30
  bool test __attribute__((unused)) = true;
31
  const wchar_t carray01[] = L"mos def & talib kweli are black star";
32
 
33
  // normal
34
  std::wostringstream ostr1(L"mos def");
35
  VERIFY( ostr1.str() == L"mos def" );
36
  ostr1 << L" & talib kweli";  // should overwrite first part of buffer
37
  VERIFY( ostr1.str() == L" & talib kweli" );
38
  ostr1 << L" are black star";  // should append to string from above
39
  VERIFY( ostr1.str() != carray01 );
40
  VERIFY( ostr1.str() == L" & talib kweli are black star" );
41
 
42
  // appending
43
  std::wostringstream ostr2(L"blackalicious",
44
                            std::ios_base::out | std::ios_base::ate);
45
  VERIFY( ostr2.str() == L"blackalicious" );
46
  ostr2 << L" NIA ";  // should not overwrite first part of buffer
47
  VERIFY( ostr2.str() == L"blackalicious NIA " );
48
  ostr2 << L"4: deception (5:19)";  // should append to full string from above
49
  VERIFY( ostr2.str() == L"blackalicious NIA 4: deception (5:19)" );
50
}
51
 
52
int main()
53
{
54
  test06();
55
  return 0;
56
}

powered by: WebSVN 2.1.0

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