@ -55,9 +55,9 @@ class FilterBlockTest {
TEST ( FilterBlockTest , EmptyBuilder ) {
TEST ( FilterBlockTest , EmptyBuilder ) {
BlockBasedFilterBlockBuilder builder ( nullptr , table_options_ ) ;
BlockBasedFilterBlockBuilder builder ( nullptr , table_options_ ) ;
Slice block = builder . Finish ( ) ;
BlockContents block ( builder . Finish ( ) , false , kNoCompression ) ;
ASSERT_EQ ( " \\ x00 \\ x00 \\ x00 \\ x00 \\ x0b " , EscapeString ( block ) ) ;
ASSERT_EQ ( " \\ x00 \\ x00 \\ x00 \\ x00 \\ x0b " , EscapeString ( block . data ) ) ;
BlockBasedFilterBlockReader reader ( nullptr , table_options_ , block ) ;
BlockBasedFilterBlockReader reader ( nullptr , table_options_ , std : : move ( block ) ) ;
ASSERT_TRUE ( reader . KeyMayMatch ( " foo " , 0 ) ) ;
ASSERT_TRUE ( reader . KeyMayMatch ( " foo " , 0 ) ) ;
ASSERT_TRUE ( reader . KeyMayMatch ( " foo " , 100000 ) ) ;
ASSERT_TRUE ( reader . KeyMayMatch ( " foo " , 100000 ) ) ;
}
}
@ -72,8 +72,8 @@ TEST(FilterBlockTest, SingleChunk) {
builder . Add ( " box " ) ;
builder . Add ( " box " ) ;
builder . StartBlock ( 300 ) ;
builder . StartBlock ( 300 ) ;
builder . Add ( " hello " ) ;
builder . Add ( " hello " ) ;
Slice block = builder . Finish ( ) ;
BlockContents block ( builder . Finish ( ) , false , kNoCompression ) ;
BlockBasedFilterBlockReader reader ( nullptr , table_options_ , block ) ;
BlockBasedFilterBlockReader reader ( nullptr , table_options_ , std : : move ( block ) ) ;
ASSERT_TRUE ( reader . KeyMayMatch ( " foo " , 100 ) ) ;
ASSERT_TRUE ( reader . KeyMayMatch ( " foo " , 100 ) ) ;
ASSERT_TRUE ( reader . KeyMayMatch ( " bar " , 100 ) ) ;
ASSERT_TRUE ( reader . KeyMayMatch ( " bar " , 100 ) ) ;
ASSERT_TRUE ( reader . KeyMayMatch ( " box " , 100 ) ) ;
ASSERT_TRUE ( reader . KeyMayMatch ( " box " , 100 ) ) ;
@ -103,8 +103,8 @@ TEST(FilterBlockTest, MultiChunk) {
builder . Add ( " box " ) ;
builder . Add ( " box " ) ;
builder . Add ( " hello " ) ;
builder . Add ( " hello " ) ;
Slice block = builder . Finish ( ) ;
BlockContents block ( builder . Finish ( ) , false , kNoCompression ) ;
BlockBasedFilterBlockReader reader ( nullptr , table_options_ , block ) ;
BlockBasedFilterBlockReader reader ( nullptr , table_options_ , std : : move ( block ) ) ;
// Check first filter
// Check first filter
ASSERT_TRUE ( reader . KeyMayMatch ( " foo " , 0 ) ) ;
ASSERT_TRUE ( reader . KeyMayMatch ( " foo " , 0 ) ) ;
@ -147,10 +147,10 @@ class BlockBasedFilterBlockTest {
TEST ( BlockBasedFilterBlockTest , BlockBasedEmptyBuilder ) {
TEST ( BlockBasedFilterBlockTest , BlockBasedEmptyBuilder ) {
FilterBlockBuilder * builder = new BlockBasedFilterBlockBuilder (
FilterBlockBuilder * builder = new BlockBasedFilterBlockBuilder (
nullptr , table_options_ ) ;
nullptr , table_options_ ) ;
Slice block = builder - > Finish ( ) ;
BlockContents block ( builder - > Finish ( ) , false , kNoCompression ) ;
ASSERT_EQ ( " \\ x00 \\ x00 \\ x00 \\ x00 \\ x0b " , EscapeString ( block ) ) ;
ASSERT_EQ ( " \\ x00 \\ x00 \\ x00 \\ x00 \\ x0b " , EscapeString ( block . data ) ) ;
FilterBlockReader * reader = new BlockBasedFilterBlockReader (
FilterBlockReader * reader = new BlockBasedFilterBlockReader (
nullptr , table_options_ , block ) ;
nullptr , table_options_ , std : : move ( block ) ) ;
ASSERT_TRUE ( reader - > KeyMayMatch ( " foo " , 0 ) ) ;
ASSERT_TRUE ( reader - > KeyMayMatch ( " foo " , 0 ) ) ;
ASSERT_TRUE ( reader - > KeyMayMatch ( " foo " , 100000 ) ) ;
ASSERT_TRUE ( reader - > KeyMayMatch ( " foo " , 100000 ) ) ;
@ -169,9 +169,9 @@ TEST(BlockBasedFilterBlockTest, BlockBasedSingleChunk) {
builder - > Add ( " box " ) ;
builder - > Add ( " box " ) ;
builder - > StartBlock ( 300 ) ;
builder - > StartBlock ( 300 ) ;
builder - > Add ( " hello " ) ;
builder - > Add ( " hello " ) ;
Slice block = builder - > Finish ( ) ;
BlockContents block ( builder - > Finish ( ) , false , kNoCompression ) ;
FilterBlockReader * reader = new BlockBasedFilterBlockReader (
FilterBlockReader * reader = new BlockBasedFilterBlockReader (
nullptr , table_options_ , block ) ;
nullptr , table_options_ , std : : move ( block ) ) ;
ASSERT_TRUE ( reader - > KeyMayMatch ( " foo " , 100 ) ) ;
ASSERT_TRUE ( reader - > KeyMayMatch ( " foo " , 100 ) ) ;
ASSERT_TRUE ( reader - > KeyMayMatch ( " bar " , 100 ) ) ;
ASSERT_TRUE ( reader - > KeyMayMatch ( " bar " , 100 ) ) ;
ASSERT_TRUE ( reader - > KeyMayMatch ( " box " , 100 ) ) ;
ASSERT_TRUE ( reader - > KeyMayMatch ( " box " , 100 ) ) ;
@ -205,9 +205,9 @@ TEST(BlockBasedFilterBlockTest, BlockBasedMultiChunk) {
builder - > Add ( " box " ) ;
builder - > Add ( " box " ) ;
builder - > Add ( " hello " ) ;
builder - > Add ( " hello " ) ;
Slice block = builder - > Finish ( ) ;
BlockContents block ( builder - > Finish ( ) , false , kNoCompression ) ;
FilterBlockReader * reader = new BlockBasedFilterBlockReader (
FilterBlockReader * reader = new BlockBasedFilterBlockReader (
nullptr , table_options_ , block ) ;
nullptr , table_options_ , std : : move ( block ) ) ;
// Check first filter
// Check first filter
ASSERT_TRUE ( reader - > KeyMayMatch ( " foo " , 0 ) ) ;
ASSERT_TRUE ( reader - > KeyMayMatch ( " foo " , 0 ) ) ;