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,26 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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 ostream_iterator
|
||||
|
||||
// ostream_iterator(const ostream_iterator& x);
|
||||
|
||||
#include <iterator>
|
||||
#include <sstream>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::ostringstream outf;
|
||||
std::ostream_iterator<int> i(outf);
|
||||
std::ostream_iterator<int> j = i;
|
||||
assert(outf.good());
|
||||
}
|
@@ -0,0 +1,25 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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 ostream_iterator
|
||||
|
||||
// ostream_iterator(ostream_type& s);
|
||||
|
||||
#include <iterator>
|
||||
#include <sstream>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::ostringstream outf;
|
||||
std::ostream_iterator<int> i(outf);
|
||||
assert(outf.good());
|
||||
}
|
@@ -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 ostream_iterator
|
||||
|
||||
// ostream_iterator(ostream_type& s, const charT* delimiter);
|
||||
|
||||
#include <iterator>
|
||||
#include <sstream>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
std::ostringstream outf;
|
||||
std::ostream_iterator<int> i(outf, ", ");
|
||||
assert(outf.good());
|
||||
}
|
||||
{
|
||||
std::wostringstream outf;
|
||||
std::ostream_iterator<double, wchar_t> i(outf, L", ");
|
||||
assert(outf.good());
|
||||
}
|
||||
}
|
@@ -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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <iterator>
|
||||
|
||||
// class ostream_iterator
|
||||
|
||||
// ostream_iterator& operator=(const T& value);
|
||||
|
||||
#include <iterator>
|
||||
#include <sstream>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
std::ostringstream outf;
|
||||
std::ostream_iterator<int> i(outf);
|
||||
i = 2.4;
|
||||
assert(outf.str() == "2");
|
||||
}
|
||||
{
|
||||
std::ostringstream outf;
|
||||
std::ostream_iterator<int> i(outf, ", ");
|
||||
i = 2.4;
|
||||
assert(outf.str() == "2, ");
|
||||
}
|
||||
{
|
||||
std::wostringstream outf;
|
||||
std::ostream_iterator<int, wchar_t> i(outf);
|
||||
i = 2.4;
|
||||
assert(outf.str() == L"2");
|
||||
}
|
||||
{
|
||||
std::wostringstream outf;
|
||||
std::ostream_iterator<int, wchar_t> i(outf, L", ");
|
||||
i = 2.4;
|
||||
assert(outf.str() == L"2, ");
|
||||
}
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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 ostream_iterator
|
||||
|
||||
// ostream_iterator& operator*() const;
|
||||
|
||||
#include <iterator>
|
||||
#include <sstream>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::ostringstream os;
|
||||
std::ostream_iterator<int> i(os);
|
||||
std::ostream_iterator<int>& iref = *i;
|
||||
assert(&iref == &i);
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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 ostream_iterator
|
||||
|
||||
// ostream_iterator& operator++();
|
||||
// ostream_iterator& operator++(int);
|
||||
|
||||
#include <iterator>
|
||||
#include <sstream>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::ostringstream os;
|
||||
std::ostream_iterator<int> i(os);
|
||||
std::ostream_iterator<int>& iref1 = ++i;
|
||||
assert(&iref1 == &i);
|
||||
std::ostream_iterator<int>& iref2 = i++;
|
||||
assert(&iref2 == &i);
|
||||
}
|
@@ -0,0 +1,40 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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 T, class charT = char, class traits = char_traits<charT>,
|
||||
// class Distance = ptrdiff_t>
|
||||
// class ostream_iterator
|
||||
// : public iterator<output_iterator_tag, void, void, void, void>
|
||||
// {
|
||||
// public:
|
||||
// typedef charT char_type;
|
||||
// typedef traits traits_type;
|
||||
// typedef basic_istream<charT,traits> istream_type;
|
||||
// ...
|
||||
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
|
||||
int main()
|
||||
{
|
||||
typedef std::ostream_iterator<double> 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::ostream_type, std::ostream>::value), "");
|
||||
typedef std::ostream_iterator<unsigned, 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::ostream_type, std::wostream>::value), "");
|
||||
}
|
Reference in New Issue
Block a user