26 template <
typename StringStreamType>
28 typedef typename StringStreamType::char_type Ch;
30 Ch
s[] = {
'A',
'B',
'C',
'\0' };
31 StringStreamType oss(s);
33 for (
size_t i = 0; i < 3; i++)
36 for (
size_t i = 0; i < 3; i++)
37 EXPECT_EQ(s[i], oss.str()[i]);
41 TestStringStream<ostringstream>();
45 TestStringStream<stringstream>();
49 TestStringStream<wostringstream>();
53 TestStringStream<wstringstream>();
58 const char*
s =
"Hello World!\n";
64 template <
typename FileStreamType>
66 char filename[L_tmpnam];
70 const char*
s =
"Hello World!\n";
72 FileStreamType ofs(filename, ios::out | ios::binary);
74 for (
const char* p = s; *p; p++)
79 fp = fopen(filename,
"r");
80 ASSERT_TRUE( fp != NULL );
81 for (
const char* p = s; *p; p++)
82 EXPECT_EQ(*p, static_cast<char>(fgetc(fp)));
87 TestFileStream<ofstream>();
91 TestFileStream<fstream>();
Wrapper of std::basic_ostream into RapidJSON's Stream concept.
FILE * TempFile(char *filename)
TEST(OStreamWrapper, ostringstream)
static void TestStringStream()
static void TestFileStream()