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:
Eric Fiselier
2014-12-20 01:40:03 +00:00
parent 669a8a5a19
commit a90c6dd460
4817 changed files with 13 additions and 0 deletions

View File

@@ -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.
//
//===----------------------------------------------------------------------===//
// <sstream>
// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
// class basic_istringstream
// void swap(basic_istringstream& rhs);
#include <sstream>
#include <cassert>
int main()
{
{
std::istringstream ss0(" 123 456");
std::istringstream ss(" 789 321");
ss.swap(ss0);
assert(ss.rdbuf() != 0);
assert(ss.good());
assert(ss.str() == " 123 456");
int i = 0;
ss >> i;
assert(i == 123);
ss >> i;
assert(i == 456);
ss0 >> i;
assert(i == 789);
ss0 >> i;
assert(i == 321);
}
{
std::wistringstream ss0(L" 123 456");
std::wistringstream ss(L" 789 321");
ss.swap(ss0);
assert(ss.rdbuf() != 0);
assert(ss.good());
assert(ss.str() == L" 123 456");
int i = 0;
ss >> i;
assert(i == 123);
ss >> i;
assert(i == 456);
ss0 >> i;
assert(i == 789);
ss0 >> i;
assert(i == 321);
}
}

View File

@@ -0,0 +1,86 @@
//===----------------------------------------------------------------------===//
//
// 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_istringstream
// basic_istringstream& operator=(basic_istringstream&& rhs);
#include <sstream>
#include <cassert>
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::istringstream ss0(" 123 456");
std::istringstream ss;
ss = std::move(ss0);
assert(ss.rdbuf() != 0);
assert(ss.good());
assert(ss.str() == " 123 456");
int i = 0;
ss >> i;
assert(i == 123);
ss >> i;
assert(i == 456);
}
{
std::istringstream s1("Aaaaa Bbbbb Cccccccccc Dddddddddddddddddd");
std::string s;
s1 >> s;
std::istringstream s2 = std::move(s1);
s2 >> s;
assert(s == "Bbbbb");
std::istringstream s3;
s3 = std::move(s2);
s3 >> s;
assert(s == "Cccccccccc");
s1 = std::move(s3);
s1 >> s;
assert(s == "Dddddddddddddddddd");
}
{
std::wistringstream ss0(L" 123 456");
std::wistringstream ss;
ss = std::move(ss0);
assert(ss.rdbuf() != 0);
assert(ss.good());
assert(ss.str() == L" 123 456");
int i = 0;
ss >> i;
assert(i == 123);
ss >> i;
assert(i == 456);
}
{
std::wistringstream s1(L"Aaaaa Bbbbb Cccccccccc Dddddddddddddddddd");
std::wstring s;
s1 >> s;
std::wistringstream s2 = std::move(s1);
s2 >> s;
assert(s == L"Bbbbb");
std::wistringstream s3;
s3 = std::move(s2);
s3 >> s;
assert(s == L"Cccccccccc");
s1 = std::move(s3);
s1 >> s;
assert(s == L"Dddddddddddddddddd");
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -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_istringstream
// template <class charT, class traits, class Allocator>
// void
// swap(basic_istringstream<charT, traits, Allocator>& x,
// basic_istringstream<charT, traits, Allocator>& y);
#include <sstream>
#include <cassert>
int main()
{
{
std::istringstream ss0(" 123 456");
std::istringstream ss(" 789 321");
swap(ss, ss0);
assert(ss.rdbuf() != 0);
assert(ss.good());
assert(ss.str() == " 123 456");
int i = 0;
ss >> i;
assert(i == 123);
ss >> i;
assert(i == 456);
ss0 >> i;
assert(i == 789);
ss0 >> i;
assert(i == 321);
}
{
std::wistringstream ss0(L" 123 456");
std::wistringstream ss(L" 789 321");
swap(ss, ss0);
assert(ss.rdbuf() != 0);
assert(ss.good());
assert(ss.str() == L" 123 456");
int i = 0;
ss >> i;
assert(i == 123);
ss >> i;
assert(i == 456);
ss0 >> i;
assert(i == 789);
ss0 >> i;
assert(i == 321);
}
}

View File

@@ -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_istringstream
// explicit basic_istringstream(ios_base::openmode which = ios_base::in);
#include <sstream>
#include <cassert>
int main()
{
{
std::istringstream ss;
assert(ss.rdbuf() != 0);
assert(ss.good());
assert(ss.str() == "");
}
{
std::istringstream ss(std::ios_base::in);
assert(ss.rdbuf() != 0);
assert(ss.good());
assert(ss.str() == "");
}
{
std::wistringstream ss;
assert(ss.rdbuf() != 0);
assert(ss.good());
assert(ss.str() == L"");
}
{
std::wistringstream ss(std::ios_base::in);
assert(ss.rdbuf() != 0);
assert(ss.good());
assert(ss.str() == L"");
}
}

View File

@@ -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_istringstream
// basic_istringstream(basic_istringstream&& rhs);
#include <sstream>
#include <cassert>
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::istringstream ss0(" 123 456");
std::istringstream ss(std::move(ss0));
assert(ss.rdbuf() != 0);
assert(ss.good());
assert(ss.str() == " 123 456");
int i = 0;
ss >> i;
assert(i == 123);
ss >> i;
assert(i == 456);
}
{
std::wistringstream ss0(L" 123 456");
std::wistringstream ss(std::move(ss0));
assert(ss.rdbuf() != 0);
assert(ss.good());
assert(ss.str() == L" 123 456");
int i = 0;
ss >> i;
assert(i == 123);
ss >> i;
assert(i == 456);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -0,0 +1,67 @@
//===----------------------------------------------------------------------===//
//
// 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_istringstream
// explicit basic_istringstream(const basic_string<charT,traits,allocator>& str,
// ios_base::openmode which = ios_base::in);
#include <sstream>
#include <cassert>
int main()
{
{
std::istringstream ss(" 123 456");
assert(ss.rdbuf() != 0);
assert(ss.good());
assert(ss.str() == " 123 456");
int i = 0;
ss >> i;
assert(i == 123);
ss >> i;
assert(i == 456);
}
{
std::istringstream ss(" 123 456", std::ios_base::out);
assert(ss.rdbuf() != 0);
assert(ss.good());
assert(ss.str() == " 123 456");
int i = 0;
ss >> i;
assert(i == 123);
ss >> i;
assert(i == 456);
}
{
std::wistringstream ss(L" 123 456");
assert(ss.rdbuf() != 0);
assert(ss.good());
assert(ss.str() == L" 123 456");
int i = 0;
ss >> i;
assert(i == 123);
ss >> i;
assert(i == 456);
}
{
std::wistringstream ss(L" 123 456", std::ios_base::out);
assert(ss.rdbuf() != 0);
assert(ss.good());
assert(ss.str() == L" 123 456");
int i = 0;
ss >> i;
assert(i == 123);
ss >> i;
assert(i == 456);
}
}

View File

@@ -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.
//
//===----------------------------------------------------------------------===//
// <sstream>
// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
// class basic_istringstream
// void str(const basic_string<charT,traits,Allocator>& s);
#include <sstream>
#include <cassert>
int main()
{
{
std::istringstream ss(" 123 456");
assert(ss.rdbuf() != 0);
assert(ss.good());
assert(ss.str() == " 123 456");
int i = 0;
ss >> i;
assert(i == 123);
ss >> i;
assert(i == 456);
ss.str(" 789");
ss.clear();
assert(ss.good());
assert(ss.str() == " 789");
ss >> i;
assert(i == 789);
}
{
std::wistringstream ss(L" 123 456");
assert(ss.rdbuf() != 0);
assert(ss.good());
assert(ss.str() == L" 123 456");
int i = 0;
ss >> i;
assert(i == 123);
ss >> i;
assert(i == 456);
ss.str(L" 789");
ss.clear();
assert(ss.good());
assert(ss.str() == L" 789");
ss >> i;
assert(i == 789);
}
}

View File

@@ -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_istringstream
// : public basic_istream<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_istream<char>, std::basic_istringstream<char> >::value), "");
static_assert((std::is_same<std::basic_istringstream<char>::char_type, char>::value), "");
static_assert((std::is_same<std::basic_istringstream<char>::traits_type, std::char_traits<char> >::value), "");
static_assert((std::is_same<std::basic_istringstream<char>::int_type, std::char_traits<char>::int_type>::value), "");
static_assert((std::is_same<std::basic_istringstream<char>::pos_type, std::char_traits<char>::pos_type>::value), "");
static_assert((std::is_same<std::basic_istringstream<char>::off_type, std::char_traits<char>::off_type>::value), "");
static_assert((std::is_same<std::basic_istringstream<char>::allocator_type, std::allocator<char> >::value), "");
}