MCPcopy Create free account
hub / github.com/Tencent/rapidjson / TestFileStream

Function TestFileStream

test/unittest/ostreamwrappertest.cpp:65–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63
64template <typename FileStreamType>
65static void TestFileStream() {
66 char filename[L_tmpnam];
67 FILE* fp = TempFile(filename);
68 fclose(fp);
69
70 const char* s = "Hello World!\n";
71 {
72 ofstream ofs(filename, ios::out | ios::binary);
73 BasicOStreamWrapper<ofstream> osw(ofs);
74 for (const char* p = s; *p; p++)
75 osw.Put(*p);
76 osw.Flush();
77 }
78
79 fp = fopen(filename, "r");
80 for (const char* p = s; *p; p++)
81 EXPECT_EQ(*p, static_cast<char>(fgetc(fp)));
82 fclose(fp);
83}
84
85TEST(OStreamWrapper, ofstream) {
86 TestFileStream<ofstream>();

Callers

nothing calls this directly

Calls 3

TempFileFunction · 0.85
PutMethod · 0.45
FlushMethod · 0.45

Tested by

no test coverage detected