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