diff options
Diffstat (limited to 'libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals')
10 files changed, 279 insertions, 0 deletions
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); + } +} |