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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [libstdc++-v3/] [testsuite/] [22_locale/] [num_put/] [put/] [wchar_t/] [38210.cc] - Blame information for rev 424

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 424 jeremybenn
// Copyright (C) 2008, 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
// 22.2.2.2.1  num_put members
19
 
20
#include <locale>
21
#include <sstream>
22
#include <testsuite_hooks.h>
23
 
24
// libstdc++/38210
25
void test01()
26
{
27
  bool test __attribute__((unused)) = true;
28
  using namespace std;
29
 
30
  wostringstream oss1, oss2, oss3, oss4;
31
  wstring result1, result2, result3, result4;
32
 
33
  const num_put<wchar_t>& ng1 = use_facet<num_put<wchar_t> >(oss1.getloc());
34
  const num_put<wchar_t>& ng2 = use_facet<num_put<wchar_t> >(oss2.getloc());
35
  const num_put<wchar_t>& ng3 = use_facet<num_put<wchar_t> >(oss3.getloc());
36
  const num_put<wchar_t>& ng4 = use_facet<num_put<wchar_t> >(oss4.getloc());
37
 
38
  void* p = (void*)0x1;
39
 
40
  oss1.width(5);
41
  ng1.put(oss1.rdbuf(), oss1, L'*', p);
42
  result1 = oss1.str();
43
  VERIFY( result1 == L"**0x1" );
44
 
45
  oss2.width(5);
46
  oss2.setf(ios_base::right, ios_base::adjustfield);
47
  ng2.put(oss2.rdbuf(), oss2, L'*', p);
48
  result2 = oss2.str();
49
  VERIFY( result2 == L"**0x1" );
50
 
51
  oss3.width(5);
52
  oss3.setf(ios_base::internal, ios_base::adjustfield);
53
  ng3.put(oss3.rdbuf(), oss3, L'*', p);
54
  result3 = oss3.str();
55
  VERIFY( result3 == L"0x**1" );
56
 
57
  oss4.width(5);
58
  oss4.setf(ios_base::left, ios_base::adjustfield);
59
  ng4.put(oss4.rdbuf(), oss4, L'*', p);
60
  result4 = oss4.str();
61
  VERIFY( result4 == L"0x1**" );
62
}
63
 
64
int main()
65
{
66
  test01();
67
  return 0;
68
}

powered by: WebSVN 2.1.0

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