2
************************************************************************
3
* Copyright (c) 1997-2001, International Business Machines
4
* Corporation and others. All Rights Reserved.
5
************************************************************************
11
#include "unicode/utypes.h"
12
#include "unicode/normlzr.h"
15
#define TEST_SUITE_DIR "unidata"
16
#define TEST_SUITE_FILE "NormalizationTest.txt"
18
class NormalizerConformanceTest : public IntlTest {
19
Normalizer normalizer;
22
NormalizerConformanceTest();
23
virtual ~NormalizerConformanceTest();
25
void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par=NULL);
28
* Test the conformance of Normalizer to
29
* http://www.unicode.org/Public/UNIDATA/NormalizationTest.txt
30
* This file must be located at the path specified as TEST_SUITE_FILE.
32
void TestConformance(void);
34
// Specific tests for debugging. These are generally failures taken from
35
// the conformance file, but culled out to make debugging easier.
40
* Verify the conformance of the given line of the Unicode
41
* normalization (UTR 15) test suite file. For each line,
42
* there are five columns, corresponding to field[0]..field[4].
44
* The following invariants must be true for all conformant implementations
45
* c2 == NFC(c1) == NFC(c2) == NFC(c3)
46
* c3 == NFD(c1) == NFD(c2) == NFD(c3)
47
* c4 == NFKC(c1) == NFKC(c2) == NFKC(c3) == NFKC(c4) == NFKC(c5)
48
* c5 == NFKD(c1) == NFKD(c2) == NFKD(c3) == NFKD(c4) == NFKD(c5)
50
* @param field the 5 columns
51
* @param line the source line from the test suite file
52
* @return true if the test passes
54
UBool checkConformance(const UnicodeString* field,
55
const UnicodeString& line);
57
void iterativeNorm(const UnicodeString& str,
58
UNormalizationMode mode,
59
UnicodeString& result,
63
* @param op name of normalization form, e.g., "KC"
64
* @param s string being normalized
65
* @param got value received
66
* @param exp expected value
67
* @param msg description of this test
68
* @param return true if got == exp
70
UBool assertEqual(const char *op,
71
const UnicodeString& s,
72
const UnicodeString& got,
73
const UnicodeString& exp,
78
* Split a string into pieces based on the given delimiter
79
* character. Then, parse the resultant fields from hex into
80
* characters. That is, "0040 0400;0C00;0899" -> new String[] {
81
* "\u0040\u0400", "\u0C00", "\u0899" }. The output is assumed to
82
* be of the proper length already, and exactly output.length
83
* fields are parsed. If there are too few an exception is
84
* thrown. If there are too many the extras are ignored.
86
* @param buf scratch buffer
87
* @return FALSE upon failure
89
UBool hexsplit(const char *s, char delimiter,
90
UnicodeString output[], int32_t outputLength);
92
void _testOneLine(const char *line);