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
|
1999-12-16 01:41:19 +00:00
|
|
|
/*
|
|
|
|
**********************************************************************
|
2016-05-31 21:45:07 +00:00
|
|
|
* Copyright (C) 1999-2003, International Business Machines
|
|
|
|
* Corporation and others. All Rights Reserved.
|
1999-12-16 01:41:19 +00:00
|
|
|
**********************************************************************
|
|
|
|
* Date Name Description
|
|
|
|
* 12/09/99 aliu Ported from Java.
|
|
|
|
**********************************************************************
|
|
|
|
*/
|
|
|
|
|
2001-08-31 18:02:09 +00:00
|
|
|
#ifndef COLLATIONTHAITEST_H
|
|
|
|
#define COLLATIONTHAITEST_H
|
1999-12-16 01:41:19 +00:00
|
|
|
|
2002-09-21 00:43:14 +00:00
|
|
|
#include "unicode/utypes.h"
|
|
|
|
|
|
|
|
#if !UCONFIG_NO_COLLATION
|
|
|
|
|
2001-08-31 18:02:09 +00:00
|
|
|
#include "tscoll.h"
|
1999-12-16 01:41:19 +00:00
|
|
|
|
2001-08-31 18:02:09 +00:00
|
|
|
class CollationThaiTest : public IntlTestCollator {
|
1999-12-16 01:41:19 +00:00
|
|
|
Collator* coll; // Thai collator
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
CollationThaiTest();
|
2000-04-18 17:58:18 +00:00
|
|
|
virtual ~CollationThaiTest();
|
1999-12-16 01:41:19 +00:00
|
|
|
|
2000-08-14 21:42:36 +00:00
|
|
|
void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
|
1999-12-16 01:41:19 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Read the external dictionary file, which is already in proper
|
|
|
|
* sorted order, and confirm that the collator compares each line as
|
|
|
|
* preceding the following line.
|
|
|
|
*/
|
1999-12-22 22:57:04 +00:00
|
|
|
void TestDictionary(void);
|
1999-12-16 01:41:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Odd corner conditions taken from "How to Sort Thai Without Rewriting Sort",
|
|
|
|
* by Doug Cooper, http://seasrc.th.net/paper/thaisort.zip
|
|
|
|
*/
|
1999-12-22 22:57:04 +00:00
|
|
|
void TestCornerCases(void);
|
1999-12-16 01:41:19 +00:00
|
|
|
|
2003-02-20 01:23:41 +00:00
|
|
|
/**
|
|
|
|
* Read the external names list, and confirms that the collator
|
|
|
|
* gets the same results when comparing lines one to another
|
|
|
|
* using regular and iterative comparison.
|
|
|
|
*/
|
|
|
|
void TestNamesList(void);
|
|
|
|
|
2003-07-16 22:48:25 +00:00
|
|
|
/**
|
|
|
|
* test that invalid Thai sorts properly
|
|
|
|
*/
|
|
|
|
void TestInvalidThai(void);
|
2003-07-23 22:49:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* test that reording is done properly
|
|
|
|
*/
|
|
|
|
void TestReordering(void);
|
|
|
|
|
1999-12-16 01:41:19 +00:00
|
|
|
private:
|
|
|
|
|
2003-07-23 22:49:25 +00:00
|
|
|
void compareArray(Collator& c, const char* tests[],
|
1999-12-16 01:41:19 +00:00
|
|
|
int32_t testsLength);
|
|
|
|
|
|
|
|
int8_t sign(int32_t i);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set a UnicodeString corresponding to the given string. Use
|
|
|
|
* UnicodeString and the default converter, unless we see the sequence
|
|
|
|
* "\\u", in which case we interpret the subsequent escape.
|
|
|
|
*/
|
|
|
|
UnicodeString& parseChars(UnicodeString& result,
|
|
|
|
const char* chars);
|
|
|
|
};
|
2001-08-31 18:02:09 +00:00
|
|
|
|
2002-09-21 00:43:14 +00:00
|
|
|
#endif /* #if !UCONFIG_NO_COLLATION */
|
|
|
|
|
2001-08-31 18:02:09 +00:00
|
|
|
#endif
|