xapian-core  2.1.0
Classes | Macros | Functions | Variables
api_unicode.cc File Reference

Test the Unicode and UTF-8 classes and functions. More...

#include <config.h>
#include "api_unicode.h"
#include <xapian.h>
#include "apitest.h"
#include "stringutils.h"
#include "testutils.h"
#include <cctype>
#include <fstream>
#include <limits>
#include <string_view>
+ Include dependency graph for api_unicode.cc:

Go to the source code of this file.

Classes

struct  testcase
 
struct  testcase2
 

Macros

#define ENCODE(C1, C2)   ((C1 - 'A') * 26 + (C2 - 'a'))
 

Functions

 DEFINE_TESTCASE (utf8iterator1, !backend)
 
 DEFINE_TESTCASE (utf8iterator2, !backend)
 
 DEFINE_TESTCASE (unicode1, !backend)
 
 DEFINE_TESTCASE (caseconvert1, !backend)
 
 DEFINE_TESTCASE (utf8convert1, !backend)
 
static unsigned decode_codepoint (const char **p)
 
static void test_codepoint (unsigned codepoint, unsigned upper, unsigned lower, Xapian::Unicode::category category)
 
 DEFINE_TESTCASE (unicodetables, !backend)
 

Variables

static const testcase testcases []
 
static const testcase2 testcases2 []
 

Detailed Description

Test the Unicode and UTF-8 classes and functions.

Definition in file api_unicode.cc.

Macro Definition Documentation

◆ ENCODE

#define ENCODE (   C1,
  C2 
)    ((C1 - 'A') * 26 + (C2 - 'a'))

Function Documentation

◆ decode_codepoint()

static unsigned decode_codepoint ( const char **  p)
static

Definition at line 216 of file api_unicode.cc.

References C_isxdigit(), hex_digit(), p, and TEST.

Referenced by DEFINE_TESTCASE().

◆ DEFINE_TESTCASE() [1/6]

DEFINE_TESTCASE ( caseconvert1  ,
backend 
)

◆ DEFINE_TESTCASE() [2/6]

DEFINE_TESTCASE ( unicode1  ,
backend 
)

◆ DEFINE_TESTCASE() [3/6]

DEFINE_TESTCASE ( unicodetables  ,
backend 
)

◆ DEFINE_TESTCASE() [4/6]

DEFINE_TESTCASE ( utf8convert1  ,
backend 
)

Definition at line 192 of file api_unicode.cc.

References Xapian::Unicode::append_utf8(), and TEST_STRINGS_EQUAL.

◆ DEFINE_TESTCASE() [5/6]

DEFINE_TESTCASE ( utf8iterator1  ,
backend 
)

Definition at line 100 of file api_unicode.cc.

References p, TEST, TEST_EQUAL, testcases, and tout.

◆ DEFINE_TESTCASE() [6/6]

DEFINE_TESTCASE ( utf8iterator2  ,
backend 
)

Definition at line 142 of file api_unicode.cc.

References p, TEST, TEST_EQUAL, and testcases2.

◆ test_codepoint()

static void test_codepoint ( unsigned  codepoint,
unsigned  upper,
unsigned  lower,
Xapian::Unicode::category  category 
)
static

Variable Documentation

◆ testcases

const testcase testcases[]
static

Definition at line 43 of file api_unicode.cc.

Referenced by DEFINE_TESTCASE().

◆ testcases2

const testcase2 testcases2[]
static
Initial value:
= {
{ "a", 97 },
{ "\x80", 128 },
{ "\xa0", 160 },
{ "\xc2\x80", 128 },
{ "\xc2\xa0", 160 },
{ "\xe0\xa0\x80", 0x0800 },
{ "\xe1\x80\x80", 0x1000 },
{ "\xf0\xa8\xa8\x8f", 166415 },
{ "\xf3\x80\x80\x80", 0x0c0000 },
{ "\xf4\x80\x80\x80", 0x100000 },
{ 0, 0 }
}

Definition at line 127 of file api_unicode.cc.

Referenced by DEFINE_TESTCASE().