]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/27_io/manipulators/adjustfield/wchar_t/1.cc
1 // Copyright (C) 2004-2024 Free Software Foundation, Inc.
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)
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.
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/>.
22 #include <testsuite_hooks.h>
24 struct MyNP
: std::numpunct
<wchar_t>
26 std::wstring
do_truename() const;
27 std::wstring
do_falsename() const;
31 MyNP::do_truename() const
33 std::wstring
s(L
"yea");
38 MyNP::do_falsename() const
40 std::wstring
s(L
"nay");
47 const wchar_t lit
[] = L
"1 0\n"
60 std::wostringstream oss
;
61 oss
<< true << L
" " << false << std::endl
;
62 oss
<< std::boolalpha
;
63 oss
<< true << L
" " << false << std::endl
;
65 oss
<< L
":" << std::setw(6) << std::internal
<< true << L
":" << std::endl
;
66 oss
<< L
":" << std::setw(6) << std::left
<< true << L
":" << std::endl
;
67 oss
<< L
":" << std::setw(6) << std::right
<< false << L
":" << std::endl
;
68 oss
<< std::noboolalpha
;
69 oss
<< L
":" << std::setw(3) << std::internal
<< true << L
":" << std::endl
;
70 oss
<< L
":" << std::setw(3) << std::left
<< true << L
":" << std::endl
;
71 oss
<< L
":" << std::setw(3) << std::right
<< false << L
":" << std::endl
;
73 std::locale loc
= std::locale(std::locale::classic(), new MyNP
);
76 oss
<< std::boolalpha
;
77 oss
<< true << L
" " << false << std::endl
;
79 oss
<< L
":" << std::setw(6) << std::internal
<< true << L
":" << std::endl
;
80 oss
<< L
":" << std::setw(6) << std::left
<< true << L
":" << std::endl
;
81 oss
<< L
":" << std::setw(6) << std::right
<< false << L
":" << std::endl
;
84 VERIFY( oss
.str() == lit
);