Debian Codegraph @

libcxx/test/std/input.output/syncstream/syncbuf/syncstream.syncbuf.cons/cons.default.pass.cpp

raw
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 //===----------------------------------------------------------------------===//
8
9 // UNSUPPORTED: c++03, c++11, c++14, c++17
10 // UNSUPPORTED: no-localization
11 // UNSUPPORTED: libcpp-has-no-experimental-syncstream
12
13 // <syncstream>
14
15 // template <class charT, class traits, class Allocator>
16 // class basic_syncbuf;
17
18 // basic_syncbuf();
19
20 #include <cassert>
21 #include <concepts>
22 #include <syncstream>
23
24 #include "test_macros.h"
25 #include "constexpr_char_traits.h"
26 #include "test_allocator.h"
27
28 template <class CharT>
29 void test() {
30 {
31 using Buf = std::basic_syncbuf<CharT>;
32 static_assert(std::default_initializable<Buf>);
33 Buf buf;
34 assert(buf.get_wrapped() == nullptr);
35 assert(buf.get_allocator() == std::allocator<CharT>());
36 }
37 {
38 using Buf = std::basic_syncbuf<CharT, constexpr_char_traits<CharT>>;
39 static_assert(std::default_initializable<Buf>);
40 Buf buf;
41 assert(buf.get_wrapped() == nullptr);
42 assert(buf.get_allocator() == std::allocator<CharT>());
43 }
44 {
45 using Buf = std::basic_syncbuf<CharT, constexpr_char_traits<CharT>, test_allocator<CharT>>;
46 static_assert(std::default_initializable<Buf>);
47 Buf buf;
48 assert(buf.get_wrapped() == nullptr);
49 assert(buf.get_allocator() == test_allocator<CharT>());
50 }
51 }
52
53 int main(int, char**) {
54 test<char>();
55 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
56 test<wchar_t>();
57 #endif
58
59 return 0;
60 }