Move test into test/std subdirectory.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224658 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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");
|
||||
}
|
||||
}
|
@@ -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
|
||||
}
|
@@ -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");
|
||||
}
|
||||
}
|
@@ -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"");
|
||||
}
|
||||
}
|
@@ -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
|
||||
}
|
@@ -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");
|
||||
}
|
||||
}
|
@@ -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");
|
||||
}
|
||||
}
|
@@ -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), "");
|
||||
}
|
Reference in New Issue
Block a user