summaryrefslogtreecommitdiffstats
path: root/searchlib/src/tests/attribute/attribute_test.cpp
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@oath.com>2018-06-18 09:20:34 +0200
committerHenning Baldersheim <balder@oath.com>2018-06-18 09:20:34 +0200
commit4427f70a542b89aab9a7c5336c967456c44ca4cc (patch)
treee3b92400d3365725061dda6e8e34cb579089b1a1 /searchlib/src/tests/attribute/attribute_test.cpp
parentf9ccd351b0a195c2ac7be77f66510c1a53fcd82d (diff)
Add test for getNamePrefix
Diffstat (limited to 'searchlib/src/tests/attribute/attribute_test.cpp')
-rw-r--r--searchlib/src/tests/attribute/attribute_test.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/searchlib/src/tests/attribute/attribute_test.cpp b/searchlib/src/tests/attribute/attribute_test.cpp
index 9134711773c..b0aec782c64 100644
--- a/searchlib/src/tests/attribute/attribute_test.cpp
+++ b/searchlib/src/tests/attribute/attribute_test.cpp
@@ -32,8 +32,7 @@ using search::index::DummyFileHeaderContext;
using search::attribute::BasicType;
using search::attribute::IAttributeVector;
-namespace
-{
+namespace {
vespalib::string empty;
vespalib::string tmpDir("tmp");
@@ -2315,6 +2314,23 @@ AttributeTest::testPendingCompaction()
populateSimple(iv, 1, 2); // should not trigger new compaction
}
+void testNamePrefix() {
+ Config cfg(BasicType::INT32, CollectionType::SINGLE);
+ AttributeVector::SP vFlat = createAttribute("sfsint32_pc", cfg);
+ AttributeVector::SP vS1 = createAttribute("sfsint32_pc.abc", cfg);
+ AttributeVector::SP vS2 = createAttribute("sfsint32_pc.xyz", cfg);
+ AttributeVector::SP vSS1 = createAttribute("sfsint32_pc.xyz.abc", cfg);
+ EXPECT_EQUAL("sfsint32_pc", vFlat->getName());
+ EXPECT_EQUAL("sfsint32_pc", vFlat->getNamePrefix());
+ EXPECT_EQUAL("sfsint32_pc.abc", vS1->getName());
+ EXPECT_EQUAL("sfsint32_pc", vS1->getNamePrefix());
+ EXPECT_EQUAL("sfsint32_pc.xyz", vS2->getName());
+ EXPECT_EQUAL("sfsint32_pc", vS2->getNamePrefix());
+ EXPECT_EQUAL("sfsint32_pc.xyz.abc", vSS1->getName());
+ EXPECT_EQUAL("sfsint32_pc", vSS1->getNamePrefix());
+
+}
+
void
deleteDataDirs()
{
@@ -2361,6 +2377,7 @@ int AttributeTest::Main()
TEST_DO(requireThatAddressSpaceUsageIsReported());
testReaderDuringLastUpdate();
TEST_DO(testPendingCompaction());
+ TEST_DO(testNamePrefix());
deleteDataDirs();
TEST_DONE();