]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/27_io/manipulators/standard/char/1.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 27_io / manipulators / standard / char / 1.cc
CommitLineData
a945c346 1// Copyright (C) 2002-2024 Free Software Foundation, Inc.
04fc1394
BK
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
748086b7 6// Free Software Foundation; either version 3, or (at your option)
04fc1394
BK
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
748086b7
JJ
15// with this library; see the file COPYING3. If not see
16// <http://www.gnu.org/licenses/>.
04fc1394
BK
17
18// 27.6.3 - Standard manipulators
19
20#include <sstream>
21#include <iomanip>
22#include <testsuite_hooks.h>
23
24void
25test01()
26{
27 using namespace std;
04fc1394
BK
28
29 string s("john coltrane, a love supreme");
30 istringstream iss(s);
31 ostringstream oss;
32
33 // resetiosflags
34 resetiosflags(ios_base::boolalpha);
35 iss >> resetiosflags(ios_base::boolalpha);
36 VERIFY(iss.good());
37 oss << resetiosflags(ios_base::boolalpha);
38 VERIFY(oss.good());
39
40 // setiosflags
41 setiosflags(ios_base::skipws);
42 iss >> setiosflags(ios_base::skipws);
43 VERIFY(iss.good());
44 oss << setiosflags(ios_base::skipws);
45 VERIFY(oss.good());
46
47 // setbase
48 setbase(8);
49 iss >> setbase(8);
50 VERIFY(iss.good());
51 oss << setbase(8);
52 VERIFY(oss.good());
53
979f8bfd 54 // setfill
04fc1394 55 setfill('a');
979f8bfd 56 iss >> setfill('a'); // { dg-warning "deprecated" }
04fc1394
BK
57 VERIFY(iss.good());
58 oss << setfill('a');
59 VERIFY(oss.good());
60
61 // setprecision
62 setprecision(4);
63 iss >> setprecision(4);
64 VERIFY(iss.good());
65 oss << setprecision(4);
66 VERIFY(oss.good());
67
68 // setprecision
69 setw(7);
70 iss >> setw(7);
71 VERIFY(iss.good());
72 oss << setw(7);
73 VERIFY(oss.good());
74}
75
04fc1394
BK
76int
77main()
78{
79 test01();
80 return 0;
81}