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