diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2019-08-16 14:48:11 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2019-08-16 17:22:45 +0000 |
commit | 224b5fbe12ecab75beee6efe24068a9ce7092110 (patch) | |
tree | 3e8c0dd797c583b032b960488b2bf3436ccbd2b9 /searchcore/src/tests/proton/common | |
parent | 5fb8e66dbd2d6e02a64a054e147ac7214943d563 (diff) |
doc: -> id:
Diffstat (limited to 'searchcore/src/tests/proton/common')
-rw-r--r-- | searchcore/src/tests/proton/common/cachedselect_test.cpp | 22 | ||||
-rw-r--r-- | searchcore/src/tests/proton/common/selectpruner_test.cpp | 67 |
2 files changed, 28 insertions, 61 deletions
diff --git a/searchcore/src/tests/proton/common/cachedselect_test.cpp b/searchcore/src/tests/proton/common/cachedselect_test.cpp index dcba8fda1c6..df414439bce 100644 --- a/searchcore/src/tests/proton/common/cachedselect_test.cpp +++ b/searchcore/src/tests/proton/common/cachedselect_test.cpp @@ -466,10 +466,10 @@ TEST_F("Test that basic select works", TestFixture) { MyDB &db(*f._db); - db.addDoc(1u, "doc:test:1", "hello", "null", 45, 37); - db.addDoc(2u, "doc:test:2", "gotcha", "foo", 3, 25); - db.addDoc(3u, "doc:test:3", "gotcha", "foo", noIntVal, noIntVal); - db.addDoc(4u, "doc:test:4", "null", "foo", noIntVal, noIntVal); + db.addDoc(1u, "id:ns:test::1", "hello", "null", 45, 37); + db.addDoc(2u, "id:ns:test::2", "gotcha", "foo", 3, 25); + db.addDoc(3u, "id:ns:test::3", "gotcha", "foo", noIntVal, noIntVal); + db.addDoc(4u, "id:ns:test::4", "null", "foo", noIntVal, noIntVal); CachedSelect::SP cs; @@ -566,9 +566,9 @@ struct PreDocSelectFixture : public TestFixture { PreDocSelectFixture() : TestFixture() { - db().addDoc(1u, "doc:test:1", "foo", "null", 3, 5); - db().addDoc(2u, "doc:test:1", "bar", "null", 3, 5); - db().addDoc(3u, "doc:test:2", "foo", "null", 7, 5); + db().addDoc(1u, "id:ns:test::1", "foo", "null", 3, 5); + db().addDoc(2u, "id:ns:test::1", "bar", "null", 3, 5); + db().addDoc(3u, "id:ns:test::2", "foo", "null", 7, 5); } }; @@ -602,10 +602,10 @@ TEST_F("Test performance when using attributes", TestFixture) { MyDB &db(*f._db); - db.addDoc(1u, "doc:test:1", "hello", "null", 45, 37); - db.addDoc(2u, "doc:test:2", "gotcha", "foo", 3, 25); - db.addDoc(3u, "doc:test:3", "gotcha", "foo", noIntVal, noIntVal); - db.addDoc(4u, "doc:test:4", "null", "foo", noIntVal, noIntVal); + db.addDoc(1u, "id:ns:test::1", "hello", "null", 45, 37); + db.addDoc(2u, "id:ns:test::2", "gotcha", "foo", 3, 25); + db.addDoc(3u, "id:ns:test::3", "gotcha", "foo", noIntVal, noIntVal); + db.addDoc(4u, "id:ns:test::4", "null", "foo", noIntVal, noIntVal); CachedSelect::SP cs; cs = f.testParse("test.aa < 45", "test"); diff --git a/searchcore/src/tests/proton/common/selectpruner_test.cpp b/searchcore/src/tests/proton/common/selectpruner_test.cpp index a7feb865d96..5b1fa3ed4bf 100644 --- a/searchcore/src/tests/proton/common/selectpruner_test.cpp +++ b/searchcore/src/tests/proton/common/selectpruner_test.cpp @@ -36,8 +36,7 @@ using search::AttributeFactory; typedef Node::UP NodeUP; -namespace -{ +namespace { const int32_t doc_type_id = 787121340; const string type_name = "test"; @@ -57,9 +56,6 @@ const string invalid_name("test_2.ac > 3999"); const string invalid2_name("test_2.ac > 4999"); const string empty(""); -const document::DocumentId docId("doc:test:1"); - - std::unique_ptr<const DocumentTypeRepo> makeDocTypeRepo() { @@ -135,23 +131,12 @@ public: bool _hasDocuments; TestFixture(); - ~TestFixture(); - void - testParse(const string &selection); - - void - testParseFail(const string &selection); - - void - testPrune(const string &selection, - const string &exp); - - void - testPrune(const string &selection, - const string &exp, - const string &docTypeName); + void testParse(const string &selection); + void testParseFail(const string &selection); + void testPrune(const string &selection, const string &exp); + void testPrune(const string &selection, const string &exp, const string &docTypeName); }; @@ -169,28 +154,22 @@ TestFixture::TestFixture() } -TestFixture::~TestFixture() -{ -} +TestFixture::~TestFixture() = default; void TestFixture::testParse(const string &selection) { const DocumentTypeRepo &repo(*_repoUP); - document::select::Parser parser(repo, - document::BucketIdFactory()); + document::select::Parser parser(repo,document::BucketIdFactory()); NodeUP select; try { - LOG(info, - "Trying to parse '%s'", - selection.c_str()); + LOG(info, "Trying to parse '%s'", selection.c_str()); select = parser.parse(selection); } catch (document::select::ParsingFailedException &e) { - LOG(info, - "Parse failed: %s", e.what()); + LOG(info, "Parse failed: %s", e.what()); select.reset(0); } ASSERT_TRUE(select.get() != NULL); @@ -201,20 +180,15 @@ void TestFixture::testParseFail(const string &selection) { const DocumentTypeRepo &repo(*_repoUP); - document::select::Parser parser(repo, - document::BucketIdFactory()); + document::select::Parser parser(repo,document::BucketIdFactory()); NodeUP select; try { - LOG(info, - "Trying to parse '%s'", - selection.c_str()); + LOG(info, "Trying to parse '%s'", selection.c_str()); select = parser.parse(selection); } catch (document::select::ParsingFailedException &e) { - LOG(info, - "Parse failed: %s", - e.getMessage().c_str()); + LOG(info, "Parse failed: %s", e.getMessage().c_str()); select.reset(0); } ASSERT_TRUE(select.get() == NULL); @@ -222,25 +196,18 @@ TestFixture::testParseFail(const string &selection) void -TestFixture::testPrune(const string &selection, - const string &exp, - const string &docTypeName) +TestFixture::testPrune(const string &selection, const string &exp, const string &docTypeName) { const DocumentTypeRepo &repo(*_repoUP); - document::select::Parser parser(repo, - document::BucketIdFactory()); + document::select::Parser parser(repo,document::BucketIdFactory()); NodeUP select; try { - LOG(info, - "Trying to parse '%s' with docType=%s", - selection.c_str(), - docTypeName.c_str()); + LOG(info, "Trying to parse '%s' with docType=%s", selection.c_str(), docTypeName.c_str()); select = parser.parse(selection); } catch (document::select::ParsingFailedException &e) { - LOG(info, - "Parse failed: %s", e.what()); + LOG(info, "Parse failed: %s", e.what()); select.reset(0); } ASSERT_TRUE(select.get() != NULL); @@ -249,7 +216,7 @@ TestFixture::testPrune(const string &selection, LOG(info, "ParseTree: '%s'", os.str().c_str()); const DocumentType *docType = repo.getDocumentType(docTypeName); ASSERT_TRUE(docType != NULL); - Document::UP emptyDoc(new Document(*docType, docId)); + Document::UP emptyDoc(new Document(*docType, document::DocumentId("id:ns:" + docTypeName + "::1"))); emptyDoc->setRepo(repo); SelectPruner pruner(docTypeName, &_amgr, *emptyDoc, repo, _hasFields, _hasDocuments); pruner.process(*select); |