xapian-core
1.4.27
|
tests which need a backend More...
#include <config.h>
#include "api_db.h"
#include <algorithm>
#include <fstream>
#include <map>
#include <string>
#include <vector>
#include "safenetdb.h"
#include "safesysstat.h"
#include "safeunistd.h"
#include <xapian.h>
#include "backendmanager.h"
#include "testsuite.h"
#include "testutils.h"
#include "unixcmds.h"
#include "apitest.h"
Go to the source code of this file.
Classes | |
class | GrepMatchDecider |
class | MyWeight |
Macros | |
#define | EXPECTED_EXCEPTION Xapian::DatabaseOpeningError |
Functions | |
static Xapian::Query | query (const string &t) |
DEFINE_TESTCASE (termstats, backend) | |
DEFINE_TESTCASE (stubdb1, check &&path) | |
DEFINE_TESTCASE (stubdb2, path) | |
DEFINE_TESTCASE (stubdb3, path) | |
DEFINE_TESTCASE (stubdb4, !backend) | |
DEFINE_TESTCASE (stubdb5, path) | |
DEFINE_TESTCASE (stubdb6, inmemory) | |
DEFINE_TESTCASE (stubdb8, inmemory) | |
Test error running Database::check() on a stub database. More... | |
DEFINE_TESTCASE (matchdecider1, backend &&!remote) | |
DEFINE_TESTCASE (matchdecider2, backend &&!remote) | |
DEFINE_TESTCASE (matchdecider3, backend &&!remote) | |
DEFINE_TESTCASE (msetiterator1, backend) | |
DEFINE_TESTCASE (msetiterator2, backend) | |
DEFINE_TESTCASE (msetiterator3, backend) | |
DEFINE_TESTCASE (esetiterator1, backend) | |
DEFINE_TESTCASE (esetiterator2, backend) | |
DEFINE_TESTCASE (collapsekey1, backend) | |
DEFINE_TESTCASE (collapsekey2, backend) | |
DEFINE_TESTCASE (collapsekey3, backend) | |
DEFINE_TESTCASE (collapsekey4, backend) | |
DEFINE_TESTCASE (keepalive1, remote) | |
DEFINE_TESTCASE (allterms1, backend) | |
DEFINE_TESTCASE (allterms2, backend) | |
DEFINE_TESTCASE (allterms3, backend) | |
DEFINE_TESTCASE (allterms4, backend) | |
DEFINE_TESTCASE (allterms5, backend) | |
DEFINE_TESTCASE (allterms6, backend) | |
DEFINE_TESTCASE (specialterms1, backend) | |
DEFINE_TESTCASE (specialterms2, backend) | |
DEFINE_TESTCASE (rsetmultidb2, backend &&!multi) | |
DEFINE_TESTCASE (multiexpand1, backend &&!multi) | |
DEFINE_TESTCASE (postlist1, backend) | |
DEFINE_TESTCASE (postlist2, backend) | |
DEFINE_TESTCASE (postlist3, backend) | |
DEFINE_TESTCASE (postlist4, backend) | |
DEFINE_TESTCASE (postlist5, backend) | |
DEFINE_TESTCASE (postlist6, backend) | |
DEFINE_TESTCASE (collfreq1, backend) | |
DEFINE_TESTCASE (sortvalue1, backend) | |
DEFINE_TESTCASE (consistency1, backend &&!remote) | |
DEFINE_TESTCASE (chertdatabasenotfounderror1, chert) | |
DEFINE_TESTCASE (glassdatabasenotfounderror1, glass) | |
DEFINE_TESTCASE (databasenotfounderror2, !backend) | |
DEFINE_TESTCASE (chertdatabaseopen1, chert) | |
Test opening of a chert database. More... | |
DEFINE_TESTCASE (sortrel1, backend) | |
static void | make_netstats1_db (Xapian::WritableDatabase &db, const string &) |
DEFINE_TESTCASE (netstats1, backend) | |
DEFINE_TESTCASE (userweight1, backend &&!remote) | |
DEFINE_TESTCASE (matchall1, backend) | |
DEFINE_TESTCASE (valuesetmatchdecider2, backend &&!remote) | |
tests which need a backend
Definition in file api_db.cc.
#define EXPECTED_EXCEPTION Xapian::DatabaseOpeningError |
Referenced by DEFINE_TESTCASE().
DEFINE_TESTCASE | ( | termstats | , |
backend | |||
) |
Definition at line 59 of file api_db.cc.
References get_database(), Xapian::Database::get_termfreq(), Xapian::Database::term_exists(), TEST, and TEST_EQUAL.
Referenced by DEFINE_TESTCASE().
DEFINE_TESTCASE | ( | stubdb1 | , |
check && | path | ||
) |
Definition at line 71 of file api_db.cc.
References Xapian::Database::check(), Xapian::DB_BACKEND_STUB, get_database_path(), Xapian::Enquire::get_mset(), Xapian::Enquire::set_query(), TEST, and TEST_EQUAL.
DEFINE_TESTCASE | ( | stubdb2 | , |
path | |||
) |
Definition at line 96 of file api_db.cc.
References Xapian::DB_BACKEND_STUB, EXPECTED_EXCEPTION, get_database_path(), Xapian::Enquire::get_mset(), Xapian::Error::get_msg(), BackendManager::get_xapian_progsrv_command(), Xapian::Enquire::set_query(), TEST, and TEST_EXCEPTION.
DEFINE_TESTCASE | ( | stubdb3 | , |
path | |||
) |
Definition at line 223 of file api_db.cc.
References Xapian::DB_BACKEND_STUB, get_database_path(), TEST, and TEST_EXCEPTION.
DEFINE_TESTCASE | ( | stubdb4 | , |
! | backend | ||
) |
Definition at line 240 of file api_db.cc.
References Xapian::DB_BACKEND_STUB, TEST, and TEST_EXCEPTION.
DEFINE_TESTCASE | ( | stubdb5 | , |
path | |||
) |
Definition at line 257 of file api_db.cc.
References Xapian::DB_BACKEND_STUB, get_database_path(), TEST, and TEST_EXCEPTION.
DEFINE_TESTCASE | ( | stubdb6 | , |
inmemory | |||
) |
Definition at line 274 of file api_db.cc.
References Xapian::WritableDatabase::add_document(), Xapian::DB_BACKEND_STUB, Xapian::DB_OPEN, Xapian::MSet::empty(), Xapian::Database::get_doccount(), TEST, and TEST_EQUAL.
DEFINE_TESTCASE | ( | stubdb8 | , |
inmemory | |||
) |
Test error running Database::check() on a stub database.
Definition at line 320 of file api_db.cc.
References Xapian::Database::add_database(), Xapian::Database::check(), DEFINE_TESTCASE(), FAIL_TEST, get_database(), Xapian::Error::get_description(), Xapian::Enquire::get_mset(), Xapian::Error::get_msg(), mset_expect_order(), Xapian::Query::OP_OR, query(), Xapian::Enquire::set_query(), Xapian::Enquire::set_weighting_scheme(), RealTime::sleep(), TEST, TEST_EQUAL, TEST_STRINGS_EQUAL, and tout.
DEFINE_TESTCASE | ( | matchdecider1 | , |
backend &&! | remote | ||
) |
Definition at line 490 of file api_db.cc.
References Xapian::BAD_VALUENO, Xapian::MSet::begin(), Xapian::MSet::end(), get_database(), Xapian::Database::get_document(), Xapian::Database::get_lastdocid(), Xapian::MSet::get_matches_estimated(), Xapian::MSet::get_matches_lower_bound(), Xapian::MSet::get_matches_upper_bound(), Xapian::Enquire::get_mset(), Xapian::MSet::get_uncollapsed_matches_estimated(), Xapian::MSet::get_uncollapsed_matches_lower_bound(), Xapian::MSet::get_uncollapsed_matches_upper_bound(), Xapian::Enquire::set_collapse_key(), Xapian::Enquire::set_cutoff(), Xapian::Enquire::set_query(), Xapian::MSet::size(), TEST, TEST_EQUAL, and TEST_REL.
DEFINE_TESTCASE | ( | matchdecider2 | , |
backend &&! | remote | ||
) |
Definition at line 617 of file api_db.cc.
References Xapian::MSet::begin(), Xapian::MSet::end(), get_database(), Xapian::Database::get_document(), Xapian::Database::get_lastdocid(), Xapian::Enquire::get_mset(), Xapian::Enquire::set_query(), Xapian::MSet::size(), TEST, and TEST_EQUAL.
DEFINE_TESTCASE | ( | matchdecider3 | , |
backend &&! | remote | ||
) |
Definition at line 648 of file api_db.cc.
References get_database(), Xapian::Database::get_doccount(), Xapian::MSet::get_matches_estimated(), Xapian::MSet::get_matches_lower_bound(), Xapian::MSet::get_matches_upper_bound(), Xapian::Enquire::get_mset(), Xapian::MSet::get_uncollapsed_matches_estimated(), Xapian::MSet::get_uncollapsed_matches_lower_bound(), Xapian::MSet::get_uncollapsed_matches_upper_bound(), Xapian::Enquire::set_collapse_key(), Xapian::Enquire::set_query(), Xapian::Enquire::set_sort_by_value(), Xapian::MSet::size(), TEST_EQUAL, and TEST_REL.
DEFINE_TESTCASE | ( | msetiterator1 | , |
backend | |||
) |
Definition at line 689 of file api_db.cc.
References Xapian::MSet::begin(), Xapian::MSet::end(), get_database(), Xapian::Enquire::get_mset(), Xapian::Enquire::set_query(), TEST_EQUAL, and TEST_NOT_EQUAL.
DEFINE_TESTCASE | ( | msetiterator2 | , |
backend | |||
) |
Definition at line 732 of file api_db.cc.
References Xapian::MSet::begin(), Xapian::MSet::end(), get_database(), Xapian::Enquire::get_mset(), Xapian::Enquire::set_query(), and TEST_EQUAL.
DEFINE_TESTCASE | ( | msetiterator3 | , |
backend | |||
) |
Definition at line 750 of file api_db.cc.
References Xapian::MSet::begin(), Xapian::MSet::empty(), get_database(), Xapian::MSetIterator::get_document(), Xapian::Enquire::get_mset(), Xapian::Enquire::set_query(), and TEST.
DEFINE_TESTCASE | ( | esetiterator1 | , |
backend | |||
) |
Definition at line 763 of file api_db.cc.
References Xapian::ESet::begin(), Xapian::MSet::begin(), Xapian::ESet::end(), get_database(), Xapian::Enquire::get_eset(), Xapian::Enquire::get_mset(), Xapian::Enquire::set_query(), Xapian::MSet::size(), TEST, TEST_EQUAL, and TEST_NOT_EQUAL.
DEFINE_TESTCASE | ( | esetiterator2 | , |
backend | |||
) |
Definition at line 810 of file api_db.cc.
References Xapian::ESet::begin(), Xapian::MSet::begin(), Xapian::ESet::end(), get_database(), Xapian::Enquire::get_eset(), Xapian::Enquire::get_mset(), Xapian::Enquire::set_query(), Xapian::MSet::size(), TEST, and TEST_EQUAL.
DEFINE_TESTCASE | ( | collapsekey1 | , |
backend | |||
) |
Definition at line 836 of file api_db.cc.
References Xapian::MSet::begin(), Xapian::MSet::end(), get_database(), Xapian::MSetIterator::get_document(), Xapian::Enquire::get_mset(), Xapian::Document::get_value(), Xapian::Enquire::set_collapse_key(), Xapian::Enquire::set_query(), Xapian::MSet::size(), TEST, and TEST_AND_EXPLAIN.
DEFINE_TESTCASE | ( | collapsekey2 | , |
backend | |||
) |
Definition at line 862 of file api_db.cc.
References get_database(), Xapian::MSet::get_matches_lower_bound(), Xapian::MSet::get_matches_upper_bound(), Xapian::Enquire::get_mset(), Xapian::Enquire::set_collapse_key(), Xapian::Enquire::set_query(), SKIP_TEST, TEST_EQUAL, and TEST_REL.
DEFINE_TESTCASE | ( | collapsekey3 | , |
backend | |||
) |
Definition at line 886 of file api_db.cc.
References Xapian::MSet::begin(), Xapian::MSet::end(), get_database(), Xapian::MSetIterator::get_document(), Xapian::MSet::get_matches_lower_bound(), Xapian::MSet::get_matches_upper_bound(), Xapian::Enquire::get_mset(), Xapian::Document::get_value(), Xapian::Enquire::set_collapse_key(), Xapian::Enquire::set_query(), TEST, TEST_AND_EXPLAIN, and TEST_EQUAL.
DEFINE_TESTCASE | ( | collapsekey4 | , |
backend | |||
) |
Definition at line 935 of file api_db.cc.
References Xapian::MSet::begin(), Xapian::MSet::end(), get_database(), Xapian::MSetIterator::get_document(), Xapian::MSet::get_matches_lower_bound(), Xapian::MSet::get_matches_upper_bound(), Xapian::Enquire::get_mset(), Xapian::Document::get_value(), Xapian::Enquire::set_collapse_key(), Xapian::Enquire::set_query(), TEST, and TEST_AND_EXPLAIN.
DEFINE_TESTCASE | ( | keepalive1 | , |
remote | |||
) |
Definition at line 961 of file api_db.cc.
References Xapian::Enquire::get_mset(), get_remote_database(), Xapian::Database::keep_alive(), Xapian::Enquire::set_query(), RealTime::sleep(), and TEST_EXCEPTION_BASE_CLASS.
DEFINE_TESTCASE | ( | allterms1 | , |
backend | |||
) |
Definition at line 984 of file api_db.cc.
References Xapian::Database::allterms_begin(), Xapian::Database::allterms_end(), get_database(), Xapian::TermIterator::get_termfreq(), TEST, TEST_EQUAL, tout, and verbose.
DEFINE_TESTCASE | ( | allterms2 | , |
backend | |||
) |
Definition at line 1030 of file api_db.cc.
References Xapian::Database::add_database(), Xapian::Database::allterms_begin(), Xapian::Database::allterms_end(), get_database(), Xapian::TermIterator::get_termfreq(), and TEST.
DEFINE_TESTCASE | ( | allterms3 | , |
backend | |||
) |
Definition at line 1070 of file api_db.cc.
References Xapian::Database::add_database(), Xapian::Database::allterms_begin(), Xapian::Database::allterms_end(), get_database(), Xapian::TermIterator::skip_to(), and TEST.
DEFINE_TESTCASE | ( | allterms4 | , |
backend | |||
) |
Definition at line 1081 of file api_db.cc.
References Xapian::Database::allterms_begin(), Xapian::Database::allterms_end(), get_database(), Xapian::TermIterator::get_termfreq(), and TEST.
DEFINE_TESTCASE | ( | allterms5 | , |
backend | |||
) |
Definition at line 1096 of file api_db.cc.
References Xapian::Database::add_database(), Xapian::Database::allterms_begin(), Xapian::Database::allterms_end(), get_database(), Xapian::TermIterator::skip_to(), TEST, and TEST_EQUAL.
DEFINE_TESTCASE | ( | allterms6 | , |
backend | |||
) |
Definition at line 1106 of file api_db.cc.
References Xapian::Database::add_database(), Xapian::Database::allterms_begin(), Xapian::Database::allterms_end(), get_database(), Xapian::TermIterator::skip_to(), TEST, and TEST_EQUAL.
DEFINE_TESTCASE | ( | specialterms1 | , |
backend | |||
) |
Definition at line 1150 of file api_db.cc.
References Xapian::MSet::begin(), Xapian::MSet::end(), get_database(), Xapian::MSetIterator::get_document(), Xapian::Enquire::get_mset(), Xapian::Document::get_value(), Xapian::Enquire::set_query(), stemmer, TEST, TEST_EQUAL, TEST_MSET_SIZE, and TEST_NOT_EQUAL.
DEFINE_TESTCASE | ( | specialterms2 | , |
backend | |||
) |
Definition at line 1186 of file api_db.cc.
References Xapian::Database::allterms_begin(), Xapian::Database::allterms_end(), get_database(), Xapian::TermIterator::skip_to(), TEST_EQUAL, and TEST_NOT_EQUAL.
DEFINE_TESTCASE | ( | rsetmultidb2 | , |
backend &&! | multi | ||
) |
Definition at line 1212 of file api_db.cc.
References Xapian::Database::add_database(), Xapian::RSet::add_document(), get_database(), Xapian::Enquire::get_mset(), mset_expect_order(), mset_range_is_same_weights(), query(), Xapian::Enquire::set_query(), TEST, and TEST_NOT_EQUAL.
DEFINE_TESTCASE | ( | multiexpand1 | , |
backend &&! | multi | ||
) |
Definition at line 1247 of file api_db.cc.
References Xapian::Database::add_database(), Xapian::RSet::add_document(), Xapian::ESet::begin(), Xapian::ESet::end(), get_database(), Xapian::Enquire::get_eset(), Xapian::ESetIterator::get_weight(), Xapian::ESet::size(), TEST, TEST_EQUAL, and Xapian::Enquire::USE_EXACT_TERMFREQ.
DEFINE_TESTCASE | ( | postlist1 | , |
backend | |||
) |
Definition at line 1302 of file api_db.cc.
References get_database(), Xapian::Database::postlist_begin(), Xapian::Database::postlist_end(), TEST_EQUAL, and TEST_NOT_EQUAL.
DEFINE_TESTCASE | ( | postlist2 | , |
backend | |||
) |
Definition at line 1318 of file api_db.cc.
References get_database(), Xapian::PostingIterator::get_description(), Xapian::Database::postlist_begin(), Xapian::Database::postlist_end(), TEST, TEST_EQUAL, TEST_NOT_EQUAL, and TEST_STRINGS_EQUAL.
DEFINE_TESTCASE | ( | postlist3 | , |
backend | |||
) |
Definition at line 1355 of file api_db.cc.
References get_database(), Xapian::Database::postlist_begin(), Xapian::Database::postlist_end(), and TEST_EQUAL.
DEFINE_TESTCASE | ( | postlist4 | , |
backend | |||
) |
Definition at line 1374 of file api_db.cc.
References get_database(), Xapian::Database::postlist_begin(), Xapian::Database::postlist_end(), Xapian::PostingIterator::skip_to(), and TEST.
DEFINE_TESTCASE | ( | postlist5 | , |
backend | |||
) |
Definition at line 1383 of file api_db.cc.
References Xapian::Database::get_avlength(), get_database(), Xapian::Database::postlist_begin(), Xapian::Database::postlist_end(), TEST_EQUAL, and TEST_EQUAL_DOUBLE.
DEFINE_TESTCASE | ( | postlist6 | , |
backend | |||
) |
Definition at line 1397 of file api_db.cc.
References get_database(), Xapian::PostingIterator::get_doclength(), Xapian::Database::get_doclength(), Xapian::PostingIterator::get_unique_terms(), Xapian::Database::get_unique_terms(), Xapian::PostingIterator::get_wdf(), Xapian::Database::postlist_begin(), Xapian::Database::postlist_end(), TEST, TEST_EQUAL, and TEST_REL.
DEFINE_TESTCASE | ( | collfreq1 | , |
backend | |||
) |
Definition at line 1415 of file api_db.cc.
References Xapian::Database::add_database(), Xapian::Database::get_collection_freq(), get_database(), and TEST_EQUAL.
DEFINE_TESTCASE | ( | sortvalue1 | , |
backend | |||
) |
Definition at line 1438 of file api_db.cc.
References Xapian::MSet::begin(), Xapian::Enquire::DESCENDING, Xapian::MSet::end(), FAIL_TEST, get_database(), Xapian::Enquire::get_mset(), Xapian::Enquire::set_docid_order(), Xapian::Enquire::set_query(), Xapian::Enquire::set_sort_by_value(), Xapian::MSet::size(), TEST, TEST_EQUAL, and tout.
DEFINE_TESTCASE | ( | consistency1 | , |
backend &&! | remote | ||
) |
Definition at line 1482 of file api_db.cc.
References get_database(), Xapian::Enquire::get_mset(), Xapian::Query::OP_OR, Xapian::Enquire::set_query(), Xapian::MSet::size(), SKIP_TEST, TEST, TEST_EQUAL, and TEST_EQUAL_DOUBLE.
DEFINE_TESTCASE | ( | chertdatabasenotfounderror1 | , |
chert | |||
) |
Definition at line 1515 of file api_db.cc.
References Xapian::DB_BACKEND_CHERT, Xapian::DB_CREATE, Xapian::DB_CREATE_OR_OPEN, Xapian::DB_CREATE_OR_OVERWRITE, Xapian::DB_OPEN, TEST_EXCEPTION, and touch().
DEFINE_TESTCASE | ( | glassdatabasenotfounderror1 | , |
glass | |||
) |
Definition at line 1553 of file api_db.cc.
References Xapian::DB_BACKEND_GLASS, Xapian::DB_CREATE, Xapian::DB_CREATE_OR_OPEN, Xapian::DB_CREATE_OR_OVERWRITE, Xapian::DB_OPEN, TEST_EXCEPTION, and touch().
DEFINE_TESTCASE | ( | databasenotfounderror2 | , |
! | backend | ||
) |
Definition at line 1590 of file api_db.cc.
References Xapian::DB_OPEN, and TEST_EXCEPTION.
DEFINE_TESTCASE | ( | chertdatabaseopen1 | , |
chert | |||
) |
Test opening of a chert database.
Definition at line 1608 of file api_db.cc.
References Xapian::DB_BACKEND_CHERT, Xapian::DB_CREATE, Xapian::DB_CREATE_OR_OPEN, Xapian::DB_CREATE_OR_OVERWRITE, Xapian::DB_OPEN, rm_rf(), and TEST_EXCEPTION.
DEFINE_TESTCASE | ( | sortrel1 | , |
backend | |||
) |
Definition at line 1673 of file api_db.cc.
References Xapian::Enquire::ASCENDING, Xapian::Enquire::DESCENDING, get_database(), Xapian::Enquire::get_mset(), Xapian::Enquire::set_docid_order(), Xapian::Enquire::set_query(), Xapian::Enquire::set_sort_by_relevance_then_value(), Xapian::Enquire::set_sort_by_value(), Xapian::Enquire::set_sort_by_value_then_relevance(), Xapian::MSet::size(), and TEST_EQUAL.
DEFINE_TESTCASE | ( | netstats1 | , |
backend | |||
) |
Definition at line 1843 of file api_db.cc.
References Xapian::RSet::add_document(), get_database(), Xapian::MSet::get_matches_estimated(), Xapian::MSet::get_matches_lower_bound(), Xapian::MSet::get_matches_upper_bound(), Xapian::MSet::get_max_attained(), Xapian::Enquire::get_mset(), make_netstats1_db(), mset_range_is_same(), Xapian::Query::OP_OR, query(), Xapian::Enquire::set_query(), Xapian::MSet::size(), TEST, TEST_EQUAL, and TEST_EQUAL_DOUBLE.
DEFINE_TESTCASE | ( | userweight1 | , |
backend &&! | remote | ||
) |
Definition at line 1913 of file api_db.cc.
References Xapian::MSet::begin(), Xapian::MSet::end(), get_database(), Xapian::Enquire::get_matching_terms_begin(), Xapian::Enquire::get_matching_terms_end(), Xapian::Enquire::get_mset(), Xapian::Query::OP_OR, query(), Xapian::Enquire::set_query(), Xapian::Enquire::set_weighting_scheme(), and TEST_EQUAL.
DEFINE_TESTCASE | ( | matchall1 | , |
backend | |||
) |
Definition at line 1939 of file api_db.cc.
References get_database(), Xapian::Database::get_doccount(), Xapian::MSet::get_matches_lower_bound(), Xapian::Enquire::get_mset(), Xapian::MSet::get_uncollapsed_matches_lower_bound(), Xapian::Query::MatchAll, Xapian::Query::OP_OR, Xapian::Enquire::set_query(), Xapian::MSet::size(), TEST, and TEST_EQUAL.
DEFINE_TESTCASE | ( | valuesetmatchdecider2 | , |
backend &&! | remote | ||
) |
Definition at line 1962 of file api_db.cc.
References Xapian::ValueSetMatchDecider::add_value(), get_database(), Xapian::Enquire::get_mset(), mset_expect_order(), and Xapian::Enquire::set_query().
|
static |
Definition at line 1797 of file api_db.cc.
References Xapian::WritableDatabase::commit(), Xapian::TermGenerator::index_text(), Xapian::WritableDatabase::replace_document(), Xapian::TermGenerator::set_document(), Xapian::TermGenerator::set_stemmer(), Xapian::TermGenerator::set_stemming_strategy(), and Xapian::TermGenerator::STEM_ALL.
Referenced by DEFINE_TESTCASE().
|
static |
Definition at line 50 of file api_db.cc.
Referenced by DEFINE_TESTCASE().