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
|
2004-11-01 18:56:24 +00:00
|
|
|
/***********************************************************************
|
2000-01-15 02:00:06 +00:00
|
|
|
* COPYRIGHT:
|
2016-05-31 21:45:07 +00:00
|
|
|
* Copyright (c) 1997-2014, International Business Machines Corporation
|
|
|
|
* and others. All Rights Reserved.
|
2004-11-01 18:56:24 +00:00
|
|
|
***********************************************************************/
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* CollationAPITest is a third level test class. This test performs API
|
|
|
|
* related tests for the Collation framework.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _APICOLL
|
|
|
|
#define _APICOLL
|
|
|
|
|
2002-09-21 00:43:14 +00:00
|
|
|
#include "unicode/utypes.h"
|
|
|
|
|
|
|
|
#if !UCONFIG_NO_COLLATION
|
|
|
|
|
1999-12-28 23:57:50 +00:00
|
|
|
#include "unicode/tblcoll.h"
|
2001-08-31 18:02:09 +00:00
|
|
|
#include "tscoll.h"
|
1999-08-16 21:50:52 +00:00
|
|
|
|
2001-08-31 18:02:09 +00:00
|
|
|
class CollationAPITest: public IntlTestCollator {
|
1999-08-16 21:50:52 +00:00
|
|
|
public:
|
2000-08-23 19:11:16 +00:00
|
|
|
void runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par = NULL */);
|
2000-05-18 22:08:39 +00:00
|
|
|
void doAssert(UBool condition, const char *message);
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This tests the properties of a collator object.
|
|
|
|
* - constructor/destructor
|
|
|
|
* - factory method createInstance
|
|
|
|
* - compare and getCollationKey
|
|
|
|
* - get/set decomposition mode and comparison level
|
|
|
|
* - displayable name in the desired locale
|
|
|
|
*/
|
2000-08-23 19:11:16 +00:00
|
|
|
void TestProperty(/* char* par */);
|
2016-10-26 22:05:50 +00:00
|
|
|
void TestKeywordValues();
|
1999-08-16 21:50:52 +00:00
|
|
|
|
2001-03-23 00:57:44 +00:00
|
|
|
/**
|
|
|
|
* This tests the RuleBasedCollator
|
|
|
|
* - constructor/destructor
|
|
|
|
* - getRules
|
|
|
|
*/
|
|
|
|
void TestRuleBasedColl(/* char* par */);
|
|
|
|
|
2002-02-13 02:57:21 +00:00
|
|
|
/**
|
|
|
|
* This tests the RuleBasedCollator
|
|
|
|
* - getRules
|
|
|
|
*/
|
|
|
|
void TestRules(/* char* par */);
|
|
|
|
|
2001-03-23 00:57:44 +00:00
|
|
|
/**
|
|
|
|
* Tests decomposition setting
|
|
|
|
*/
|
|
|
|
void TestDecomposition();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* SafeClone test
|
|
|
|
*/
|
|
|
|
void TestSafeClone();
|
|
|
|
|
1999-08-16 21:50:52 +00:00
|
|
|
/**
|
|
|
|
* This tests the properties of a rule based collator object.
|
|
|
|
* - constructor/destructor
|
|
|
|
* - == and != operators
|
|
|
|
* - clone and copy
|
|
|
|
* - collation rules access
|
|
|
|
*/
|
2000-08-23 19:11:16 +00:00
|
|
|
void TestOperators(/* char* par */);
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This tests the duplication of a collator object.
|
|
|
|
*/
|
2000-08-23 19:11:16 +00:00
|
|
|
void TestDuplicate(/* char* par */);
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This tests the comparison convenience methods of a collator object.
|
|
|
|
* - greater than
|
|
|
|
* - greater than or equal to
|
|
|
|
* - equal to
|
|
|
|
*/
|
2000-08-23 19:11:16 +00:00
|
|
|
void TestCompare(/* char* par */);
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This tests the hashCode method of a collator object.
|
|
|
|
*/
|
2000-08-23 19:11:16 +00:00
|
|
|
void TestHashCode(/* char* par */);
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This tests the collation key related APIs.
|
|
|
|
* - constructor/destructor
|
|
|
|
* - Collator::getCollationKey
|
|
|
|
* - == and != operators
|
|
|
|
* - comparison between collation keys
|
|
|
|
* - creating collation key with a byte array and vice versa
|
|
|
|
*/
|
2000-08-23 19:11:16 +00:00
|
|
|
void TestCollationKey(/* char* par */);
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This tests the CollationElementIterator related APIs.
|
|
|
|
* - creation of a CollationElementIterator object
|
|
|
|
* - == and != operators
|
|
|
|
* - iterating forward
|
|
|
|
* - reseting the iterator index
|
|
|
|
* - requesting the order properties(primary, secondary or tertiary)
|
|
|
|
*/
|
2000-08-23 19:11:16 +00:00
|
|
|
void TestElemIter(/* char* par */);
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This tests the list the all available locales.
|
|
|
|
*/
|
2000-08-23 19:11:16 +00:00
|
|
|
void TestGetAll(/* char* par */);
|
1999-08-16 21:50:52 +00:00
|
|
|
|
2001-06-26 17:44:23 +00:00
|
|
|
/**
|
|
|
|
* This tests the sort keys generated by collator
|
|
|
|
*/
|
|
|
|
void TestSortKey();
|
2011-05-03 00:29:45 +00:00
|
|
|
void TestSortKeyOverflow();
|
2001-06-26 17:44:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This tests getMaxExpansion
|
|
|
|
*/
|
|
|
|
void TestMaxExpansion();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Tests the retrieval of names given a locale
|
|
|
|
*/
|
|
|
|
void TestDisplayName();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Tests the collator attributes
|
|
|
|
*/
|
|
|
|
void TestAttribute();
|
|
|
|
|
2001-06-26 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* Tests the setters and getters of variable top
|
|
|
|
*/
|
|
|
|
void TestVariableTopSetting();
|
2014-02-25 21:21:49 +00:00
|
|
|
void TestMaxVariable();
|
2001-06-26 22:25:23 +00:00
|
|
|
|
2002-02-28 21:51:25 +00:00
|
|
|
/**
|
|
|
|
* Tests GetLocale for a Collator
|
|
|
|
*/
|
|
|
|
void TestGetLocale();
|
2002-08-10 00:12:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Tests bounds API
|
|
|
|
*/
|
|
|
|
void TestBounds();
|
|
|
|
|
2002-09-17 06:27:51 +00:00
|
|
|
/**
|
|
|
|
* Tests getTailoredSet API
|
|
|
|
*/
|
|
|
|
void TestGetTailoredSet();
|
|
|
|
|
2004-11-11 23:34:58 +00:00
|
|
|
/**
|
2002-12-10 06:02:50 +00:00
|
|
|
* Tests the subclassability
|
|
|
|
*/
|
|
|
|
void TestSubclass();
|
|
|
|
|
2004-11-11 23:34:58 +00:00
|
|
|
/**
|
2002-11-21 21:43:03 +00:00
|
|
|
* Tests the dynamic and static ids of collation classes
|
|
|
|
*/
|
|
|
|
void TestUClassID();
|
|
|
|
|
2004-06-03 19:26:16 +00:00
|
|
|
/**
|
|
|
|
* Test NULL
|
|
|
|
*/
|
|
|
|
void TestNULLCharTailoring();
|
|
|
|
|
2006-08-09 22:16:47 +00:00
|
|
|
void TestClone();
|
2014-02-25 21:21:49 +00:00
|
|
|
void TestCloneBinary();
|
2013-09-13 03:07:39 +00:00
|
|
|
void TestIterNumeric();
|
2014-05-27 18:50:10 +00:00
|
|
|
void TestBadKeywords();
|
2017-05-05 19:36:48 +00:00
|
|
|
void TestGapTooSmall();
|
2013-09-13 03:07:39 +00:00
|
|
|
|
1999-08-16 21:50:52 +00:00
|
|
|
private:
|
2001-03-30 01:22:03 +00:00
|
|
|
// If this is too small for the test data, just increase it.
|
|
|
|
// Just don't make it too large, otherwise the executable will get too big
|
|
|
|
enum EToken_Len { MAX_TOKEN_LEN = 16 };
|
1999-08-16 21:50:52 +00:00
|
|
|
|
2006-08-09 22:16:47 +00:00
|
|
|
void dump(UnicodeString msg, RuleBasedCollator* c, UErrorCode& status);
|
|
|
|
|
1999-08-16 21:50:52 +00:00
|
|
|
};
|
2002-09-21 00:43:14 +00:00
|
|
|
|
|
|
|
#endif /* #if !UCONFIG_NO_COLLATION */
|
|
|
|
|
1999-08-16 21:50:52 +00:00
|
|
|
#endif
|