summaryrefslogtreecommitdiffstats
path: root/searchlib/src/tests/attribute/attribute_test.cpp
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@yahoo-inc.com>2017-03-27 12:08:35 +0000
committerTor Egge <Tor.Egge@yahoo-inc.com>2017-03-27 12:08:35 +0000
commit8d6092f8113b8b9d8070a4960aebd1d727fc4347 (patch)
tree3642c06fddde9e5e0550302b08720213edf1de3b /searchlib/src/tests/attribute/attribute_test.cpp
parent0a0670c449c7da08727e767c2000a08f1ec15563 (diff)
Save persistent predicate attribute params when saving predicate
attribute (using header tags).
Diffstat (limited to 'searchlib/src/tests/attribute/attribute_test.cpp')
-rw-r--r--searchlib/src/tests/attribute/attribute_test.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/searchlib/src/tests/attribute/attribute_test.cpp b/searchlib/src/tests/attribute/attribute_test.cpp
index d38c1714a65..b1786a36597 100644
--- a/searchlib/src/tests/attribute/attribute_test.cpp
+++ b/searchlib/src/tests/attribute/attribute_test.cpp
@@ -217,6 +217,8 @@ private:
void
testCreateSerialNum(void);
+ void testPredicateHeaderTags();
+
template <typename VectorType, typename BufferType>
void
testCompactLidSpace(const Config &config,
@@ -1994,6 +1996,21 @@ AttributeTest::testCreateSerialNum()
EXPECT_EQUAL(42u, attr2->getCreateSerialNum());
}
+void
+AttributeTest::testPredicateHeaderTags()
+{
+ Config cfg(BasicType::PREDICATE);
+ AttributePtr attr = createAttribute("predicate", cfg);
+ attr->addReservedDoc();
+ EXPECT_TRUE(attr->save());
+ auto df = search::FileUtil::openFile(baseFileName("predicate.dat"));
+ vespalib::FileHeader datHeader;
+ datHeader.readFile(*df);
+ EXPECT_TRUE(datHeader.hasTag("predicate.arity"));
+ EXPECT_TRUE(datHeader.hasTag("predicate.lower_bound"));
+ EXPECT_TRUE(datHeader.hasTag("predicate.upper_bound"));
+ EXPECT_EQUAL(8u, datHeader.getTag("predicate.arity").asInteger());
+}
template <typename VectorType, typename BufferType>
void
@@ -2341,6 +2358,7 @@ int AttributeTest::Main()
testNullProtection();
testGeneration();
testCreateSerialNum();
+ testPredicateHeaderTags();
TEST_DO(testCompactLidSpace());
TEST_DO(requireThatAddressSpaceUsageIsReported());
testReaderDuringLastUpdate();