From bec261866af1a690e9f0ed43bc4f4bd42dc08d3a Mon Sep 17 00:00:00 2001 From: HÃ¥vard Pettersen Date: Thu, 13 Jun 2019 16:19:28 +0000 Subject: populate feature sets with serialized tensors --- .../src/tests/proton/matching/matching_test.cpp | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'searchcore/src/tests/proton/matching') diff --git a/searchcore/src/tests/proton/matching/matching_test.cpp b/searchcore/src/tests/proton/matching/matching_test.cpp index 2a29847a634..b34a8c84237 100644 --- a/searchcore/src/tests/proton/matching/matching_test.cpp +++ b/searchcore/src/tests/proton/matching/matching_test.cpp @@ -630,21 +630,21 @@ TEST("require that summary features are filled") { world.basicResults(); DocsumRequest::SP req = world.createSimpleDocsumRequest("f1", "foo"); FeatureSet::SP fs = world.getSummaryFeatures(req); - const feature_t * f = NULL; + const FeatureSet::Value * f = NULL; EXPECT_EQUAL(2u, fs->numFeatures()); EXPECT_EQUAL("attribute(a1)", fs->getNames()[0]); EXPECT_EQUAL("value(100)", fs->getNames()[1]); EXPECT_EQUAL(2u, fs->numDocs()); f = fs->getFeaturesByDocId(10); EXPECT_TRUE(f != NULL); - EXPECT_EQUAL(10, f[0]); - EXPECT_EQUAL(100, f[1]); + EXPECT_EQUAL(10, f[0].as_double()); + EXPECT_EQUAL(100, f[1].as_double()); f = fs->getFeaturesByDocId(15); EXPECT_TRUE(f == NULL); f = fs->getFeaturesByDocId(30); EXPECT_TRUE(f != NULL); - EXPECT_EQUAL(30, f[0]); - EXPECT_EQUAL(100, f[1]); + EXPECT_EQUAL(30, f[0].as_double()); + EXPECT_EQUAL(100, f[1].as_double()); } TEST("require that rank features are filled") { @@ -653,18 +653,18 @@ TEST("require that rank features are filled") { world.basicResults(); DocsumRequest::SP req = world.createSimpleDocsumRequest("f1", "foo"); FeatureSet::SP fs = world.getRankFeatures(req); - const feature_t * f = NULL; + const FeatureSet::Value * f = NULL; EXPECT_EQUAL(1u, fs->numFeatures()); EXPECT_EQUAL("attribute(a2)", fs->getNames()[0]); EXPECT_EQUAL(2u, fs->numDocs()); f = fs->getFeaturesByDocId(10); EXPECT_TRUE(f != NULL); - EXPECT_EQUAL(20, f[0]); + EXPECT_EQUAL(20, f[0].as_double()); f = fs->getFeaturesByDocId(15); EXPECT_TRUE(f == NULL); f = fs->getFeaturesByDocId(30); EXPECT_TRUE(f != NULL); - EXPECT_EQUAL(60, f[0]); + EXPECT_EQUAL(60, f[0].as_double()); } TEST("require that search session can be cached") { @@ -703,10 +703,10 @@ TEST("require that getSummaryFeatures can use cached query setup") { EXPECT_EQUAL("attribute(a1)", fs->getNames()[0]); EXPECT_EQUAL("value(100)", fs->getNames()[1]); ASSERT_EQUAL(1u, fs->numDocs()); - const feature_t *f = fs->getFeaturesByDocId(30); + const auto *f = fs->getFeaturesByDocId(30); ASSERT_TRUE(f); - EXPECT_EQUAL(30, f[0]); - EXPECT_EQUAL(100, f[1]); + EXPECT_EQUAL(30, f[0].as_double()); + EXPECT_EQUAL(100, f[1].as_double()); // getSummaryFeatures can be called multiple times. fs = world.getSummaryFeatures(docsum_request); @@ -716,8 +716,8 @@ TEST("require that getSummaryFeatures can use cached query setup") { ASSERT_EQUAL(1u, fs->numDocs()); f = fs->getFeaturesByDocId(30); ASSERT_TRUE(f); - EXPECT_EQUAL(30, f[0]); - EXPECT_EQUAL(100, f[1]); + EXPECT_EQUAL(30, f[0].as_double()); + EXPECT_EQUAL(100, f[1].as_double()); } TEST("require that getSummaryFeatures prefers cached query setup") { -- cgit v1.2.3