Merge pull request #8064 from liewegas/wip-zlib-test

unittest_compression_zlib: do not assume buffer will be null terminated
This commit is contained in:
Sage Weil 2016-03-14 10:49:45 -04:00
commit fed796dea7

View File

@ -36,7 +36,9 @@ TEST(CompressionZlib, compress_decompress)
bufferlist after;
res = sp.decompress(out, after);
EXPECT_EQ(res, 0);
EXPECT_STREQ(test, after.c_str());
bufferlist exp;
exp.append(test);
EXPECT_TRUE(exp.contents_equal(after));
}
TEST(CompressionZlib, compress_decompress_chunk)
@ -54,7 +56,9 @@ TEST(CompressionZlib, compress_decompress_chunk)
bufferlist after;
res = sp.decompress(out, after);
EXPECT_EQ(res, 0);
EXPECT_STREQ("This is test text1234567890", after.c_str());
bufferlist exp;
exp.append("This is test text1234567890");
EXPECT_TRUE(exp.contents_equal(after));
}
int main(int argc, char **argv) {