]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/std/input.output/iostream.format/std.manip/setiosflags.pass.cpp
Vendor import of libc++ release_39 branch r276489:
[FreeBSD/FreeBSD.git] / test / std / input.output / iostream.format / std.manip / setiosflags.pass.cpp
1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 // <iomanip>
11
12 // T2 setiosflags (ios_base::fmtflags mask);
13
14 #include <iomanip>
15 #include <cassert>
16
17 template <class CharT>
18 struct testbuf
19     : public std::basic_streambuf<CharT>
20 {
21     testbuf() {}
22 };
23
24 int main()
25 {
26     {
27         testbuf<char> sb;
28         std::istream is(&sb);
29         assert(!(is.flags() & std::ios_base::oct));
30         is >> std::setiosflags(std::ios_base::oct);
31         assert(is.flags() & std::ios_base::oct);
32     }
33     {
34         testbuf<char> sb;
35         std::ostream os(&sb);
36         assert(!(os.flags() & std::ios_base::oct));
37         os << std::setiosflags(std::ios_base::oct);
38         assert(os.flags() & std::ios_base::oct);
39     }
40     {
41         testbuf<wchar_t> sb;
42         std::wistream is(&sb);
43         assert(!(is.flags() & std::ios_base::oct));
44         is >> std::setiosflags(std::ios_base::oct);
45         assert(is.flags() & std::ios_base::oct);
46     }
47     {
48         testbuf<wchar_t> sb;
49         std::wostream os(&sb);
50         assert(!(os.flags() & std::ios_base::oct));
51         os << std::setiosflags(std::ios_base::oct);
52         assert(os.flags() & std::ios_base::oct);
53     }
54 }