xapian-core  1.4.26
Classes | Macros | Functions
api_closedb.cc File Reference

Tests of closing databases. More...

#include <config.h>
#include "api_closedb.h"
#include <xapian.h>
#include "safeunistd.h"
#include "apitest.h"
#include "testutils.h"
+ Include dependency graph for api_closedb.cc:

Go to the source code of this file.

Classes

struct  closedb1_iterators
 

Macros

#define COUNT_CLOSEDEXC(CODE)
 
#define IF_NOT_CLOSEDEXC(CODE)
 

Functions

 DEFINE_TESTCASE (closedb1, backend)
 
 DEFINE_TESTCASE (closedb2, writable &&path)
 
 DEFINE_TESTCASE (closedb3, backend)
 Check API methods which might either work or throw an exception. More...
 
 DEFINE_TESTCASE (closedb4, writable &&!inmemory)
 Regression test for bug fixed in 1.1.4 - close() should implicitly commit(). More...
 
 DEFINE_TESTCASE (closedb5, transactions)
 Test the effects of close() on transactions. More...
 
 DEFINE_TESTCASE (closedb6, remote)
 Database::keep_alive() should fail after close() for a remote database. More...
 
 DEFINE_TESTCASE (closedb7, writable)
 
 DEFINE_TESTCASE (closedb8, writable &&spelling)
 
 DEFINE_TESTCASE (closedb9, writable &&synonyms)
 
 DEFINE_TESTCASE (closedb10, writable &&metadata)
 

Detailed Description

Tests of closing databases.

Definition in file api_closedb.cc.

Macro Definition Documentation

◆ COUNT_CLOSEDEXC

#define COUNT_CLOSEDEXC (   CODE)
Value:
try { \
CODE; \
} catch (const Xapian::DatabaseClosedError &) { \
++closedexc_count; \
}
Indicates an attempt to access a closed database.
Definition: error.h:1097

Definition at line 35 of file api_closedb.cc.

Referenced by closedb1_iterators::perform().

◆ IF_NOT_CLOSEDEXC

#define IF_NOT_CLOSEDEXC (   CODE)
Value:
do { \
hadexc = false; \
try { \
CODE; \
} catch (const Xapian::DatabaseClosedError &) { \
++closedexc_count; \
hadexc = true; \
} \
} while (false); if (hadexc)
Indicates an attempt to access a closed database.
Definition: error.h:1097

Definition at line 42 of file api_closedb.cc.

Referenced by closedb1_iterators::perform().

Function Documentation

◆ DEFINE_TESTCASE() [1/10]

DEFINE_TESTCASE ( closedb1  ,
backend   
)

◆ DEFINE_TESTCASE() [2/10]

DEFINE_TESTCASE ( closedb2  ,
writable &&  path 
)

◆ DEFINE_TESTCASE() [3/10]

DEFINE_TESTCASE ( closedb3  ,
backend   
)

◆ DEFINE_TESTCASE() [4/10]

DEFINE_TESTCASE ( closedb4  ,
writable &&!  inmemory 
)

Regression test for bug fixed in 1.1.4 - close() should implicitly commit().

Definition at line 303 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() [5/10]

DEFINE_TESTCASE ( closedb5  ,
transactions   
)

◆ DEFINE_TESTCASE() [6/10]

DEFINE_TESTCASE ( closedb6  ,
remote   
)

Database::keep_alive() should fail after close() for a remote database.

Definition at line 386 of file api_closedb.cc.

References Xapian::Database::close(), FAIL_TEST, get_database(), and Xapian::Database::keep_alive().

◆ DEFINE_TESTCASE() [7/10]

DEFINE_TESTCASE ( closedb7  ,
writable   
)

◆ DEFINE_TESTCASE() [8/10]

DEFINE_TESTCASE ( closedb8  ,
writable &&  spelling 
)

◆ DEFINE_TESTCASE() [9/10]

DEFINE_TESTCASE ( closedb9  ,
writable &&  synonyms 
)

◆ DEFINE_TESTCASE() [10/10]

DEFINE_TESTCASE ( closedb10  ,
writable &&  metadata 
)