blob: e98198bf738a37d923643af5f36d93b249b22aec [file] [log] [blame]
Howard Hinnant3e519522010-05-11 19:42:16 +00001//===----------------------------------------------------------------------===//
2//
Howard Hinnant5b08a8a2010-05-11 21:36:01 +00003// The LLVM Compiler Infrastructure
Howard Hinnant3e519522010-05-11 19:42:16 +00004//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10// <sstream>
11
12// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
13// class basic_stringbuf
14
Howard Hinnant66dbf0d2010-08-22 00:26:48 +000015// explicit basic_stringbuf(const basic_string<charT,traits,Allocator>& s,
Howard Hinnant3e519522010-05-11 19:42:16 +000016// ios_base::openmode which = ios_base::in | ios_base::out);
17
18#include <sstream>
19#include <cassert>
20
21int main()
22{
23 {
24 std::stringbuf buf("testing");
25 assert(buf.str() == "testing");
26 }
27 {
28 std::stringbuf buf("testing", std::ios_base::in);
29 assert(buf.str() == "testing");
30 }
31 {
32 std::stringbuf buf("testing", std::ios_base::out);
33 assert(buf.str() == "testing");
34 }
35 {
36 std::wstringbuf buf(L"testing");
37 assert(buf.str() == L"testing");
38 }
39 {
40 std::wstringbuf buf(L"testing", std::ios_base::in);
41 assert(buf.str() == L"testing");
42 }
43 {
44 std::wstringbuf buf(L"testing", std::ios_base::out);
45 assert(buf.str() == L"testing");
46 }
47}