#include <config.h>
#include "api_backend.h"
#include <xapian.h>
#include "str.h"
#include "testsuite.h"
#include "testutils.h"
#include "utils.h"
#include "apitest.h"
#include "safeunistd.h"

Go to the source code of this file.
Classes | |
| struct | MyMatchDecider |
Defines | |
| #define | XAPIAN_DEPRECATED(X) X |
Functions | |
| DEFINE_TESTCASE (lockfileumask1, brass||chert||flint) | |
| Regression test - lockfile should honour umask, was only user-readable. | |
| DEFINE_TESTCASE (totaldoclen1, writable) | |
| Check that the backend handles total document length > 0xffffffff. | |
| DEFINE_TESTCASE (dbstats1, backend) | |
| DEFINE_TESTCASE (alldocspl3, backend) | |
| Check handling of alldocs on an empty database. | |
| DEFINE_TESTCASE (modifiedpostlist1, writable) | |
| Regression test for bug#392 in ModifiedPostList iteration, fixed in 1.0.15. | |
| DEFINE_TESTCASE (doclenaftercommit1, writable) | |
| Regression test for chert bug fixed in 1.1.3 (ticket#397). | |
| DEFINE_TESTCASE (valuesaftercommit1, writable) | |
| DEFINE_TESTCASE (lockfilefd0or1, brass||chert||flint) | |
| DEFINE_TESTCASE (matchdecider4, remote) | |
| Test Xapian::MatchDecider with remote backend fails. | |
| DEFINE_TESTCASE (replacedoc7, writable &&!inmemory &&!remote) | |
| Check that replacing an unmodified document doesn't increase the automatic flush counter. | |
| DEFINE_TESTCASE (replacedoc8, writable) | |
| Check that replacing a document deleted since the last flush works. | |
| DEFINE_TESTCASE (databasemodified1, writable &&!inmemory &&!remote) | |
| Test coverage for DatabaseModifiedError. | |
| DEFINE_TESTCASE (qpmemoryleak1, writable &&!inmemory) | |
| Regression test for bug#462 fixed in 1.0.19 and 1.1.5. | |
| static void | make_msize1_db (Xapian::WritableDatabase &db, const string &) |
| DEFINE_TESTCASE (msize1, generated) | |
| Regression test for ticket#464, fixed in 1.1.6 and 1.0.20. | |
| static void | make_msize2_db (Xapian::WritableDatabase &db, const string &) |
| DEFINE_TESTCASE (msize2, generated) | |
| Regression test for bug related to ticket#464, fixed in 1.1.6 and 1.0.20. | |
| static void | make_xordecay1_db (Xapian::WritableDatabase &db, const string &) |
| DEFINE_TESTCASE (xordecay1, generated) | |
| Regression test for bug in decay of XOR, fixed in 1.2.1 and 1.0.21. | |
| static void | make_ordecay_db (Xapian::WritableDatabase &db, const string &) |
| DEFINE_TESTCASE (ordecay1, generated) | |
| Regression test for bug in decay of OR to AND, fixed in 1.2.1 and 1.0.21. | |
| DEFINE_TESTCASE (ordecay2, generated) | |
| Regression test for bug in decay of OR to AND_MAYBE, fixed in 1.2.1 and 1.0.21. | |
| static void | make_orcheck_db (Xapian::WritableDatabase &db, const string &) |
| DEFINE_TESTCASE (orcheck1, generated) | |
| Regression test for bugs in the check() method of OrPostList. | |
| DEFINE_TESTCASE (failedreplace1, brass||chert||flint) | |
| Regression test for bug fixed in 1.2.1 and 1.0.21. | |
| DEFINE_TESTCASE (failedreplace2, brass||chert||flint) | |
| DEFINE_TESTCASE (phrase3, positional) | |
| Coverage for SelectPostList::skip_to(). | |
| DEFINE_TESTCASE (msetfirst2, backend) | |
| Check that get_mset(<large number>, 10) doesn't exhaust memory needlessly. | |
| DEFINE_TESTCASE (bm25weight2, backend) | |
| DEFINE_TESTCASE (tradweight2, backend) | |
Definition in file api_backend.cc.
| #define XAPIAN_DEPRECATED | ( | X | ) | X |
Definition at line 27 of file api_backend.cc.
| DEFINE_TESTCASE | ( | tradweight2 | , | |
| backend | ||||
| ) |
Definition at line 740 of file api_backend.cc.
References get_database(), Xapian::Enquire::get_mset(), Xapian::Enquire::set_query(), Xapian::Enquire::set_weighting_scheme(), Xapian::MSet::size(), TEST_EQUAL, and TEST_REL.
| DEFINE_TESTCASE | ( | bm25weight2 | , | |
| backend | ||||
| ) |
Definition at line 726 of file api_backend.cc.
References get_database(), Xapian::Enquire::get_mset(), Xapian::Enquire::set_query(), Xapian::Enquire::set_weighting_scheme(), Xapian::MSet::size(), TEST_EQUAL, and TEST_REL.
| DEFINE_TESTCASE | ( | msetfirst2 | , | |
| backend | ||||
| ) |
Check that get_mset(<large number>, 10) doesn't exhaust memory needlessly.
Definition at line 707 of file api_backend.cc.
References get_database(), Xapian::MSet::get_firstitem(), Xapian::Enquire::get_mset(), Xapian::Query::MatchNothing, Xapian::Enquire::set_query(), and TEST_EQUAL.
| DEFINE_TESTCASE | ( | phrase3 | , | |
| positional | ||||
| ) |
Coverage for SelectPostList::skip_to().
Definition at line 691 of file api_backend.cc.
References get_database(), Xapian::Enquire::get_mset(), Xapian::Query::OP_AND_MAYBE, Xapian::Query::OP_NEAR, and Xapian::Enquire::set_query().
| DEFINE_TESTCASE | ( | failedreplace2 | , | |
| brass||chert|| | flint | |||
| ) |
Definition at line 669 of file api_backend.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Document::add_term(), Xapian::Document::add_value(), Xapian::WritableDatabase::commit(), Xapian::Database::get_doccount(), Xapian::Database::get_termfreq(), get_writable_database(), Xapian::WritableDatabase::replace_document(), Xapian::Document::set_data(), TEST_EQUAL, and TEST_EXCEPTION.
| DEFINE_TESTCASE | ( | failedreplace1 | , | |
| brass||chert|| | flint | |||
| ) |
Regression test for bug fixed in 1.2.1 and 1.0.21.
We failed to mark the Btree as unmodified after cancel().
Definition at line 653 of file api_backend.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Document::add_term(), Xapian::WritableDatabase::commit(), Xapian::Database::get_doccount(), Xapian::Database::get_termfreq(), get_writable_database(), Xapian::WritableDatabase::replace_document(), TEST_EQUAL, and TEST_EXCEPTION.
| DEFINE_TESTCASE | ( | orcheck1 | , | |
| generated | ||||
| ) |
Regression test for bugs in the check() method of OrPostList.
(ticket #485) Bugs introduced and fixed between 1.2.0 and 1.2.1 (never in a release).
Definition at line 608 of file api_backend.cc.
References get_database(), Xapian::Database::get_doccount(), Xapian::Enquire::get_mset(), make_orcheck_db(), mset_expect_order(), Xapian::Query::OP_AND, Xapian::Query::OP_OR, Xapian::Query::OP_VALUE_RANGE, Xapian::Enquire::set_query(), and tout.
| DEFINE_TESTCASE | ( | ordecay2 | , | |
| generated | ||||
| ) |
Regression test for bug in decay of OR to AND_MAYBE, fixed in 1.2.1 and 1.0.21.
Definition at line 548 of file api_backend.cc.
References get_database(), Xapian::Database::get_doccount(), Xapian::Enquire::get_mset(), make_ordecay_db(), mset_range_is_same(), Xapian::Query::OP_AND, Xapian::Query::OP_OR, Xapian::Enquire::set_query(), Xapian::MSet::size(), and TEST.
| DEFINE_TESTCASE | ( | ordecay1 | , | |
| generated | ||||
| ) |
Regression test for bug in decay of OR to AND, fixed in 1.2.1 and 1.0.21.
Definition at line 530 of file api_backend.cc.
References get_database(), Xapian::Database::get_doccount(), Xapian::Enquire::get_mset(), make_ordecay_db(), mset_range_is_same(), Xapian::Query::OP_OR, Xapian::Enquire::set_query(), Xapian::MSet::size(), and TEST.
| DEFINE_TESTCASE | ( | xordecay1 | , | |
| generated | ||||
| ) |
Regression test for bug in decay of XOR, fixed in 1.2.1 and 1.0.21.
Definition at line 497 of file api_backend.cc.
References get_database(), Xapian::Database::get_doccount(), Xapian::Enquire::get_mset(), make_xordecay1_db(), mset_range_is_same(), Xapian::Query::OP_OR, Xapian::Query::OP_XOR, Xapian::Enquire::set_query(), Xapian::MSet::size(), and TEST.
| DEFINE_TESTCASE | ( | msize2 | , | |
| generated | ||||
| ) |
Regression test for bug related to ticket#464, fixed in 1.1.6 and 1.0.20.
Definition at line 450 of file api_backend.cc.
References get_database(), Xapian::MSet::get_matches_estimated(), Xapian::MSet::get_matches_lower_bound(), Xapian::MSet::get_matches_upper_bound(), Xapian::Enquire::get_mset(), make_msize2_db(), Xapian::Enquire::set_collapse_key(), Xapian::Enquire::set_query(), Xapian::Enquire::set_sort_by_value(), and TEST_EQUAL.
| DEFINE_TESTCASE | ( | msize1 | , | |
| generated | ||||
| ) |
Regression test for ticket#464, fixed in 1.1.6 and 1.0.20.
Definition at line 400 of file api_backend.cc.
References get_database(), Xapian::MSet::get_matches_estimated(), Xapian::MSet::get_matches_lower_bound(), Xapian::MSet::get_matches_upper_bound(), Xapian::Enquire::get_mset(), make_msize1_db(), Xapian::Enquire::set_collapse_key(), Xapian::Enquire::set_query(), Xapian::Enquire::set_sort_by_value(), and TEST_EQUAL.
| DEFINE_TESTCASE | ( | qpmemoryleak1 | , | |
| writable &&! | inmemory | |||
| ) |
Regression test for bug#462 fixed in 1.0.19 and 1.1.5.
Definition at line 352 of file api_backend.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Document::add_term(), Xapian::WritableDatabase::commit(), Xapian::QueryParser::FLAG_PARTIAL, get_writable_database(), get_writable_database_as_database(), Xapian::QueryParser::parse_query(), Xapian::QueryParser::set_database(), Xapian::Internal::str(), and TEST_EXCEPTION.
| DEFINE_TESTCASE | ( | databasemodified1 | , | |
| writable &&!inmemory &&! | remote | |||
| ) |
Test coverage for DatabaseModifiedError.
Definition at line 309 of file api_backend.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Document::add_term(), Xapian::WritableDatabase::commit(), Xapian::Enquire::get_mset(), get_writable_database(), get_writable_database_as_database(), Xapian::Document::set_data(), Xapian::Enquire::set_query(), Xapian::Database::termlist_begin(), and TEST_EQUAL.
| DEFINE_TESTCASE | ( | replacedoc8 | , | |
| writable | ||||
| ) |
Check that replacing a document deleted since the last flush works.
Prior to 1.1.4/1.0.18, this failed to update the collection frequency and wdf, and caused an assertion failure when assertions were enabled.
Definition at line 285 of file api_backend.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Document::add_term(), Xapian::WritableDatabase::delete_document(), Xapian::WritableDatabase::flush(), Xapian::Database::get_collection_freq(), get_writable_database(), Xapian::Database::postlist_begin(), Xapian::Database::postlist_end(), Xapian::WritableDatabase::replace_document(), Xapian::Document::set_data(), TEST, and TEST_EQUAL.
| DEFINE_TESTCASE | ( | replacedoc7 | , | |
| writable &&!inmemory &&! | remote | |||
| ) |
Check that replacing an unmodified document doesn't increase the automatic flush counter.
Regression test for bug fixed in 1.1.4/1.0.18.
Definition at line 243 of file api_backend.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Document::add_posting(), Xapian::Document::add_term(), Xapian::Document::add_value(), Xapian::WritableDatabase::commit(), Xapian::WritableDatabase::flush(), Xapian::Database::get_doccount(), Xapian::Database::get_document(), get_writable_database(), get_writable_database_as_database(), Xapian::Database::reopen(), Xapian::WritableDatabase::replace_document(), Xapian::Document::set_data(), and TEST_EQUAL.
| DEFINE_TESTCASE | ( | matchdecider4 | , | |
| remote | ||||
| ) |
Test Xapian::MatchDecider with remote backend fails.
Definition at line 216 of file api_backend.cc.
References MyMatchDecider::called, get_database(), Xapian::Enquire::get_mset(), Xapian::Enquire::set_query(), TEST, and TEST_EXCEPTION.
| DEFINE_TESTCASE | ( | lockfilefd0or1 | , | |
| brass||chert|| | flint | |||
| ) |
Definition at line 162 of file api_backend.cc.
References get_writable_database(), get_writable_database_again(), and TEST_EXCEPTION.
| DEFINE_TESTCASE | ( | valuesaftercommit1 | , | |
| writable | ||||
| ) |
Definition at line 148 of file api_backend.cc.
References Xapian::Document::add_value(), Xapian::WritableDatabase::commit(), Xapian::Database::get_document(), Xapian::Document::get_value(), get_writable_database(), Xapian::WritableDatabase::replace_document(), and TEST_EQUAL.
| DEFINE_TESTCASE | ( | doclenaftercommit1 | , | |
| writable | ||||
| ) |
Regression test for chert bug fixed in 1.1.3 (ticket#397).
Definition at line 139 of file api_backend.cc.
References Xapian::WritableDatabase::commit(), Xapian::Database::get_doclength(), get_writable_database(), Xapian::WritableDatabase::replace_document(), TEST_EQUAL, and TEST_EXCEPTION.
| DEFINE_TESTCASE | ( | modifiedpostlist1 | , | |
| writable | ||||
| ) |
Regression test for bug#392 in ModifiedPostList iteration, fixed in 1.0.15.
Definition at line 120 of file api_backend.cc.
References Xapian::Document::add_term(), Xapian::WritableDatabase::commit(), Xapian::Enquire::get_mset(), get_writable_database(), mset_expect_order(), Xapian::WritableDatabase::replace_document(), and Xapian::Enquire::set_query().
| DEFINE_TESTCASE | ( | alldocspl3 | , | |
| backend | ||||
| ) |
Check handling of alldocs on an empty database.
Definition at line 109 of file api_backend.cc.
References Xapian::Database::get_collection_freq(), get_database(), Xapian::Database::get_termfreq(), Xapian::Database::postlist_begin(), Xapian::Database::postlist_end(), TEST, and TEST_EQUAL.
| DEFINE_TESTCASE | ( | dbstats1 | , | |
| backend | ||||
| ) |
Definition at line 83 of file api_backend.cc.
References get_database(), get_dbtype(), Xapian::Database::get_doclength_lower_bound(), Xapian::Database::get_doclength_upper_bound(), Xapian::Database::get_wdf_upper_bound(), TEST_EQUAL, and TEST_REL.
| DEFINE_TESTCASE | ( | totaldoclen1 | , | |
| writable | ||||
| ) |
Check that the backend handles total document length > 0xffffffff.
Definition at line 66 of file api_backend.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Document::add_posting(), Xapian::WritableDatabase::commit(), Xapian::Database::get_avlength(), get_dbtype(), get_writable_database(), get_writable_database_as_database(), and TEST_EQUAL.
| DEFINE_TESTCASE | ( | lockfileumask1 | , | |
| brass||chert|| | flint | |||
| ) |
Regression test - lockfile should honour umask, was only user-readable.
Definition at line 42 of file api_backend.cc.
References get_named_writable_database(), get_named_writable_database_path(), stat(), TEST, and TEST_EQUAL.
| static void make_msize1_db | ( | Xapian::WritableDatabase & | db, | |
| const string & | ||||
| ) | [static] |
Definition at line 382 of file api_backend.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Document::add_term(), and Xapian::Document::add_value().
Referenced by DEFINE_TESTCASE().
| static void make_msize2_db | ( | Xapian::WritableDatabase & | db, | |
| const string & | ||||
| ) | [static] |
Definition at line 434 of file api_backend.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Document::add_term(), and Xapian::Document::add_value().
Referenced by DEFINE_TESTCASE().
| static void make_orcheck_db | ( | Xapian::WritableDatabase & | db, | |
| const string & | ||||
| ) | [static] |
Definition at line 570 of file api_backend.cc.
References Xapian::Database::get_document(), and Xapian::WritableDatabase::replace_document().
Referenced by DEFINE_TESTCASE().
| static void make_ordecay_db | ( | Xapian::WritableDatabase & | db, | |
| const string & | ||||
| ) | [static] |
Definition at line 513 of file api_backend.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Document::add_term(), and Xapian::Internal::str().
Referenced by DEFINE_TESTCASE().
| static void make_xordecay1_db | ( | Xapian::WritableDatabase & | db, | |
| const string & | ||||
| ) | [static] |
Definition at line 484 of file api_backend.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Document::add_term(), and Xapian::Internal::str().
Referenced by DEFINE_TESTCASE().