Skip to content

Commit af5dcda

Browse files
committed
"add testing"
1 parent 313454d commit af5dcda

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

paddle/fluid/recordio/header_test.cc

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,5 @@ TEST(Recordio, ChunkHead) {
3232
std::ostringstream oss2;
3333
hdr2.Write(oss2);
3434
EXPECT_STREQ(oss2.str().c_str(), oss.str().c_str());
35-
}
36-
37-
TEST(Recordio, Stream) {
38-
Header hdr(0, 1, static_cast<Compressor>(2), 3);
39-
std::ostringstream oss1;
40-
hdr.Write(oss1);
41-
42-
std::ostringstream oss2;
43-
oss2 << hdr;
44-
EXPECT_STREQ(oss2.str().c_str(), oss1.str().c_str());
35+
EXPECT_EQ(hdr == hdr2);
4536
}

paddle/fluid/recordio/writer.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,14 @@ Writer::Writer(std::ostream& os, int maxChunkSize, int compressor)
2929
chunk_.reset(new Chunk);
3030
}
3131

32-
size_t Writer::Write(const std::string& buf) {}
32+
size_t Writer::Write(const std::string& buf) { return Write(std::string(buf)); }
3333

3434
size_t Writer::Write(const char* buf, size_t length) {
35-
// std::string s(buf, length);
36-
Write(std::string(buf, length));
35+
return Write(std::string(buf, length));
3736
}
3837

38+
size_t Writer::Write(std::string&& buf) {}
39+
3940
void Writer::Close() {
4041
stream_.flush();
4142
stream_.setstate(std::ios::eofbit);

0 commit comments

Comments
 (0)