From 5a83710e371fe68a06e6e3876c6a2c8b820a8976 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sat, 20 Dec 2014 01:40:03 +0000 Subject: Move test into test/std subdirectory. llvm-svn: 224658 --- .../stringbuf.assign/nonmember_swap.pass.cpp | 66 ++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 libcxx/test/std/input.output/string.streams/stringbuf/stringbuf.assign/nonmember_swap.pass.cpp (limited to 'libcxx/test/std/input.output/string.streams/stringbuf/stringbuf.assign/nonmember_swap.pass.cpp') diff --git a/libcxx/test/std/input.output/string.streams/stringbuf/stringbuf.assign/nonmember_swap.pass.cpp b/libcxx/test/std/input.output/string.streams/stringbuf/stringbuf.assign/nonmember_swap.pass.cpp new file mode 100644 index 00000000000..dca637d39fa --- /dev/null +++ b/libcxx/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. +// +//===----------------------------------------------------------------------===// + +// + +// template , class Allocator = allocator > +// class basic_stringbuf + +// template +// void swap(basic_stringbuf& x, +// basic_stringbuf& y); + +#include +#include + +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""); + } +} -- cgit v1.2.3