aboutsummaryrefslogtreecommitdiff
path: root/test/std/input.output/string.streams
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/input.output/string.streams')
-rw-r--r--test/std/input.output/string.streams/istringstream/istringstream.assign/member_swap.pass.cpp56
-rw-r--r--test/std/input.output/string.streams/istringstream/istringstream.assign/move.pass.cpp86
-rw-r--r--test/std/input.output/string.streams/istringstream/istringstream.assign/nonmember_swap.pass.cpp59
-rw-r--r--test/std/input.output/string.streams/istringstream/istringstream.cons/default.pass.cpp46
-rw-r--r--test/std/input.output/string.streams/istringstream/istringstream.cons/move.pass.cpp48
-rw-r--r--test/std/input.output/string.streams/istringstream/istringstream.cons/string.pass.cpp67
-rw-r--r--test/std/input.output/string.streams/istringstream/istringstream.members/str.pass.cpp56
-rw-r--r--test/std/input.output/string.streams/istringstream/types.pass.cpp36
-rw-r--r--test/std/input.output/string.streams/ostringstream/ostringstream.assign/member_swap.pass.cpp48
-rw-r--r--test/std/input.output/string.streams/ostringstream/ostringstream.assign/move.pass.cpp46
-rw-r--r--test/std/input.output/string.streams/ostringstream/ostringstream.assign/nonmember_swap.pass.cpp48
-rw-r--r--test/std/input.output/string.streams/ostringstream/ostringstream.cons/default.pass.cpp46
-rw-r--r--test/std/input.output/string.streams/ostringstream/ostringstream.cons/move.pass.cpp44
-rw-r--r--test/std/input.output/string.streams/ostringstream/ostringstream.cons/string.pass.cpp59
-rw-r--r--test/std/input.output/string.streams/ostringstream/ostringstream.members/str.pass.cpp52
-rw-r--r--test/std/input.output/string.streams/ostringstream/types.pass.cpp36
-rw-r--r--test/std/input.output/string.streams/stringbuf/stringbuf.assign/member_swap.pass.cpp64
-rw-r--r--test/std/input.output/string.streams/stringbuf/stringbuf.assign/move.pass.cpp58
-rw-r--r--test/std/input.output/string.streams/stringbuf/stringbuf.assign/nonmember_swap.pass.cpp66
-rw-r--r--test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp30
-rw-r--r--test/std/input.output/string.streams/stringbuf/stringbuf.cons/move.pass.cpp52
-rw-r--r--test/std/input.output/string.streams/stringbuf/stringbuf.cons/string.pass.cpp47
-rw-r--r--test/std/input.output/string.streams/stringbuf/stringbuf.members/str.pass.cpp34
-rw-r--r--test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/overflow.pass.cpp97
-rw-r--r--test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/pbackfail.pass.cpp92
-rw-r--r--test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/seekoff.pass.cpp143
-rw-r--r--test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/seekpos.pass.cpp77
-rw-r--r--test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/setbuf.pass.cpp32
-rw-r--r--test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/underflow.pass.cpp70
-rw-r--r--test/std/input.output/string.streams/stringbuf/types.pass.cpp36
-rw-r--r--test/std/input.output/string.streams/stringstream.cons/default.pass.cpp46
-rw-r--r--test/std/input.output/string.streams/stringstream.cons/move.pass.cpp52
-rw-r--r--test/std/input.output/string.streams/stringstream.cons/move2.pass.cpp37
-rw-r--r--test/std/input.output/string.streams/stringstream.cons/string.pass.cpp49
-rw-r--r--test/std/input.output/string.streams/stringstream.cons/stringstream.assign/member_swap.pass.cpp56
-rw-r--r--test/std/input.output/string.streams/stringstream.cons/stringstream.assign/move.pass.cpp54
-rw-r--r--test/std/input.output/string.streams/stringstream.cons/stringstream.assign/nonmember_swap.pass.cpp59
-rw-r--r--test/std/input.output/string.streams/stringstream.members/str.pass.cpp62
-rw-r--r--test/std/input.output/string.streams/stringstream/types.pass.cpp36
-rw-r--r--test/std/input.output/string.streams/version.pass.cpp20
40 files changed, 2202 insertions, 0 deletions
diff --git a/test/std/input.output/string.streams/istringstream/istringstream.assign/member_swap.pass.cpp b/test/std/input.output/string.streams/istringstream/istringstream.assign/member_swap.pass.cpp
new file mode 100644
index 000000000000..fc5f2e7e920f
--- /dev/null
+++ b/test/std/input.output/string.streams/istringstream/istringstream.assign/member_swap.pass.cpp
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_istringstream
+
+// void swap(basic_istringstream& rhs);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::istringstream ss0(" 123 456");
+ std::istringstream ss(" 789 321");
+ ss.swap(ss0);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ ss0 >> i;
+ assert(i == 789);
+ ss0 >> i;
+ assert(i == 321);
+ }
+ {
+ std::wistringstream ss0(L" 123 456");
+ std::wistringstream ss(L" 789 321");
+ ss.swap(ss0);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ ss0 >> i;
+ assert(i == 789);
+ ss0 >> i;
+ assert(i == 321);
+ }
+}
diff --git a/test/std/input.output/string.streams/istringstream/istringstream.assign/move.pass.cpp b/test/std/input.output/string.streams/istringstream/istringstream.assign/move.pass.cpp
new file mode 100644
index 000000000000..e57ad55c9078
--- /dev/null
+++ b/test/std/input.output/string.streams/istringstream/istringstream.assign/move.pass.cpp
@@ -0,0 +1,86 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_istringstream
+
+// basic_istringstream& operator=(basic_istringstream&& rhs);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ std::istringstream ss0(" 123 456");
+ std::istringstream ss;
+ ss = std::move(ss0);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ }
+ {
+ std::istringstream s1("Aaaaa Bbbbb Cccccccccc Dddddddddddddddddd");
+ std::string s;
+ s1 >> s;
+
+ std::istringstream s2 = std::move(s1);
+ s2 >> s;
+ assert(s == "Bbbbb");
+
+ std::istringstream s3;
+ s3 = std::move(s2);
+ s3 >> s;
+ assert(s == "Cccccccccc");
+
+ s1 = std::move(s3);
+ s1 >> s;
+ assert(s == "Dddddddddddddddddd");
+ }
+ {
+ std::wistringstream ss0(L" 123 456");
+ std::wistringstream ss;
+ ss = std::move(ss0);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ }
+ {
+ std::wistringstream s1(L"Aaaaa Bbbbb Cccccccccc Dddddddddddddddddd");
+ std::wstring s;
+ s1 >> s;
+
+ std::wistringstream s2 = std::move(s1);
+ s2 >> s;
+ assert(s == L"Bbbbb");
+
+ std::wistringstream s3;
+ s3 = std::move(s2);
+ s3 >> s;
+ assert(s == L"Cccccccccc");
+
+ s1 = std::move(s3);
+ s1 >> s;
+ assert(s == L"Dddddddddddddddddd");
+ }
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/std/input.output/string.streams/istringstream/istringstream.assign/nonmember_swap.pass.cpp b/test/std/input.output/string.streams/istringstream/istringstream.assign/nonmember_swap.pass.cpp
new file mode 100644
index 000000000000..d72cef16076f
--- /dev/null
+++ b/test/std/input.output/string.streams/istringstream/istringstream.assign/nonmember_swap.pass.cpp
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_istringstream
+
+// template <class charT, class traits, class Allocator>
+// void
+// swap(basic_istringstream<charT, traits, Allocator>& x,
+// basic_istringstream<charT, traits, Allocator>& y);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::istringstream ss0(" 123 456");
+ std::istringstream ss(" 789 321");
+ swap(ss, ss0);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ ss0 >> i;
+ assert(i == 789);
+ ss0 >> i;
+ assert(i == 321);
+ }
+ {
+ std::wistringstream ss0(L" 123 456");
+ std::wistringstream ss(L" 789 321");
+ swap(ss, ss0);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ ss0 >> i;
+ assert(i == 789);
+ ss0 >> i;
+ assert(i == 321);
+ }
+}
diff --git a/test/std/input.output/string.streams/istringstream/istringstream.cons/default.pass.cpp b/test/std/input.output/string.streams/istringstream/istringstream.cons/default.pass.cpp
new file mode 100644
index 000000000000..5d44a50a3f67
--- /dev/null
+++ b/test/std/input.output/string.streams/istringstream/istringstream.cons/default.pass.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_istringstream
+
+// explicit basic_istringstream(ios_base::openmode which = ios_base::in);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::istringstream ss;
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == "");
+ }
+ {
+ std::istringstream ss(std::ios_base::in);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == "");
+ }
+ {
+ std::wistringstream ss;
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L"");
+ }
+ {
+ std::wistringstream ss(std::ios_base::in);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L"");
+ }
+}
diff --git a/test/std/input.output/string.streams/istringstream/istringstream.cons/move.pass.cpp b/test/std/input.output/string.streams/istringstream/istringstream.cons/move.pass.cpp
new file mode 100644
index 000000000000..adc46ab65f5e
--- /dev/null
+++ b/test/std/input.output/string.streams/istringstream/istringstream.cons/move.pass.cpp
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_istringstream
+
+// basic_istringstream(basic_istringstream&& rhs);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ std::istringstream ss0(" 123 456");
+ std::istringstream ss(std::move(ss0));
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ }
+ {
+ std::wistringstream ss0(L" 123 456");
+ std::wistringstream ss(std::move(ss0));
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ }
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/std/input.output/string.streams/istringstream/istringstream.cons/string.pass.cpp b/test/std/input.output/string.streams/istringstream/istringstream.cons/string.pass.cpp
new file mode 100644
index 000000000000..977923639699
--- /dev/null
+++ b/test/std/input.output/string.streams/istringstream/istringstream.cons/string.pass.cpp
@@ -0,0 +1,67 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_istringstream
+
+// explicit basic_istringstream(const basic_string<charT,traits,allocator>& str,
+// ios_base::openmode which = ios_base::in);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::istringstream ss(" 123 456");
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ }
+ {
+ std::istringstream ss(" 123 456", std::ios_base::out);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ }
+ {
+ std::wistringstream ss(L" 123 456");
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ }
+ {
+ std::wistringstream ss(L" 123 456", std::ios_base::out);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ }
+}
diff --git a/test/std/input.output/string.streams/istringstream/istringstream.members/str.pass.cpp b/test/std/input.output/string.streams/istringstream/istringstream.members/str.pass.cpp
new file mode 100644
index 000000000000..448a6f89b259
--- /dev/null
+++ b/test/std/input.output/string.streams/istringstream/istringstream.members/str.pass.cpp
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_istringstream
+
+// void str(const basic_string<charT,traits,Allocator>& s);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::istringstream ss(" 123 456");
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ ss.str(" 789");
+ ss.clear();
+ assert(ss.good());
+ assert(ss.str() == " 789");
+ ss >> i;
+ assert(i == 789);
+ }
+ {
+ std::wistringstream ss(L" 123 456");
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ ss.str(L" 789");
+ ss.clear();
+ assert(ss.good());
+ assert(ss.str() == L" 789");
+ ss >> i;
+ assert(i == 789);
+ }
+}
diff --git a/test/std/input.output/string.streams/istringstream/types.pass.cpp b/test/std/input.output/string.streams/istringstream/types.pass.cpp
new file mode 100644
index 000000000000..349bcae1a1c1
--- /dev/null
+++ b/test/std/input.output/string.streams/istringstream/types.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_istringstream
+// : public basic_istream<charT, traits>
+// {
+// public:
+// typedef charT char_type;
+// typedef traits traits_type;
+// typedef typename traits_type::int_type int_type;
+// typedef typename traits_type::pos_type pos_type;
+// typedef typename traits_type::off_type off_type;
+// typedef Allocator allocator_type;
+
+#include <sstream>
+#include <type_traits>
+
+int main()
+{
+ static_assert((std::is_base_of<std::basic_istream<char>, std::basic_istringstream<char> >::value), "");
+ static_assert((std::is_same<std::basic_istringstream<char>::char_type, char>::value), "");
+ static_assert((std::is_same<std::basic_istringstream<char>::traits_type, std::char_traits<char> >::value), "");
+ static_assert((std::is_same<std::basic_istringstream<char>::int_type, std::char_traits<char>::int_type>::value), "");
+ static_assert((std::is_same<std::basic_istringstream<char>::pos_type, std::char_traits<char>::pos_type>::value), "");
+ static_assert((std::is_same<std::basic_istringstream<char>::off_type, std::char_traits<char>::off_type>::value), "");
+ static_assert((std::is_same<std::basic_istringstream<char>::allocator_type, std::allocator<char> >::value), "");
+}
diff --git a/test/std/input.output/string.streams/ostringstream/ostringstream.assign/member_swap.pass.cpp b/test/std/input.output/string.streams/ostringstream/ostringstream.assign/member_swap.pass.cpp
new file mode 100644
index 000000000000..eff47452c58f
--- /dev/null
+++ b/test/std/input.output/string.streams/ostringstream/ostringstream.assign/member_swap.pass.cpp
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_ostringstream
+
+// void swap(basic_ostringstream& rhs);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::ostringstream ss0(" 123 456");
+ std::ostringstream ss;
+ ss.swap(ss0);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456");
+ int i = 234;
+ ss << i << ' ' << 567;;
+ assert(ss.str() == "234 5676");
+ ss0 << i << ' ' << 567;;
+ assert(ss0.str() == "234 567");
+ }
+ {
+ std::wostringstream ss0(L" 123 456");
+ std::wostringstream ss;
+ ss.swap(ss0);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456");
+ int i = 234;
+ ss << i << ' ' << 567;;
+ assert(ss.str() == L"234 5676");
+ ss0 << i << ' ' << 567;;
+ assert(ss0.str() == L"234 567");
+ }
+}
diff --git a/test/std/input.output/string.streams/ostringstream/ostringstream.assign/move.pass.cpp b/test/std/input.output/string.streams/ostringstream/ostringstream.assign/move.pass.cpp
new file mode 100644
index 000000000000..a6fb8ba69b2e
--- /dev/null
+++ b/test/std/input.output/string.streams/ostringstream/ostringstream.assign/move.pass.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_ostringstream
+
+// basic_ostringstream& operator=(basic_ostringstream&& rhs);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ std::ostringstream ss0(" 123 456");
+ std::ostringstream ss;
+ ss = std::move(ss0);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456");
+ int i = 234;
+ ss << i << ' ' << 567;;
+ assert(ss.str() == "234 5676");
+ }
+ {
+ std::wostringstream ss0(L" 123 456");
+ std::wostringstream ss;
+ ss = std::move(ss0);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456");
+ int i = 234;
+ ss << i << ' ' << 567;;
+ assert(ss.str() == L"234 5676");
+ }
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/std/input.output/string.streams/ostringstream/ostringstream.assign/nonmember_swap.pass.cpp b/test/std/input.output/string.streams/ostringstream/ostringstream.assign/nonmember_swap.pass.cpp
new file mode 100644
index 000000000000..3d7081d8e241
--- /dev/null
+++ b/test/std/input.output/string.streams/ostringstream/ostringstream.assign/nonmember_swap.pass.cpp
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_ostringstream
+
+// void swap(basic_ostringstream& rhs);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::ostringstream ss0(" 123 456");
+ std::ostringstream ss;
+ swap(ss, ss0);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456");
+ int i = 234;
+ ss << i << ' ' << 567;;
+ assert(ss.str() == "234 5676");
+ ss0 << i << ' ' << 567;;
+ assert(ss0.str() == "234 567");
+ }
+ {
+ std::wostringstream ss0(L" 123 456");
+ std::wostringstream ss;
+ swap(ss, ss0);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456");
+ int i = 234;
+ ss << i << ' ' << 567;;
+ assert(ss.str() == L"234 5676");
+ ss0 << i << ' ' << 567;;
+ assert(ss0.str() == L"234 567");
+ }
+}
diff --git a/test/std/input.output/string.streams/ostringstream/ostringstream.cons/default.pass.cpp b/test/std/input.output/string.streams/ostringstream/ostringstream.cons/default.pass.cpp
new file mode 100644
index 000000000000..dde1dc719238
--- /dev/null
+++ b/test/std/input.output/string.streams/ostringstream/ostringstream.cons/default.pass.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_ostringstream
+
+// explicit basic_ostringstream(ios_base::openmode which = ios_base::in);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::ostringstream ss;
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == "");
+ }
+ {
+ std::ostringstream ss(std::ios_base::out);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == "");
+ }
+ {
+ std::wostringstream ss;
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L"");
+ }
+ {
+ std::wostringstream ss(std::ios_base::out);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L"");
+ }
+}
diff --git a/test/std/input.output/string.streams/ostringstream/ostringstream.cons/move.pass.cpp b/test/std/input.output/string.streams/ostringstream/ostringstream.cons/move.pass.cpp
new file mode 100644
index 000000000000..dc63b59fe39f
--- /dev/null
+++ b/test/std/input.output/string.streams/ostringstream/ostringstream.cons/move.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_ostringstream
+
+// basic_ostringstream(basic_ostringstream&& rhs);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ std::ostringstream ss0(" 123 456");
+ std::ostringstream ss(std::move(ss0));
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456");
+ int i = 234;
+ ss << i << ' ' << 567;;
+ assert(ss.str() == "234 5676");
+ }
+ {
+ std::wostringstream ss0(L" 123 456");
+ std::wostringstream ss(std::move(ss0));
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456");
+ int i = 234;
+ ss << i << ' ' << 567;;
+ assert(ss.str() == L"234 5676");
+ }
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/std/input.output/string.streams/ostringstream/ostringstream.cons/string.pass.cpp b/test/std/input.output/string.streams/ostringstream/ostringstream.cons/string.pass.cpp
new file mode 100644
index 000000000000..89c91bdee05d
--- /dev/null
+++ b/test/std/input.output/string.streams/ostringstream/ostringstream.cons/string.pass.cpp
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_ostringstream
+
+// explicit basic_ostringstream(const basic_string<charT,traits,allocator>& str,
+// ios_base::openmode which = ios_base::in);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::ostringstream ss(" 123 456");
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456");
+ int i = 234;
+ ss << i << ' ' << 567;;
+ assert(ss.str() == "234 5676");
+ }
+ {
+ std::ostringstream ss(" 123 456", std::ios_base::in);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456");
+ int i = 234;
+ ss << i << ' ' << 567;;
+ assert(ss.str() == "234 5676");
+ }
+ {
+ std::wostringstream ss(L" 123 456");
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456");
+ int i = 234;
+ ss << i << ' ' << 567;;
+ assert(ss.str() == L"234 5676");
+ }
+ {
+ std::wostringstream ss(L" 123 456", std::ios_base::in);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456");
+ int i = 234;
+ ss << i << ' ' << 567;;
+ assert(ss.str() == L"234 5676");
+ }
+}
diff --git a/test/std/input.output/string.streams/ostringstream/ostringstream.members/str.pass.cpp b/test/std/input.output/string.streams/ostringstream/ostringstream.members/str.pass.cpp
new file mode 100644
index 000000000000..ab277a2eeac7
--- /dev/null
+++ b/test/std/input.output/string.streams/ostringstream/ostringstream.members/str.pass.cpp
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_ostringstream
+
+// void str(const basic_string<charT,traits,Allocator>& s);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::ostringstream ss(" 123 456");
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456");
+ int i = 0;
+ ss << i;
+ assert(ss.str() == "0123 456");
+ ss << 456;
+ assert(ss.str() == "0456 456");
+ ss.str(" 789");
+ assert(ss.str() == " 789");
+ ss << "abc";
+ assert(ss.str() == "abc9");
+ }
+ {
+ std::wostringstream ss(L" 123 456");
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456");
+ int i = 0;
+ ss << i;
+ assert(ss.str() == L"0123 456");
+ ss << 456;
+ assert(ss.str() == L"0456 456");
+ ss.str(L" 789");
+ assert(ss.str() == L" 789");
+ ss << L"abc";
+ assert(ss.str() == L"abc9");
+ }
+}
diff --git a/test/std/input.output/string.streams/ostringstream/types.pass.cpp b/test/std/input.output/string.streams/ostringstream/types.pass.cpp
new file mode 100644
index 000000000000..c9cb763784ef
--- /dev/null
+++ b/test/std/input.output/string.streams/ostringstream/types.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_ostringstream
+// : public basic_ostream<charT, traits>
+// {
+// public:
+// typedef charT char_type;
+// typedef traits traits_type;
+// typedef typename traits_type::int_type int_type;
+// typedef typename traits_type::pos_type pos_type;
+// typedef typename traits_type::off_type off_type;
+// typedef Allocator allocator_type;
+
+#include <sstream>
+#include <type_traits>
+
+int main()
+{
+ static_assert((std::is_base_of<std::basic_ostream<char>, std::basic_ostringstream<char> >::value), "");
+ static_assert((std::is_same<std::basic_ostringstream<char>::char_type, char>::value), "");
+ static_assert((std::is_same<std::basic_ostringstream<char>::traits_type, std::char_traits<char> >::value), "");
+ static_assert((std::is_same<std::basic_ostringstream<char>::int_type, std::char_traits<char>::int_type>::value), "");
+ static_assert((std::is_same<std::basic_ostringstream<char>::pos_type, std::char_traits<char>::pos_type>::value), "");
+ static_assert((std::is_same<std::basic_ostringstream<char>::off_type, std::char_traits<char>::off_type>::value), "");
+ static_assert((std::is_same<std::basic_ostringstream<char>::allocator_type, std::allocator<char> >::value), "");
+}
diff --git a/test/std/input.output/string.streams/stringbuf/stringbuf.assign/member_swap.pass.cpp b/test/std/input.output/string.streams/stringbuf/stringbuf.assign/member_swap.pass.cpp
new file mode 100644
index 000000000000..eaca7245461f
--- /dev/null
+++ b/test/std/input.output/string.streams/stringbuf/stringbuf.assign/member_swap.pass.cpp
@@ -0,0 +1,64 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+
+// void swap(basic_stringbuf& rhs);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::stringbuf buf1("testing");
+ std::stringbuf buf;
+ buf.swap(buf1);
+ assert(buf.str() == "testing");
+ assert(buf1.str() == "");
+ }
+ {
+ std::stringbuf buf1("testing", std::ios_base::in);
+ std::stringbuf buf;
+ buf.swap(buf1);
+ assert(buf.str() == "testing");
+ assert(buf1.str() == "");
+ }
+ {
+ std::stringbuf buf1("testing", std::ios_base::out);
+ std::stringbuf buf;
+ buf.swap(buf1);
+ assert(buf.str() == "testing");
+ assert(buf1.str() == "");
+ }
+ {
+ std::wstringbuf buf1(L"testing");
+ std::wstringbuf buf;
+ buf.swap(buf1);
+ assert(buf.str() == L"testing");
+ assert(buf1.str() == L"");
+ }
+ {
+ std::wstringbuf buf1(L"testing", std::ios_base::in);
+ std::wstringbuf buf;
+ buf.swap(buf1);
+ assert(buf.str() == L"testing");
+ assert(buf1.str() == L"");
+ }
+ {
+ std::wstringbuf buf1(L"testing", std::ios_base::out);
+ std::wstringbuf buf;
+ buf.swap(buf1);
+ assert(buf.str() == L"testing");
+ assert(buf1.str() == L"");
+ }
+}
diff --git a/test/std/input.output/string.streams/stringbuf/stringbuf.assign/move.pass.cpp b/test/std/input.output/string.streams/stringbuf/stringbuf.assign/move.pass.cpp
new file mode 100644
index 000000000000..716b6afa755a
--- /dev/null
+++ b/test/std/input.output/string.streams/stringbuf/stringbuf.assign/move.pass.cpp
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+
+// basic_stringbuf& operator=(basic_stringbuf&& rhs);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::stringbuf buf1("testing");
+ std::stringbuf buf;
+ buf = move(buf1);
+ assert(buf.str() == "testing");
+ }
+ {
+ std::stringbuf buf1("testing", std::ios_base::in);
+ std::stringbuf buf;
+ buf = move(buf1);
+ assert(buf.str() == "testing");
+ }
+ {
+ std::stringbuf buf1("testing", std::ios_base::out);
+ std::stringbuf buf;
+ buf = move(buf1);
+ assert(buf.str() == "testing");
+ }
+ {
+ std::wstringbuf buf1(L"testing");
+ std::wstringbuf buf;
+ buf = move(buf1);
+ assert(buf.str() == L"testing");
+ }
+ {
+ std::wstringbuf buf1(L"testing", std::ios_base::in);
+ std::wstringbuf buf;
+ buf = move(buf1);
+ assert(buf.str() == L"testing");
+ }
+ {
+ std::wstringbuf buf1(L"testing", std::ios_base::out);
+ std::wstringbuf buf;
+ buf = move(buf1);
+ assert(buf.str() == L"testing");
+ }
+}
diff --git a/test/std/input.output/string.streams/stringbuf/stringbuf.assign/nonmember_swap.pass.cpp b/test/std/input.output/string.streams/stringbuf/stringbuf.assign/nonmember_swap.pass.cpp
new file mode 100644
index 000000000000..dca637d39fab
--- /dev/null
+++ b/test/std/input.output/string.streams/stringbuf/stringbuf.assign/nonmember_swap.pass.cpp
@@ -0,0 +1,66 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+
+// template <class charT, class traits, class Allocator>
+// void swap(basic_stringbuf<charT, traits, Allocator>& x,
+// basic_stringbuf<charT, traits, Allocator>& y);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::stringbuf buf1("testing");
+ std::stringbuf buf;
+ swap(buf, buf1);
+ assert(buf.str() == "testing");
+ assert(buf1.str() == "");
+ }
+ {
+ std::stringbuf buf1("testing", std::ios_base::in);
+ std::stringbuf buf;
+ swap(buf, buf1);
+ assert(buf.str() == "testing");
+ assert(buf1.str() == "");
+ }
+ {
+ std::stringbuf buf1("testing", std::ios_base::out);
+ std::stringbuf buf;
+ swap(buf, buf1);
+ assert(buf.str() == "testing");
+ assert(buf1.str() == "");
+ }
+ {
+ std::wstringbuf buf1(L"testing");
+ std::wstringbuf buf;
+ swap(buf, buf1);
+ assert(buf.str() == L"testing");
+ assert(buf1.str() == L"");
+ }
+ {
+ std::wstringbuf buf1(L"testing", std::ios_base::in);
+ std::wstringbuf buf;
+ swap(buf, buf1);
+ assert(buf.str() == L"testing");
+ assert(buf1.str() == L"");
+ }
+ {
+ std::wstringbuf buf1(L"testing", std::ios_base::out);
+ std::wstringbuf buf;
+ swap(buf, buf1);
+ assert(buf.str() == L"testing");
+ assert(buf1.str() == L"");
+ }
+}
diff --git a/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp b/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp
new file mode 100644
index 000000000000..28007c8edf45
--- /dev/null
+++ b/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+
+// explicit basic_stringbuf(ios_base::openmode which = ios_base::in | ios_base::out);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::stringbuf buf;
+ assert(buf.str() == "");
+ }
+ {
+ std::wstringbuf buf;
+ assert(buf.str() == L"");
+ }
+}
diff --git a/test/std/input.output/string.streams/stringbuf/stringbuf.cons/move.pass.cpp b/test/std/input.output/string.streams/stringbuf/stringbuf.cons/move.pass.cpp
new file mode 100644
index 000000000000..14fd0caa5cb9
--- /dev/null
+++ b/test/std/input.output/string.streams/stringbuf/stringbuf.cons/move.pass.cpp
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+
+// basic_stringbuf(basic_stringbuf&& rhs);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::stringbuf buf1("testing");
+ std::stringbuf buf(move(buf1));
+ assert(buf.str() == "testing");
+ }
+ {
+ std::stringbuf buf1("testing", std::ios_base::in);
+ std::stringbuf buf(move(buf1));
+ assert(buf.str() == "testing");
+ }
+ {
+ std::stringbuf buf1("testing", std::ios_base::out);
+ std::stringbuf buf(move(buf1));
+ assert(buf.str() == "testing");
+ }
+ {
+ std::wstringbuf buf1(L"testing");
+ std::wstringbuf buf(move(buf1));
+ assert(buf.str() == L"testing");
+ }
+ {
+ std::wstringbuf buf1(L"testing", std::ios_base::in);
+ std::wstringbuf buf(move(buf1));
+ assert(buf.str() == L"testing");
+ }
+ {
+ std::wstringbuf buf1(L"testing", std::ios_base::out);
+ std::wstringbuf buf(move(buf1));
+ assert(buf.str() == L"testing");
+ }
+}
diff --git a/test/std/input.output/string.streams/stringbuf/stringbuf.cons/string.pass.cpp b/test/std/input.output/string.streams/stringbuf/stringbuf.cons/string.pass.cpp
new file mode 100644
index 000000000000..eae1b0b87653
--- /dev/null
+++ b/test/std/input.output/string.streams/stringbuf/stringbuf.cons/string.pass.cpp
@@ -0,0 +1,47 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+
+// explicit basic_stringbuf(const basic_string<charT,traits,Allocator>& s,
+// ios_base::openmode which = ios_base::in | ios_base::out);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::stringbuf buf("testing");
+ assert(buf.str() == "testing");
+ }
+ {
+ std::stringbuf buf("testing", std::ios_base::in);
+ assert(buf.str() == "testing");
+ }
+ {
+ std::stringbuf buf("testing", std::ios_base::out);
+ assert(buf.str() == "testing");
+ }
+ {
+ std::wstringbuf buf(L"testing");
+ assert(buf.str() == L"testing");
+ }
+ {
+ std::wstringbuf buf(L"testing", std::ios_base::in);
+ assert(buf.str() == L"testing");
+ }
+ {
+ std::wstringbuf buf(L"testing", std::ios_base::out);
+ assert(buf.str() == L"testing");
+ }
+}
diff --git a/test/std/input.output/string.streams/stringbuf/stringbuf.members/str.pass.cpp b/test/std/input.output/string.streams/stringbuf/stringbuf.members/str.pass.cpp
new file mode 100644
index 000000000000..712e0edd27b5
--- /dev/null
+++ b/test/std/input.output/string.streams/stringbuf/stringbuf.members/str.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+
+// void str(const basic_string<charT,traits,Allocator>& s);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::stringbuf buf("testing");
+ assert(buf.str() == "testing");
+ buf.str("another test");
+ assert(buf.str() == "another test");
+ }
+ {
+ std::wstringbuf buf(L"testing");
+ assert(buf.str() == L"testing");
+ buf.str(L"another test");
+ assert(buf.str() == L"another test");
+ }
+}
diff --git a/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/overflow.pass.cpp b/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/overflow.pass.cpp
new file mode 100644
index 000000000000..3abf9423a12e
--- /dev/null
+++ b/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/overflow.pass.cpp
@@ -0,0 +1,97 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+
+// int_type overflow(int_type c = traits::eof());
+
+#include <sstream>
+#include <cassert>
+
+int overflow_called = 0;
+
+template <class CharT>
+struct testbuf
+ : public std::basic_stringbuf<CharT>
+{
+ typedef std::basic_stringbuf<CharT> base;
+ explicit testbuf(const std::basic_string<CharT>& str,
+ std::ios_base::openmode which = std::ios_base::in | std::ios_base::out)
+ : base(str, which) {}
+
+ typename base::int_type
+ overflow(typename base::int_type c = base::type_traits::eof())
+ {++overflow_called; return base::overflow(c);}
+
+ void pbump(int n) {base::pbump(n);}
+};
+
+int main()
+{
+ {
+ testbuf<char> sb("abc");
+ assert(sb.sputc('1') == '1');
+ assert(sb.str() == "1bc");
+ assert(sb.sputc('2') == '2');
+ assert(sb.str() == "12c");
+ assert(sb.sputc('3') == '3');
+ assert(sb.str() == "123");
+ assert(sb.sputc('4') == '4');
+ assert(sb.str() == "1234");
+ assert(sb.sputc('5') == '5');
+ assert(sb.str() == "12345");
+ assert(sb.sputc('6') == '6');
+ assert(sb.str() == "123456");
+ assert(sb.sputc('7') == '7');
+ assert(sb.str() == "1234567");
+ assert(sb.sputc('8') == '8');
+ assert(sb.str() == "12345678");
+ assert(sb.sputc('9') == '9');
+ assert(sb.str() == "123456789");
+ assert(sb.sputc('0') == '0');
+ assert(sb.str() == "1234567890");
+ assert(sb.sputc('1') == '1');
+ assert(sb.str() == "12345678901");
+ }
+ {
+ testbuf<wchar_t> sb(L"abc");
+ assert(sb.sputc(L'1') == L'1');
+ assert(sb.str() == L"1bc");
+ assert(sb.sputc(L'2') == L'2');
+ assert(sb.str() == L"12c");
+ assert(sb.sputc(L'3') == L'3');
+ assert(sb.str() == L"123");
+ assert(sb.sputc(L'4') == L'4');
+ assert(sb.str() == L"1234");
+ assert(sb.sputc(L'5') == L'5');
+ assert(sb.str() == L"12345");
+ assert(sb.sputc(L'6') == L'6');
+ assert(sb.str() == L"123456");
+ assert(sb.sputc(L'7') == L'7');
+ assert(sb.str() == L"1234567");
+ assert(sb.sputc(L'8') == L'8');
+ assert(sb.str() == L"12345678");
+ assert(sb.sputc(L'9') == L'9');
+ assert(sb.str() == L"123456789");
+ assert(sb.sputc(L'0') == L'0');
+ assert(sb.str() == L"1234567890");
+ assert(sb.sputc(L'1') == L'1');
+ assert(sb.str() == L"12345678901");
+ }
+ {
+ testbuf<char> sb("abc", std::ios_base::app | std::ios_base::out);
+ assert(sb.sputc('1') == '1');
+ assert(sb.str() == "abc1");
+ assert(sb.sputc('2') == '2');
+ assert(sb.str() == "abc12");
+ }
+}
diff --git a/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/pbackfail.pass.cpp b/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/pbackfail.pass.cpp
new file mode 100644
index 000000000000..4af0e63029a7
--- /dev/null
+++ b/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/pbackfail.pass.cpp
@@ -0,0 +1,92 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+
+// int_type pbackfail(int_type c = traits::eof());
+
+#include <sstream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_stringbuf<CharT>
+{
+ typedef std::basic_stringbuf<CharT> base;
+ explicit testbuf(const std::basic_string<CharT>& str,
+ std::ios_base::openmode which = std::ios_base::in | std::ios_base::out)
+ : base(str, which) {}
+
+ typename base::int_type
+ pbackfail(typename base::int_type c = base::type_traits::eof())
+ {return base::pbackfail(c);}
+
+ void pbump(int n) {base::pbump(n);}
+};
+
+int main()
+{
+ {
+ testbuf<char> sb("123", std::ios_base::in);
+ assert(sb.sgetc() == '1');
+ assert(sb.snextc() == '2');
+ assert(sb.snextc() == '3');
+ assert(sb.sgetc() == '3');
+ assert(sb.snextc() == std::char_traits<char>::eof());
+ assert(sb.pbackfail('3') == '3');
+ assert(sb.pbackfail('3') == std::char_traits<char>::eof());
+ assert(sb.pbackfail('2') == '2');
+ assert(sb.pbackfail(std::char_traits<char>::eof()) != std::char_traits<char>::eof());
+ assert(sb.pbackfail(std::char_traits<char>::eof()) == std::char_traits<char>::eof());
+ assert(sb.str() == "123");
+ }
+ {
+ testbuf<char> sb("123");
+ assert(sb.sgetc() == '1');
+ assert(sb.snextc() == '2');
+ assert(sb.snextc() == '3');
+ assert(sb.sgetc() == '3');
+ assert(sb.snextc() == std::char_traits<char>::eof());
+ assert(sb.pbackfail('3') == '3');
+ assert(sb.pbackfail('3') == '3');
+ assert(sb.pbackfail(std::char_traits<char>::eof()) != std::char_traits<char>::eof());
+ assert(sb.pbackfail(std::char_traits<char>::eof()) == std::char_traits<char>::eof());
+ assert(sb.str() == "133");
+ }
+ {
+ testbuf<wchar_t> sb(L"123", std::ios_base::in);
+ assert(sb.sgetc() == L'1');
+ assert(sb.snextc() == L'2');
+ assert(sb.snextc() == L'3');
+ assert(sb.sgetc() == L'3');
+ assert(sb.snextc() == std::char_traits<wchar_t>::eof());
+ assert(sb.pbackfail(L'3') == L'3');
+ assert(sb.pbackfail(L'3') == std::char_traits<wchar_t>::eof());
+ assert(sb.pbackfail(L'2') == L'2');
+ assert(sb.pbackfail(std::char_traits<wchar_t>::eof()) != std::char_traits<wchar_t>::eof());
+ assert(sb.pbackfail(std::char_traits<wchar_t>::eof()) == std::char_traits<wchar_t>::eof());
+ assert(sb.str() == L"123");
+ }
+ {
+ testbuf<wchar_t> sb(L"123");
+ assert(sb.sgetc() == L'1');
+ assert(sb.snextc() == L'2');
+ assert(sb.snextc() == L'3');
+ assert(sb.sgetc() == L'3');
+ assert(sb.snextc() == std::char_traits<wchar_t>::eof());
+ assert(sb.pbackfail(L'3') == L'3');
+ assert(sb.pbackfail(L'3') == L'3');
+ assert(sb.pbackfail(std::char_traits<wchar_t>::eof()) != std::char_traits<wchar_t>::eof());
+ assert(sb.pbackfail(std::char_traits<wchar_t>::eof()) == std::char_traits<wchar_t>::eof());
+ assert(sb.str() == L"133");
+ }
+}
diff --git a/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/seekoff.pass.cpp b/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/seekoff.pass.cpp
new file mode 100644
index 000000000000..6d20db13189a
--- /dev/null
+++ b/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/seekoff.pass.cpp
@@ -0,0 +1,143 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+
+// pos_type seekoff(off_type off, ios_base::seekdir way,
+// ios_base::openmode which = ios_base::in | ios_base::out);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::stringbuf sb("0123456789", std::ios_base::in);
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::out) == -1);
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::out) == -1);
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::out) == -1);
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::in | std::ios_base::out) == -1);
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::in | std::ios_base::out) == -1);
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::in | std::ios_base::out) == -1);
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::in) == 3);
+ assert(sb.sgetc() == '3');
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::in) == 6);
+ assert(sb.sgetc() == '6');
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::in) == 7);
+ assert(sb.sgetc() == '7');
+ }
+ {
+ std::stringbuf sb("0123456789", std::ios_base::out);
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::in) == -1);
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::in) == -1);
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::in) == -1);
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::out | std::ios_base::in) == -1);
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::out | std::ios_base::in) == -1);
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::out | std::ios_base::in) == -1);
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::out) == 3);
+ assert(sb.sputc('a') == 'a');
+ assert(sb.str() == "012a456789");
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::out) == 7);
+ assert(sb.sputc('b') == 'b');
+ assert(sb.str() == "012a456b89");
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::out) == 7);
+ assert(sb.sputc('c') == 'c');
+ assert(sb.str() == "012a456c89");
+ }
+ {
+ std::stringbuf sb("0123456789");
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::in) == 3);
+ assert(sb.sgetc() == '3');
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::in) == 6);
+ assert(sb.sgetc() == '6');
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::in) == 7);
+ assert(sb.sgetc() == '7');
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::out | std::ios_base::in) == 3);
+ assert(sb.sgetc() == '3');
+ assert(sb.sputc('a') == 'a');
+ assert(sb.str() == "012a456789");
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::out | std::ios_base::in) == -1);
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::out | std::ios_base::in) == 7);
+ assert(sb.sgetc() == '7');
+ assert(sb.sputc('c') == 'c');
+ assert(sb.str() == "012a456c89");
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::out) == 3);
+ assert(sb.sputc('3') == '3');
+ assert(sb.str() == "0123456c89");
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::out) == 7);
+ assert(sb.sputc('7') == '7');
+ assert(sb.str() == "0123456789");
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::out) == 7);
+ assert(sb.sputc('c') == 'c');
+ assert(sb.str() == "0123456c89");
+ }
+ {
+ std::wstringbuf sb(L"0123456789", std::ios_base::in);
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::out) == -1);
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::out) == -1);
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::out) == -1);
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::in | std::ios_base::out) == -1);
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::in | std::ios_base::out) == -1);
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::in | std::ios_base::out) == -1);
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::in) == 3);
+ assert(sb.sgetc() == L'3');
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::in) == 6);
+ assert(sb.sgetc() == L'6');
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::in) == 7);
+ assert(sb.sgetc() == L'7');
+ }
+ {
+ std::wstringbuf sb(L"0123456789", std::ios_base::out);
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::in) == -1);
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::in) == -1);
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::in) == -1);
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::out | std::ios_base::in) == -1);
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::out | std::ios_base::in) == -1);
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::out | std::ios_base::in) == -1);
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::out) == 3);
+ assert(sb.sputc(L'a') == L'a');
+ assert(sb.str() == L"012a456789");
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::out) == 7);
+ assert(sb.sputc(L'b') == L'b');
+ assert(sb.str() == L"012a456b89");
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::out) == 7);
+ assert(sb.sputc(L'c') == L'c');
+ assert(sb.str() == L"012a456c89");
+ }
+ {
+ std::wstringbuf sb(L"0123456789");
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::in) == 3);
+ assert(sb.sgetc() == L'3');
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::in) == 6);
+ assert(sb.sgetc() == L'6');
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::in) == 7);
+ assert(sb.sgetc() == L'7');
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::out | std::ios_base::in) == 3);
+ assert(sb.sgetc() == L'3');
+ assert(sb.sputc(L'a') == L'a');
+ assert(sb.str() == L"012a456789");
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::out | std::ios_base::in) == -1);
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::out | std::ios_base::in) == 7);
+ assert(sb.sgetc() == L'7');
+ assert(sb.sputc(L'c') == L'c');
+ assert(sb.str() == L"012a456c89");
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::out) == 3);
+ assert(sb.sputc(L'3') == L'3');
+ assert(sb.str() == L"0123456c89");
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::out) == 7);
+ assert(sb.sputc(L'7') == L'7');
+ assert(sb.str() == L"0123456789");
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::out) == 7);
+ assert(sb.sputc(L'c') == L'c');
+ assert(sb.str() == L"0123456c89");
+ }
+}
diff --git a/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/seekpos.pass.cpp b/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/seekpos.pass.cpp
new file mode 100644
index 000000000000..2b809a887a35
--- /dev/null
+++ b/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/seekpos.pass.cpp
@@ -0,0 +1,77 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+
+// pos_type seekpos(pos_type sp,
+// ios_base::openmode which = ios_base::in | ios_base::out);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::stringbuf sb("0123456789", std::ios_base::in);
+ assert(sb.pubseekpos(3, std::ios_base::out) == -1);
+ assert(sb.pubseekpos(3, std::ios_base::in | std::ios_base::out) == -1);
+ assert(sb.pubseekpos(3, std::ios_base::in) == 3);
+ assert(sb.sgetc() == '3');
+ }
+ {
+ std::stringbuf sb("0123456789", std::ios_base::out);
+ assert(sb.pubseekpos(3, std::ios_base::in) == -1);
+ assert(sb.pubseekpos(3, std::ios_base::out | std::ios_base::in) == -1);
+ assert(sb.pubseekpos(3, std::ios_base::out) == 3);
+ assert(sb.sputc('a') == 'a');
+ assert(sb.str() == "012a456789");
+ }
+ {
+ std::stringbuf sb("0123456789");
+ assert(sb.pubseekpos(3, std::ios_base::in) == 3);
+ assert(sb.sgetc() == '3');
+ assert(sb.pubseekpos(3, std::ios_base::out | std::ios_base::in) == 3);
+ assert(sb.sgetc() == '3');
+ assert(sb.sputc('a') == 'a');
+ assert(sb.str() == "012a456789");
+ assert(sb.pubseekpos(3, std::ios_base::out) == 3);
+ assert(sb.sputc('3') == '3');
+ assert(sb.str() == "0123456789");
+ }
+ {
+ std::wstringbuf sb(L"0123456789", std::ios_base::in);
+ assert(sb.pubseekpos(3, std::ios_base::out) == -1);
+ assert(sb.pubseekpos(3, std::ios_base::in | std::ios_base::out) == -1);
+ assert(sb.pubseekpos(3, std::ios_base::in) == 3);
+ assert(sb.sgetc() == L'3');
+ }
+ {
+ std::wstringbuf sb(L"0123456789", std::ios_base::out);
+ assert(sb.pubseekpos(3, std::ios_base::in) == -1);
+ assert(sb.pubseekpos(3, std::ios_base::out | std::ios_base::in) == -1);
+ assert(sb.pubseekpos(3, std::ios_base::out) == 3);
+ assert(sb.sputc(L'a') == L'a');
+ assert(sb.str() == L"012a456789");
+ }
+ {
+ std::wstringbuf sb(L"0123456789");
+ assert(sb.pubseekpos(3, std::ios_base::in) == 3);
+ assert(sb.sgetc() == L'3');
+ assert(sb.pubseekpos(3, std::ios_base::out | std::ios_base::in) == 3);
+ assert(sb.sgetc() == L'3');
+ assert(sb.sputc(L'a') == L'a');
+ assert(sb.str() == L"012a456789");
+ assert(sb.pubseekpos(3, std::ios_base::out) == 3);
+ assert(sb.sputc(L'3') == L'3');
+ assert(sb.str() == L"0123456789");
+ }
+}
diff --git a/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/setbuf.pass.cpp b/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/setbuf.pass.cpp
new file mode 100644
index 000000000000..7130f5b8646f
--- /dev/null
+++ b/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/setbuf.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+
+// basic_streambuf<charT,traits>* setbuf(charT* s, streamsize n);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::stringbuf sb("0123456789");
+ assert(sb.pubsetbuf(0, 0) == &sb);
+ assert(sb.str() == "0123456789");
+ }
+ {
+ std::wstringbuf sb(L"0123456789");
+ assert(sb.pubsetbuf(0, 0) == &sb);
+ assert(sb.str() == L"0123456789");
+ }
+}
diff --git a/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/underflow.pass.cpp b/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/underflow.pass.cpp
new file mode 100644
index 000000000000..3641af239d7d
--- /dev/null
+++ b/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/underflow.pass.cpp
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+
+// int_type underflow();
+
+#include <sstream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+ : public std::basic_stringbuf<CharT>
+{
+ typedef std::basic_stringbuf<CharT> base;
+ explicit testbuf(const std::basic_string<CharT>& str)
+ : base(str) {}
+
+ typename base::int_type underflow() {return base::underflow();}
+ void pbump(int n) {base::pbump(n);}
+};
+
+int main()
+{
+ {
+ testbuf<char> sb("123");
+ sb.pbump(3);
+ assert(sb.underflow() == '1');
+ assert(sb.underflow() == '1');
+ assert(sb.snextc() == '2');
+ assert(sb.underflow() == '2');
+ assert(sb.underflow() == '2');
+ assert(sb.snextc() == '3');
+ assert(sb.underflow() == '3');
+ assert(sb.underflow() == '3');
+ assert(sb.snextc() == std::char_traits<char>::eof());
+ assert(sb.underflow() == std::char_traits<char>::eof());
+ assert(sb.underflow() == std::char_traits<char>::eof());
+ sb.sputc('4');
+ assert(sb.underflow() == '4');
+ assert(sb.underflow() == '4');
+ }
+ {
+ testbuf<wchar_t> sb(L"123");
+ sb.pbump(3);
+ assert(sb.underflow() == L'1');
+ assert(sb.underflow() == L'1');
+ assert(sb.snextc() == L'2');
+ assert(sb.underflow() == L'2');
+ assert(sb.underflow() == L'2');
+ assert(sb.snextc() == L'3');
+ assert(sb.underflow() == L'3');
+ assert(sb.underflow() == L'3');
+ assert(sb.snextc() == std::char_traits<wchar_t>::eof());
+ assert(sb.underflow() == std::char_traits<wchar_t>::eof());
+ assert(sb.underflow() == std::char_traits<wchar_t>::eof());
+ sb.sputc(L'4');
+ assert(sb.underflow() == L'4');
+ assert(sb.underflow() == L'4');
+ }
+}
diff --git a/test/std/input.output/string.streams/stringbuf/types.pass.cpp b/test/std/input.output/string.streams/stringbuf/types.pass.cpp
new file mode 100644
index 000000000000..067a3a29e0f9
--- /dev/null
+++ b/test/std/input.output/string.streams/stringbuf/types.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+// : public basic_streambuf<charT, traits>
+// {
+// public:
+// typedef charT char_type;
+// typedef traits traits_type;
+// typedef typename traits_type::int_type int_type;
+// typedef typename traits_type::pos_type pos_type;
+// typedef typename traits_type::off_type off_type;
+// typedef Allocator allocator_type;
+
+#include <sstream>
+#include <type_traits>
+
+int main()
+{
+ static_assert((std::is_base_of<std::basic_streambuf<char>, std::basic_stringbuf<char> >::value), "");
+ static_assert((std::is_same<std::basic_stringbuf<char>::char_type, char>::value), "");
+ static_assert((std::is_same<std::basic_stringbuf<char>::traits_type, std::char_traits<char> >::value), "");
+ static_assert((std::is_same<std::basic_stringbuf<char>::int_type, std::char_traits<char>::int_type>::value), "");
+ static_assert((std::is_same<std::basic_stringbuf<char>::pos_type, std::char_traits<char>::pos_type>::value), "");
+ static_assert((std::is_same<std::basic_stringbuf<char>::off_type, std::char_traits<char>::off_type>::value), "");
+ static_assert((std::is_same<std::basic_stringbuf<char>::allocator_type, std::allocator<char> >::value), "");
+}
diff --git a/test/std/input.output/string.streams/stringstream.cons/default.pass.cpp b/test/std/input.output/string.streams/stringstream.cons/default.pass.cpp
new file mode 100644
index 000000000000..b8905ade3408
--- /dev/null
+++ b/test/std/input.output/string.streams/stringstream.cons/default.pass.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringstream
+
+// explicit basic_stringstream(ios_base::openmode which = ios_base::out|ios_base::in);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::stringstream ss;
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == "");
+ }
+ {
+ std::stringstream ss(std::ios_base::in);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == "");
+ }
+ {
+ std::wstringstream ss;
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L"");
+ }
+ {
+ std::wstringstream ss(std::ios_base::in);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L"");
+ }
+}
diff --git a/test/std/input.output/string.streams/stringstream.cons/move.pass.cpp b/test/std/input.output/string.streams/stringstream.cons/move.pass.cpp
new file mode 100644
index 000000000000..4ae3aa6e84db
--- /dev/null
+++ b/test/std/input.output/string.streams/stringstream.cons/move.pass.cpp
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringstream
+
+// basic_stringstream(basic_stringstream&& rhs);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ std::stringstream ss0(" 123 456 ");
+ std::stringstream ss(std::move(ss0));
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456 ");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ ss << i << ' ' << 123;
+ assert(ss.str() == "456 1236 ");
+ }
+ {
+ std::wstringstream ss0(L" 123 456 ");
+ std::wstringstream ss(std::move(ss0));
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456 ");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ ss << i << ' ' << 123;
+ assert(ss.str() == L"456 1236 ");
+ }
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/std/input.output/string.streams/stringstream.cons/move2.pass.cpp b/test/std/input.output/string.streams/stringstream.cons/move2.pass.cpp
new file mode 100644
index 000000000000..856cf3cbeafd
--- /dev/null
+++ b/test/std/input.output/string.streams/stringstream.cons/move2.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringstream
+
+// basic_stringstream(basic_stringstream&& rhs);
+
+#include <sstream>
+#include <vector>
+#include <string>
+#include <cassert>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ std::vector<std::istringstream> vecis;
+ vecis.push_back(std::istringstream());
+ vecis.back().str("hub started at [00 6b 8b 45 69]");
+ vecis.push_back(std::istringstream());
+ vecis.back().str("hub started at [00 6b 8b 45 69]");
+ for (int n = 0; n < vecis.size(); n++)
+ {
+ assert(vecis[n].str().size() == 31);
+ vecis[n].seekg(0, std::ios_base::beg);
+ assert(vecis[n].str().size() == 31);
+ }
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/std/input.output/string.streams/stringstream.cons/string.pass.cpp b/test/std/input.output/string.streams/stringstream.cons/string.pass.cpp
new file mode 100644
index 000000000000..3776f17f5304
--- /dev/null
+++ b/test/std/input.output/string.streams/stringstream.cons/string.pass.cpp
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringstream
+
+// explicit basic_stringstream(const basic_string<charT,traits,Allocator>& str,
+// ios_base::openmode which = ios_base::out|ios_base::in);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::stringstream ss(" 123 456 ");
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456 ");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ ss << i << ' ' << 123;
+ assert(ss.str() == "456 1236 ");
+ }
+ {
+ std::wstringstream ss(L" 123 456 ");
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456 ");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ ss << i << ' ' << 123;
+ assert(ss.str() == L"456 1236 ");
+ }
+}
diff --git a/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/member_swap.pass.cpp b/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/member_swap.pass.cpp
new file mode 100644
index 000000000000..95599dd254e9
--- /dev/null
+++ b/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/member_swap.pass.cpp
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringstream
+
+// void swap(basic_stringstream& rhs);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::stringstream ss0(" 123 456 ");
+ std::stringstream ss;
+ ss.swap(ss0);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456 ");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ ss << i << ' ' << 123;
+ assert(ss.str() == "456 1236 ");
+ ss0 << i << ' ' << 123;
+ assert(ss0.str() == "456 123");
+ }
+ {
+ std::wstringstream ss0(L" 123 456 ");
+ std::wstringstream ss;
+ ss.swap(ss0);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456 ");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ ss << i << ' ' << 123;
+ assert(ss.str() == L"456 1236 ");
+ ss0 << i << ' ' << 123;
+ assert(ss0.str() == L"456 123");
+ }
+}
diff --git a/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/move.pass.cpp b/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/move.pass.cpp
new file mode 100644
index 000000000000..ccaf72d7e550
--- /dev/null
+++ b/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/move.pass.cpp
@@ -0,0 +1,54 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringstream
+
+// basic_stringstream& operator=(basic_stringstream&& rhs);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ std::stringstream ss0(" 123 456 ");
+ std::stringstream ss;
+ ss = std::move(ss0);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456 ");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ ss << i << ' ' << 123;
+ assert(ss.str() == "456 1236 ");
+ }
+ {
+ std::wstringstream ss0(L" 123 456 ");
+ std::wstringstream ss;
+ ss = std::move(ss0);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456 ");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ ss << i << ' ' << 123;
+ assert(ss.str() == L"456 1236 ");
+ }
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/nonmember_swap.pass.cpp b/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/nonmember_swap.pass.cpp
new file mode 100644
index 000000000000..3ec11cd9e307
--- /dev/null
+++ b/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/nonmember_swap.pass.cpp
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringstream
+
+// template <class charT, class traits, class Allocator>
+// void
+// swap(basic_stringstream<charT, traits, Allocator>& x,
+// basic_stringstream<charT, traits, Allocator>& y);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::stringstream ss0(" 123 456 ");
+ std::stringstream ss;
+ swap(ss, ss0);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456 ");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ ss << i << ' ' << 123;
+ assert(ss.str() == "456 1236 ");
+ ss0 << i << ' ' << 123;
+ assert(ss0.str() == "456 123");
+ }
+ {
+ std::wstringstream ss0(L" 123 456 ");
+ std::wstringstream ss;
+ swap(ss, ss0);
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456 ");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ ss << i << ' ' << 123;
+ assert(ss.str() == L"456 1236 ");
+ ss0 << i << ' ' << 123;
+ assert(ss0.str() == L"456 123");
+ }
+}
diff --git a/test/std/input.output/string.streams/stringstream.members/str.pass.cpp b/test/std/input.output/string.streams/stringstream.members/str.pass.cpp
new file mode 100644
index 000000000000..155a262e19f9
--- /dev/null
+++ b/test/std/input.output/string.streams/stringstream.members/str.pass.cpp
@@ -0,0 +1,62 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringstream
+
+// void str(const basic_string<charT,traits,Allocator>& str);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ std::stringstream ss(" 123 456 ");
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == " 123 456 ");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ ss << i << ' ' << 123;
+ assert(ss.str() == "456 1236 ");
+ ss.str("5466 89 ");
+ ss >> i;
+ assert(i == 5466);
+ ss >> i;
+ assert(i == 89);
+ ss << i << ' ' << 321;
+ assert(ss.str() == "89 3219 ");
+ }
+ {
+ std::wstringstream ss(L" 123 456 ");
+ assert(ss.rdbuf() != 0);
+ assert(ss.good());
+ assert(ss.str() == L" 123 456 ");
+ int i = 0;
+ ss >> i;
+ assert(i == 123);
+ ss >> i;
+ assert(i == 456);
+ ss << i << ' ' << 123;
+ assert(ss.str() == L"456 1236 ");
+ ss.str(L"5466 89 ");
+ ss >> i;
+ assert(i == 5466);
+ ss >> i;
+ assert(i == 89);
+ ss << i << ' ' << 321;
+ assert(ss.str() == L"89 3219 ");
+ }
+}
diff --git a/test/std/input.output/string.streams/stringstream/types.pass.cpp b/test/std/input.output/string.streams/stringstream/types.pass.cpp
new file mode 100644
index 000000000000..a89daa144e9a
--- /dev/null
+++ b/test/std/input.output/string.streams/stringstream/types.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringstream
+// : public basic_iostream<charT, traits>
+// {
+// public:
+// typedef charT char_type;
+// typedef traits traits_type;
+// typedef typename traits_type::int_type int_type;
+// typedef typename traits_type::pos_type pos_type;
+// typedef typename traits_type::off_type off_type;
+// typedef Allocator allocator_type;
+
+#include <sstream>
+#include <type_traits>
+
+int main()
+{
+ static_assert((std::is_base_of<std::basic_iostream<char>, std::basic_stringstream<char> >::value), "");
+ static_assert((std::is_same<std::basic_stringstream<char>::char_type, char>::value), "");
+ static_assert((std::is_same<std::basic_stringstream<char>::traits_type, std::char_traits<char> >::value), "");
+ static_assert((std::is_same<std::basic_stringstream<char>::int_type, std::char_traits<char>::int_type>::value), "");
+ static_assert((std::is_same<std::basic_stringstream<char>::pos_type, std::char_traits<char>::pos_type>::value), "");
+ static_assert((std::is_same<std::basic_stringstream<char>::off_type, std::char_traits<char>::off_type>::value), "");
+ static_assert((std::is_same<std::basic_stringstream<char>::allocator_type, std::allocator<char> >::value), "");
+}
diff --git a/test/std/input.output/string.streams/version.pass.cpp b/test/std/input.output/string.streams/version.pass.cpp
new file mode 100644
index 000000000000..103897106d37
--- /dev/null
+++ b/test/std/input.output/string.streams/version.pass.cpp
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+#include <sstream>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}