| 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 |
// streambuf_type* get_wrapped() const noexcept; |
| 19 |
|
| 20 |
#include <syncstream> |
| 21 |
#include <concepts> |
| 22 |
#include <cassert> |
| 23 |
|
| 24 |
#include "../helpers.h" |
| 25 |
#include "test_macros.h" |
| 26 |
|
| 27 |
template <class T> |
| 28 |
void test() { |
| 29 |
test_buf<T> base(42); |
| 30 |
const std::allocator<T> alloc; |
| 31 |
const test_syncbuf<T> buff(&base, alloc); |
| 32 |
std::same_as<std::basic_streambuf<T>*> auto wrapped = buff.get_wrapped(); |
| 33 |
assert(static_cast<test_buf<T>*>(wrapped)->id == 42); |
| 34 |
ASSERT_NOEXCEPT(buff.get_wrapped()); |
| 35 |
} |
| 36 |
|
| 37 |
int main(int, char**) { |
| 38 |
test<char>(); |
| 39 |
#ifndef TEST_HAS_NO_WIDE_CHARACTERS |
| 40 |
test<wchar_t>(); |
| 41 |
#endif |
| 42 |
|
| 43 |
return 0; |
| 44 |
} |