8 #include <gtest/gtest.h>
13 using namespace HCE::sphinx;
14 using namespace HCE::sphinx::reduce_task;
24 sphinxResultDataAccumulator.
accumulate(emptySphinxResultData);
47 AttrInfo attrInfo1(
"first",
"value");
49 matchInfo1.addAttrInfo(attrInfo1);
50 matchInfo2.addAttrInfo(attrInfo1);
51 matchInfo3.addAttrInfo(attrInfo1);
53 sphinxRequestInfo.setQuery(query1);
54 sphinxRequestInfo.setTotal(totalRes1);
55 sphinxRequestInfo.setTotalFound(totalFound1);
56 sphinxRequestInfo.setTimeMsec(time1);
57 sphinxRequestInfo.addWordInfo(word1);
58 sphinxRequestInfo.addWordInfo(word2);
60 sphinxResultData1.addMatchInfo(matchInfo1);
61 sphinxResultData1.addMatchInfo(matchInfo2);
62 sphinxResultData1.addRequestInfo(sphinxRequestInfo);
64 sphinxResultData2.addMatchInfo(matchInfo3);
85 map<string, bool> expectStorage;
86 expectStorage.insert(make_pair(to_string(matchInfo1.getDocId()) + matchInfo1.getWeight(),
88 expectStorage.insert(make_pair(to_string(matchInfo2.getDocId()) + matchInfo2.getWeight(),
90 expectStorage.insert(make_pair(to_string(matchInfo3.getDocId()) + matchInfo3.getWeight(),
93 int storageElemNumber = 0;
97 sphinxResultDataAccumulator.
accumulate(sphinxResultData1);
98 sphinxResultDataAccumulator.
accumulate(sphinxResultData2);
109 ASSERT_TRUE(expectStorage.find(
key +
weight) != expectStorage.end());
112 ASSERT_EQ(storageElemNumber, 3);