• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 // explicit basic_stringbuf(const basic_string<charT,traits,Allocator>& s,
15 //                          ios_base::openmode which = ios_base::in | ios_base::out);
16 
17 #include <sstream>
18 #include <cassert>
19 
20 #include "test_macros.h"
21 
main(int,char **)22 int main(int, char**)
23 {
24     {
25         std::stringbuf buf("testing");
26         assert(buf.str() == "testing");
27     }
28     {
29         std::stringbuf buf("testing", std::ios_base::in);
30         assert(buf.str() == "testing");
31     }
32     {
33         std::stringbuf buf("testing", std::ios_base::out);
34         assert(buf.str() == "testing");
35     }
36     {
37         std::wstringbuf buf(L"testing");
38         assert(buf.str() == L"testing");
39     }
40     {
41         std::wstringbuf buf(L"testing", std::ios_base::in);
42         assert(buf.str() == L"testing");
43     }
44     {
45         std::wstringbuf buf(L"testing", std::ios_base::out);
46         assert(buf.str() == L"testing");
47     }
48 
49   return 0;
50 }
51