diff options
author | Geir Storli <geirst@verizonmedia.com> | 2019-05-03 07:55:42 +0000 |
---|---|---|
committer | Geir Storli <geirst@verizonmedia.com> | 2019-05-03 07:55:42 +0000 |
commit | a91e44a0ab32d4b14d42bbca95331f339f109267 (patch) | |
tree | 81086e49174fd1117c6eec3948db61af116080c3 /searchcommon/src/tests/schema/schema_test.cpp | |
parent | c1bfad36330765d713188280c402de0c284ded9b (diff) |
Specify default values when loading an IndexField from config lines.
Diffstat (limited to 'searchcommon/src/tests/schema/schema_test.cpp')
-rw-r--r-- | searchcommon/src/tests/schema/schema_test.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/searchcommon/src/tests/schema/schema_test.cpp b/searchcommon/src/tests/schema/schema_test.cpp index 780ea7a6640..e360ee1ba7a 100644 --- a/searchcommon/src/tests/schema/schema_test.cpp +++ b/searchcommon/src/tests/schema/schema_test.cpp @@ -16,6 +16,7 @@ namespace search::index { using schema::DataType; using schema::CollectionType; using SIAF = Schema::ImportedAttributeField; +using SIF = Schema::IndexField; void assertField(const Schema::Field& exp, const Schema::Field& act) @@ -170,7 +171,6 @@ TEST(SchemaTest, test_basic) TEST(SchemaTest, test_load_and_save) { - using SIF = Schema::IndexField; using SAF = Schema::AttributeField; using SSF = Schema::SummaryField; using SDT = schema::DataType; @@ -439,6 +439,20 @@ TEST(SchemaTest, require_that_schema_can_be_built_with_imported_attribute_fields assertField(SIAF("regular", DataType::INT32, CollectionType::SINGLE), regular[0]); } +TEST(SchemaTest, require_that_index_field_is_loaded_with_default_values_when_properties_are_not_set) +{ + Schema s; + s.loadFromFile("schema-without-index-field-properties.txt"); + + const auto& index_fields = s.getIndexFields(); + ASSERT_EQ(1, index_fields.size()); + assertIndexField(SIF("foo", DataType::STRING, CollectionType::SINGLE). + setAvgElemLen(512). + set_experimental_posting_list_format(false), + index_fields[0]); + assertIndexField(SIF("foo", DataType::STRING, CollectionType::SINGLE), index_fields[0]); +} + } GTEST_MAIN_RUN_ALL_TESTS() |