xapian-core  2.0.0
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
 
struct  remotefailure1_iterators
 

Macros

#define COUNT_EXCEPTION(CODE, EXCEPTION)
 
#define COUNT_CLOSED(CODE)   COUNT_EXCEPTION(CODE, DatabaseClosedError)
 
#define COUNT_NETWORK(CODE)   COUNT_EXCEPTION(CODE, NetworkError)
 

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)
 
 DEFINE_TESTCASE (remotefailure1, remotetcp)
 
 DEFINE_TESTCASE (remotefailure3, remotetcp)
 Check API methods which might either work or throw an exception. More...
 
 DEFINE_TESTCASE (remotefailure5, remotetcp)
 Test the effects of remote server failure on transactions. More...
 
 DEFINE_TESTCASE (remotefailure7, remotetcp)
 
 DEFINE_TESTCASE (remotefailure8, remotetcp)
 
 DEFINE_TESTCASE (remotefailure9, remotetcp)
 
 DEFINE_TESTCASE (remotefailure10, remotetcp)
 

Detailed Description

Tests of closing databases.

Definition in file api_closedb.cc.

Macro Definition Documentation

◆ COUNT_CLOSED

#define COUNT_CLOSED (   CODE)    COUNT_EXCEPTION(CODE, DatabaseClosedError)

Definition at line 42 of file api_closedb.cc.

◆ COUNT_EXCEPTION

#define COUNT_EXCEPTION (   CODE,
  EXCEPTION 
)
Value:
try { \
CODE; \
} catch (const Xapian::EXCEPTION&) { \
++exception_count; \
}

Definition at line 35 of file api_closedb.cc.

◆ COUNT_NETWORK

#define COUNT_NETWORK (   CODE)    COUNT_EXCEPTION(CODE, NetworkError)

Definition at line 434 of file api_closedb.cc.

Function Documentation

◆ DEFINE_TESTCASE() [1/17]

DEFINE_TESTCASE ( closedb1  ,
backend   
)

◆ DEFINE_TESTCASE() [2/17]

DEFINE_TESTCASE ( closedb10  ,
writable &&  metadata 
)

◆ DEFINE_TESTCASE() [3/17]

DEFINE_TESTCASE ( closedb2  ,
writable &&  path 
)

◆ DEFINE_TESTCASE() [4/17]

DEFINE_TESTCASE ( closedb3  ,
backend   
)

◆ DEFINE_TESTCASE() [5/17]

DEFINE_TESTCASE ( closedb4  ,
writable &&!  inmemory 
)

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

Definition at line 270 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() [6/17]

DEFINE_TESTCASE ( closedb5  ,
transactions   
)

◆ DEFINE_TESTCASE() [7/17]

DEFINE_TESTCASE ( closedb6  ,
remote   
)

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

Definition at line 345 of file api_closedb.cc.

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

◆ DEFINE_TESTCASE() [8/17]

DEFINE_TESTCASE ( closedb7  ,
writable   
)

◆ DEFINE_TESTCASE() [9/17]

DEFINE_TESTCASE ( closedb8  ,
writable &&  spelling 
)

◆ DEFINE_TESTCASE() [10/17]

DEFINE_TESTCASE ( closedb9  ,
writable &&  synonyms 
)

◆ DEFINE_TESTCASE() [11/17]

DEFINE_TESTCASE ( remotefailure1  ,
remotetcp   
)

◆ DEFINE_TESTCASE() [12/17]

DEFINE_TESTCASE ( remotefailure10  ,
remotetcp   
)

◆ DEFINE_TESTCASE() [13/17]

DEFINE_TESTCASE ( remotefailure3  ,
remotetcp   
)

◆ DEFINE_TESTCASE() [14/17]

DEFINE_TESTCASE ( remotefailure5  ,
remotetcp   
)

◆ DEFINE_TESTCASE() [15/17]

DEFINE_TESTCASE ( remotefailure7  ,
remotetcp   
)

◆ DEFINE_TESTCASE() [16/17]

DEFINE_TESTCASE ( remotefailure8  ,
remotetcp   
)

◆ DEFINE_TESTCASE() [17/17]

DEFINE_TESTCASE ( remotefailure9  ,
remotetcp   
)