34 operator<<(ostream &os,
const vector<Xapian::docid> &ints)
36 copy(ints.begin(), ints.end(),
37 ostream_iterator<Xapian::docid>(os,
", "));
50 "mset1 is too small: expected at least " <<
51 (first1 + count) <<
" items, got " <<
55 "mset2 is too small: expected at least " <<
56 (first2 + count) <<
" items, got " <<
62 for (
unsigned int l = 0; l < count; ++l) {
64 tout <<
"docids differ at item " << (l + 1) <<
" in range: "
65 << *i <<
" != " << *j <<
"\n";
70 tout <<
"weights differ at item " << (l + 1) <<
" in range: "
82 const pair<Xapian::docid, double> to_compare[],
86 "mset is too small: expected at least " <<
87 (first + count - 1) <<
" items, got " <<
92 for (
unsigned int l = 0; l < count; ++l) {
93 if (*i != to_compare[l].first) {
94 tout <<
"docids differ at item " << (l + 1) <<
" in range: "
95 << *i <<
" != " << to_compare[l].first <<
"\n";
100 tout <<
"weights differ at item " << (l + 1) <<
" in range: "
101 << i.
get_weight() <<
" != " << to_compare[l].second <<
"\n";
115 "mset1 is too small: expected at least " <<
116 (first1 + count - 1) <<
" items, got " <<
117 mset1.
size() <<
".");
120 "mset2 is too small: expected at least " <<
121 (first2 + count - 1) <<
" items, got " <<
122 mset2.
size() <<
".");
127 for (
unsigned int l = 0; l < count; ++l) {
130 tout <<
"weights differ at item " << (l + 1) <<
" in range: "
149 if (first.
empty())
return true;
159 vector<Xapian::docid> expect;
161 expect.push_back(d1);
163 expect.push_back(d2);
165 expect.push_back(d3);
167 expect.push_back(d4);
169 expect.push_back(d5);
171 expect.push_back(d6);
173 expect.push_back(d7);
175 expect.push_back(d8);
177 expect.push_back(d9);
179 expect.push_back(d10);
181 expect.push_back(d11);
183 expect.push_back(d12);
200 "Mset is of wrong size (" <<
A.size()
201 <<
" < " << expect.size() <<
"):\n"
202 "Full mset was: " <<
A <<
"\n"
203 "Expected order to start: {" << expect <<
"}");
206 "Mset is of wrong size (" <<
A.size()
207 <<
" != " << expect.size() <<
"):\n"
208 "Full mset was: " <<
A <<
"\n"
209 "Expected order: {" << expect <<
"}");
213 for (
size_t i = 0; i < expect.size(); ++i, ++j) {
215 "Mset didn't contain expected result:\n"
216 <<
"Item " << i <<
" was " << *j
217 <<
", expected " << expect[i] <<
"\n"
218 "Full mset was: " <<
A <<
"\n"
219 "Expected: {" << expect <<
"}");
229 mset_expect_order_(
A,
false, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12);
236 "Msets not the same size - "
237 << mset1.
size() <<
" != " << mset2.
size());
240 for (; i != mset1.
end(); ++i, ++j) {
242 "Msets have different contents -\n" <<
243 mset1 <<
"\n !=\n" << mset2);
Iterator over a Xapian::MSet.
double get_weight() const
Get the weight for the current position.
Class representing a list of search results.
Xapian::doccount size() const
Return number of items in this MSet object.
double get_max_possible() const
The maximum possible weight any document could achieve.
bool empty() const
Return true if this MSet object is empty.
Xapian::doccount get_matches_upper_bound() const
Upper bound on the total number of matching documents.
MSetIterator begin() const
Return iterator pointing to the first item in this MSet.
Xapian::doccount get_matches_lower_bound() const
Lower bound on the total number of matching documents.
MSetIterator end() const
Return iterator pointing to just after the last item in this MSet.
Xapian::doccount get_matches_estimated() const
Estimate of the total number of matching documents.
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
bool TEST_EQUAL_DOUBLE_(double a, double b)
Helper function for TEST_EQUAL_DOUBLE macro.
std::ostringstream tout
The debug printing stream.
a generic test suite engine
#define TEST_AND_EXPLAIN(a, b)
Test a condition, and display the test with an extra explanation if the condition fails.
bool operator==(const Xapian::MSet &first, const Xapian::MSet &second)
bool mset_range_is_same_weights(const Xapian::MSet &mset1, unsigned int first1, const Xapian::MSet &mset2, unsigned int first2, unsigned int count)
static void mset_expect_order_(const Xapian::MSet &A, bool beginning, Xapian::docid d1, Xapian::docid d2, Xapian::docid d3, Xapian::docid d4, Xapian::docid d5, Xapian::docid d6, Xapian::docid d7, Xapian::docid d8, Xapian::docid d9, Xapian::docid d10, Xapian::docid d11, Xapian::docid d12)
void mset_expect_order(const Xapian::MSet &A, Xapian::docid d1, Xapian::docid d2, Xapian::docid d3, Xapian::docid d4, Xapian::docid d5, Xapian::docid d6, Xapian::docid d7, Xapian::docid d8, Xapian::docid d9, Xapian::docid d10, Xapian::docid d11, Xapian::docid d12)
ostream & operator<<(ostream &os, const vector< Xapian::docid > &ints)
bool mset_range_is_same(const Xapian::MSet &mset1, unsigned int first1, const Xapian::MSet &mset2, unsigned int first2, unsigned int count)
void test_mset_order_equal(const Xapian::MSet &mset1, const Xapian::MSet &mset2)
Xapian-specific test helper functions and macros.