ICU-432 changes according to purify output

X-SVN-Rev: 1607
This commit is contained in:
Vladimir Weinstein 2000-06-12 22:42:50 +00:00
parent baffa188a7
commit f66f0b6dfb
10 changed files with 135 additions and 73 deletions

View file

@ -190,27 +190,33 @@ void addDanishCollTest(TestNode** root)
void doTest(UCollator* myCollation, const UChar source[], const UChar target[], UCollationResult result)
{
int32_t sortklen;
int32_t sortklen1, sortklen2, sortklenmax, sortklenmin;
int32_t temp;
UCollationResult compareResult, keyResult;
uint8_t *sortKey1, *sortKey2;
compareResult = ucol_strcoll(myCollation, source, u_strlen(source), target, u_strlen(target));
sortklen=ucol_getSortKey(myCollation, source, u_strlen(source), NULL, 0);
sortKey1=(uint8_t*)malloc(sizeof(uint8_t) * (sortklen+1));
ucol_getSortKey(myCollation, source, u_strlen(source), sortKey1, sortklen+1);
sortklen1=ucol_getSortKey(myCollation, source, u_strlen(source), NULL, 0);
sortklen2=ucol_getSortKey(myCollation, target, u_strlen(target), NULL, 0);
sortklenmax = (sortklen1>sortklen2?sortklen1:sortklen2);
sortklenmin = (sortklen1<sortklen2?sortklen1:sortklen2);
sortKey1=(uint8_t*)malloc(sizeof(uint8_t) * (sortklenmax+1));
ucol_getSortKey(myCollation, source, u_strlen(source), sortKey1, sortklen1+1);
sortklen=ucol_getSortKey(myCollation, target, u_strlen(target), NULL, 0);
sortKey2=(uint8_t*)malloc(sizeof(uint8_t) * (sortklen+1));
ucol_getSortKey(myCollation, target, u_strlen(target), sortKey2, sortklen+1);
sortKey2=(uint8_t*)malloc(sizeof(uint8_t) * (sortklenmax+1));
ucol_getSortKey(myCollation, target, u_strlen(target), sortKey2, sortklen2+1);
temp= memcmp(sortKey1, sortKey2, sortklen);
temp= memcmp(sortKey1, sortKey2, sortklenmin);
if(temp < 0) keyResult=UCOL_LESS;
else if(temp > 0) keyResult= UCOL_GREATER;
else keyResult = UCOL_EQUAL;
reportCResult( source, target, sortKey1, sortKey2, compareResult, keyResult, result );
free(sortKey1);
free(sortKey2);
}
void TestTertiary( )

View file

@ -92,27 +92,33 @@ void addGermanCollTest(TestNode** root)
}
void doTest(UCollator* myCollation, const UChar source[], const UChar target[], UCollationResult result)
{
int32_t sortklen, temp;
int32_t sortklen1, sortklen2, sortklenmax, sortklenmin;
int32_t temp;
UCollationResult compareResult, keyResult;
uint8_t *sortKey1, *sortKey2;
compareResult = ucol_strcoll(myCollation, source, u_strlen(source), target, u_strlen(target));
sortklen=ucol_getSortKey(myCollation, source, u_strlen(source), NULL, 0);
sortKey1=(uint8_t*)malloc(sizeof(uint8_t) * (sortklen+1));
ucol_getSortKey(myCollation, source, u_strlen(source), sortKey1, sortklen+1);
sortklen1=ucol_getSortKey(myCollation, source, u_strlen(source), NULL, 0);
sortklen2=ucol_getSortKey(myCollation, target, u_strlen(target), NULL, 0);
sortklenmax = (sortklen1>sortklen2?sortklen1:sortklen2);
sortklenmin = (sortklen1<sortklen2?sortklen1:sortklen2);
sortKey1=(uint8_t*)malloc(sizeof(uint8_t) * (sortklenmax+1));
ucol_getSortKey(myCollation, source, u_strlen(source), sortKey1, sortklen1+1);
sortklen=ucol_getSortKey(myCollation, target, u_strlen(target), NULL, 0);
sortKey2=(uint8_t*)malloc(sizeof(uint8_t) * (sortklen+1));
ucol_getSortKey(myCollation, target, u_strlen(target), sortKey2, sortklen+1);
sortKey2=(uint8_t*)malloc(sizeof(uint8_t) * (sortklenmax+1));
ucol_getSortKey(myCollation, target, u_strlen(target), sortKey2, sortklen2+1);
temp= memcmp(sortKey1, sortKey2, sortklen);
temp= memcmp(sortKey1, sortKey2, sortklenmin);
if(temp < 0) keyResult=UCOL_LESS;
else if(temp > 0) keyResult= UCOL_GREATER;
else keyResult = UCOL_EQUAL;
reportCResult( source, target, sortKey1, sortKey2, compareResult, keyResult, result );
free(sortKey1);
free(sortKey2);
}
void TestTertiary( )

View file

@ -76,26 +76,33 @@ void addSpanishCollTest(TestNode** root)
}
void doTest(UCollator* myCollation, const UChar source[], const UChar target[], UCollationResult result)
{
int32_t sortklen, temp;
int32_t sortklen1, sortklen2, sortklenmax, sortklenmin;
int32_t temp;
UCollationResult compareResult, keyResult;
uint8_t *sortKey1, *sortKey2;
compareResult = ucol_strcoll(myCollation, source, u_strlen(source), target, u_strlen(target));
sortklen=ucol_getSortKey(myCollation, source, u_strlen(source), NULL, 0);
sortKey1=(uint8_t*)malloc(sizeof(uint8_t) * (sortklen+1));
ucol_getSortKey(myCollation, source, u_strlen(source), sortKey1, sortklen+1);
sortklen1=ucol_getSortKey(myCollation, source, u_strlen(source), NULL, 0);
sortklen2=ucol_getSortKey(myCollation, target, u_strlen(target), NULL, 0);
sortklenmax = (sortklen1>sortklen2?sortklen1:sortklen2);
sortklenmin = (sortklen1<sortklen2?sortklen1:sortklen2);
sortKey1=(uint8_t*)malloc(sizeof(uint8_t) * (sortklenmax+1));
ucol_getSortKey(myCollation, source, u_strlen(source), sortKey1, sortklen1+1);
sortklen=ucol_getSortKey(myCollation, target, u_strlen(target), NULL, 0);
sortKey2=(uint8_t*)malloc(sizeof(uint8_t) * (sortklen+1));
ucol_getSortKey(myCollation, target, u_strlen(target), sortKey2, sortklen+1);
sortKey2=(uint8_t*)malloc(sizeof(uint8_t) * (sortklenmax+1));
ucol_getSortKey(myCollation, target, u_strlen(target), sortKey2, sortklen2+1);
temp= memcmp(sortKey1, sortKey2, sortklen);
temp= memcmp(sortKey1, sortKey2, sortklenmin);
if(temp < 0) keyResult=UCOL_LESS;
else if(temp > 0) keyResult= UCOL_GREATER;
else keyResult = UCOL_EQUAL;
reportCResult( source, target, sortKey1, sortKey2, compareResult, keyResult, result );
free(sortKey1);
free(sortKey2);
}
void TestTertiary( )

View file

@ -67,26 +67,33 @@ void addFinnishCollTest(TestNode** root)
}
void doTest(UCollator* myCollation, const UChar source[], const UChar target[], UCollationResult result)
{
int32_t sortklen, temp;
int32_t sortklen1, sortklen2, sortklenmax, sortklenmin;
int32_t temp;
UCollationResult compareResult, keyResult;
uint8_t *sortKey1, *sortKey2;
compareResult = ucol_strcoll(myCollation, source, u_strlen(source), target, u_strlen(target));
sortklen=ucol_getSortKey(myCollation, source, u_strlen(source), NULL, 0);
sortKey1=(uint8_t*)malloc(sizeof(uint8_t) * (sortklen+1));
ucol_getSortKey(myCollation, source, u_strlen(source), sortKey1, sortklen+1);
sortklen1=ucol_getSortKey(myCollation, source, u_strlen(source), NULL, 0);
sortklen2=ucol_getSortKey(myCollation, target, u_strlen(target), NULL, 0);
sortklenmax = (sortklen1>sortklen2?sortklen1:sortklen2);
sortklenmin = (sortklen1<sortklen2?sortklen1:sortklen2);
sortKey1=(uint8_t*)malloc(sizeof(uint8_t) * (sortklenmax+1));
ucol_getSortKey(myCollation, source, u_strlen(source), sortKey1, sortklen1+1);
sortklen=ucol_getSortKey(myCollation, target, u_strlen(target), NULL, 0);
sortKey2=(uint8_t*)malloc(sizeof(uint8_t) * (sortklen+1));
ucol_getSortKey(myCollation, target, u_strlen(target), sortKey2, sortklen+1);
sortKey2=(uint8_t*)malloc(sizeof(uint8_t) * (sortklenmax+1));
ucol_getSortKey(myCollation, target, u_strlen(target), sortKey2, sortklen2+1);
temp= memcmp(sortKey1, sortKey2, sortklen);
temp= memcmp(sortKey1, sortKey2, sortklenmin);
if(temp < 0) keyResult=UCOL_LESS;
else if(temp > 0) keyResult= UCOL_GREATER;
else keyResult = UCOL_EQUAL;
reportCResult( source, target, sortKey1, sortKey2, compareResult, keyResult, result );
free(sortKey1);
free(sortKey2);
}
void TestTertiary( )

View file

@ -137,26 +137,33 @@ void addFrenchCollTest(TestNode** root)
void doTest(UCollator* myCollation, const UChar source[], const UChar target[], UCollationResult result)
{
int32_t sortklen, temp;
int32_t sortklen1, sortklen2, sortklenmax, sortklenmin;
int32_t temp;
UCollationResult compareResult, keyResult;
uint8_t *sortKey1, *sortKey2;
compareResult = ucol_strcoll(myCollation, source, u_strlen(source), target, u_strlen(target));
sortklen=ucol_getSortKey(myCollation, source, u_strlen(source), NULL, 0);
sortKey1=(uint8_t*)malloc(sizeof(uint8_t) * (sortklen+1));
ucol_getSortKey(myCollation, source, u_strlen(source), sortKey1, sortklen+1);
sortklen1=ucol_getSortKey(myCollation, source, u_strlen(source), NULL, 0);
sortklen2=ucol_getSortKey(myCollation, target, u_strlen(target), NULL, 0);
sortklenmax = (sortklen1>sortklen2?sortklen1:sortklen2);
sortklenmin = (sortklen1<sortklen2?sortklen1:sortklen2);
sortKey1=(uint8_t*)malloc(sizeof(uint8_t) * (sortklenmax+1));
ucol_getSortKey(myCollation, source, u_strlen(source), sortKey1, sortklen1+1);
sortklen=ucol_getSortKey(myCollation, target, u_strlen(target), NULL, 0);
sortKey2=(uint8_t*)malloc(sizeof(uint8_t) * (sortklen+1));
ucol_getSortKey(myCollation, target, u_strlen(target), sortKey2, sortklen+1);
sortKey2=(uint8_t*)malloc(sizeof(uint8_t) * (sortklenmax+1));
ucol_getSortKey(myCollation, target, u_strlen(target), sortKey2, sortklen2+1);
temp= memcmp(sortKey1, sortKey2, sortklen);
temp= memcmp(sortKey1, sortKey2, sortklenmin);
if(temp < 0) keyResult=UCOL_LESS;
else if(temp > 0) keyResult= UCOL_GREATER;
else keyResult = UCOL_EQUAL;
reportCResult( source, target, sortKey1, sortKey2, compareResult, keyResult, result );
free(sortKey1);
free(sortKey2);
}
void TestTertiary( )

View file

@ -158,26 +158,33 @@ void addRuleBasedCollTest(TestNode** root)
}
void doTest(UCollator *myCollation, const UChar source[], const UChar target[], UCollationResult result)
{
int32_t sortklen, temp;
int32_t sortklen1, sortklen2, sortklenmax, sortklenmin;
int32_t temp;
UCollationResult compareResult, keyResult;
uint8_t *sortKey1, *sortKey2;
compareResult = ucol_strcoll(myCollation, source, u_strlen(source), target, u_strlen(target));
sortklen=ucol_getSortKey(myCollation, source, u_strlen(source), NULL, 0);
sortKey1=(uint8_t*)malloc(sizeof(uint8_t) * (sortklen+1));
ucol_getSortKey(myCollation, source, u_strlen(source), sortKey1, sortklen+1);
sortklen1=ucol_getSortKey(myCollation, source, u_strlen(source), NULL, 0);
sortklen2=ucol_getSortKey(myCollation, target, u_strlen(target), NULL, 0);
sortklenmax = (sortklen1>sortklen2?sortklen1:sortklen2);
sortklenmin = (sortklen1<sortklen2?sortklen1:sortklen2);
sortKey1=(uint8_t*)malloc(sizeof(uint8_t) * (sortklenmax+1));
ucol_getSortKey(myCollation, source, u_strlen(source), sortKey1, sortklen1+1);
sortklen=ucol_getSortKey(myCollation, target, u_strlen(target), NULL, 0);
sortKey2=(uint8_t*)malloc(sizeof(uint8_t) * (sortklen+1));
ucol_getSortKey(myCollation, target, u_strlen(target), sortKey2, sortklen+1);
sortKey2=(uint8_t*)malloc(sizeof(uint8_t) * (sortklenmax+1));
ucol_getSortKey(myCollation, target, u_strlen(target), sortKey2, sortklen2+1);
temp= memcmp(sortKey1, sortKey2, sortklen);
temp= memcmp(sortKey1, sortKey2, sortklenmin);
if(temp < 0) keyResult=UCOL_LESS;
else if(temp > 0) keyResult= UCOL_GREATER;
else keyResult = UCOL_EQUAL;
reportCResult( source, target, sortKey1, sortKey2, compareResult, keyResult, result );
free(sortKey1);
free(sortKey2);
}
void TestG7Locales()

View file

@ -79,26 +79,33 @@ void addKannaCollTest(TestNode** root)
}
void doTest(UCollator* myCollation, const UChar source[], const UChar target[], UCollationResult result)
{
int32_t sortklen, temp;
int32_t sortklen1, sortklen2, sortklenmax, sortklenmin;
int32_t temp;
UCollationResult compareResult, keyResult;
uint8_t *sortKey1, *sortKey2;
compareResult = ucol_strcoll(myCollation, source, u_strlen(source), target, u_strlen(target));
sortklen=ucol_getSortKey(myCollation, source, u_strlen(source), NULL, 0);
sortKey1=(uint8_t*)malloc(sizeof(uint8_t) * (sortklen+1));
ucol_getSortKey(myCollation, source, u_strlen(source), sortKey1, sortklen+1);
sortklen1=ucol_getSortKey(myCollation, source, u_strlen(source), NULL, 0);
sortklen2=ucol_getSortKey(myCollation, target, u_strlen(target), NULL, 0);
sortklenmax = (sortklen1>sortklen2?sortklen1:sortklen2);
sortklenmin = (sortklen1<sortklen2?sortklen1:sortklen2);
sortKey1=(uint8_t*)malloc(sizeof(uint8_t) * (sortklenmax+1));
ucol_getSortKey(myCollation, source, u_strlen(source), sortKey1, sortklen1+1);
sortklen=ucol_getSortKey(myCollation, target, u_strlen(target), NULL, 0);
sortKey2=(uint8_t*)malloc(sizeof(uint8_t) * (sortklen+1));
ucol_getSortKey(myCollation, target, u_strlen(target), sortKey2, sortklen+1);
sortKey2=(uint8_t*)malloc(sizeof(uint8_t) * (sortklenmax+1));
ucol_getSortKey(myCollation, target, u_strlen(target), sortKey2, sortklen2+1);
temp= memcmp(sortKey1, sortKey2, sortklen);
temp= memcmp(sortKey1, sortKey2, sortklenmin);
if(temp < 0) keyResult=UCOL_LESS;
else if(temp > 0) keyResult= UCOL_GREATER;
else keyResult = UCOL_EQUAL;
reportCResult( source, target, sortKey1, sortKey2, compareResult, keyResult, result );
free(sortKey1);
free(sortKey2);
}
void TestTertiary( )

View file

@ -754,6 +754,7 @@ void TestForwardWordSelection()
/* sample(e, testWordText); */
log_verbose("Testing forward word selection.....\n");
doForwardSelectionTest(e, testWordText, wordSelectionData);
doForwardSelectionTest(e, testWordText, wordSelectionData);
ubrk_close(e);
free(wordSelectionData);
}

View file

@ -83,26 +83,33 @@ void addTurkishCollTest(TestNode** root)
}
void doTest(UCollator* myCollation, const UChar source[], const UChar target[], UCollationResult result)
{
int32_t sortklen, temp;
int32_t sortklen1, sortklen2, sortklenmax, sortklenmin;
int32_t temp;
UCollationResult compareResult, keyResult;
uint8_t *sortKey1, *sortKey2;
compareResult = ucol_strcoll(myCollation, source, u_strlen(source), target, u_strlen(target));
sortklen=ucol_getSortKey(myCollation, source, u_strlen(source), NULL, 0);
sortKey1=(uint8_t*)malloc(sizeof(uint8_t) * (sortklen+1));
ucol_getSortKey(myCollation, source, u_strlen(source), sortKey1, sortklen+1);
sortklen1=ucol_getSortKey(myCollation, source, u_strlen(source), NULL, 0);
sortklen2=ucol_getSortKey(myCollation, target, u_strlen(target), NULL, 0);
sortklenmax = (sortklen1>sortklen2?sortklen1:sortklen2);
sortklenmin = (sortklen1<sortklen2?sortklen1:sortklen2);
sortKey1=(uint8_t*)malloc(sizeof(uint8_t) * (sortklenmax+1));
ucol_getSortKey(myCollation, source, u_strlen(source), sortKey1, sortklen1+1);
sortklen=ucol_getSortKey(myCollation, target, u_strlen(target), NULL, 0);
sortKey2=(uint8_t*)malloc(sizeof(uint8_t) * (sortklen+1));
ucol_getSortKey(myCollation, target, u_strlen(target), sortKey2, sortklen+1);
sortKey2=(uint8_t*)malloc(sizeof(uint8_t) * (sortklenmax+1));
ucol_getSortKey(myCollation, target, u_strlen(target), sortKey2, sortklen2+1);
temp= memcmp(sortKey1, sortKey2, sortklen);
temp= memcmp(sortKey1, sortKey2, sortklenmin);
if(temp < 0) keyResult=UCOL_LESS;
else if(temp > 0) keyResult= UCOL_GREATER;
else keyResult = UCOL_EQUAL;
reportCResult( source, target, sortKey1, sortKey2, compareResult, keyResult, result );
free(sortKey1);
free(sortKey2);
}
void TestTertiary( )

View file

@ -255,26 +255,33 @@ void addEnglishCollTest(TestNode** root)
void doTest(UCollator* myCollation, const UChar source[], const UChar target[], UCollationResult result)
{
int32_t sortklen, temp;
int32_t sortklen1, sortklen2, sortklenmax, sortklenmin;
int32_t temp;
UCollationResult compareResult, keyResult;
uint8_t *sortKey1, *sortKey2;
compareResult = ucol_strcoll(myCollation, source, u_strlen(source), target, u_strlen(target));
sortklen=ucol_getSortKey(myCollation, source, u_strlen(source), NULL, 0);
sortKey1=(uint8_t*)malloc(sizeof(uint8_t) * (sortklen+1));
ucol_getSortKey(myCollation, source, u_strlen(source), sortKey1, sortklen+1);
sortklen1=ucol_getSortKey(myCollation, source, u_strlen(source), NULL, 0);
sortklen2=ucol_getSortKey(myCollation, target, u_strlen(target), NULL, 0);
sortklenmax = (sortklen1>sortklen2?sortklen1:sortklen2);
sortklenmin = (sortklen1<sortklen2?sortklen1:sortklen2);
sortKey1=(uint8_t*)malloc(sizeof(uint8_t) * (sortklenmax+1));
ucol_getSortKey(myCollation, source, u_strlen(source), sortKey1, sortklen1+1);
sortklen=ucol_getSortKey(myCollation, target, u_strlen(target), NULL, 0);
sortKey2=(uint8_t*)malloc(sizeof(uint8_t) * (sortklen+1));
ucol_getSortKey(myCollation, target, u_strlen(target), sortKey2, sortklen+1);
sortKey2=(uint8_t*)malloc(sizeof(uint8_t) * (sortklenmax+1));
ucol_getSortKey(myCollation, target, u_strlen(target), sortKey2, sortklen2+1);
temp= memcmp(sortKey1, sortKey2, sortklen);
temp= memcmp(sortKey1, sortKey2, sortklenmin);
if(temp < 0) keyResult=UCOL_LESS;
else if(temp > 0) keyResult= UCOL_GREATER;
else keyResult = UCOL_EQUAL;
reportCResult( source, target, sortKey1, sortKey2, compareResult, keyResult, result );
free(sortKey1);
free(sortKey2);
}
void TestTertiary( )