35 operator<<(ostream &os, const vector<Xapian::docid> &ints)
37 copy(ints.begin(), ints.end(),
38 ostream_iterator<Xapian::docid>(os,
", "));
51 "mset1 is too small: expected at least " <<
52 (first1 + count) <<
" items, got " <<
56 "mset2 is too small: expected at least " <<
57 (first2 + count) <<
" items, got " <<
63 for (
unsigned int l = 0; l < count; ++l) {
65 tout <<
"docids differ at item " << (l + 1) <<
" in range: " 66 << *i <<
" != " << *j <<
"\n";
71 tout <<
"weights differ at item " << (l + 1) <<
" in range: " 72 << i.get_weight() <<
" != " << j.
get_weight() <<
"\n";
83 const pair<Xapian::docid, double> to_compare[],
87 "mset is too small: expected at least " <<
88 (first + count - 1) <<
" items, got " <<
93 for (
unsigned int l = 0; l < count; ++l) {
94 if (*i != to_compare[l].first) {
95 tout <<
"docids differ at item " << (l + 1) <<
" in range: " 96 << *i <<
" != " << to_compare[l].first <<
"\n";
101 tout <<
"weights differ at item " << (l + 1) <<
" in range: " 102 << i.get_weight() <<
" != " << to_compare[l].second <<
"\n";
116 "mset1 is too small: expected at least " <<
117 (first1 + count - 1) <<
" items, got " <<
118 mset1.
size() <<
".");
121 "mset2 is too small: expected at least " <<
122 (first2 + count - 1) <<
" items, got " <<
123 mset2.
size() <<
".");
128 for (
unsigned int l = 0; l < count; ++l) {
131 tout <<
"weights differ at item " << (l + 1) <<
" in range: " 132 << i.get_weight() <<
" != " << j.
get_weight() <<
"\n";
150 if (first.
empty())
return true;
160 vector<Xapian::docid> expect;
162 expect.push_back(d1);
164 expect.push_back(d2);
166 expect.push_back(d3);
168 expect.push_back(d4);
170 expect.push_back(d5);
172 expect.push_back(d6);
174 expect.push_back(d7);
176 expect.push_back(d8);
178 expect.push_back(d9);
180 expect.push_back(d10);
182 expect.push_back(d11);
184 expect.push_back(d12);
201 "Mset is of wrong size (" << A.
size()
202 <<
" < " << expect.size() <<
"):\n" 203 "Full mset was: " << A <<
"\n" 204 "Expected order to start: {" << expect <<
"}");
207 "Mset is of wrong size (" << A.
size()
208 <<
" != " << expect.size() <<
"):\n" 209 "Full mset was: " << A <<
"\n" 210 "Expected order: {" << expect <<
"}");
214 for (
size_t i = 0; i < expect.size(); ++i, ++j) {
216 "Mset didn't contain expected result:\n" 217 <<
"Item " << i <<
" was " << *j
218 <<
", expected " << expect[i] <<
"\n" 219 "Full mset was: " << A <<
"\n" 220 "Expected: {" << expect <<
"}");
230 mset_expect_order_(A,
false, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12);
237 "Msets not the same size - " 238 << mset1.
size() <<
" != " << mset2.
size());
241 for (; i != mset1.
end(); ++i, ++j) {
243 "Msets have different contents -\n" <<
244 mset1 <<
"\n !=\n" << mset2);
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 mset_range_is_same(const Xapian::MSet &mset1, unsigned int first1, const Xapian::MSet &mset2, unsigned int first2, unsigned int count)
#define TEST_AND_EXPLAIN(a, b)
Test a condition, and display the test with an extra explanation if the condition fails...
bool empty() const
Return true if this MSet object is empty.
Xapian::doccount get_matches_lower_bound() const
Lower bound on the total number of matching documents.
a generic test suite engine
Class representing a list of search results.
Xapian::doccount get_matches_upper_bound() const
Upper bound on the total number of matching documents.
void test_mset_order_equal(const Xapian::MSet &mset1, const Xapian::MSet &mset2)
std::ostringstream tout
The debug printing stream.
Iterator over a Xapian::MSet.
MSetIterator begin() const
Return iterator pointing to the first item in this MSet.
MSetIterator end() const
Return iterator pointing to just after the last item in this MSet.
bool operator==(const Xapian::MSet &first, const Xapian::MSet &second)
bool TEST_EQUAL_DOUBLE_(double a, double b)
Helper function for TEST_EQUAL_DOUBLE macro.
double get_weight() const
Get the weight for the current position.
Xapian::doccount get_matches_estimated() const
Estimate of the total number of matching documents.
Xapian-specific test helper functions and macros.
bool mset_range_is_same_weights(const Xapian::MSet &mset1, unsigned int first1, const Xapian::MSet &mset2, unsigned int first2, unsigned int count)
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)
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)
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.