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 // <sstream> 10 11 // template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > 12 // class basic_stringbuf 13 14 // void str(const basic_string<charT,traits,Allocator>& s); 15 16 #include <sstream> 17 #include <cassert> 18 19 #include "test_macros.h" 20 main(int,char **)21int main(int, char**) 22 { 23 { 24 std::stringbuf buf("testing"); 25 assert(buf.str() == "testing"); 26 buf.str("another test"); 27 assert(buf.str() == "another test"); 28 } 29 #ifndef TEST_HAS_NO_WIDE_CHARACTERS 30 { 31 std::wstringbuf buf(L"testing"); 32 assert(buf.str() == L"testing"); 33 buf.str(L"another test"); 34 assert(buf.str() == L"another test"); 35 } 36 #endif 37 38 return 0; 39 } 40