diff options
author | Vinnie Falco <vinnie.falco@gmail.com> | 2013-07-01 08:36:32 -0700 |
---|---|---|
committer | Vinnie Falco <vinnie.falco@gmail.com> | 2013-07-01 08:36:32 -0700 |
commit | fb1da62318f5a7f6e3ec31cdc02178a5445870e4 (patch) | |
tree | 4ef6f0b1017c747e84132427666eea4a36d10b0d /src/leveldb/table/table_test.cc | |
parent | 28bcf3b7ef804f7084938b21708b29c1f5d7c8f8 (diff) | |
parent | adae78ea9940f4d44382967d1296e7db0b54a4de (diff) |
Merge commit 'adae78ea9940f4d44382967d1296e7db0b54a4de' into leveldb-squashed
Diffstat (limited to 'src/leveldb/table/table_test.cc')
-rw-r--r-- | src/leveldb/table/table_test.cc | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/leveldb/table/table_test.cc b/src/leveldb/table/table_test.cc index 57cea25334..c723bf84cf 100644 --- a/src/leveldb/table/table_test.cc +++ b/src/leveldb/table/table_test.cc @@ -644,6 +644,36 @@ class Harness { Constructor* constructor_; }; +// Test empty table/block. +TEST(Harness, Empty) { + for (int i = 0; i < kNumTestArgs; i++) { + Init(kTestArgList[i]); + Random rnd(test::RandomSeed() + 1); + Test(&rnd); + } +} + +// Special test for a block with no restart entries. The C++ leveldb +// code never generates such blocks, but the Java version of leveldb +// seems to. +TEST(Harness, ZeroRestartPointsInBlock) { + char data[sizeof(uint32_t)]; + memset(data, 0, sizeof(data)); + BlockContents contents; + contents.data = Slice(data, sizeof(data)); + contents.cachable = false; + contents.heap_allocated = false; + Block block(contents); + Iterator* iter = block.NewIterator(BytewiseComparator()); + iter->SeekToFirst(); + ASSERT_TRUE(!iter->Valid()); + iter->SeekToLast(); + ASSERT_TRUE(!iter->Valid()); + iter->Seek("foo"); + ASSERT_TRUE(!iter->Valid()); + delete iter; +} + // Test the empty key TEST(Harness, SimpleEmptyKey) { for (int i = 0; i < kNumTestArgs; i++) { |