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,85 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <istream>
|
||||
|
||||
// template <class charT, class traits = char_traits<charT> >
|
||||
// class basic_iostream;
|
||||
|
||||
// void swap(basic_iostream& rhs);
|
||||
|
||||
#include <istream>
|
||||
#include <cassert>
|
||||
|
||||
template <class CharT>
|
||||
struct testbuf
|
||||
: public std::basic_streambuf<CharT>
|
||||
{
|
||||
testbuf() {}
|
||||
};
|
||||
|
||||
template <class CharT>
|
||||
struct test_iostream
|
||||
: public std::basic_iostream<CharT>
|
||||
{
|
||||
typedef std::basic_iostream<CharT> base;
|
||||
test_iostream(testbuf<CharT>* sb) : base(sb) {}
|
||||
|
||||
void swap(test_iostream& s) {base::swap(s);}
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
testbuf<char> sb1;
|
||||
testbuf<char> sb2;
|
||||
test_iostream<char> is1(&sb1);
|
||||
test_iostream<char> is2(&sb2);
|
||||
is1.swap(is2);
|
||||
assert(is1.rdbuf() == &sb1);
|
||||
assert(is1.tie() == 0);
|
||||
assert(is1.fill() == ' ');
|
||||
assert(is1.rdstate() == is1.goodbit);
|
||||
assert(is1.exceptions() == is1.goodbit);
|
||||
assert(is1.flags() == (is1.skipws | is1.dec));
|
||||
assert(is1.precision() == 6);
|
||||
assert(is1.getloc().name() == "C");
|
||||
assert(is2.rdbuf() == &sb2);
|
||||
assert(is2.tie() == 0);
|
||||
assert(is2.fill() == ' ');
|
||||
assert(is2.rdstate() == is2.goodbit);
|
||||
assert(is2.exceptions() == is2.goodbit);
|
||||
assert(is2.flags() == (is2.skipws | is2.dec));
|
||||
assert(is2.precision() == 6);
|
||||
assert(is2.getloc().name() == "C");
|
||||
}
|
||||
{
|
||||
testbuf<wchar_t> sb1;
|
||||
testbuf<wchar_t> sb2;
|
||||
test_iostream<wchar_t> is1(&sb1);
|
||||
test_iostream<wchar_t> is2(&sb2);
|
||||
is1.swap(is2);
|
||||
assert(is1.rdbuf() == &sb1);
|
||||
assert(is1.tie() == 0);
|
||||
assert(is1.fill() == ' ');
|
||||
assert(is1.rdstate() == is1.goodbit);
|
||||
assert(is1.exceptions() == is1.goodbit);
|
||||
assert(is1.flags() == (is1.skipws | is1.dec));
|
||||
assert(is1.precision() == 6);
|
||||
assert(is1.getloc().name() == "C");
|
||||
assert(is2.rdbuf() == &sb2);
|
||||
assert(is2.tie() == 0);
|
||||
assert(is2.fill() == ' ');
|
||||
assert(is2.rdstate() == is2.goodbit);
|
||||
assert(is2.exceptions() == is2.goodbit);
|
||||
assert(is2.flags() == (is2.skipws | is2.dec));
|
||||
assert(is2.precision() == 6);
|
||||
assert(is2.getloc().name() == "C");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <istream>
|
||||
|
||||
// template <class charT, class traits = char_traits<charT> >
|
||||
// class basic_iostream;
|
||||
|
||||
// basic_iostream& operator=(basic_iostream&& rhs);
|
||||
|
||||
#include <istream>
|
||||
#include <cassert>
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class CharT>
|
||||
struct testbuf
|
||||
: public std::basic_streambuf<CharT>
|
||||
{
|
||||
testbuf() {}
|
||||
};
|
||||
|
||||
template <class CharT>
|
||||
struct test_iostream
|
||||
: public std::basic_iostream<CharT>
|
||||
{
|
||||
typedef std::basic_iostream<CharT> base;
|
||||
test_iostream(testbuf<CharT>* sb) : base(sb) {}
|
||||
|
||||
test_iostream& operator=(test_iostream&& s)
|
||||
{base::operator=(std::move(s)); return *this;}
|
||||
};
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
{
|
||||
testbuf<char> sb1;
|
||||
testbuf<char> sb2;
|
||||
test_iostream<char> is1(&sb1);
|
||||
test_iostream<char> is2(&sb2);
|
||||
is2 = (std::move(is1));
|
||||
assert(is1.rdbuf() == &sb1);
|
||||
assert(is1.tie() == 0);
|
||||
assert(is1.fill() == ' ');
|
||||
assert(is1.rdstate() == is1.goodbit);
|
||||
assert(is1.exceptions() == is1.goodbit);
|
||||
assert(is1.flags() == (is1.skipws | is1.dec));
|
||||
assert(is1.precision() == 6);
|
||||
assert(is1.getloc().name() == "C");
|
||||
assert(is2.rdbuf() == &sb2);
|
||||
assert(is2.tie() == 0);
|
||||
assert(is2.fill() == ' ');
|
||||
assert(is2.rdstate() == is2.goodbit);
|
||||
assert(is2.exceptions() == is2.goodbit);
|
||||
assert(is2.flags() == (is2.skipws | is2.dec));
|
||||
assert(is2.precision() == 6);
|
||||
assert(is2.getloc().name() == "C");
|
||||
}
|
||||
{
|
||||
testbuf<wchar_t> sb1;
|
||||
testbuf<wchar_t> sb2;
|
||||
test_iostream<wchar_t> is1(&sb1);
|
||||
test_iostream<wchar_t> is2(&sb2);
|
||||
is2 = (std::move(is1));
|
||||
assert(is1.rdbuf() == &sb1);
|
||||
assert(is1.tie() == 0);
|
||||
assert(is1.fill() == ' ');
|
||||
assert(is1.rdstate() == is1.goodbit);
|
||||
assert(is1.exceptions() == is1.goodbit);
|
||||
assert(is1.flags() == (is1.skipws | is1.dec));
|
||||
assert(is1.precision() == 6);
|
||||
assert(is1.getloc().name() == "C");
|
||||
assert(is2.rdbuf() == &sb2);
|
||||
assert(is2.tie() == 0);
|
||||
assert(is2.fill() == ' ');
|
||||
assert(is2.rdstate() == is2.goodbit);
|
||||
assert(is2.exceptions() == is2.goodbit);
|
||||
assert(is2.flags() == (is2.skipws | is2.dec));
|
||||
assert(is2.precision() == 6);
|
||||
assert(is2.getloc().name() == "C");
|
||||
}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <istream>
|
||||
|
||||
// template <class charT, class traits = char_traits<charT> >
|
||||
// class basic_iostream;
|
||||
|
||||
// basic_iostream(basic_iostream&& rhs);
|
||||
|
||||
#include <istream>
|
||||
#include <cassert>
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class CharT>
|
||||
struct testbuf
|
||||
: public std::basic_streambuf<CharT>
|
||||
{
|
||||
testbuf() {}
|
||||
};
|
||||
|
||||
template <class CharT>
|
||||
struct test_iostream
|
||||
: public std::basic_iostream<CharT>
|
||||
{
|
||||
typedef std::basic_iostream<CharT> base;
|
||||
test_iostream(testbuf<CharT>* sb) : base(sb) {}
|
||||
|
||||
test_iostream(test_iostream&& s)
|
||||
: base(std::move(s)) {}
|
||||
};
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
{
|
||||
testbuf<char> sb;
|
||||
test_iostream<char> is1(&sb);
|
||||
test_iostream<char> is(std::move(is1));
|
||||
assert(is1.rdbuf() == &sb);
|
||||
assert(is1.gcount() == 0);
|
||||
assert(is.gcount() == 0);
|
||||
assert(is.rdbuf() == 0);
|
||||
assert(is.tie() == 0);
|
||||
assert(is.fill() == ' ');
|
||||
assert(is.rdstate() == is.goodbit);
|
||||
assert(is.exceptions() == is.goodbit);
|
||||
assert(is.flags() == (is.skipws | is.dec));
|
||||
assert(is.precision() == 6);
|
||||
assert(is.getloc().name() == "C");
|
||||
}
|
||||
{
|
||||
testbuf<wchar_t> sb;
|
||||
test_iostream<wchar_t> is1(&sb);
|
||||
test_iostream<wchar_t> is(std::move(is1));
|
||||
assert(is1.gcount() == 0);
|
||||
assert(is.gcount() == 0);
|
||||
assert(is1.rdbuf() == &sb);
|
||||
assert(is.rdbuf() == 0);
|
||||
assert(is.tie() == 0);
|
||||
assert(is.fill() == L' ');
|
||||
assert(is.rdstate() == is.goodbit);
|
||||
assert(is.exceptions() == is.goodbit);
|
||||
assert(is.flags() == (is.skipws | is.dec));
|
||||
assert(is.precision() == 6);
|
||||
assert(is.getloc().name() == "C");
|
||||
}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <istream>
|
||||
|
||||
// template <class charT, class traits = char_traits<charT> >
|
||||
// class basic_iostream;
|
||||
|
||||
// explicit basic_iostream(basic_streambuf<charT,traits>* sb);
|
||||
|
||||
#include <istream>
|
||||
#include <cassert>
|
||||
|
||||
template <class CharT>
|
||||
struct testbuf
|
||||
: public std::basic_streambuf<CharT>
|
||||
{
|
||||
testbuf() {}
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
testbuf<char> sb;
|
||||
std::basic_iostream<char> is(&sb);
|
||||
assert(is.rdbuf() == &sb);
|
||||
assert(is.tie() == 0);
|
||||
assert(is.fill() == ' ');
|
||||
assert(is.rdstate() == is.goodbit);
|
||||
assert(is.exceptions() == is.goodbit);
|
||||
assert(is.flags() == (is.skipws | is.dec));
|
||||
assert(is.precision() == 6);
|
||||
assert(is.getloc().name() == "C");
|
||||
assert(is.gcount() == 0);
|
||||
}
|
||||
{
|
||||
testbuf<wchar_t> sb;
|
||||
std::basic_iostream<wchar_t> is(&sb);
|
||||
assert(is.rdbuf() == &sb);
|
||||
assert(is.tie() == 0);
|
||||
assert(is.fill() == L' ');
|
||||
assert(is.rdstate() == is.goodbit);
|
||||
assert(is.exceptions() == is.goodbit);
|
||||
assert(is.flags() == (is.skipws | is.dec));
|
||||
assert(is.precision() == 6);
|
||||
assert(is.getloc().name() == "C");
|
||||
assert(is.gcount() == 0);
|
||||
}
|
||||
}
|
||||
@@ -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()
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <istream>
|
||||
|
||||
// template <class charT, class traits = char_traits<charT> >
|
||||
// class basic_iostream :
|
||||
// public basic_istream<charT,traits>,
|
||||
// public basic_ostream<charT,traits>
|
||||
// {
|
||||
// public:
|
||||
// // types:
|
||||
// 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;
|
||||
|
||||
#include <istream>
|
||||
#include <type_traits>
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert((std::is_base_of<std::basic_istream<char>, std::basic_iostream<char> >::value), "");
|
||||
static_assert((std::is_base_of<std::basic_ostream<char>, std::basic_iostream<char> >::value), "");
|
||||
static_assert((std::is_same<std::basic_iostream<char>::char_type, char>::value), "");
|
||||
static_assert((std::is_same<std::basic_iostream<char>::traits_type, std::char_traits<char> >::value), "");
|
||||
static_assert((std::is_same<std::basic_iostream<char>::int_type, std::char_traits<char>::int_type>::value), "");
|
||||
static_assert((std::is_same<std::basic_iostream<char>::pos_type, std::char_traits<char>::pos_type>::value), "");
|
||||
static_assert((std::is_same<std::basic_iostream<char>::off_type, std::char_traits<char>::off_type>::value), "");
|
||||
}
|
||||
Reference in New Issue
Block a user