8 #include <gtest/gtest.h>
12 using namespace HCE::sphinx::reduce_task;
19 ASSERT_TRUE(sphinxReduceResult.
hasNext() ==
false);
26 idWeightResult.push_back(make_pair(
"14",
"12345"));
27 idWeightResult.push_back(make_pair(
"7",
"256789"));
28 idWeightResult.push_back(make_pair(
"21",
"1122334"));
40 sphinxReduceResult.
addKeyValue(idWeightResult[0].first, idWeightResult[0].second);
42 sphinxReduceResult.
reset();
43 ASSERT_TRUE(sphinxReduceResult.
hasNext());
45 sphinxReduceResult.
getNext(expectId, expectWeight);
46 EXPECT_EQ(idWeightResult[0].first, expectId);
47 EXPECT_EQ(idWeightResult[0].second, expectWeight);
49 EXPECT_TRUE(sphinxReduceResult.
hasNext() ==
false);
55 for (
size_t resIndex = 0; resIndex < idWeightResult.size(); ++resIndex){
56 sphinxReduceResult.
addKeyValue(idWeightResult[resIndex].first,
57 idWeightResult[resIndex].second);
60 unsigned int docsNumber = 0;
61 sphinxReduceResult.
reset();
62 while(sphinxReduceResult.
hasNext()){
63 sphinxReduceResult.
getNext(expectId, expectWeight);
64 EXPECT_EQ(idWeightResult[docsNumber].first, expectId);
65 EXPECT_EQ(idWeightResult[docsNumber].second, expectWeight);
69 ASSERT_EQ(docsNumber, idWeightResult.size());