Home | Info | Community | Development | myReactOS | Contact Us
[protected]
Definition at line 143 of file sstream_test.cpp.
{ stringstream s; s << 1 << '\n' << 2.0 << '\n' << "abcd\n" << "ghk lm\n" << "abcd ef"; CPPUNIT_ASSERT( s.good() ); int i = 0; s >> i; CPPUNIT_ASSERT( i == 1 ); CPPUNIT_ASSERT( s.good() ); double d = 0.0; s >> d; CPPUNIT_ASSERT( d == 2.0 ); CPPUNIT_ASSERT( s.good() ); string str; s >> str; CPPUNIT_ASSERT( str == "abcd" ); CPPUNIT_ASSERT( s.good() ); char c; s.get(c); // extract newline, that not extracted by operator >> CPPUNIT_ASSERT( s.good() ); CPPUNIT_ASSERT( c == '\n' ); getline( s, str ); CPPUNIT_ASSERT( s.good() ); CPPUNIT_ASSERT( str == "ghk lm" ); getline( s, str ); CPPUNIT_ASSERT( str == "abcd ef" ); CPPUNIT_ASSERT( s.eof() ); }