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,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.
//
//===----------------------------------------------------------------------===//
// <iterator>
// class ostreambuf_iterator
// ostreambuf_iterator(ostream_type& s) throw();
#include <iterator>
#include <sstream>
#include <cassert>
int main()
{
{
std::ostringstream outf;
std::ostreambuf_iterator<char> i(outf);
assert(!i.failed());
}
{
std::wostringstream outf;
std::ostreambuf_iterator<wchar_t> i(outf);
assert(!i.failed());
}
}

View File

@@ -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.
//
//===----------------------------------------------------------------------===//
// <iterator>
// class ostreambuf_iterator
// ostreambuf_iterator(streambuf_type* s) throw();
#include <iterator>
#include <sstream>
#include <cassert>
int main()
{
{
std::ostringstream outf;
std::ostreambuf_iterator<char> i(outf.rdbuf());
assert(!i.failed());
}
{
std::wostringstream outf;
std::ostreambuf_iterator<wchar_t> i(outf.rdbuf());
assert(!i.failed());
}
}

View File

@@ -0,0 +1,39 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <iterator>
// class ostreambuf_iterator
// ostreambuf_iterator<charT,traits>&
// operator=(charT c);
#include <iterator>
#include <sstream>
#include <cassert>
int main()
{
{
std::ostringstream outf;
std::ostreambuf_iterator<char> i(outf);
i = 'a';
assert(outf.str() == "a");
i = 'b';
assert(outf.str() == "ab");
}
{
std::wostringstream outf;
std::ostreambuf_iterator<wchar_t> i(outf);
i = L'a';
assert(outf.str() == L"a");
i = L'b';
assert(outf.str() == L"ab");
}
}

View File

@@ -0,0 +1,34 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <iterator>
// class ostreambuf_iterator
// ostreambuf_iterator<charT,traits>& operator*();
#include <iterator>
#include <sstream>
#include <cassert>
int main()
{
{
std::ostringstream outf;
std::ostreambuf_iterator<char> i(outf);
std::ostreambuf_iterator<char>& iref = *i;
assert(&iref == &i);
}
{
std::wostringstream outf;
std::ostreambuf_iterator<wchar_t> i(outf);
std::ostreambuf_iterator<wchar_t>& iref = *i;
assert(&iref == &i);
}
}

View File

@@ -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.
//
//===----------------------------------------------------------------------===//
// <iterator>
// class ostreambuf_iterator
// bool failed() const throw();
#include <iterator>
#include <sstream>
#include <cassert>
int main()
{
{
std::ostreambuf_iterator<char> i(nullptr);
assert(i.failed());
}
{
std::ostreambuf_iterator<wchar_t> i(nullptr);
assert(i.failed());
}
}

View File

@@ -0,0 +1,39 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <iterator>
// class ostreambuf_iterator
// ostreambuf_iterator<charT,traits>& operator++();
// ostreambuf_iterator<charT,traits>& operator++(int);
#include <iterator>
#include <sstream>
#include <cassert>
int main()
{
{
std::ostringstream outf;
std::ostreambuf_iterator<char> i(outf);
std::ostreambuf_iterator<char>& iref = ++i;
assert(&iref == &i);
std::ostreambuf_iterator<char>& iref2 = i++;
assert(&iref2 == &i);
}
{
std::wostringstream outf;
std::ostreambuf_iterator<wchar_t> i(outf);
std::ostreambuf_iterator<wchar_t>& iref = ++i;
assert(&iref == &i);
std::ostreambuf_iterator<wchar_t>& iref2 = i++;
assert(&iref2 == &i);
}
}

View File

@@ -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.
//
//===----------------------------------------------------------------------===//
// <iterator>
// template <class charT, class traits = char_traits<charT> >
// class ostreambuf_iterator
// : public iterator<output_iterator_tag, void, void, void, void>
// {
// public:
// typedef charT char_type;
// typedef traits traits_type;
// typedef basic_streambuf<charT, traits> streambuf_type;
// typedef basic_ostream<charT, traits> ostream_type;
// ...
#include <iterator>
#include <string>
#include <type_traits>
int main()
{
typedef std::ostreambuf_iterator<char> I1;
static_assert((std::is_convertible<I1,
std::iterator<std::output_iterator_tag, void, void, void, void> >::value), "");
static_assert((std::is_same<I1::char_type, char>::value), "");
static_assert((std::is_same<I1::traits_type, std::char_traits<char> >::value), "");
static_assert((std::is_same<I1::streambuf_type, std::streambuf>::value), "");
static_assert((std::is_same<I1::ostream_type, std::ostream>::value), "");
typedef std::ostreambuf_iterator<wchar_t> I2;
static_assert((std::is_convertible<I2,
std::iterator<std::output_iterator_tag, void, void, void, void> >::value), "");
static_assert((std::is_same<I2::char_type, wchar_t>::value), "");
static_assert((std::is_same<I2::traits_type, std::char_traits<wchar_t> >::value), "");
static_assert((std::is_same<I2::streambuf_type, std::wstreambuf>::value), "");
static_assert((std::is_same<I2::ostream_type, std::wostream>::value), "");
}