[flang][OpenMP] Parse METADIRECTIVE in specification part (#123397)
[llvm-project.git] / libcxx / test / std / input.output / iostream.format / output.streams / ostream.cons / streambuf.pass.cpp
blob1c38a68f1f895fba90694ed15d8ccd34572326cd
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // <ostream>
11 // template <class charT, class traits = char_traits<charT> >
12 // class basic_ostream;
14 // explicit basic_ostream(basic_streambuf<charT,traits>* sb);
16 #include <ostream>
17 #include <cassert>
19 #include "test_macros.h"
21 template <class CharT>
22 struct testbuf
23 : public std::basic_streambuf<CharT>
25 testbuf() {}
28 int main(int, char**)
31 testbuf<char> sb;
32 std::basic_ostream<char> os(&sb);
33 assert(os.rdbuf() == &sb);
34 assert(os.tie() == 0);
35 assert(os.fill() == ' ');
36 assert(os.rdstate() == os.goodbit);
37 assert(os.exceptions() == os.goodbit);
38 assert(os.flags() == (os.skipws | os.dec));
39 assert(os.precision() == 6);
40 assert(os.getloc().name() == "C");
42 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
44 testbuf<wchar_t> sb;
45 std::basic_ostream<wchar_t> os(&sb);
46 assert(os.rdbuf() == &sb);
47 assert(os.tie() == 0);
48 assert(os.fill() == L' ');
49 assert(os.rdstate() == os.goodbit);
50 assert(os.exceptions() == os.goodbit);
51 assert(os.flags() == (os.skipws | os.dec));
52 assert(os.precision() == 6);
53 assert(os.getloc().name() == "C");
55 #endif
57 return 0;