Files
cxx/test/std/depr/depr.str.strstreams/depr.strstream/depr.strstream.cons/default.pass.cpp
Eric Fiselier a90c6dd460 Move test into test/std subdirectory.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224658 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-20 01:40:03 +00:00

36 lines
835 B
C++

//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <strstream>
// class strstream
// strstream();
#include <strstream>
#include <cassert>
int main()
{
std::strstream inout;
int i = 123;
double d = 4.5;
std::string s("dog");
inout << i << ' ' << d << ' ' << s << std::ends;
assert(inout.str() == std::string("123 4.5 dog"));
i = 0;
d = 0;
s = "";
inout >> i >> d >> s;
assert(i == 123);
assert(d == 4.5);
assert(strcmp(s.c_str(), "dog") == 0);
inout.freeze(false);
}