diff options
author | Samuel Just <sam.just@inktank.com> | 2013-09-26 14:46:24 -0700 |
---|---|---|
committer | Samuel Just <sam.just@inktank.com> | 2013-09-26 14:49:01 -0700 |
commit | 0719b54b4e7437e7bed7ae50ee1806cd76661324 (patch) | |
tree | 19e75172c3ebac60cde25bdedf260f51309b9b6a /src/test/bufferlist.cc | |
parent | d1c68979e2246e2a2ef4d3043600b830317b3086 (diff) | |
download | ceph-wip-cache-crc.tar.gz |
common/buffer: slightly more useful crc caching with testwip-cache-crc
Signed-off-by: Samuel Just <sam.just@inktank.com>
Diffstat (limited to 'src/test/bufferlist.cc')
-rw-r--r-- | src/test/bufferlist.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/bufferlist.cc b/src/test/bufferlist.cc index b23bd33e55a..beae868c0da 100644 --- a/src/test/bufferlist.cc +++ b/src/test/bufferlist.cc @@ -1649,6 +1649,23 @@ TEST(BufferList, crc32c) { EXPECT_EQ((unsigned)0x5FA5C0CC, crc); } +TEST(BufferList, crc32cappend) { + bufferlist bl1; + bufferlist bl2; + + for (int j = 0; j < 200; ++j) { + bufferlist bl; + for (int i = 0; i < 200; ++i) { + char x = rand(); + bl.append(x); + bl1.append(x); + } + bl.crc32c(rand()); // mess with the cached bufferptr crc values + bl2.append(bl); + } + ASSERT_EQ(bl1.crc32c(0), bl2.crc32c(0)); +} + TEST(BufferList, compare) { bufferlist a; a.append("A"); |