tests/api_wrdb.cc File Reference

#include <config.h>
#include "api_wrdb.h"
#include <xapian.h>
#include "backendmanager.h"
#include "omtime.h"
#include "testsuite.h"
#include "testutils.h"
#include "utils.h"
#include "unixcmds.h"
#include "apitest.h"
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <list>
#include <map>
#include <string>

Include dependency graph for api_wrdb.cc:

Go to the source code of this file.

Functions

 DEFINE_TESTCASE (adddoc1, writable)
 DEFINE_TESTCASE (adddoc2, writable)
 DEFINE_TESTCASE (adddoc3, writable)
 DEFINE_TESTCASE (adddoc4, writable)
 DEFINE_TESTCASE (adddoc5, writable)
 DEFINE_TESTCASE (adddoc6, writable)
 DEFINE_TESTCASE (implicitendsession1, writable)
 DEFINE_TESTCASE (databaseassign1, writable)
 DEFINE_TESTCASE (deldoc1, writable)
 DEFINE_TESTCASE (deldoc2, writable)
 DEFINE_TESTCASE (deldoc3, writable)
 DEFINE_TESTCASE (deldoc4, writable)
 DEFINE_TESTCASE (deldoc5, writable)
 DEFINE_TESTCASE (deldoc6, writable)
 DEFINE_TESTCASE (replacedoc1, writable)
 DEFINE_TESTCASE (replacedoc2, writable)
 DEFINE_TESTCASE (replacedoc3, writable)
 DEFINE_TESTCASE (replacedoc4, writable)
 DEFINE_TESTCASE (replacedoc5, writable)
 DEFINE_TESTCASE (replacedoc6, writable)
 DEFINE_TESTCASE (uniqueterm1, writable)
 DEFINE_TESTCASE (allpostlist2, writable)
static void test_emptyterm2_helper (Xapian::WritableDatabase &db)
 DEFINE_TESTCASE (emptyterm2, writable)
 DEFINE_TESTCASE (phraseorneartoand1, writable)
 DEFINE_TESTCASE (longpositionlist1, writable)
bool test_consistency2 ()
 DEFINE_TESTCASE (crashrecovery1, writable)
 DEFINE_TESTCASE (nomoredocids1, writable)
 DEFINE_TESTCASE (synonymitor1, writable)
 DEFINE_TESTCASE (metadata1, writable)
 DEFINE_TESTCASE (metadata2, metadata)
 DEFINE_TESTCASE (metadata3, metadata)
 DEFINE_TESTCASE (metadata4, metadata)
 DEFINE_TESTCASE (termtoolong1, writable)
 DEFINE_TESTCASE (postlist7, writable)
 Test playing with a postlist.
 DEFINE_TESTCASE (writeread1, writable &&metadata)
 Regression test of reading after writing but not flushing.
 DEFINE_TESTCASE (lazytablebug1, writable &&flint)
static double bigoaddvalue_helper (size_t num_values)
 DEFINE_TESTCASE (bigoaddvalue, writable)
 DEFINE_TESTCASE (cursordelbug1, flint)
 Regression test for bug #287 for flint.


Function Documentation

DEFINE_TESTCASE ( adddoc1  ,
writable   
)

Definition at line 55 of file api_wrdb.cc.

References Xapian::WritableDatabase::add_document(), Xapian::Document::add_posting(), Xapian::Enquire::get_mset(), get_writable_database(), mset_expect_order(), query(), Xapian::Document::set_data(), and Xapian::Enquire::set_query().

DEFINE_TESTCASE ( adddoc2  ,
writable   
)

Definition at line 100 of file api_wrdb.cc.

References Xapian::WritableDatabase::add_document(), Xapian::Document::add_posting(), Xapian::Document::add_term(), Xapian::Database::get_document(), Xapian::TermIterator::get_termfreq(), Xapian::TermIterator::get_wdf(), get_writable_database(), Xapian::TermIterator::positionlist_begin(), Xapian::TermIterator::positionlist_end(), Xapian::Document::remove_posting(), Xapian::Document::remove_term(), Xapian::Document::termlist_begin(), Xapian::Document::termlist_end(), TEST, and TEST_EQUAL.

DEFINE_TESTCASE ( adddoc3  ,
writable   
)

Definition at line 275 of file api_wrdb.cc.

References Xapian::WritableDatabase::add_document(), and get_writable_database().

DEFINE_TESTCASE ( adddoc4  ,
writable   
)

Definition at line 293 of file api_wrdb.cc.

References Xapian::WritableDatabase::add_document(), Xapian::WritableDatabase::flush(), Xapian::Database::get_document(), get_writable_database(), Xapian::Document::termlist_begin(), TEST, and TEST_EQUAL.

DEFINE_TESTCASE ( adddoc5  ,
writable   
)

Definition at line 323 of file api_wrdb.cc.

References Xapian::WritableDatabase::add_document(), Xapian::Document::add_posting(), Xapian::Document::add_value(), Xapian::WritableDatabase::delete_document(), Xapian::Database::get_avlength(), Xapian::Database::get_collection_freq(), Xapian::Document::get_data(), Xapian::Database::get_doccount(), Xapian::Database::get_document(), Xapian::Database::get_termfreq(), get_writable_database(), get_writable_database_as_database(), Xapian::Document::set_data(), SKIP_TEST_FOR_BACKEND, Xapian::Document::termlist_begin(), Xapian::Document::termlist_end(), TEST_EQUAL, TEST_EXCEPTION, TEST_NOT_EQUAL, Xapian::Document::values_begin(), and Xapian::Document::values_end().

DEFINE_TESTCASE ( adddoc6  ,
writable   
)

Definition at line 455 of file api_wrdb.cc.

References Xapian::WritableDatabase::add_document(), Xapian::Document::add_posting(), Xapian::Document::add_value(), Xapian::WritableDatabase::delete_document(), Xapian::Database::get_avlength(), Xapian::Database::get_collection_freq(), Xapian::Database::get_doccount(), Xapian::Database::get_termfreq(), get_writable_database(), get_writable_database_again(), Xapian::Document::remove_term(), Xapian::WritableDatabase::replace_document(), Xapian::Document::set_data(), SKIP_TEST_FOR_BACKEND, and TEST_EQUAL.

DEFINE_TESTCASE ( implicitendsession1  ,
writable   
)

Definition at line 500 of file api_wrdb.cc.

References Xapian::WritableDatabase::add_document(), Xapian::Document::add_posting(), get_writable_database(), and Xapian::Document::set_data().

DEFINE_TESTCASE ( databaseassign1  ,
writable   
)

Definition at line 515 of file api_wrdb.cc.

References get_database(), and get_writable_database().

DEFINE_TESTCASE ( deldoc1  ,
writable   
)

Definition at line 531 of file api_wrdb.cc.

References Xapian::WritableDatabase::add_document(), Xapian::Document::add_posting(), Xapian::Document::add_term(), Xapian::WritableDatabase::delete_document(), Xapian::Database::get_document(), get_writable_database(), Xapian::Document::remove_term(), Xapian::WritableDatabase::replace_document(), Xapian::Document::termlist_begin(), Xapian::Document::termlist_end(), TEST_EQUAL, TEST_EXCEPTION, and TEST_NOT_EQUAL.

DEFINE_TESTCASE ( deldoc2  ,
writable   
)

Definition at line 578 of file api_wrdb.cc.

References Xapian::WritableDatabase::add_document(), Xapian::Document::add_posting(), Xapian::Database::allterms_begin(), Xapian::Database::allterms_end(), Xapian::WritableDatabase::delete_document(), Xapian::WritableDatabase::flush(), Xapian::Database::get_avlength(), Xapian::Database::get_collection_freq(), Xapian::Database::get_doccount(), Xapian::Database::get_doclength(), Xapian::Database::get_document(), Xapian::Database::get_termfreq(), get_writable_database(), Xapian::Database::postlist_begin(), Xapian::Database::postlist_end(), Xapian::Document::remove_term(), Xapian::Database::reopen(), Xapian::Database::term_exists(), Xapian::Database::termlist_begin(), TEST, TEST_EQUAL, and TEST_EXCEPTION.

DEFINE_TESTCASE ( deldoc3  ,
writable   
)

Definition at line 654 of file api_wrdb.cc.

References Xapian::WritableDatabase::add_document(), Xapian::Document::add_posting(), Xapian::Database::allterms_begin(), Xapian::Database::allterms_end(), Xapian::WritableDatabase::delete_document(), Xapian::WritableDatabase::flush(), Xapian::Database::get_avlength(), Xapian::Database::get_collection_freq(), Xapian::Database::get_doccount(), Xapian::Database::get_doclength(), Xapian::Database::get_document(), Xapian::Database::get_termfreq(), get_writable_database(), Xapian::Database::postlist_begin(), Xapian::Database::postlist_end(), Xapian::Database::reopen(), Xapian::Database::term_exists(), Xapian::Database::termlist_begin(), TEST, TEST_EQUAL, and TEST_EXCEPTION.

DEFINE_TESTCASE ( deldoc4  ,
writable   
)

Definition at line 702 of file api_wrdb.cc.

References Xapian::WritableDatabase::add_document(), Xapian::Document::add_posting(), Xapian::Database::allterms_begin(), Xapian::Database::allterms_end(), Xapian::WritableDatabase::delete_document(), Xapian::WritableDatabase::flush(), Xapian::Database::get_avlength(), Xapian::Database::get_collection_freq(), Xapian::Database::get_doccount(), Xapian::Database::get_doclength(), Xapian::Database::get_document(), Xapian::Database::get_termfreq(), get_writable_database(), Xapian::Database::postlist_begin(), Xapian::Database::postlist_end(), Xapian::Document::remove_term(), Xapian::Database::reopen(), Xapian::Database::term_exists(), Xapian::Database::termlist_begin(), TEST, TEST_EQUAL, TEST_EXCEPTION, and tout.

DEFINE_TESTCASE ( deldoc5  ,
writable   
)

Definition at line 787 of file api_wrdb.cc.

References Xapian::WritableDatabase::add_document(), Xapian::Document::add_posting(), Xapian::Document::add_term(), Xapian::WritableDatabase::delete_document(), Xapian::WritableDatabase::flush(), Xapian::Database::get_document(), Xapian::Database::get_termfreq(), get_writable_database(), Xapian::Database::postlist_begin(), Xapian::Database::postlist_end(), Xapian::Document::remove_term(), TEST_EQUAL, TEST_EXCEPTION, and TEST_NOT_EQUAL.

DEFINE_TESTCASE ( deldoc6  ,
writable   
)

Definition at line 834 of file api_wrdb.cc.

References Xapian::WritableDatabase::add_document(), Xapian::Document::add_posting(), Xapian::Document::add_term(), Xapian::WritableDatabase::delete_document(), Xapian::WritableDatabase::flush(), Xapian::Database::get_document(), get_writable_database(), Xapian::Document::remove_term(), TEST_EQUAL, and TEST_EXCEPTION.

DEFINE_TESTCASE ( replacedoc1  ,
writable   
)

Definition at line 864 of file api_wrdb.cc.

References Xapian::WritableDatabase::add_document(), Xapian::Document::add_posting(), Xapian::Database::get_document(), get_writable_database(), Xapian::TermIterator::positionlist_begin(), Xapian::WritableDatabase::replace_document(), Xapian::Document::termlist_begin(), Xapian::Document::termlist_end(), and TEST_EQUAL.

DEFINE_TESTCASE ( replacedoc2  ,
writable   
)

Definition at line 910 of file api_wrdb.cc.

References Xapian::WritableDatabase::add_document(), Xapian::Document::add_posting(), Xapian::Database::get_doccount(), Xapian::Database::get_document(), get_writable_database(), Xapian::TermIterator::positionlist_begin(), Xapian::Database::postlist_begin(), Xapian::Database::postlist_end(), Xapian::WritableDatabase::replace_document(), Xapian::Document::termlist_begin(), TEST, TEST_EQUAL, and TEST_EXCEPTION.

DEFINE_TESTCASE ( replacedoc3  ,
writable   
)

Definition at line 968 of file api_wrdb.cc.

References Xapian::WritableDatabase::add_document(), Xapian::Document::add_posting(), Xapian::Document::add_term(), Xapian::WritableDatabase::flush(), Xapian::Database::get_doclength(), Xapian::Database::get_document(), Xapian::Database::get_termfreq(), get_writable_database(), Xapian::Database::postlist_begin(), Xapian::Database::postlist_end(), Xapian::Document::remove_term(), Xapian::WritableDatabase::replace_document(), TEST_EQUAL, and TEST_NOT_EQUAL.

DEFINE_TESTCASE ( replacedoc4  ,
writable   
)

Definition at line 1034 of file api_wrdb.cc.

References Xapian::WritableDatabase::add_document(), Xapian::Document::add_posting(), Xapian::Document::add_term(), Xapian::WritableDatabase::delete_document(), Xapian::WritableDatabase::flush(), Xapian::Database::get_document(), Xapian::Database::get_termfreq(), get_writable_database(), Xapian::Database::postlist_begin(), Xapian::Database::postlist_end(), Xapian::Document::remove_term(), Xapian::WritableDatabase::replace_document(), TEST_EQUAL, and TEST_NOT_EQUAL.

DEFINE_TESTCASE ( replacedoc5  ,
writable   
)

Definition at line 1096 of file api_wrdb.cc.

References Xapian::WritableDatabase::add_document(), Xapian::Document::add_posting(), Xapian::WritableDatabase::flush(), Xapian::Database::get_document(), get_writable_database(), Xapian::Database::has_positions(), Xapian::Database::positionlist_begin(), Xapian::Database::positionlist_end(), Xapian::WritableDatabase::replace_document(), TEST, and TEST_EQUAL.

DEFINE_TESTCASE ( replacedoc6  ,
writable   
)

Definition at line 1124 of file api_wrdb.cc.

References Xapian::WritableDatabase::add_document(), Xapian::Document::add_value(), Xapian::WritableDatabase::flush(), Xapian::Database::get_document(), Xapian::Document::get_value(), get_writable_database(), Xapian::WritableDatabase::replace_document(), and TEST_EQUAL.

DEFINE_TESTCASE ( uniqueterm1  ,
writable   
)

Definition at line 1163 of file api_wrdb.cc.

References Xapian::WritableDatabase::add_document(), Xapian::Document::add_term(), Xapian::WritableDatabase::delete_document(), Xapian::Database::get_doccount(), get_writable_database(), om_tostring(), Xapian::WritableDatabase::replace_document(), Xapian::Document::set_data(), and TEST_EQUAL.

DEFINE_TESTCASE ( allpostlist2  ,
writable   
)

Definition at line 1218 of file api_wrdb.cc.

References Xapian::WritableDatabase::delete_document(), get_writable_database(), Xapian::Database::postlist_begin(), Xapian::Database::postlist_end(), Xapian::PostingIterator::skip_to(), and TEST_EQUAL.

static void test_emptyterm2_helper ( Xapian::WritableDatabase db  )  [static]

Definition at line 1260 of file api_wrdb.cc.

References Xapian::Database::get_collection_freq(), Xapian::Database::get_doccount(), Xapian::Database::get_termfreq(), Xapian::Database::positionlist_begin(), Xapian::Database::term_exists(), TEST_EQUAL, and TEST_EXCEPTION.

Referenced by DEFINE_TESTCASE().

DEFINE_TESTCASE ( emptyterm2  ,
writable   
)

Definition at line 1271 of file api_wrdb.cc.

References Xapian::WritableDatabase::delete_document(), Xapian::Database::get_doccount(), get_writable_database(), test_emptyterm2_helper(), and TEST_EQUAL.

DEFINE_TESTCASE ( phraseorneartoand1  ,
writable   
)

Definition at line 1307 of file api_wrdb.cc.

References Xapian::WritableDatabase::add_document(), Xapian::WritableDatabase::flush(), Xapian::Enquire::get_mset(), get_writable_database(), om_tostring(), Xapian::Query::OP_NEAR, Xapian::Query::OP_PHRASE, Xapian::Enquire::set_query(), Xapian::MSet::size(), and TEST_EQUAL.

DEFINE_TESTCASE ( longpositionlist1  ,
writable   
)

Definition at line 1346 of file api_wrdb.cc.

References Xapian::WritableDatabase::add_document(), Xapian::Document::add_posting(), Xapian::WritableDatabase::flush(), Xapian::Database::get_document(), get_writable_database(), Xapian::TermIterator::positionlist_begin(), Xapian::TermIterator::positionlist_end(), Xapian::Document::set_data(), Xapian::Document::termlist_begin(), Xapian::Document::termlist_end(), TEST, and TEST_EQUAL.

bool test_consistency2 (  ) 

Definition at line 1411 of file api_wrdb.cc.

References Xapian::WritableDatabase::add_document(), Xapian::WritableDatabase::flush(), Xapian::Enquire::get_mset(), get_writable_database(), Xapian::Enquire::set_query(), Xapian::Enquire::set_sort_by_value_then_relevance(), Xapian::MSet::size(), and TEST_EQUAL.

DEFINE_TESTCASE ( crashrecovery1  ,
writable   
)

Definition at line 1463 of file api_wrdb.cc.

References Xapian::WritableDatabase::add_document(), Xapian::DB_OPEN, Xapian::WritableDatabase::flush(), get_dbtype(), Xapian::Database::get_doccount(), get_writable_database(), get_writable_database_as_database(), Xapian::Database::reopen(), SKIP_TEST, TEST_EQUAL, and unlink().

DEFINE_TESTCASE ( nomoredocids1  ,
writable   
)

Definition at line 1528 of file api_wrdb.cc.

References Xapian::WritableDatabase::add_document(), Xapian::Document::add_term(), get_writable_database(), Xapian::WritableDatabase::replace_document(), Xapian::Document::set_data(), SKIP_TEST_FOR_BACKEND, and TEST_EXCEPTION.

DEFINE_TESTCASE ( synonymitor1  ,
writable   
)

Definition at line 1546 of file api_wrdb.cc.

References Xapian::Database::add_database(), Xapian::WritableDatabase::add_synonym(), Xapian::WritableDatabase::clear_synonyms(), Xapian::WritableDatabase::flush(), get_database(), get_writable_database(), Xapian::WritableDatabase::remove_synonym(), SKIP_TEST_UNLESS_BACKEND, Xapian::Database::synonym_keys_begin(), Xapian::Database::synonym_keys_end(), Xapian::Database::synonyms_begin(), Xapian::Database::synonyms_end(), TEST, and TEST_STRINGS_EQUAL.

DEFINE_TESTCASE ( metadata1  ,
writable   
)

Definition at line 1662 of file api_wrdb.cc.

References Xapian::Database::get_doccount(), Xapian::Database::get_metadata(), get_writable_database(), Xapian::WritableDatabase::set_metadata(), SKIP_TEST, and TEST_EQUAL.

DEFINE_TESTCASE ( metadata2  ,
metadata   
)

Definition at line 1684 of file api_wrdb.cc.

References Xapian::WritableDatabase::add_document(), Xapian::WritableDatabase::flush(), Xapian::Database::get_doccount(), Xapian::Database::get_metadata(), get_writable_database(), get_writable_database_as_database(), Xapian::Database::reopen(), Xapian::WritableDatabase::set_metadata(), SKIP_TEST_UNLESS_BACKEND, and TEST_EQUAL.

DEFINE_TESTCASE ( metadata3  ,
metadata   
)

Definition at line 1723 of file api_wrdb.cc.

References Xapian::Database::get_metadata(), get_writable_database(), Xapian::WritableDatabase::set_metadata(), and TEST_EXCEPTION.

DEFINE_TESTCASE ( metadata4  ,
metadata   
)

Definition at line 1735 of file api_wrdb.cc.

References Xapian::WritableDatabase::add_document(), Xapian::Document::add_posting(), Xapian::WritableDatabase::flush(), get_writable_database(), get_writable_database_as_database(), and Xapian::WritableDatabase::set_metadata().

DEFINE_TESTCASE ( termtoolong1  ,
writable   
)

Definition at line 1754 of file api_wrdb.cc.

References Xapian::WritableDatabase::add_document(), Xapian::Document::add_term(), Xapian::WritableDatabase::flush(), Xapian::Error::get_msg(), get_writable_database(), SKIP_TEST_FOR_BACKEND, TEST, TEST_AND_EXPLAIN, and tout.

DEFINE_TESTCASE ( postlist7  ,
writable   
)

Test playing with a postlist.

Definition at line 1816 of file api_wrdb.cc.

References Xapian::Document::add_term(), Xapian::PostingIterator::get_doclength(), Xapian::PostingIterator::get_wdf(), get_writable_database(), Xapian::Database::postlist_begin(), Xapian::Database::postlist_end(), Xapian::WritableDatabase::replace_document(), TEST, and TEST_EQUAL.

DEFINE_TESTCASE ( writeread1  ,
writable &&  metadata 
)

Regression test of reading after writing but not flushing.

Definition at line 1859 of file api_wrdb.cc.

References Xapian::Database::get_metadata(), get_writable_database(), Xapian::WritableDatabase::set_metadata(), and TEST_EQUAL.

DEFINE_TESTCASE ( lazytablebug1  ,
writable &&  flint 
)

Definition at line 1871 of file api_wrdb.cc.

References Xapian::WritableDatabase::add_document(), Xapian::WritableDatabase::add_synonym(), Xapian::Document::add_term(), Xapian::WritableDatabase::flush(), get_named_writable_database(), get_writable_database_as_database(), Xapian::Database::synonym_keys_begin(), Xapian::Database::synonym_keys_end(), and tout.

static double bigoaddvalue_helper ( size_t  num_values  )  [static]

Definition at line 1899 of file api_wrdb.cc.

References Xapian::WritableDatabase::add_document(), Xapian::Document::add_value(), Xapian::WritableDatabase::flush(), get_writable_database(), and OmTime::now().

Referenced by DEFINE_TESTCASE().

DEFINE_TESTCASE ( bigoaddvalue  ,
writable   
)

Definition at line 1916 of file api_wrdb.cc.

References bigoaddvalue_helper(), SKIP_TEST, TEST_LESSER, and tout.

DEFINE_TESTCASE ( cursordelbug1  ,
flint   
)

Regression test for bug #287 for flint.

Definition at line 1939 of file api_wrdb.cc.

References Xapian::WritableDatabase::add_document(), Xapian::WritableDatabase::delete_document(), Xapian::WritableDatabase::flush(), get_named_writable_database(), om_tostring(), system(), and XAPIAN_BIN_PATH.


Documentation for Xapian (version 1.0.10).
Generated on 24 Dec 2008 by Doxygen 1.5.2.