2017-01-20 00:20:31 +00:00
|
|
|
// © 2016 and later: Unicode, Inc. and others.
|
2016-06-15 18:58:17 +00:00
|
|
|
// License & terms of use: http://www.unicode.org/copyright.html
|
2000-01-15 02:00:06 +00:00
|
|
|
/********************************************************************
|
|
|
|
* COPYRIGHT:
|
2016-05-31 21:45:07 +00:00
|
|
|
* Copyright (c) 1997-2010, International Business Machines Corporation and
|
|
|
|
* others. All Rights Reserved.
|
2000-01-15 02:00:06 +00:00
|
|
|
********************************************************************/
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Normalizer basic tests
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _TSTNORM
|
|
|
|
#define _TSTNORM
|
|
|
|
|
2003-05-06 01:22:23 +00:00
|
|
|
#include "unicode/utypes.h"
|
|
|
|
|
|
|
|
#if !UCONFIG_NO_NORMALIZATION
|
|
|
|
|
1999-12-28 23:57:50 +00:00
|
|
|
#include "unicode/normlzr.h"
|
1999-08-16 21:50:52 +00:00
|
|
|
#include "intltest.h"
|
|
|
|
|
|
|
|
class BasicNormalizerTest : public IntlTest {
|
|
|
|
public:
|
|
|
|
BasicNormalizerTest();
|
2000-12-09 03:17:45 +00:00
|
|
|
virtual ~BasicNormalizerTest();
|
1999-08-16 21:50:52 +00:00
|
|
|
|
2000-08-14 21:42:36 +00:00
|
|
|
void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
void TestHangulCompose(void);
|
|
|
|
void TestHangulDecomp(void);
|
|
|
|
void TestPrevious(void);
|
|
|
|
void TestDecomp(void);
|
|
|
|
void TestCompatDecomp(void);
|
|
|
|
void TestCanonCompose(void);
|
|
|
|
void TestCompatCompose(void);
|
2000-07-13 22:13:13 +00:00
|
|
|
void TestTibetan(void);
|
|
|
|
void TestCompositionExclusion(void);
|
2000-07-18 18:41:50 +00:00
|
|
|
void TestZeroIndex(void);
|
2001-04-02 19:29:50 +00:00
|
|
|
void TestVerisign(void);
|
2001-09-11 01:29:06 +00:00
|
|
|
void TestPreviousNext(void);
|
2001-11-09 21:54:32 +00:00
|
|
|
void TestNormalizerAPI(void);
|
2002-03-12 23:00:50 +00:00
|
|
|
void TestConcatenate(void);
|
2002-05-24 22:25:34 +00:00
|
|
|
void TestCompare(void);
|
2002-06-08 03:44:02 +00:00
|
|
|
void FindFoldFCDExceptions();
|
2002-11-05 00:59:02 +00:00
|
|
|
void TestSkippable();
|
2010-02-16 23:43:22 +00:00
|
|
|
void TestCustomComp();
|
2010-02-18 18:33:00 +00:00
|
|
|
void TestCustomFCC();
|
2010-10-12 16:38:38 +00:00
|
|
|
void TestFilteredNormalizer2Coverage();
|
2017-06-02 21:19:33 +00:00
|
|
|
void TestNormalizeUTF8WithEdits();
|
2017-07-14 22:38:40 +00:00
|
|
|
void TestLowMappingToEmpty_D();
|
|
|
|
void TestLowMappingToEmpty_FCD();
|
|
|
|
void TestNormalizeIllFormedText();
|
2017-07-20 22:08:30 +00:00
|
|
|
void TestComposeJamoTBase();
|
2017-08-25 22:46:12 +00:00
|
|
|
void TestComposeBoundaryAfter();
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
private:
|
2001-07-11 18:29:51 +00:00
|
|
|
UnicodeString canonTests[24][3];
|
|
|
|
UnicodeString compatTests[11][3];
|
|
|
|
UnicodeString hangulCanon[2][3];
|
1999-08-16 21:50:52 +00:00
|
|
|
|
2003-05-23 17:05:19 +00:00
|
|
|
void
|
|
|
|
TestPreviousNext(const UChar *src, int32_t srcLength,
|
|
|
|
const UChar32 *expext, int32_t expectLength,
|
|
|
|
const int32_t *expectIndex, // its length=expectLength+1
|
|
|
|
int32_t srcMiddle, int32_t expectMiddle,
|
|
|
|
const char *moves,
|
|
|
|
UNormalizationMode mode,
|
|
|
|
const char *name);
|
|
|
|
|
2002-06-08 03:44:02 +00:00
|
|
|
int32_t countFoldFCDExceptions(uint32_t foldingOptions);
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
//------------------------------------------------------------------------
|
|
|
|
// Internal utilities
|
|
|
|
//
|
|
|
|
void backAndForth(Normalizer* iter, const UnicodeString& input);
|
|
|
|
|
2001-09-25 22:45:26 +00:00
|
|
|
void staticTest(UNormalizationMode mode, int options,
|
1999-08-16 21:50:52 +00:00
|
|
|
UnicodeString tests[][3], int length, int outCol);
|
|
|
|
|
|
|
|
void iterateTest(Normalizer* iter, UnicodeString tests[][3], int length, int outCol);
|
|
|
|
|
|
|
|
void assertEqual(const UnicodeString& input,
|
|
|
|
const UnicodeString& expected,
|
|
|
|
Normalizer* result,
|
|
|
|
const UnicodeString& errPrefix);
|
|
|
|
|
|
|
|
static UnicodeString hex(UChar ch);
|
|
|
|
static UnicodeString hex(const UnicodeString& str);
|
|
|
|
|
2017-07-14 22:38:40 +00:00
|
|
|
void checkLowMappingToEmpty(const Normalizer2 &n2);
|
1999-08-16 21:50:52 +00:00
|
|
|
};
|
|
|
|
|
2003-05-06 01:22:23 +00:00
|
|
|
#endif /* #if !UCONFIG_NO_NORMALIZATION */
|
|
|
|
|
1999-08-16 21:50:52 +00:00
|
|
|
#endif // _TSTNORM
|