45     return unsigned(range * (rand() / (RAND_MAX + 1.0)));
    53     return min + unsigned((max + 1 - min) * (rand() / (RAND_MAX + 1.0)));
    61     return rand() / (RAND_MAX + 1.0);
    70 gen_word(
unsigned int length, 
unsigned int char_range)
    73     result.reserve(length);
    74     for (
unsigned int i = 0; i != length; ++i) {
    75         char ch = char(
'a' + 
rand_int(char_range));
    85     std::string dbname(
"randomidx1");
    88     unsigned int runsize = 100000;
    89     unsigned int seed = 42;
    92     unsigned int slots_used = 10;
    93     double slot_probability = 0.7;
    94     unsigned int slotval_minlen = 1;
    95     unsigned int slotval_maxlen = 6;
    97     unsigned int minterms = 100;
    98     unsigned int maxterms = 1000;
    99     unsigned int mintermlen = 1;
   100     unsigned int maxtermlen = 10;
   101     unsigned int termcharrange = 10;
   105     std::map<std::string, std::string> params;
   106     params[
"runsize"] = 
str(runsize);
   107     params[
"seed"] = 
str(seed);
   108     params[
"slots_used"] = 
str(slots_used);
   109     params[
"slot_probability"] = 
str(slot_probability);
   110     params[
"slotval_minlen"] = 
str(slotval_minlen);
   111     params[
"slotval_maxlen"] = 
str(slotval_maxlen);
   112     params[
"minterms"] = 
str(minterms);
   113     params[
"maxterms"] = 
str(maxterms);
   114     params[
"mintermlen"] = 
str(mintermlen);
   115     params[
"maxtermlen"] = 
str(maxtermlen);
   116     params[
"termcharrange"] = 
str(termcharrange);
   120     for (i = 0; i < runsize; ++i) {
   124         unsigned int terms = 
rand_int(minterms, maxterms);
   125         for (
unsigned int j = 0; j < terms; ++j) {
   126             unsigned int termlen = 
rand_int(mintermlen, maxtermlen);
   133         for (
unsigned int slot = 0; slot < slots_used; ++slot) {
   134             if (
rand_01() < slot_probability) {
   135                 unsigned int len = 
rand_int(slotval_minlen, slotval_maxlen);
 static unsigned int rand_int(unsigned int range)
Generate a random integer from 0 to "range" - 1. 
 
Xapian::docid add_document(const Xapian::Document &document)
Add a new document to the database. 
 
Run multiple tests for different backends. 
 
void add_value(Xapian::valueno slot, const std::string &value)
Add a new value. 
 
performance tests for Xapian. 
 
void indexing_add()
Log the addition of a document in an indexing run. 
 
a generic test suite engine 
 
Convert types to std::string. 
 
virtual Xapian::WritableDatabase get_writable_database(const std::string &name, const std::string &file)
Get a writable database instance. 
 
void testcase_begin(const std::string &testcase)
Start a testcase. 
 
Base class for backend handling in test harness. 
 
This class provides read/write access to a database. 
 
Public interfaces for the Xapian library. 
 
BackendManager * backendmanager
backendmanager is global so that it can be accessed by individual tests. 
 
string str(int value)
Convert int to std::string. 
 
void commit()
Commit any pending modifications made to the database. 
 
void indexing_end()
Log the end of an indexing run. 
 
static string gen_word(unsigned int length, unsigned int char_range)
Generate a "word", of the specified length. 
 
static double rand_01()
Generate a random double in range 0.0 <= v < 1.0. 
 
DEFINE_TESTCASE(randomidx1, writable &&!inmemory)
 
Xapian-specific test helper functions and macros. 
 
void testcase_end()
End a testcase. 
 
void set_data(const std::string &data)
Set data stored in the document. 
 
A handle representing a document in a Xapian database. 
 
void indexing_begin(const std::string &dbname, const std::map< std::string, std::string > ¶ms)
Log the start of an indexing run. 
 
void add_term(const std::string &tname, Xapian::termcount wdfinc=1)
Add a term to the document, without positional information.