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 = char_traits<charT>, class Allocator = allocator<charT>> |
16 | // class basic_osyncstream : public basic_ostream<charT, traits> { |
17 | // public: |
18 | // using char_type = charT; |
19 | // using int_type = typename traits::int_type; |
20 | // using pos_type = typename traits::pos_type; |
21 | // using off_type = typename traits::off_type; |
22 | // using traits_type = traits; |
23 | // |
24 | // using allocator_type = Allocator; |
25 | // using streambuf_type = basic_streambuf<charT, traits>; |
26 | // using syncbuf_type = basic_syncbuf<charT, traits, Allocator>; |
27 | |
28 | #include <syncstream> |
29 | #include <concepts> |
30 | |
31 | #include "test_macros.h" |
32 | #include "constexpr_char_traits.h" |
33 | #include "test_allocator.h" |
34 | |
35 | static_assert(std::same_as<std::basic_osyncstream<char>, |
36 | std::basic_osyncstream<char, std::char_traits<char>, std::allocator<char>>>); |
37 | static_assert(std::same_as<std::basic_osyncstream<char, constexpr_char_traits<char>>, |
38 | std::basic_osyncstream<char, constexpr_char_traits<char>, std::allocator<char>>>); |
39 | |
40 | static_assert( |
41 | std::same_as<std::basic_osyncstream<char, constexpr_char_traits<char>, test_allocator<char>>::char_type, char>); |
42 | static_assert(std::same_as<std::basic_osyncstream<char, constexpr_char_traits<char>, test_allocator<char>>::int_type, |
43 | constexpr_char_traits<char>::int_type>); |
44 | static_assert(std::same_as<std::basic_osyncstream<char, constexpr_char_traits<char>, test_allocator<char>>::pos_type, |
45 | constexpr_char_traits<char>::pos_type>); |
46 | static_assert(std::same_as<std::basic_osyncstream<char, constexpr_char_traits<char>, test_allocator<char>>::off_type, |
47 | constexpr_char_traits<char>::off_type>); |
48 | static_assert(std::same_as<std::basic_osyncstream<char, constexpr_char_traits<char>, test_allocator<char>>::traits_type, |
49 | constexpr_char_traits<char>>); |
50 | static_assert( |
51 | std::same_as<std::basic_osyncstream<char, constexpr_char_traits<char>, test_allocator<char>>::allocator_type, |
52 | test_allocator<char>>); |
53 | static_assert( |
54 | std::same_as<std::basic_osyncstream<char, constexpr_char_traits<char>, test_allocator<char>>::streambuf_type, |
55 | std::basic_streambuf<char, constexpr_char_traits<char>>>); |
56 | static_assert( |
57 | std::same_as<std::basic_osyncstream<char, constexpr_char_traits<char>, test_allocator<char>>::syncbuf_type, |
58 | std::basic_syncbuf<char, constexpr_char_traits<char>, test_allocator<char>>>); |
59 | |
60 | #ifndef TEST_HAS_NO_WIDE_CHARACTERS |
61 | |
62 | static_assert(std::same_as<std::basic_osyncstream<wchar_t>, |
63 | std::basic_osyncstream<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t>>>); |
64 | static_assert(std::same_as<std::basic_osyncstream<wchar_t, constexpr_char_traits<wchar_t>>, |
65 | std::basic_osyncstream<wchar_t, constexpr_char_traits<wchar_t>, std::allocator<wchar_t>>>); |
66 | |
67 | static_assert( |
68 | std::same_as<std::basic_osyncstream<wchar_t, constexpr_char_traits<wchar_t>, test_allocator<wchar_t>>::char_type, |
69 | wchar_t>); |
70 | static_assert( |
71 | std::same_as<std::basic_osyncstream<wchar_t, constexpr_char_traits<wchar_t>, test_allocator<wchar_t>>::int_type, |
72 | constexpr_char_traits<wchar_t>::int_type>); |
73 | static_assert( |
74 | std::same_as<std::basic_osyncstream<wchar_t, constexpr_char_traits<wchar_t>, test_allocator<wchar_t>>::pos_type, |
75 | constexpr_char_traits<wchar_t>::pos_type>); |
76 | static_assert( |
77 | std::same_as<std::basic_osyncstream<wchar_t, constexpr_char_traits<wchar_t>, test_allocator<wchar_t>>::off_type, |
78 | constexpr_char_traits<wchar_t>::off_type>); |
79 | static_assert( |
80 | std::same_as<std::basic_osyncstream<wchar_t, constexpr_char_traits<wchar_t>, test_allocator<wchar_t>>::traits_type, |
81 | constexpr_char_traits<wchar_t>>); |
82 | static_assert(std::same_as< |
83 | std::basic_osyncstream<wchar_t, constexpr_char_traits<wchar_t>, test_allocator<wchar_t>>::allocator_type, |
84 | test_allocator<wchar_t>>); |
85 | static_assert(std::same_as< |
86 | std::basic_osyncstream<wchar_t, constexpr_char_traits<wchar_t>, test_allocator<wchar_t>>::streambuf_type, |
87 | std::basic_streambuf<wchar_t, constexpr_char_traits<wchar_t>>>); |
88 | static_assert( |
89 | std::same_as<std::basic_osyncstream<wchar_t, constexpr_char_traits<wchar_t>, test_allocator<wchar_t>>::syncbuf_type, |
90 | std::basic_syncbuf<wchar_t, constexpr_char_traits<wchar_t>, test_allocator<wchar_t>>>); |
91 | |
92 | #endif // TEST_HAS_NO_WIDE_CHARACTERS |
93 | |