summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/input.output/stream.buffers
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/test/std/input.output/stream.buffers')
-rw-r--r--libcxx/test/std/input.output/stream.buffers/streambuf.reqts/tested_elsewhere.pass.cpp12
-rw-r--r--libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.cons/copy.fail.cpp25
-rw-r--r--libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.cons/copy.pass.cpp84
-rw-r--r--libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.cons/default.fail.cpp22
-rw-r--r--libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.cons/default.pass.cpp56
-rw-r--r--libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/nothing_to_do.pass.cpp12
-rw-r--r--libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubseekoff.pass.cpp35
-rw-r--r--libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubseekpos.pass.cpp34
-rw-r--r--libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubsetbuf.pass.cpp33
-rw-r--r--libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubsync.pass.cpp33
-rw-r--r--libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.locales/locales.pass.cpp51
-rw-r--r--libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/in_avail.pass.cpp52
-rw-r--r--libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sbumpc.pass.cpp56
-rw-r--r--libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sgetc.pass.cpp56
-rw-r--r--libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sgetn.pass.cpp41
-rw-r--r--libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/snextc.pass.cpp56
-rw-r--r--libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.pback/sputbackc.pass.cpp56
-rw-r--r--libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.pback/sungetc.pass.cpp56
-rw-r--r--libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.put/sputc.pass.cpp63
-rw-r--r--libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.put/sputn.pass.cpp41
-rw-r--r--libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.protected/nothing_to_do.pass.cpp12
-rw-r--r--libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.assign/assign.pass.cpp91
-rw-r--r--libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.assign/swap.pass.cpp101
-rw-r--r--libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.get.area/gbump.pass.cpp59
-rw-r--r--libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.get.area/setg.pass.cpp49
-rw-r--r--libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump.pass.cpp61
-rw-r--r--libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/setp.pass.cpp49
-rw-r--r--libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/nothing_to_do.pass.cpp12
-rw-r--r--libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.buffer/tested_elsewhere.pass.cpp12
-rw-r--r--libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/showmanyc.pass.cpp33
-rw-r--r--libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/uflow.pass.cpp33
-rw-r--r--libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/underflow.pass.cpp30
-rw-r--r--libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/xsgetn.pass.cpp41
-rw-r--r--libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.locales/nothing_to_do.pass.cpp12
-rw-r--r--libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.pback/pbackfail.pass.cpp32
-rw-r--r--libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.put/overflow.pass.cpp30
-rw-r--r--libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.put/xsputn.pass.cpp44
-rw-r--r--libcxx/test/std/input.output/stream.buffers/streambuf/types.pass.cpp39
-rw-r--r--libcxx/test/std/input.output/stream.buffers/version.pass.cpp20
39 files changed, 1634 insertions, 0 deletions
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf.reqts/tested_elsewhere.pass.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf.reqts/tested_elsewhere.pass.cpp
new file mode 100644
index 00000000000..b58f5c55b64
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf.reqts/tested_elsewhere.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.cons/copy.fail.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.cons/copy.fail.cpp
new file mode 100644
index 00000000000..469c7449971
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.cons/copy.fail.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// basic_streambuf(const basic_streambuf& rhs); // protected
+
+#include <streambuf>
+#include <cassert>
+
+std::streambuf get();
+
+int main()
+{
+ std::streambuf sb = get();
+}
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.cons/copy.pass.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.cons/copy.pass.cpp
new file mode 100644
index 00000000000..c1e18392b6c
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.cons/copy.pass.cpp
@@ -0,0 +1,84 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// basic_streambuf(const basic_streambuf& rhs);
+
+#include <streambuf>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+template <class CharT>
+struct test
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ test() {}
+
+ test(const test& t)
+ : std::basic_streambuf<CharT>(t)
+ {
+ assert(this->eback() == t.eback());
+ assert(this->gptr() == t.gptr());
+ assert(this->egptr() == t.egptr());
+ assert(this->pbase() == t.pbase());
+ assert(this->pptr() == t.pptr());
+ assert(this->epptr() == t.epptr());
+ assert(this->getloc() == t.getloc());
+ }
+
+ void setg(CharT* gbeg, CharT* gnext, CharT* gend)
+ {
+ base::setg(gbeg, gnext, gend);
+ }
+ void setp(CharT* pbeg, CharT* pend)
+ {
+ base::setp(pbeg, pend);
+ }
+};
+
+int main()
+{
+ {
+ test<char> t;
+ test<char> t2 = t;
+ }
+ {
+ test<wchar_t> t;
+ test<wchar_t> t2 = t;
+ }
+ {
+ char g1, g2, g3, p1, p3;
+ test<char> t;
+ t.setg(&g1, &g2, &g3);
+ t.setp(&p1, &p3);
+ test<char> t2 = t;
+ }
+ {
+ wchar_t g1, g2, g3, p1, p3;
+ test<wchar_t> t;
+ t.setg(&g1, &g2, &g3);
+ t.setp(&p1, &p3);
+ test<wchar_t> t2 = t;
+ }
+ std::locale::global(std::locale(LOCALE_en_US_UTF_8));
+ {
+ test<char> t;
+ test<char> t2 = t;
+ }
+ {
+ test<wchar_t> t;
+ test<wchar_t> t2 = t;
+ }
+}
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.cons/default.fail.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.cons/default.fail.cpp
new file mode 100644
index 00000000000..7f57f3cf930
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.cons/default.fail.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// basic_streambuf(); // is protected
+
+#include <streambuf>
+
+int main()
+{
+ std::basic_streambuf<char> sb;
+}
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.cons/default.pass.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.cons/default.pass.cpp
new file mode 100644
index 00000000000..d8ca8aebc62
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.cons/default.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// basic_streambuf();
+
+#include <streambuf>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+template <class CharT>
+struct test
+ : public std::basic_streambuf<CharT>
+{
+ test()
+ {
+ assert(this->eback() == 0);
+ assert(this->gptr() == 0);
+ assert(this->egptr() == 0);
+ assert(this->pbase() == 0);
+ assert(this->pptr() == 0);
+ assert(this->epptr() == 0);
+ }
+};
+
+int main()
+{
+ {
+ test<char> t;
+ assert(t.getloc().name() == "C");
+ }
+ {
+ test<wchar_t> t;
+ assert(t.getloc().name() == "C");
+ }
+ std::locale::global(std::locale(LOCALE_en_US_UTF_8));
+ {
+ test<char> t;
+ assert(t.getloc().name() == LOCALE_en_US_UTF_8);
+ }
+ {
+ test<wchar_t> t;
+ assert(t.getloc().name() == LOCALE_en_US_UTF_8);
+ }
+}
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/nothing_to_do.pass.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/nothing_to_do.pass.cpp
new file mode 100644
index 00000000000..b58f5c55b64
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubseekoff.pass.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubseekoff.pass.cpp
new file mode 100644
index 00000000000..2c77f25c2e5
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubseekoff.pass.cpp
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// pos_type pubseekoff(off_type off, ios_base::seekdir way,
+// ios_base::openmode which = ios_base::in | ios_base::out);
+
+#include <streambuf>
+#include <cassert>
+
+template <class CharT>
+struct test
+ : public std::basic_streambuf<CharT>
+{
+ test() {}
+};
+
+int main()
+{
+ {
+ test<char> t;
+ assert(t.pubseekoff(0, std::ios_base::beg) == -1);
+ assert(t.pubseekoff(0, std::ios_base::beg, std::ios_base::app) == -1);
+ }
+}
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubseekpos.pass.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubseekpos.pass.cpp
new file mode 100644
index 00000000000..0b9ddff4106
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubseekpos.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// pos_type pubseekpos(pos_type sp,
+// ios_base::openmode which = ios_base::in | ios_base::out;
+
+#include <streambuf>
+#include <cassert>
+
+template <class CharT>
+struct test
+ : public std::basic_streambuf<CharT>
+{
+ test() {}
+};
+
+int main()
+{
+ {
+ test<char> t;
+ assert(t.pubseekpos(0, std::ios_base::app) == -1);
+ }
+}
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubsetbuf.pass.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubsetbuf.pass.cpp
new file mode 100644
index 00000000000..8cf62771e49
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubsetbuf.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// basic_streambuf* pubsetbuf(char_type* s, streamsize n);
+
+#include <streambuf>
+#include <cassert>
+
+template <class CharT>
+struct test
+ : public std::basic_streambuf<CharT>
+{
+ test() {}
+};
+
+int main()
+{
+ {
+ test<char> t;
+ assert(t.pubsetbuf(0, 0) == &t);
+ }
+}
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubsync.pass.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubsync.pass.cpp
new file mode 100644
index 00000000000..cc167907161
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubsync.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// int pubsync();
+
+#include <streambuf>
+#include <cassert>
+
+template <class CharT>
+struct test
+ : public std::basic_streambuf<CharT>
+{
+ test() {}
+};
+
+int main()
+{
+ {
+ test<char> t;
+ assert(t.pubsync() == 0);
+ }
+}
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.locales/locales.pass.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.locales/locales.pass.cpp
new file mode 100644
index 00000000000..deb2dc7c139
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.locales/locales.pass.cpp
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.en_US.UTF-8
+// REQUIRES: locale.fr_FR.UTF-8
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// locale pubimbue(const locale& loc);
+// locale getloc() const;
+
+#include <streambuf>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+template <class CharT>
+struct test
+ : public std::basic_streambuf<CharT>
+{
+ test() {}
+
+ void imbue(const std::locale&)
+ {
+ assert(this->getloc().name() == LOCALE_en_US_UTF_8);
+ }
+};
+
+int main()
+{
+ {
+ test<char> t;
+ assert(t.getloc().name() == "C");
+ }
+ std::locale::global(std::locale(LOCALE_en_US_UTF_8));
+ {
+ test<char> t;
+ assert(t.getloc().name() == LOCALE_en_US_UTF_8);
+ assert(t.pubimbue(std::locale(LOCALE_fr_FR_UTF_8)).name() == "en_US.UTF-8");
+ assert(t.getloc().name() == LOCALE_fr_FR_UTF_8);
+ }
+}
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/in_avail.pass.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/in_avail.pass.cpp
new file mode 100644
index 00000000000..200150639b9
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/in_avail.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// streamsize in_avail();
+
+#include <streambuf>
+#include <cassert>
+
+int showmanyc_called = 0;
+
+template <class CharT>
+struct test
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+
+ test() {}
+
+ void setg(CharT* gbeg, CharT* gnext, CharT* gend)
+ {
+ base::setg(gbeg, gnext, gend);
+ }
+protected:
+ std::streamsize showmanyc()
+ {
+ ++showmanyc_called;
+ return 5;
+ }
+};
+
+int main()
+{
+ {
+ test<char> t;
+ assert(t.in_avail() == 5);
+ assert(showmanyc_called == 1);
+ char in[5];
+ t.setg(in, in+2, in+5);
+ assert(t.in_avail() == 3);
+ }
+}
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sbumpc.pass.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sbumpc.pass.cpp
new file mode 100644
index 00000000000..ac6d0cc932a
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sbumpc.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// int_type sbumpc();
+
+#include <streambuf>
+#include <cassert>
+
+int uflow_called = 0;
+
+struct test
+ : public std::basic_streambuf<char>
+{
+ typedef std::basic_streambuf<char> base;
+
+ test() {}
+
+ void setg(char* gbeg, char* gnext, char* gend)
+ {
+ base::setg(gbeg, gnext, gend);
+ }
+
+protected:
+ int_type uflow()
+ {
+ ++uflow_called;
+ return 'a';
+ }
+};
+
+int main()
+{
+ {
+ test t;
+ assert(uflow_called == 0);
+ assert(t.sbumpc() == 'a');
+ assert(uflow_called == 1);
+ char in[] = "ABC";
+ t.setg(in, in, in+sizeof(in));
+ assert(t.sbumpc() == 'A');
+ assert(uflow_called == 1);
+ assert(t.sbumpc() == 'B');
+ assert(uflow_called == 1);
+ }
+}
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sgetc.pass.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sgetc.pass.cpp
new file mode 100644
index 00000000000..c68930cfa84
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sgetc.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// int_type sgetc();
+
+#include <streambuf>
+#include <cassert>
+
+int underflow_called = 0;
+
+struct test
+ : public std::basic_streambuf<char>
+{
+ typedef std::basic_streambuf<char> base;
+
+ test() {}
+
+ void setg(char* gbeg, char* gnext, char* gend)
+ {
+ base::setg(gbeg, gnext, gend);
+ }
+
+protected:
+ int_type underflow()
+ {
+ ++underflow_called;
+ return 'a';
+ }
+};
+
+int main()
+{
+ {
+ test t;
+ assert(underflow_called == 0);
+ assert(t.sgetc() == 'a');
+ assert(underflow_called == 1);
+ char in[] = "ABC";
+ t.setg(in, in, in+sizeof(in));
+ assert(t.sgetc() == 'A');
+ assert(underflow_called == 1);
+ assert(t.sgetc() == 'A');
+ assert(underflow_called == 1);
+ }
+}
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sgetn.pass.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sgetn.pass.cpp
new file mode 100644
index 00000000000..730cedeea76
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sgetn.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// streamsize sgetn(char_type* s, streamsize n);
+
+#include <streambuf>
+#include <cassert>
+
+int xsgetn_called = 0;
+
+struct test
+ : public std::basic_streambuf<char>
+{
+ test() {}
+
+protected:
+ std::streamsize xsgetn(char_type* s, std::streamsize n)
+ {
+ ++xsgetn_called;
+ return 10;
+ }
+};
+
+int main()
+{
+ test t;
+ assert(xsgetn_called == 0);
+ assert(t.sgetn(0, 0) == 10);
+ assert(xsgetn_called == 1);
+}
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/snextc.pass.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/snextc.pass.cpp
new file mode 100644
index 00000000000..7f44245e26e
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/snextc.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// int_type snextc();
+
+#include <streambuf>
+#include <cassert>
+
+int uflow_called = 0;
+
+struct test
+ : public std::basic_streambuf<char>
+{
+ typedef std::basic_streambuf<char> base;
+
+ test() {}
+
+ void setg(char* gbeg, char* gnext, char* gend)
+ {
+ base::setg(gbeg, gnext, gend);
+ }
+
+protected:
+ int_type uflow()
+ {
+ ++uflow_called;
+ return 'a';
+ }
+};
+
+int main()
+{
+ {
+ test t;
+ assert(uflow_called == 0);
+ assert(t.snextc() == -1);
+ assert(uflow_called == 1);
+ char in[] = "ABC";
+ t.setg(in, in, in+sizeof(in));
+ assert(t.snextc() == 'B');
+ assert(uflow_called == 1);
+ assert(t.snextc() == 'C');
+ assert(uflow_called == 1);
+ }
+}
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.pback/sputbackc.pass.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.pback/sputbackc.pass.cpp
new file mode 100644
index 00000000000..34a2a2dda37
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.pback/sputbackc.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// int_type sputbackc(char_type c);
+
+#include <streambuf>
+#include <cassert>
+
+int pbackfail_called = 0;
+
+struct test
+ : public std::basic_streambuf<char>
+{
+ typedef std::basic_streambuf<char> base;
+
+ test() {}
+
+ void setg(char* gbeg, char* gnext, char* gend)
+ {
+ base::setg(gbeg, gnext, gend);
+ }
+
+protected:
+ int_type pbackfail(int_type c = traits_type::eof())
+ {
+ ++pbackfail_called;
+ return 'a';
+ }
+};
+
+int main()
+{
+ {
+ test t;
+ assert(pbackfail_called == 0);
+ assert(t.sputbackc('A') == 'a');
+ assert(pbackfail_called == 1);
+ char in[] = "ABC";
+ t.setg(in, in+1, in+sizeof(in));
+ assert(t.sputbackc('A') == 'A');
+ assert(pbackfail_called == 1);
+ assert(t.sputbackc('A') == 'a');
+ assert(pbackfail_called == 2);
+ }
+}
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.pback/sungetc.pass.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.pback/sungetc.pass.cpp
new file mode 100644
index 00000000000..4c68fada07a
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.pback/sungetc.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// int_type sungetc();
+
+#include <streambuf>
+#include <cassert>
+
+int pbackfail_called = 0;
+
+struct test
+ : public std::basic_streambuf<char>
+{
+ typedef std::basic_streambuf<char> base;
+
+ test() {}
+
+ void setg(char* gbeg, char* gnext, char* gend)
+ {
+ base::setg(gbeg, gnext, gend);
+ }
+
+protected:
+ int_type pbackfail(int_type c = traits_type::eof())
+ {
+ ++pbackfail_called;
+ return 'a';
+ }
+};
+
+int main()
+{
+ {
+ test t;
+ assert(pbackfail_called == 0);
+ assert(t.sungetc() == 'a');
+ assert(pbackfail_called == 1);
+ char in[] = "ABC";
+ t.setg(in, in+1, in+sizeof(in));
+ assert(t.sungetc() == 'A');
+ assert(pbackfail_called == 1);
+ assert(t.sungetc() == 'a');
+ assert(pbackfail_called == 2);
+ }
+}
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.put/sputc.pass.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.put/sputc.pass.cpp
new file mode 100644
index 00000000000..b04b8b0acc9
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.put/sputc.pass.cpp
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// int_type sputc(char_type c);
+
+#include <streambuf>
+#include <cassert>
+
+int overflow_called = 0;
+
+struct test
+ : public std::basic_streambuf<char>
+{
+ typedef std::basic_streambuf<char> base;
+
+ test() {}
+
+ void setg(char* gbeg, char* gnext, char* gend)
+ {
+ base::setg(gbeg, gnext, gend);
+ }
+ void setp(char* pbeg, char* pend)
+ {
+ base::setp(pbeg, pend);
+ }
+
+protected:
+ int_type overflow(int_type c = traits_type::eof())
+ {
+ ++overflow_called;
+ return 'a';
+ }
+};
+
+int main()
+{
+ {
+ test t;
+ assert(overflow_called == 0);
+ assert(t.sputc('A') == 'a');
+ assert(overflow_called == 1);
+ char out[3] = {0};
+ t.setp(out, out+sizeof(out));
+ assert(t.sputc('A') == 'A');
+ assert(overflow_called == 1);
+ assert(out[0] == 'A');
+ assert(t.sputc('B') == 'B');
+ assert(overflow_called == 1);
+ assert(out[0] == 'A');
+ assert(out[1] == 'B');
+ }
+}
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.put/sputn.pass.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.put/sputn.pass.cpp
new file mode 100644
index 00000000000..e03e8e0cbda
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.put/sputn.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// streamsize sputn(const char_type* s, streamsize n);
+
+#include <streambuf>
+#include <cassert>
+
+int xsputn_called = 0;
+
+struct test
+ : public std::basic_streambuf<char>
+{
+ test() {}
+
+protected:
+ std::streamsize xsputn(const char_type* s, std::streamsize n)
+ {
+ ++xsputn_called;
+ return 5;
+ }
+};
+
+int main()
+{
+ test t;
+ assert(xsputn_called == 0);
+ assert(t.sputn(0, 0) == 5);
+ assert(xsputn_called == 1);
+}
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.protected/nothing_to_do.pass.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.protected/nothing_to_do.pass.cpp
new file mode 100644
index 00000000000..b58f5c55b64
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.protected/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.assign/assign.pass.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.assign/assign.pass.cpp
new file mode 100644
index 00000000000..803198938f6
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.assign/assign.pass.cpp
@@ -0,0 +1,91 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// basic_streambuf& operator=(const basic_streambuf& rhs);
+
+#include <streambuf>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+template <class CharT>
+struct test
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ test() {}
+
+ test& operator=(const test& t)
+ {
+ base::operator=(t);
+ assert(this->eback() == t.eback());
+ assert(this->gptr() == t.gptr());
+ assert(this->egptr() == t.egptr());
+ assert(this->pbase() == t.pbase());
+ assert(this->pptr() == t.pptr());
+ assert(this->epptr() == t.epptr());
+ assert(this->getloc() == t.getloc());
+ return *this;
+ }
+
+ void setg(CharT* gbeg, CharT* gnext, CharT* gend)
+ {
+ base::setg(gbeg, gnext, gend);
+ }
+ void setp(CharT* pbeg, CharT* pend)
+ {
+ base::setp(pbeg, pend);
+ }
+};
+
+int main()
+{
+ {
+ test<char> t;
+ test<char> t2;
+ t2 = t;
+ }
+ {
+ test<wchar_t> t;
+ test<wchar_t> t2;
+ t2 = t;
+ }
+ {
+ char g1, g2, g3, p1, p3;
+ test<char> t;
+ t.setg(&g1, &g2, &g3);
+ t.setp(&p1, &p3);
+ test<char> t2;
+ t2 = t;
+ }
+ {
+ wchar_t g1, g2, g3, p1, p3;
+ test<wchar_t> t;
+ t.setg(&g1, &g2, &g3);
+ t.setp(&p1, &p3);
+ test<wchar_t> t2;
+ t2 = t;
+ }
+ std::locale::global(std::locale(LOCALE_en_US_UTF_8));
+ {
+ test<char> t;
+ test<char> t2;
+ t2 = t;
+ }
+ {
+ test<wchar_t> t;
+ test<wchar_t> t2;
+ t2 = t;
+ }
+}
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.assign/swap.pass.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.assign/swap.pass.cpp
new file mode 100644
index 00000000000..7a23206b42d
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.assign/swap.pass.cpp
@@ -0,0 +1,101 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// void swap(basic_streambuf& rhs);
+
+#include <streambuf>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+template <class CharT>
+struct test
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+ test() {}
+
+ void swap(test& t)
+ {
+ test old_this(*this);
+ test old_that(t);
+ base::swap(t);
+ assert(this->eback() == old_that.eback());
+ assert(this->gptr() == old_that.gptr());
+ assert(this->egptr() == old_that.egptr());
+ assert(this->pbase() == old_that.pbase());
+ assert(this->pptr() == old_that.pptr());
+ assert(this->epptr() == old_that.epptr());
+ assert(this->getloc() == old_that.getloc());
+
+ assert(t.eback() == old_this.eback());
+ assert(t.gptr() == old_this.gptr());
+ assert(t.egptr() == old_this.egptr());
+ assert(t.pbase() == old_this.pbase());
+ assert(t.pptr() == old_this.pptr());
+ assert(t.epptr() == old_this.epptr());
+ assert(t.getloc() == old_this.getloc());
+ return *this;
+ }
+
+ void setg(CharT* gbeg, CharT* gnext, CharT* gend)
+ {
+ base::setg(gbeg, gnext, gend);
+ }
+ void setp(CharT* pbeg, CharT* pend)
+ {
+ base::setp(pbeg, pend);
+ }
+};
+
+int main()
+{
+ {
+ test<char> t;
+ test<char> t2;
+ swap(t2, t);
+ }
+ {
+ test<wchar_t> t;
+ test<wchar_t> t2;
+ swap(t2, t);
+ }
+ {
+ char g1, g2, g3, p1, p3;
+ test<char> t;
+ t.setg(&g1, &g2, &g3);
+ t.setp(&p1, &p3);
+ test<char> t2;
+ swap(t2, t);
+ }
+ {
+ wchar_t g1, g2, g3, p1, p3;
+ test<wchar_t> t;
+ t.setg(&g1, &g2, &g3);
+ t.setp(&p1, &p3);
+ test<wchar_t> t2;
+ swap(t2, t);
+ }
+ std::locale::global(std::locale(LOCALE_en_US_UTF_8));
+ {
+ test<char> t;
+ test<char> t2;
+ swap(t2, t);
+ }
+ {
+ test<wchar_t> t;
+ test<wchar_t> t2;
+ swap(t2, t);
+ }
+}
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.get.area/gbump.pass.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.get.area/gbump.pass.cpp
new file mode 100644
index 00000000000..ce25a191914
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.get.area/gbump.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// void gbump(int n);
+
+#include <streambuf>
+#include <cassert>
+
+template <class CharT>
+struct test
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+
+ test() {}
+
+ void setg(CharT* gbeg, CharT* gnext, CharT* gend)
+ {
+ base::setg(gbeg, gnext, gend);
+ }
+
+ void gbump(int n)
+ {
+ CharT* gbeg = base::eback();
+ CharT* gnext = base::gptr();
+ CharT* gend = base::egptr();
+ base::gbump(n);
+ assert(base::eback() == gbeg);
+ assert(base::gptr() == gnext+n);
+ assert(base::egptr() == gend);
+ }
+};
+
+int main()
+{
+ {
+ test<char> t;
+ char in[] = "ABCDE";
+ t.setg(in, in+1, in+sizeof(in)/sizeof(in[0]));
+ t.gbump(2);
+ }
+ {
+ test<wchar_t> t;
+ wchar_t in[] = L"ABCDE";
+ t.setg(in, in+1, in+sizeof(in)/sizeof(in[0]));
+ t.gbump(3);
+ }
+}
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.get.area/setg.pass.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.get.area/setg.pass.cpp
new file mode 100644
index 00000000000..68dcf6eab8f
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.get.area/setg.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// void setg(char_type* gbeg, char_type* gnext, char_type* gend);
+
+#include <streambuf>
+#include <cassert>
+
+template <class CharT>
+struct test
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+
+ test() {}
+
+ void setg(CharT* gbeg, CharT* gnext, CharT* gend)
+ {
+ base::setg(gbeg, gnext, gend);
+ assert(base::eback() == gbeg);
+ assert(base::gptr() == gnext);
+ assert(base::egptr() == gend);
+ }
+};
+
+int main()
+{
+ {
+ test<char> t;
+ char in[] = "ABC";
+ t.setg(in, in+1, in+sizeof(in)/sizeof(in[0]));
+ }
+ {
+ test<wchar_t> t;
+ wchar_t in[] = L"ABC";
+ t.setg(in, in+1, in+sizeof(in)/sizeof(in[0]));
+ }
+}
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump.pass.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump.pass.cpp
new file mode 100644
index 00000000000..47ef939142a
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump.pass.cpp
@@ -0,0 +1,61 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// void pbump(int n);
+
+#include <streambuf>
+#include <cassert>
+
+template <class CharT>
+struct test
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+
+ test() {}
+
+ void setp(CharT* pbeg, CharT* pend)
+ {
+ base::setp(pbeg, pend);
+ }
+
+ void pbump(int n)
+ {
+ CharT* pbeg = base::pbase();
+ CharT* pnext = base::pptr();
+ CharT* pend = base::epptr();
+ base::pbump(n);
+ assert(base::pbase() == pbeg);
+ assert(base::pptr() == pnext+n);
+ assert(base::epptr() == pend);
+ }
+};
+
+int main()
+{
+ {
+ test<char> t;
+ char in[] = "ABCDE";
+ t.setp(in, in+sizeof(in)/sizeof(in[0]));
+ t.pbump(2);
+ t.pbump(1);
+ }
+ {
+ test<wchar_t> t;
+ wchar_t in[] = L"ABCDE";
+ t.setp(in, in+sizeof(in)/sizeof(in[0]));
+ t.pbump(3);
+ t.pbump(1);
+ }
+}
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/setp.pass.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/setp.pass.cpp
new file mode 100644
index 00000000000..fa4133a475d
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/setp.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// void setp(char_type* pbeg, char_type* pend);
+
+#include <streambuf>
+#include <cassert>
+
+template <class CharT>
+struct test
+ : public std::basic_streambuf<CharT>
+{
+ typedef std::basic_streambuf<CharT> base;
+
+ test() {}
+
+ void setp(CharT* pbeg, CharT* pend)
+ {
+ base::setp(pbeg, pend);
+ assert(base::pbase() == pbeg);
+ assert(base::pptr() == pbeg);
+ assert(base::epptr() == pend);
+ }
+};
+
+int main()
+{
+ {
+ test<char> t;
+ char in[] = "ABC";
+ t.setp(in, in+sizeof(in)/sizeof(in[0]));
+ }
+ {
+ test<wchar_t> t;
+ wchar_t in[] = L"ABC";
+ t.setp(in, in+sizeof(in)/sizeof(in[0]));
+ }
+}
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/nothing_to_do.pass.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/nothing_to_do.pass.cpp
new file mode 100644
index 00000000000..b58f5c55b64
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.buffer/tested_elsewhere.pass.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.buffer/tested_elsewhere.pass.cpp
new file mode 100644
index 00000000000..b58f5c55b64
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.buffer/tested_elsewhere.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/showmanyc.pass.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/showmanyc.pass.cpp
new file mode 100644
index 00000000000..acaf1e8461e
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/showmanyc.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// streamsize showmanyc();
+
+#include <streambuf>
+#include <cassert>
+
+int showmanyc_called = 0;
+
+template <class CharT>
+struct test
+ : public std::basic_streambuf<CharT>
+{
+ test() {}
+};
+
+int main()
+{
+ test<char> t;
+ assert(t.in_avail() == 0);
+}
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/uflow.pass.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/uflow.pass.cpp
new file mode 100644
index 00000000000..d25ae9b21bf
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/uflow.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// int_type uflow();
+
+#include <streambuf>
+#include <cassert>
+
+int underflow_called = 0;
+
+struct test
+ : public std::basic_streambuf<char>
+{
+ test() {}
+
+};
+
+int main()
+{
+ test t;
+ assert(t.sgetc() == -1);
+}
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/underflow.pass.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/underflow.pass.cpp
new file mode 100644
index 00000000000..1bdba0714f1
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/underflow.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// int_type underflow();
+
+#include <streambuf>
+#include <cassert>
+
+struct test
+ : public std::basic_streambuf<char>
+{
+ test() {}
+};
+
+int main()
+{
+ test t;
+ assert(t.sgetc() == -1);
+}
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/xsgetn.pass.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/xsgetn.pass.cpp
new file mode 100644
index 00000000000..b1f15427367
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/xsgetn.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// streamsize xsgetn(char_type* s, streamsize n);
+
+#include <streambuf>
+#include <cassert>
+
+struct test
+ : public std::basic_streambuf<char>
+{
+ typedef std::basic_streambuf<char> base;
+
+ test() {}
+
+ void setg(char* gbeg, char* gnext, char* gend)
+ {
+ base::setg(gbeg, gnext, gend);
+ }
+};
+
+int main()
+{
+ test t;
+ char input[7] = "123456";
+ t.setg(input, input, input+7);
+ char output[sizeof(input)] = {0};
+ assert(t.sgetn(output, 10) == 7);
+ assert(strcmp(input, output) == 0);
+}
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.locales/nothing_to_do.pass.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.locales/nothing_to_do.pass.cpp
new file mode 100644
index 00000000000..b58f5c55b64
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.locales/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.pback/pbackfail.pass.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.pback/pbackfail.pass.cpp
new file mode 100644
index 00000000000..3a10d8a70ad
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.pback/pbackfail.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// int_type pbackfail(int_type c = traits::eof());
+
+#include <streambuf>
+#include <cassert>
+
+int pbackfail_called = 0;
+
+struct test
+ : public std::basic_streambuf<char>
+{
+ test() {}
+};
+
+int main()
+{
+ test t;
+ assert(t.sputbackc('A') == -1);
+}
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.put/overflow.pass.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.put/overflow.pass.cpp
new file mode 100644
index 00000000000..dcdd45f5ff1
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.put/overflow.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// int_type overflow(int_type c = traits::eof());
+
+#include <streambuf>
+#include <cassert>
+
+struct test
+ : public std::basic_streambuf<char>
+{
+ test() {}
+};
+
+int main()
+{
+ test t;
+ assert(t.sputc('A') == -1);
+}
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.put/xsputn.pass.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.put/xsputn.pass.cpp
new file mode 100644
index 00000000000..93dc15401e9
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.put/xsputn.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// streamsize xsputn(const char_type* s, streamsize n);
+
+#include <streambuf>
+#include <cassert>
+
+struct test
+ : public std::basic_streambuf<char>
+{
+ typedef std::basic_streambuf<char> base;
+
+ test() {}
+
+ void setp(char* pbeg, char* pend)
+ {
+ base::setp(pbeg, pend);
+ }
+};
+
+int main()
+{
+ {
+ test t;
+ char in[] = "123456";
+ assert(t.sputn(in, sizeof(in)) == 0);
+ char out[sizeof(in)] = {0};
+ t.setp(out, out+sizeof(out));
+ assert(t.sputn(in, sizeof(in)) == sizeof(in));
+ assert(strcmp(in, out) == 0);
+ }
+}
diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/types.pass.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/types.pass.cpp
new file mode 100644
index 00000000000..919caee3655
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/streambuf/types.pass.cpp
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf
+// {
+// public:
+// // types:
+// 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;
+
+#include <streambuf>
+#include <type_traits>
+
+int main()
+{
+ static_assert((std::is_same<std::streambuf::char_type, char>::value), "");
+ static_assert((std::is_same<std::streambuf::traits_type, std::char_traits<char> >::value), "");
+ static_assert((std::is_same<std::streambuf::int_type, std::char_traits<char>::int_type>::value), "");
+ static_assert((std::is_same<std::streambuf::pos_type, std::char_traits<char>::pos_type>::value), "");
+ static_assert((std::is_same<std::streambuf::off_type, std::char_traits<char>::off_type>::value), "");
+
+ static_assert((std::is_same<std::wstreambuf::char_type, wchar_t>::value), "");
+ static_assert((std::is_same<std::wstreambuf::traits_type, std::char_traits<wchar_t> >::value), "");
+ static_assert((std::is_same<std::wstreambuf::int_type, std::char_traits<wchar_t>::int_type>::value), "");
+ static_assert((std::is_same<std::wstreambuf::pos_type, std::char_traits<wchar_t>::pos_type>::value), "");
+ static_assert((std::is_same<std::wstreambuf::off_type, std::char_traits<wchar_t>::off_type>::value), "");
+}
diff --git a/libcxx/test/std/input.output/stream.buffers/version.pass.cpp b/libcxx/test/std/input.output/stream.buffers/version.pass.cpp
new file mode 100644
index 00000000000..c4b06be6018
--- /dev/null
+++ b/libcxx/test/std/input.output/stream.buffers/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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+#include <streambuf>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}
OpenPOWER on IntegriCloud