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 // basic_stringbuf& operator=(basic_stringbuf&& rhs); 15 16 #include <sstream> 17 #include <cassert> 18 19 #include "test_macros.h" 20 21 int main(int, char**) 22 { 23 { 24 std::stringbuf buf1("testing"); 25 std::stringbuf buf; 26 buf = std::move(buf1); 27 assert(buf.str() == "testing"); 28 } 29 { 30 std::stringbuf buf1("testing", std::ios_base::in); 31 std::stringbuf buf; 32 buf = std::move(buf1); 33 assert(buf.str() == "testing"); 34 } 35 { 36 std::stringbuf buf1("testing", std::ios_base::out); 37 std::stringbuf buf; 38 buf = std::move(buf1); 39 assert(buf.str() == "testing"); 40 } 41 #ifndef TEST_HAS_NO_WIDE_CHARACTERS 42 { 43 std::wstringbuf buf1(L"testing"); 44 std::wstringbuf buf; 45 buf = std::move(buf1); 46 assert(buf.str() == L"testing"); 47 } 48 { 49 std::wstringbuf buf1(L"testing", std::ios_base::in); 50 std::wstringbuf buf; 51 buf = std::move(buf1); 52 assert(buf.str() == L"testing"); 53 } 54 { 55 std::wstringbuf buf1(L"testing", std::ios_base::out); 56 std::wstringbuf buf; 57 buf = std::move(buf1); 58 assert(buf.str() == L"testing"); 59 } 60 #endif // TEST_HAS_NO_WIDE_CHARACTERS 61 62 return 0; 63 } 64