diff options
author | Tor Egge <Tor.Egge@broadpark.no> | 2018-10-31 20:48:43 +0100 |
---|---|---|
committer | Tor Egge <tegge@oath.com> | 2019-01-08 18:30:29 +0000 |
commit | d04167de8b9cba666c2f03a5e53f5d167c8b4b50 (patch) | |
tree | 28c1601c4fa5212beafe30bcd8ba296525603e77 /searchlib/src/tests/attribute/sourceselector | |
parent | 21809401b2244eaf1caeae54e501d97990abe43d (diff) |
Compact lid space on source selector.
Diffstat (limited to 'searchlib/src/tests/attribute/sourceselector')
-rw-r--r-- | searchlib/src/tests/attribute/sourceselector/sourceselector_test.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/searchlib/src/tests/attribute/sourceselector/sourceselector_test.cpp b/searchlib/src/tests/attribute/sourceselector/sourceselector_test.cpp index a223b87a73f..1eda0b7cb67 100644 --- a/searchlib/src/tests/attribute/sourceselector/sourceselector_test.cpp +++ b/searchlib/src/tests/attribute/sourceselector/sourceselector_test.cpp @@ -41,7 +41,7 @@ private: void requireThatSelectorCanCloneAndSubtract(); void requireThatSelectorCanCloneAndSubtract(); template <typename SelectorType> - void requireThatSelectorCanSaveAndLoad(); + void requireThatSelectorCanSaveAndLoad(bool compactLidSpace); void requireThatSelectorCanSaveAndLoad(); template <typename SelectorType> void requireThatCompleteSourceRangeIsHandled(); @@ -140,12 +140,15 @@ Test::requireThatSelectorCanCloneAndSubtract() template <typename SelectorType> void -Test::requireThatSelectorCanSaveAndLoad() +Test::requireThatSelectorCanSaveAndLoad(bool compactLidSpace) { SelectorType selector(default_source, base_file_name2); setSources(selector); selector.setBaseId(base_id); selector.setSource(maxDocId + 1, default_source); + if (compactLidSpace) { + selector.compactLidSpace(maxDocId - 4); + } FastOS_FileInterface::EmptyAndRemoveDirectory(index_dir.c_str()); FastOS_FileInterface::MakeDirIfNotPresentOrExit(index_dir.c_str()); @@ -155,9 +158,13 @@ Test::requireThatSelectorCanSaveAndLoad() save_info->save(TuneFileAttributes(), DummyFileHeaderContext()); typename SelectorType::UP selector2(SelectorType::load(base_file_name)); - testSourceSelector(docs, arraysize(docs), default_source, *selector2); + testSourceSelector(docs, arraysize(docs) - compactLidSpace, default_source, *selector2); EXPECT_EQUAL(base_id, selector2->getBaseId()); - EXPECT_EQUAL(maxDocId + 2, selector2->getDocIdLimit()); + if (compactLidSpace) { + EXPECT_EQUAL(maxDocId - 4, selector2->getDocIdLimit()); + } else { + EXPECT_EQUAL(maxDocId + 2, selector2->getDocIdLimit()); + } FastOS_FileInterface::EmptyAndRemoveDirectory(index_dir.c_str()); } @@ -165,7 +172,8 @@ Test::requireThatSelectorCanSaveAndLoad() void Test::requireThatSelectorCanSaveAndLoad() { - requireThatSelectorCanSaveAndLoad<FixedSourceSelector>(); + requireThatSelectorCanSaveAndLoad<FixedSourceSelector>(false); + requireThatSelectorCanSaveAndLoad<FixedSourceSelector>(true); } template <typename SelectorType> |