72 tout <<
"constructor\n";
81 tout <<
"destructor\n";
118 bool deleted =
false;
125 # if __has_warning("-Wself-assign-overloaded")
128 # pragma clang diagnostic push
129 # pragma clang diagnostic ignored "-Wself-assign-overloaded"
134 # if __has_warning("-Wself-assign-overloaded")
135 # pragma clang diagnostic pop
151 if ((s1 != s2) || (s1 > s2)) {
152 FAIL_TEST(
"String comparisons BADLY wrong");
157 if ((s1 == s2) || (s1 < s2)) {
158 FAIL_TEST(
"String comparisons don't cope with extra nulls");
166 if ((s1.length() != 5) || (s2.length() != 5)) {
167 FAIL_TEST(
"Lengths with added nulls wrong");
170 if ((s1 == s2) || !(s1 < s2)) {
171 FAIL_TEST(
"Characters after a null ignored in comparisons");
201 for (
unsigned int i = 0; i != 1000; ++i) {
204 const char* ptr = packed.data();
205 const char* end = ptr + packed.size();
211 swap(prev_packed, packed);
213 for (
unsigned int i = 2345; i < 65000; i += 113) {
216 const char* ptr = packed.data();
217 const char* end = ptr + packed.size();
223 swap(prev_packed, packed);
225 unsigned int prev = 64999;
226 for (
unsigned int i = 65000; i > prev; prev = i, i = (i << 1) ^ 1337) {
229 const char* ptr = packed.data();
230 const char* end = ptr + packed.size();
236 swap(prev_packed, packed);
241 for (
unsigned int i = 23456; i < 765432; i += 1131) {
244 const char* ptr = packed.data();
245 const char* end = ptr + packed.size();
246 for (
unsigned int i = 23456; i < 765432; i += 1131) {
258 memset(tested, 0,
sizeof(tested));
259 for (
int ch =
'0'; ch !=
'9' + 1; ++ch) {
282 for (
int ch =
'A'; ch !=
'F' + 1; ++ch) {
298 int v = ch -
'A' + 10;
305 for (
int ch =
'G'; ch !=
'Z' + 1; ++ch) {
323 for (
int ch =
'a'; ch !=
'f' + 1; ++ch) {
339 int v = ch -
'a' + 10;
346 for (
int ch =
'g'; ch !=
'z' + 1; ++ch) {
364 for (
const char*
p =
"\t\n\f\r "; *
p; ++
p) {
384 for (
int ch = 0; ch != 128; ++ch) {
385 if (tested[ch])
continue;
403 for (
unsigned char ch = 128; ch != 0; ++ch) {
421 for (
signed char ch = -128; ch != 0; ++ch) {
450 TESTCASE(pack_uint_preserving_sort1),
455 int main(
int argc,
char** argv)
459 }
catch (
const char* e) {
Test_Exception(int value_)
Base class for objects managed by intrusive_ptr.
unsigned _refs
Reference count.
A smart pointer that uses intrusive reference counting.
static void parse_command_line(int argc, char **argv)
Parse the command line arguments.
static int run(const test_desc *tests)
Xapian::Internal::intrusive_ptr< const test_refcnt > test()
test_refcnt(bool &deleted_)
static void test_pack_uint_preserving_sort1()
Test pack_uint_preserving_sort()
static void test_refcnt1()
int main(int argc, char **argv)
static void test_stringcomp1()
static void test_temporarydtor1()
static const test_desc tests[]
The lists of tests to perform.
static void test_exception1()
static void test_chartype1()
Test C_isupper() etc.
static void test_refcnt2()
Pack types into strings and unpack them again.
bool unpack_uint_preserving_sort(const char **p, const char *end, U *result)
Decode a "sort preserved" unsigned integer from a string.
void pack_uint_preserving_sort(std::string &s, U value)
Append an encoded unsigned integer to a string, preserving the sort order.
Convert types to std::string.
bool C_isnotalnum(char ch)
char hex_decode(char ch1, char ch2)
Decode a pair of ASCII hex digits.
bool C_isnotalpha(char ch)
bool C_isnotdigit(char ch)
bool C_isnotlower(char ch)
bool C_isnotxdigit(char ch)
bool C_isnotupper(char ch)
bool C_isnotspace(char ch)
static TempDtorTest factory()
Structure holding a description of a test.
#define TEST_REL(A, REL, B)
Test a relation holds,e.g. TEST_REL(a,>,b);.
std::ostringstream tout
The debug printing stream.
a generic test suite engine
#define FAIL_TEST(MSG)
Fail the current testcase with message MSG.
#define TEST_EQUAL(a, b)
Test for equality of two things.
#define TEST(a)
Test a condition, without an additional explanation for failure.
#define TEST_AND_EXPLAIN(a, b)
Test a condition, and display the test with an extra explanation if the condition fails.
Xapian-specific test helper functions and macros.
Public interfaces for the Xapian library.