aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-07-06 15:07:24 +0200
committerGitHub <noreply@github.com>2023-07-06 15:07:24 +0200
commite7988be96456596aa1a42d5cb7ba51f08ba665f7 (patch)
treeaa5e88bb9a81e32bae5d1edf124682052f028bc7
parent92605333ad4af83dc7808b374a43967cc2b069f6 (diff)
Revert "- Use a single templated fixture to avoid copy-paste errors when exte…"
-rw-r--r--searchlib/src/tests/attribute/document_weight_iterator/document_weight_iterator_test.cpp37
1 files changed, 24 insertions, 13 deletions
diff --git a/searchlib/src/tests/attribute/document_weight_iterator/document_weight_iterator_test.cpp b/searchlib/src/tests/attribute/document_weight_iterator/document_weight_iterator_test.cpp
index 5518f47ef5d..c864877aec2 100644
--- a/searchlib/src/tests/attribute/document_weight_iterator/document_weight_iterator_test.cpp
+++ b/searchlib/src/tests/attribute/document_weight_iterator/document_weight_iterator_test.cpp
@@ -62,28 +62,39 @@ void populate_string(AttributeVector::SP attr_ptr) {
set_doc(attr, 7, "foo", 10);
}
-template<BasicType::Type BT, CollectionType::Type CT>
-struct Fixture {
+template<CollectionType::Type CT>
+struct LongFixture {
AttributeVector::SP attr;
const IDocumentWeightAttribute *api;
- Fixture()
- : attr(make_attribute(BT, CT, true)),
+ LongFixture()
+ : attr(make_attribute(BasicType::INT64, CollectionType::WSET, true)),
api(attr->asDocumentWeightAttribute())
{
ASSERT_TRUE(api != nullptr);
add_docs(attr);
- if (BT == BasicType::STRING) {
- populate_string(attr);
- } else {
- populate_long(attr);
- }
+ populate_long(attr);
+ }
+};
+
+using LongWsetFixture = LongFixture<CollectionType::WSET>;
+using LongArrayFixture = LongFixture<CollectionType::ARRAY>;
+
+template<CollectionType::Type CT>
+struct StringFixture {
+ AttributeVector::SP attr;
+ const IDocumentWeightAttribute *api;
+ StringFixture()
+ : attr(make_attribute(BasicType::STRING, CT, true)),
+ api(attr->asDocumentWeightAttribute())
+ {
+ ASSERT_TRUE(api != nullptr);
+ add_docs(attr);
+ populate_string(attr);
}
};
-using LongWsetFixture = Fixture<BasicType::INT64, CollectionType::WSET>;
-using LongArrayFixture = Fixture<BasicType::INT64, CollectionType::ARRAY>;
-using StringWsetFixture = Fixture<BasicType::STRING, CollectionType::WSET>;
-using StringArrayFixture = Fixture<BasicType::STRING, CollectionType::ARRAY>;
+using StringWsetFixture = StringFixture<CollectionType::WSET>;
+using StringArrayFixture = StringFixture<CollectionType::ARRAY>;
TEST("require that appropriate attributes support the document weight attribute interface") {
EXPECT_TRUE(make_attribute(BasicType::INT32, CollectionType::WSET, true)->asDocumentWeightAttribute() != nullptr);