tests/harness/testutils.h File Reference

#include "testsuite.h"
#include <xapian.h>

Include dependency graph for testutils.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define TEST_MSET_SIZE(M, S)
 Check MSet M has size S.
#define TEST_EXCEPTION(a, b)
 Check that a piece of code throws an expected exception.

Functions

std::ostream & operator<< (std::ostream &os, const std::vector< unsigned int > &ints)
bool mset_range_is_same (const Xapian::MSet &mset1, unsigned int first1, const Xapian::MSet &mset2, unsigned int first2, unsigned int count)
bool mset_range_is_same_weights (const Xapian::MSet &mset1, unsigned int first1, const Xapian::MSet &mset2, unsigned int first2, unsigned int count)
bool mset_range_is_same_percents (const Xapian::MSet &mset1, unsigned int first1, const Xapian::MSet &mset2, unsigned int first2, unsigned int count)
bool operator== (const Xapian::MSet &first, const Xapian::MSet &second)
bool operator!= (const Xapian::MSet &first, const Xapian::MSet &second)
void mset_expect_order (const Xapian::MSet &A, Xapian::docid d1=0, Xapian::docid d2=0, Xapian::docid d3=0, Xapian::docid d4=0, Xapian::docid d5=0, Xapian::docid d6=0, Xapian::docid d7=0, Xapian::docid d8=0, Xapian::docid d9=0, Xapian::docid d10=0, Xapian::docid d11=0, Xapian::docid d12=0)
void test_mset_order_equal (const Xapian::MSet &mset1, const Xapian::MSet &mset2)


Define Documentation

#define TEST_MSET_SIZE ( M,
 ) 

Value:

TEST_AND_EXPLAIN(((M).size() == (S)), \
        "MSet `"STRINGIZE(M)"' is not of expected size: was `" << \
        (M).size() << "' expected `" << (S) << "':\n" << \
        "Full mset was:\n" << (M))
Check MSet M has size S.

Definition at line 78 of file testutils.h.

Referenced by DEFINE_TESTCASE().

#define TEST_EXCEPTION ( a,
 ) 

Value:

do {\
        expected_exception = STRINGIZE(a);\
        if (strncmp(expected_exception, "Xapian::", 8) == 0)\
            expected_exception += 8;\
        if (verbose)\
            tout << "Expecting exception " << expected_exception << endl;\
        try {b;FAIL_TEST(TESTCASE_LOCN(Expected #a));}\
        catch (const a &e) {\
            if (verbose)\
                tout << "Caught expected " << expected_exception\
                     << " exception: " << e.get_description() << endl;\
        }\
        expected_exception = NULL;\
    } while (0)
Check that a piece of code throws an expected exception.

Definition at line 84 of file testutils.h.

Referenced by DEFINE_TESTCASE(), test_emptyterm1_helper(), test_emptyterm2_helper(), test_overwrite1(), test_qp_default_prefix2(), test_queryparser1(), test_serialiselength2(), test_table1(), test_tg_spell2(), and test_writelock1().


Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const std::vector< unsigned int > &  ints 
)

bool mset_range_is_same ( const Xapian::MSet mset1,
unsigned int  first1,
const Xapian::MSet mset2,
unsigned int  first2,
unsigned int  count 
)

Definition at line 43 of file testutils.cc.

References Xapian::MSetIterator::get_weight(), Xapian::MSet::size(), and TEST_AND_EXPLAIN.

Referenced by DEFINE_TESTCASE(), and operator==().

bool mset_range_is_same_weights ( const Xapian::MSet mset1,
unsigned int  first1,
const Xapian::MSet mset2,
unsigned int  first2,
unsigned int  count 
)

Definition at line 71 of file testutils.cc.

References Xapian::MSetIterator::get_weight(), Xapian::MSet::size(), and TEST_AND_EXPLAIN.

Referenced by DEFINE_TESTCASE().

bool mset_range_is_same_percents ( const Xapian::MSet mset1,
unsigned int  first1,
const Xapian::MSet mset2,
unsigned int  first2,
unsigned int  count 
)

Definition at line 99 of file testutils.cc.

References Xapian::MSetIterator::get_percent(), Xapian::MSet::size(), and TEST_AND_EXPLAIN.

Referenced by DEFINE_TESTCASE().

bool operator== ( const Xapian::MSet first,
const Xapian::MSet second 
)

Definition at line 126 of file testutils.cc.

References Xapian::MSet::empty(), Xapian::MSet::get_matches_estimated(), Xapian::MSet::get_matches_lower_bound(), Xapian::MSet::get_matches_upper_bound(), Xapian::MSet::get_max_possible(), mset_range_is_same(), and Xapian::MSet::size().

bool operator!= ( const Xapian::MSet first,
const Xapian::MSet second 
) [inline]

Definition at line 57 of file testutils.h.

void mset_expect_order ( const Xapian::MSet A,
Xapian::docid  d1 = 0,
Xapian::docid  d2 = 0,
Xapian::docid  d3 = 0,
Xapian::docid  d4 = 0,
Xapian::docid  d5 = 0,
Xapian::docid  d6 = 0,
Xapian::docid  d7 = 0,
Xapian::docid  d8 = 0,
Xapian::docid  d9 = 0,
Xapian::docid  d10 = 0,
Xapian::docid  d11 = 0,
Xapian::docid  d12 = 0 
)

Definition at line 210 of file testutils.cc.

References mset_expect_order_().

Referenced by DEFINE_TESTCASE().

void test_mset_order_equal ( const Xapian::MSet mset1,
const Xapian::MSet mset2 
)

Definition at line 219 of file testutils.cc.

References Xapian::MSet::begin(), Xapian::MSet::end(), Xapian::MSet::size(), and TEST_AND_EXPLAIN.


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