diff options
Diffstat (limited to 'searchlib/src/tests')
4 files changed, 64 insertions, 64 deletions
diff --git a/searchlib/src/tests/attribute/enum_comparator/enum_comparator_test.cpp b/searchlib/src/tests/attribute/enum_comparator/enum_comparator_test.cpp index 97b08c5683f..4a7491130f4 100644 --- a/searchlib/src/tests/attribute/enum_comparator/enum_comparator_test.cpp +++ b/searchlib/src/tests/attribute/enum_comparator/enum_comparator_test.cpp @@ -107,7 +107,7 @@ Test::requireThatComparatorWithTreeIsWorking() EXPECT_EQUAL(100u, t.size(m)); int32_t exp = 1; for (TreeType::Iterator itr = t.begin(m); itr.valid(); ++itr) { - EXPECT_EQUAL(exp++, es.getValue(itr.getKey())); + EXPECT_EQUAL(exp++, es.get_value(itr.getKey())); } EXPECT_EQUAL(101, exp); t.clear(m); diff --git a/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp b/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp index de45505e523..fe4b6ca1685 100644 --- a/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp +++ b/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp @@ -53,7 +53,7 @@ checkReaders(const StringEnumStore& ses, for (uint32_t i = 0; i < readers.size(); ++i) { const Reader& r = readers[i]; for (uint32_t j = 0; j < r._indices.size(); ++j) { - EXPECT_TRUE(ses.getValue(r._indices[j], t)); + EXPECT_TRUE(ses.get_value(r._indices[j], t)); EXPECT_TRUE(r._expected[j]._string == std::string(t)); } } @@ -90,17 +90,17 @@ TYPED_TEST(FloatEnumStoreTest, numbers_can_be_inserted_and_retrieved) } for (uint32_t i = 0; i < 5; ++i) { - EXPECT_TRUE(this->es.findIndex(a[i], idx)); - EXPECT_TRUE(!this->es.findIndex(b[i], idx)); + EXPECT_TRUE(this->es.find_index(a[i], idx)); + EXPECT_TRUE(!this->es.find_index(b[i], idx)); } this->es.insert(std::numeric_limits<EntryType>::quiet_NaN()); - EXPECT_TRUE(this->es.findIndex(std::numeric_limits<EntryType>::quiet_NaN(), idx)); - EXPECT_TRUE(this->es.findIndex(std::numeric_limits<EntryType>::quiet_NaN(), idx)); + EXPECT_TRUE(this->es.find_index(std::numeric_limits<EntryType>::quiet_NaN(), idx)); + EXPECT_TRUE(this->es.find_index(std::numeric_limits<EntryType>::quiet_NaN(), idx)); for (uint32_t i = 0; i < 5; ++i) { - EXPECT_TRUE(this->es.findIndex(a[i], idx)); - EXPECT_TRUE(!this->es.findIndex(b[i], idx)); + EXPECT_TRUE(this->es.find_index(a[i], idx)); + EXPECT_TRUE(!this->es.find_index(b[i], idx)); } } @@ -114,31 +114,31 @@ TEST(EnumStoreTest, test_find_folded_on_string_enum_store) for (std::string &str : unique) { EnumIndex idx = ses.insert(str.c_str()); indices.push_back(idx); - EXPECT_EQ(1u, ses.getRefCount(idx)); + EXPECT_EQ(1u, ses.get_ref_count(idx)); } - ses.freezeTree(); + ses.freeze_dictionary(); for (uint32_t i = 0; i < indices.size(); ++i) { EnumIndex idx; - EXPECT_TRUE(ses.findIndex(unique[i].c_str(), idx)); + EXPECT_TRUE(ses.find_index(unique[i].c_str(), idx)); } - EXPECT_EQ(1u, ses.findFoldedEnums("").size()); - EXPECT_EQ(0u, ses.findFoldedEnums("foo").size()); - EXPECT_EQ(1u, ses.findFoldedEnums("one").size()); - EXPECT_EQ(3u, ses.findFoldedEnums("two").size()); - EXPECT_EQ(3u, ses.findFoldedEnums("TWO").size()); - EXPECT_EQ(3u, ses.findFoldedEnums("tWo").size()); - const auto v = ses.findFoldedEnums("Two"); - EXPECT_EQ(std::string("TWO"), ses.getValue(v[0])); - EXPECT_EQ(std::string("Two"), ses.getValue(v[1])); - EXPECT_EQ(std::string("two"), ses.getValue(v[2])); - EXPECT_EQ(1u, ses.findFoldedEnums("three").size()); + EXPECT_EQ(1u, ses.find_folded_enums("").size()); + EXPECT_EQ(0u, ses.find_folded_enums("foo").size()); + EXPECT_EQ(1u, ses.find_folded_enums("one").size()); + EXPECT_EQ(3u, ses.find_folded_enums("two").size()); + EXPECT_EQ(3u, ses.find_folded_enums("TWO").size()); + EXPECT_EQ(3u, ses.find_folded_enums("tWo").size()); + const auto v = ses.find_folded_enums("Two"); + EXPECT_EQ(std::string("TWO"), ses.get_value(v[0])); + EXPECT_EQ(std::string("Two"), ses.get_value(v[1])); + EXPECT_EQ(std::string("two"), ses.get_value(v[2])); + EXPECT_EQ(1u, ses.find_folded_enums("three").size()); } template <typename DictionaryT> void testUniques(const StringEnumStore& ses, const std::vector<std::string>& unique) { - const auto* enumDict = dynamic_cast<const EnumStoreDictionary<DictionaryT>*>(&ses.getEnumStoreDict()); + const auto* enumDict = dynamic_cast<const EnumStoreDictionary<DictionaryT>*>(&ses.get_dictionary()); assert(enumDict != nullptr); const DictionaryT& dict = enumDict->getDictionary(); uint32_t i = 0; @@ -146,7 +146,7 @@ testUniques(const StringEnumStore& ses, const std::vector<std::string>& unique) for (typename DictionaryT::Iterator iter = dict.begin(); iter.valid(); ++iter, ++i) { idx = iter.getKey(); - EXPECT_TRUE(strcmp(unique[i].c_str(), ses.getValue(idx)) == 0); + EXPECT_TRUE(strcmp(unique[i].c_str(), ses.get_value(idx)) == 0); } EXPECT_EQ(static_cast<uint32_t>(unique.size()), i); } @@ -170,23 +170,23 @@ StringEnumStoreTest::testInsert(bool hasPostings) for (uint32_t i = 0; i < unique.size(); ++i) { EnumIndex idx = ses.insert(unique[i].c_str()); - EXPECT_EQ(1u, ses.getRefCount(idx)); + EXPECT_EQ(1u, ses.get_ref_count(idx)); indices.push_back(idx); - EXPECT_TRUE(ses.findIndex(unique[i].c_str(), idx)); + EXPECT_TRUE(ses.find_index(unique[i].c_str(), idx)); } - ses.freezeTree(); + ses.freeze_dictionary(); for (uint32_t i = 0; i < indices.size(); ++i) { uint32_t e = 0; - EXPECT_TRUE(ses.findEnum(unique[i].c_str(), e)); - EXPECT_EQ(1u, ses.findFoldedEnums(unique[i].c_str()).size()); - EXPECT_EQ(e, ses.findFoldedEnums(unique[i].c_str())[0]); + EXPECT_TRUE(ses.find_enum(unique[i].c_str(), e)); + EXPECT_EQ(1u, ses.find_folded_enums(unique[i].c_str()).size()); + EXPECT_EQ(e, ses.find_folded_enums(unique[i].c_str())[0]); EnumIndex idx; - EXPECT_TRUE(ses.findIndex(unique[i].c_str(), idx)); + EXPECT_TRUE(ses.find_index(unique[i].c_str(), idx)); EXPECT_TRUE(idx == indices[i]); - EXPECT_EQ(1u, ses.getRefCount(indices[i])); + EXPECT_EQ(1u, ses.get_ref_count(indices[i])); const char* value = nullptr; - EXPECT_TRUE(ses.getValue(indices[i], value)); + EXPECT_TRUE(ses.get_value(indices[i], value)); EXPECT_TRUE(strcmp(unique[i].c_str(), value) == 0); } @@ -231,17 +231,17 @@ TEST(EnumStoreTest, test_hold_lists_and_generation) // insert first batch of unique strings for (uint32_t i = 0; i < 100; ++i) { EnumIndex idx = ses.insert(uniques[i].c_str()); - EXPECT_TRUE(ses.getRefCount(idx)); + EXPECT_TRUE(ses.get_ref_count(idx)); // associate readers if (i % 10 == 9) { Reader::IndexVector indices; Reader::ExpectedVector expected; for (uint32_t j = i - 9; j <= i; ++j) { - EXPECT_TRUE(ses.findIndex(uniques[j].c_str(), idx)); + EXPECT_TRUE(ses.find_index(uniques[j].c_str(), idx)); indices.push_back(idx); - uint32_t ref_count = ses.getRefCount(idx); - std::string value(ses.getValue(idx)); + uint32_t ref_count = ses.get_ref_count(idx); + std::string value(ses.get_value(idx)); EXPECT_EQ(1u, ref_count); EXPECT_EQ(uniques[j], value); expected.emplace_back(ref_count, value); @@ -258,17 +258,17 @@ TEST(EnumStoreTest, test_hold_lists_and_generation) auto updater = ses.make_batch_updater(); for (uint32_t i = 0; i < 100; ++i) { EnumIndex idx; - EXPECT_TRUE(ses.findIndex(uniques[i].c_str(), idx)); + EXPECT_TRUE(ses.find_index(uniques[i].c_str(), idx)); updater.dec_ref_count(idx); - EXPECT_EQ(0u, ses.getRefCount(idx)); + EXPECT_EQ(0u, ses.get_ref_count(idx)); } updater.commit(); // check readers again checkReaders(ses, readers); - ses.transferHoldLists(sesGen); - ses.trimHoldLists(sesGen + 1); + ses.transfer_hold_lists(sesGen); + ses.trim_hold_lists(sesGen + 1); } void @@ -279,8 +279,8 @@ dec_ref_count(NumericEnumStore& store, NumericEnumStore::Index idx) updater.commit(); generation_t gen = 5; - store.transferHoldLists(gen); - store.trimHoldLists(gen + 1); + store.transfer_hold_lists(gen); + store.trim_hold_lists(gen + 1); } TEST(EnumStoreTest, address_space_usage_is_reported) @@ -289,16 +289,16 @@ TEST(EnumStoreTest, address_space_usage_is_reported) NumericEnumStore store(false); using vespalib::AddressSpace; - EXPECT_EQ(AddressSpace(1, 1, ADDRESS_LIMIT), store.getAddressSpaceUsage()); + EXPECT_EQ(AddressSpace(1, 1, ADDRESS_LIMIT), store.get_address_space_usage()); EnumIndex idx1 = store.insert(10); - EXPECT_EQ(AddressSpace(2, 1, ADDRESS_LIMIT), store.getAddressSpaceUsage()); + EXPECT_EQ(AddressSpace(2, 1, ADDRESS_LIMIT), store.get_address_space_usage()); EnumIndex idx2 = store.insert(20); // Address limit increases because buffer is re-sized. - EXPECT_EQ(AddressSpace(3, 1, ADDRESS_LIMIT + 2), store.getAddressSpaceUsage()); + EXPECT_EQ(AddressSpace(3, 1, ADDRESS_LIMIT + 2), store.get_address_space_usage()); dec_ref_count(store, idx1); - EXPECT_EQ(AddressSpace(3, 2, ADDRESS_LIMIT + 2), store.getAddressSpaceUsage()); + EXPECT_EQ(AddressSpace(3, 2, ADDRESS_LIMIT + 2), store.get_address_space_usage()); dec_ref_count(store, idx2); - EXPECT_EQ(AddressSpace(3, 3, ADDRESS_LIMIT + 2), store.getAddressSpaceUsage()); + EXPECT_EQ(AddressSpace(3, 3, ADDRESS_LIMIT + 2), store.get_address_space_usage()); } class BatchUpdaterTest : public ::testing::Test { @@ -325,16 +325,16 @@ public: void expect_value_in_store(int32_t exp_value, uint32_t exp_ref_count, EnumIndex idx) { EnumIndex tmp_idx; - EXPECT_TRUE(store.findIndex(exp_value, tmp_idx)); + EXPECT_TRUE(store.find_index(exp_value, tmp_idx)); EXPECT_EQ(idx, tmp_idx); - EXPECT_EQ(exp_value, store.getValue(idx)); - EXPECT_EQ(exp_ref_count, store.getRefCount(idx)); + EXPECT_EQ(exp_value, store.get_value(idx)); + EXPECT_EQ(exp_ref_count, store.get_ref_count(idx)); } void expect_value_not_in_store(int32_t value, EnumIndex idx) { EnumIndex temp_idx; - EXPECT_FALSE(store.findIndex(value, idx)); - EXPECT_EQ(0, store.getRefCount(idx)); + EXPECT_FALSE(store.find_index(value, idx)); + EXPECT_EQ(0, store.get_ref_count(idx)); } }; @@ -395,7 +395,7 @@ public: EnumIndex find_index(size_t values_idx) const { EnumIndex result; - EXPECT_TRUE(store.findIndex(values[values_idx], result)); + EXPECT_TRUE(store.find_index(values[values_idx], result)); return result; } @@ -406,12 +406,12 @@ public: void expect_value_in_store(size_t values_idx, uint32_t exp_ref_count) const { EnumIndex idx = find_index(values_idx); - EXPECT_EQ(exp_ref_count, store.getRefCount(idx)); + EXPECT_EQ(exp_ref_count, store.get_ref_count(idx)); } void expect_value_not_in_store(size_t values_idx) const { EnumIndex idx; - EXPECT_FALSE(store.findIndex(values[values_idx], idx)); + EXPECT_FALSE(store.find_index(values[values_idx], idx)); } void expect_values_in_store() { @@ -423,7 +423,7 @@ public: void expect_posting_idx(size_t values_idx, uint32_t exp_posting_idx) const { auto cmp = store.make_comparator(); - auto itr = store.getPostingDictionary().find(find_index(values_idx), cmp); + auto itr = store.get_posting_dictionary().find(find_index(values_idx), cmp); ASSERT_TRUE(itr.valid()); EXPECT_EQ(exp_posting_idx, itr.getData()); } diff --git a/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp b/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp index 2be779cb41d..9b4c72e1027 100644 --- a/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp +++ b/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp @@ -445,7 +445,7 @@ PostingListAttributeTest::checkPostingList(const VectorType & vec, const std::ve const RangeGenerator & range) { const typename VectorType::EnumStore & enumStore = vec.getEnumStore(); - const typename VectorType::Dictionary & dict = enumStore.getPostingDictionary(); + const typename VectorType::Dictionary & dict = enumStore.get_posting_dictionary(); const typename VectorType::PostingList & postingList = vec.getPostingList(); for (size_t i = 0; i < values.size(); ++i) { @@ -669,7 +669,7 @@ void PostingListAttributeTest::checkPostingList(AttributeType & vec, ValueType value, DocSet expected) { const typename AttributeType::EnumStore & enumStore = vec.getEnumStore(); - const typename AttributeType::Dictionary & dict = enumStore.getPostingDictionary(); + const typename AttributeType::Dictionary & dict = enumStore.get_posting_dictionary(); const typename AttributeType::PostingList & postingList = vec.getPostingList(); auto itr = dict.find(typename AttributeType::EnumIndex(), vec.getEnumStore().make_comparator(value)); @@ -690,7 +690,7 @@ template <typename AttributeType, typename ValueType> void PostingListAttributeTest::checkNonExistantPostingList(AttributeType & vec, ValueType value) { - const typename AttributeType::Dictionary & dict = vec.getEnumStore().getPostingDictionary(); + const typename AttributeType::Dictionary & dict = vec.getEnumStore().get_posting_dictionary(); auto itr = dict.find(typename AttributeType::EnumIndex(), vec.getEnumStore().make_comparator(value)); EXPECT_TRUE(!itr.valid()); diff --git a/searchlib/src/tests/attribute/stringattribute/stringattribute_test.cpp b/searchlib/src/tests/attribute/stringattribute/stringattribute_test.cpp index dcf246033ba..5c73a60f6ef 100644 --- a/searchlib/src/tests/attribute/stringattribute/stringattribute_test.cpp +++ b/searchlib/src/tests/attribute/stringattribute/stringattribute_test.cpp @@ -177,9 +177,9 @@ StringAttributeTest::testMultiValue(Attribute & attr, uint32_t numDocs) // check for correct refcounts for (uint32_t i = 0; i < uniqueStrings.size(); ++i) { typename Attribute::EnumStore::Index idx; - EXPECT_TRUE(attr.getEnumStore().findIndex(uniqueStrings[i].c_str(), idx)); + EXPECT_TRUE(attr.getEnumStore().find_index(uniqueStrings[i].c_str(), idx)); uint32_t expectedUsers = numDocs - 1 - i; - EXPECT_EQUAL(expectedUsers, attr.getEnumStore().getRefCount(idx)); + EXPECT_EQUAL(expectedUsers, attr.getEnumStore().get_ref_count(idx)); } // clear and insert new unique strings @@ -225,9 +225,9 @@ StringAttributeTest::testMultiValue(Attribute & attr, uint32_t numDocs) // check for correct refcounts for (uint32_t i = 0; i < newUniques.size(); ++i) { typename Attribute::EnumStore::Index idx; - EXPECT_TRUE(attr.getEnumStore().findIndex(newUniques[i].c_str(), idx)); + EXPECT_TRUE(attr.getEnumStore().find_index(newUniques[i].c_str(), idx)); uint32_t expectedUsers = numDocs - 1 - i; - EXPECT_EQUAL(expectedUsers, attr.getEnumStore().getRefCount(idx)); + EXPECT_EQUAL(expectedUsers, attr.getEnumStore().get_ref_count(idx)); } } |