#include <config.h>
#include "api_closedb.h"
#include <xapian.h>
#include "apitest.h"
#include "testutils.h"

Go to the source code of this file.
Classes | |
| struct | closedb1_iterators |
Defines | |
| #define | COUNT_CLOSEDEXC(CODE) try { CODE; } catch (const Xapian::DatabaseError &) { ++closedexc_count; } |
| #define | IF_NOT_CLOSEDEXC(CODE) |
Functions | |
| DEFINE_TESTCASE (closedb1, backend) | |
| DEFINE_TESTCASE (closedb2, writable &&!inmemory &&!remote) | |
| DEFINE_TESTCASE (closedb3, backend) | |
| Check API methods which might either work or throw an exception. | |
| DEFINE_TESTCASE (closedb4, writable &&!inmemory) | |
| Regression test for bug fixed in 1.1.4 - close() should implicitly commit(). | |
| DEFINE_TESTCASE (closedb5, transactions &&!remote) | |
| If a transaction is active, close() shouldn't implicitly commit(). | |
| DEFINE_TESTCASE (closedb6, remote) | |
| Database::keep_alive() should fail after close() for a remote database. | |
| DEFINE_TESTCASE (closedb7, writable) | |
| DEFINE_TESTCASE (closedb8, writable &&spelling) | |
| DEFINE_TESTCASE (closedb9, writable &&synonyms) | |
| DEFINE_TESTCASE (closedb10, writable &&metadata) | |
Definition in file api_closedb.cc.
| #define COUNT_CLOSEDEXC | ( | CODE | ) | try { CODE; } catch (const Xapian::DatabaseError &) { ++closedexc_count; } |
| #define IF_NOT_CLOSEDEXC | ( | CODE | ) |
Value:
do { \ hadexc = false; \ try { \ CODE; \ } catch (const Xapian::DatabaseError &) { \ ++closedexc_count; \ hadexc = true; \ } \ } while (false); if (hadexc)
Definition at line 36 of file api_closedb.cc.
Referenced by closedb1_iterators::perform().
| DEFINE_TESTCASE | ( | closedb10 | , | |
| writable && | metadata | |||
| ) |
Definition at line 327 of file api_closedb.cc.
References Xapian::Database::close(), Xapian::Database::get_metadata(), get_writable_database(), Xapian::Database::metadata_keys_begin(), Xapian::WritableDatabase::set_metadata(), and TEST_EXCEPTION.
| DEFINE_TESTCASE | ( | closedb9 | , | |
| writable && | synonyms | |||
| ) |
Definition at line 306 of file api_closedb.cc.
References Xapian::WritableDatabase::add_synonym(), Xapian::WritableDatabase::clear_synonyms(), Xapian::Database::close(), get_writable_database(), Xapian::WritableDatabase::remove_synonym(), Xapian::Database::synonym_keys_begin(), Xapian::Database::synonyms_begin(), and TEST_EXCEPTION.
| DEFINE_TESTCASE | ( | closedb8 | , | |
| writable && | spelling | |||
| ) |
| DEFINE_TESTCASE | ( | closedb7 | , | |
| writable | ||||
| ) |
Definition at line 263 of file api_closedb.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Database::close(), Xapian::WritableDatabase::delete_document(), get_writable_database(), Xapian::WritableDatabase::replace_document(), and TEST_EXCEPTION.
| DEFINE_TESTCASE | ( | closedb6 | , | |
| remote | ||||
| ) |
Database::keep_alive() should fail after close() for a remote database.
Definition at line 250 of file api_closedb.cc.
References Xapian::Database::close(), get_database(), and Xapian::Database::keep_alive().
| DEFINE_TESTCASE | ( | closedb5 | , | |
| transactions &&! | remote | |||
| ) |
If a transaction is active, close() shouldn't implicitly commit().
Definition at line 223 of file api_closedb.cc.
References Xapian::WritableDatabase::add_document(), Xapian::WritableDatabase::begin_transaction(), Xapian::Database::close(), Xapian::Database::get_doccount(), get_writable_database(), get_writable_database_as_database(), and TEST_EQUAL.
| DEFINE_TESTCASE | ( | closedb4 | , | |
| writable &&! | inmemory | |||
| ) |
Regression test for bug fixed in 1.1.4 - close() should implicitly commit().
Definition at line 212 of file api_closedb.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Database::close(), Xapian::Database::get_doccount(), get_writable_database(), get_writable_database_as_database(), and TEST_EQUAL.
| DEFINE_TESTCASE | ( | closedb3 | , | |
| backend | ||||
| ) |
Check API methods which might either work or throw an exception.
Definition at line 171 of file api_closedb.cc.
References Xapian::Database::close(), Xapian::Database::get_avlength(), get_database(), Xapian::Database::get_doccount(), Xapian::Database::get_doclength_lower_bound(), Xapian::Database::get_doclength_upper_bound(), Xapian::Database::get_lastdocid(), Xapian::Database::get_uuid(), Xapian::Database::get_wdf_upper_bound(), Xapian::Database::has_positions(), Xapian::Database::keep_alive(), TEST, TEST_EQUAL, and TEST_REL.
| DEFINE_TESTCASE | ( | closedb2 | , | |
| writable &&!inmemory &&! | remote | |||
| ) |
Definition at line 157 of file api_closedb.cc.
References Xapian::Database::close(), Xapian::DB_OPEN, get_named_writable_database(), get_named_writable_database_path(), Xapian::Database::postlist_begin(), Xapian::Database::postlist_end(), TEST_EQUAL, and TEST_EXCEPTION.
| DEFINE_TESTCASE | ( | closedb1 | , | |
| backend | ||||
| ) |
Definition at line 123 of file api_closedb.cc.
References Xapian::Database::close(), get_database(), Xapian::Database::get_description(), closedb1_iterators::perform(), Xapian::Database::reopen(), closedb1_iterators::setup(), TEST, TEST_EQUAL, TEST_EXCEPTION, and TEST_NOT_EQUAL.