summaryrefslogtreecommitdiff
path: root/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get')
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/showmanyc.pass.cpp33
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/uflow.pass.cpp33
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/underflow.pass.cpp30
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/xsgetn.pass.cpp41
4 files changed, 137 insertions, 0 deletions
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/showmanyc.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/showmanyc.pass.cpp
new file mode 100644
index 0000000000000..acaf1e8461e64
--- /dev/null
+++ b/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/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/uflow.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/uflow.pass.cpp
new file mode 100644
index 0000000000000..d25ae9b21bffd
--- /dev/null
+++ b/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/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/underflow.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/underflow.pass.cpp
new file mode 100644
index 0000000000000..1bdba0714f194
--- /dev/null
+++ b/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/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/xsgetn.pass.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/xsgetn.pass.cpp
new file mode 100644
index 0000000000000..b1f15427367f0
--- /dev/null
+++ b/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);
+}