summaryrefslogtreecommitdiffstats
path: root/searchlib/src/tests/sortspec
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2016-12-12 02:12:20 +0100
committerHenning Baldersheim <balder@yahoo-inc.com>2016-12-12 02:55:46 +0100
commitd7a3ed6b414d3b31d479bb0e66b62344f6e8660d (patch)
treecf3871b6f24f98cd74f82ca3931320bc449bdaeb /searchlib/src/tests/sortspec
parent0eae2f81d68c46cdf3b228b3900d4c1566047325 (diff)
Complete the test for extended docid.
Diffstat (limited to 'searchlib/src/tests/sortspec')
-rw-r--r--searchlib/src/tests/sortspec/multilevelsort.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/searchlib/src/tests/sortspec/multilevelsort.cpp b/searchlib/src/tests/sortspec/multilevelsort.cpp
index 8cbd5649a1d..d86e826ca50 100644
--- a/searchlib/src/tests/sortspec/multilevelsort.cpp
+++ b/searchlib/src/tests/sortspec/multilevelsort.cpp
@@ -405,12 +405,12 @@ TEST("test that [docid] translates to [lid][paritionid]") {
RankedHit hits[2] = {RankedHit(91, 0.0), RankedHit(3, 2.0)};
search::AttributeManager mgr;
search::AttributeContext ac(mgr);
- asc.Init("[docid]", ac);
+ EXPECT_TRUE(asc.Init("+[docid]", ac));
asc.initWithoutSorting(hits, 2);
constexpr uint8_t FIRST_ASC[6] = {0,0,0,91,0,7};
constexpr uint8_t SECOND_ASC[6] = {0,0,0,3,0,7};
- constexpr uint8_t FIRST_DESC[6] = {0,0,0,91,0,7};
- constexpr uint8_t SECOND_DESC[6] = {0,0,0,3,0,7};
+ constexpr uint8_t FIRST_DESC[6] = {255,255,255,255-91,255,255-7};
+ constexpr uint8_t SECOND_DESC[6] = {255,255,255,255-3,255,255-7};
auto sr1 = asc.getSortRef(0);
EXPECT_EQUAL(6u, sr1.second);
EXPECT_EQUAL(0, memcmp(FIRST_ASC, sr1.first, 6));
@@ -419,12 +419,12 @@ TEST("test that [docid] translates to [lid][paritionid]") {
EXPECT_EQUAL(0, memcmp(SECOND_ASC, sr2.first, 6));
FastS_SortSpec desc(7, doom, ucaFactory);
- asc.Init("-[docid]", ac);
- asc.initWithoutSorting(hits, 2);
- sr1 = asc.getSortRef(0);
+ desc.Init("-[docid]", ac);
+ desc.initWithoutSorting(hits, 2);
+ sr1 = desc.getSortRef(0);
EXPECT_EQUAL(6u, sr1.second);
EXPECT_EQUAL(0, memcmp(FIRST_DESC, sr1.first, 6));
- sr2 = asc.getSortRef(1);
+ sr2 = desc.getSortRef(1);
EXPECT_EQUAL(6u, sr2.second);
EXPECT_EQUAL(0, memcmp(SECOND_DESC, sr2.first, 6));
}