提交 af5dcda4 编写于 作者: D dongzhihong

"add testing"

上级 313454df
...@@ -32,14 +32,5 @@ TEST(Recordio, ChunkHead) { ...@@ -32,14 +32,5 @@ TEST(Recordio, ChunkHead) {
std::ostringstream oss2; std::ostringstream oss2;
hdr2.Write(oss2); hdr2.Write(oss2);
EXPECT_STREQ(oss2.str().c_str(), oss.str().c_str()); EXPECT_STREQ(oss2.str().c_str(), oss.str().c_str());
} EXPECT_EQ(hdr == hdr2);
TEST(Recordio, Stream) {
Header hdr(0, 1, static_cast<Compressor>(2), 3);
std::ostringstream oss1;
hdr.Write(oss1);
std::ostringstream oss2;
oss2 << hdr;
EXPECT_STREQ(oss2.str().c_str(), oss1.str().c_str());
} }
...@@ -29,13 +29,14 @@ Writer::Writer(std::ostream& os, int maxChunkSize, int compressor) ...@@ -29,13 +29,14 @@ Writer::Writer(std::ostream& os, int maxChunkSize, int compressor)
chunk_.reset(new Chunk); chunk_.reset(new Chunk);
} }
size_t Writer::Write(const std::string& buf) {} size_t Writer::Write(const std::string& buf) { return Write(std::string(buf)); }
size_t Writer::Write(const char* buf, size_t length) { size_t Writer::Write(const char* buf, size_t length) {
// std::string s(buf, length); return Write(std::string(buf, length));
Write(std::string(buf, length));
} }
size_t Writer::Write(std::string&& buf) {}
void Writer::Close() { void Writer::Close() {
stream_.flush(); stream_.flush();
stream_.setstate(std::ios::eofbit); stream_.setstate(std::ios::eofbit);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册