| 548 | class TableTest {}; |
| 549 | |
| 550 | TEST(TableTest, ApproximateOffsetOfPlain) { |
| 551 | TableConstructor c; |
| 552 | c.Add("k01", "hello"); |
| 553 | c.Add("k02", "hello2"); |
| 554 | c.Add("k03", string(10000, 'x')); |
| 555 | c.Add("k04", string(200000, 'x')); |
| 556 | c.Add("k05", string(300000, 'x')); |
| 557 | c.Add("k06", "hello3"); |
| 558 | c.Add("k07", string(100000, 'x')); |
| 559 | std::vector<string> keys; |
| 560 | KVMap kvmap; |
| 561 | Options options; |
| 562 | options.block_size = 1024; |
| 563 | options.compression = kNoCompression; |
| 564 | c.Finish(options, &keys, &kvmap); |
| 565 | |
| 566 | ASSERT_TRUE(Between(c.ApproximateOffsetOf("abc"), 0, 0)); |
| 567 | ASSERT_TRUE(Between(c.ApproximateOffsetOf("k01"), 0, 0)); |
| 568 | ASSERT_TRUE(Between(c.ApproximateOffsetOf("k01a"), 0, 0)); |
| 569 | ASSERT_TRUE(Between(c.ApproximateOffsetOf("k02"), 0, 0)); |
| 570 | ASSERT_TRUE(Between(c.ApproximateOffsetOf("k03"), 10, 500)); |
| 571 | ASSERT_TRUE(Between(c.ApproximateOffsetOf("k04"), 10000, 11000)); |
| 572 | ASSERT_TRUE(Between(c.ApproximateOffsetOf("k04a"), 210000, 211000)); |
| 573 | ASSERT_TRUE(Between(c.ApproximateOffsetOf("k05"), 210000, 211000)); |
| 574 | ASSERT_TRUE(Between(c.ApproximateOffsetOf("k06"), 510000, 511000)); |
| 575 | ASSERT_TRUE(Between(c.ApproximateOffsetOf("k07"), 510000, 511000)); |
| 576 | ASSERT_TRUE(Between(c.ApproximateOffsetOf("xyz"), 610000, 612000)); |
| 577 | } |
| 578 | |
| 579 | static bool SnappyCompressionSupported() { |
| 580 | string out; |
nothing calls this directly
no test coverage detected