1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
11 // template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
12 // class basic_stringbuf
14 // explicit basic_stringbuf(ios_base::openmode which = ios_base::in | ios_base::out); // before C++20
15 // basic_stringbuf() : basic_stringbuf(ios_base::in | ios_base::out) {} // C++20
16 // explicit basic_stringbuf(ios_base::openmode which); // C++20
18 // XFAIL: FROZEN-CXX03-HEADERS-FIXME
23 #include "test_macros.h"
24 #if TEST_STD_VER >= 11
25 #include "test_convertible.h"
28 template<typename CharT
>
30 : std::basic_stringbuf
<CharT
>
35 // It is implementation-defined whether the sequence pointers (eback(),
36 // gptr(), egptr(), pbase(), pptr(), epptr()) are initialized to null
38 // This tests the libc++ specific implementation.
39 LIBCPP_ASSERT(this->eback() != nullptr);
40 LIBCPP_ASSERT(this->gptr() != nullptr);
41 LIBCPP_ASSERT(this->egptr() != nullptr);
42 LIBCPP_ASSERT(this->pbase() != nullptr);
43 LIBCPP_ASSERT(this->pptr() != nullptr);
44 LIBCPP_ASSERT(this->epptr() != nullptr);
45 assert(this->str().empty());
53 assert(buf
.str() == "");
59 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
62 assert(buf
.str() == L
"");
70 #if TEST_STD_VER >= 11
72 typedef std::stringbuf B
;
73 static_assert(test_convertible
<B
>(), "");
74 static_assert(!test_convertible
<B
, std::ios_base::openmode
>(), "");