From 176ee6d51644b0ac9c882d69d926684540210235 Mon Sep 17 00:00:00 2001 From: Vladimir Weinstein Date: Fri, 15 Mar 2002 23:51:22 +0000 Subject: [PATCH] ICU-1770 tests for indirect positioning & adaptation of tests that use internal APIs X-SVN-Rev: 8064 --- icu4c/source/test/cintltst/citertst.c | 4 +-- icu4c/source/test/cintltst/cmsccoll.c | 41 ++++++++++++++++++++++++--- 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/icu4c/source/test/cintltst/citertst.c b/icu4c/source/test/cintltst/citertst.c index 0335b54f40..586fb3d3f0 100644 --- a/icu4c/source/test/cintltst/citertst.c +++ b/icu4c/source/test/cintltst/citertst.c @@ -1734,7 +1734,7 @@ static void TestCEValidity() UColTokenParser src; uint32_t strength = 0; - uint8_t specs = 0; + uint16_t specs = 0; coll = ucol_open(locale[count], &status); if (U_FAILURE(status)) { @@ -1914,7 +1914,7 @@ static void TestSortKeyValidity(void) UColTokenParser src; uint32_t strength = 0; - uint8_t specs = 0; + uint16_t specs = 0; coll = ucol_open(locale[count], &status); if (U_FAILURE(status)) { diff --git a/icu4c/source/test/cintltst/cmsccoll.c b/icu4c/source/test/cintltst/cmsccoll.c index 3b52505332..9466e8d7a8 100644 --- a/icu4c/source/test/cintltst/cmsccoll.c +++ b/icu4c/source/test/cintltst/cmsccoll.c @@ -629,7 +629,7 @@ static void testCollator(UCollator *coll, UErrorCode *status) { /* uint32_t rExpsLen = 0; */ uint32_t firstLen = 0; UBool varT = FALSE; UBool top_ = TRUE; - uint8_t specs = 0; + uint16_t specs = 0; UBool startOfRules = TRUE; UBool lastReset = FALSE; UBool before = FALSE; @@ -667,6 +667,9 @@ static void testCollator(UCollator *coll, UErrorCode *status) { startOfRules = FALSE; varT = (UBool)((specs & UCOL_TOK_VARIABLE_TOP) != 0); top_ = (UBool)((specs & UCOL_TOK_TOP) != 0); + if(top_) { /* if reset is on top, we should just continue */ + continue; + } u_strncpy(second,rulesCopy+chOffset, chLen); second[chLen] = 0; @@ -988,7 +991,7 @@ static void testAgainstUCA(UCollator *coll, UCollator *UCA, const char *refName, /* uint32_t rExpsLen = 0; */ uint32_t firstLen = 0, secondLen = 0; UBool varT = FALSE; UBool top_ = TRUE; - uint8_t specs = 0; + uint16_t specs = 0; UBool startOfRules = TRUE; UColTokenParser src; UColOptionSet opts; @@ -1084,7 +1087,7 @@ static void testCEs(UCollator *coll, UErrorCode *status) { /* uint32_t rExpsLen = 0; */ /* uint32_t firstLen = 0; */ - uint8_t specs = 0; + uint16_t specs = 0; UBool varT = FALSE; UBool top_ = TRUE; UBool startOfRules = TRUE; UColTokenParser src; @@ -2786,7 +2789,7 @@ static void TestVariableTopSetting() { UCollator *coll = ucol_open("", &status); uint32_t strength = 0; - uint8_t specs = 0; + uint16_t specs = 0; uint32_t chOffset = 0; uint32_t chLen = 0; uint32_t exOffset = 0; @@ -3446,9 +3449,39 @@ static void TestMergeSortKeys() { /* need to finish this up */ } +/* +[last variable] last variable value +[last primary ignorable] largest CE for primary ignorable +[last secondary ignorable] largest CE for secondary ignorable +[last tertiary ignorable] largest CE for tertiary ignorable +[top] guaranteed to be above all implicit CEs, for now and in the future (in 1.8) +*/ + +void TestRuleOptions() { + static struct { + const char *rules; + const char *data[50]; + const uint32_t len; + } tests[] = { + { "&[last variable]