mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-08 06:53:45 +00:00
ICU-4184 updated test to improve flexibility. This test does fail, so it was commented out until fixed. Added comments to the ticket.
X-SVN-Rev: 24664
This commit is contained in:
parent
6bb97a85f6
commit
1c2cc48c0d
1 changed files with 33 additions and 10 deletions
|
@ -2262,8 +2262,13 @@ exitTestForwardBackward :
|
|||
}
|
||||
}
|
||||
|
||||
#define TEST_ASSERT(x) \
|
||||
{if ((x)==FALSE) {log_err("%s:%d: FAIL: test assertion failure \"%s\"\n", __FILE__, __LINE__, #x);\
|
||||
}}
|
||||
|
||||
static void TestSearchForNull(void)
|
||||
{
|
||||
#if 0
|
||||
UCollator *coll;
|
||||
UErrorCode ec;
|
||||
UStringSearch *search;
|
||||
|
@ -2273,28 +2278,42 @@ static void TestSearchForNull(void)
|
|||
int expectedLen;
|
||||
int expectedNum;
|
||||
int count = 0;
|
||||
const UChar zerodigit = 0x0030; /* 0 */
|
||||
const UChar nulldigit = 0x0000; /* null */
|
||||
|
||||
/* static const UChar var[(length)+1]=U_DECLARE_UTF16(cs) */
|
||||
U_STRING_DECL (pattern, "0", 1);
|
||||
U_STRING_DECL (text, "0IS 0 OK?", 9);
|
||||
const int patternlen = 1;
|
||||
const int textlen = 10;
|
||||
U_STRING_DECL (pattern, "0", patternlen);
|
||||
U_STRING_DECL (text, "_0IS 0 OK?", textlen);
|
||||
|
||||
U_STRING_INIT (pattern, "0", 1);
|
||||
U_STRING_INIT (text, "0IS 0 OK?", 9);
|
||||
expectedPos = 0;
|
||||
U_STRING_INIT (pattern, "0", patternlen);
|
||||
U_STRING_INIT (text, "_0IS 0 OK?", textlen);
|
||||
expectedPos = 1;
|
||||
expectedLen = 1;
|
||||
expectedNum = 2;
|
||||
|
||||
for(pos=0;pos<patternlen;pos++) {
|
||||
if(pattern[pos]==zerodigit) pattern[pos] = nulldigit;
|
||||
}
|
||||
for(pos=0;pos<textlen;pos++) {
|
||||
if(text[pos]==zerodigit) text[pos] = nulldigit;
|
||||
}
|
||||
|
||||
|
||||
ec=U_ZERO_ERROR;
|
||||
|
||||
/* create a US-English collator */
|
||||
coll = ucol_open ("en-US", &ec);
|
||||
|
||||
coll = ucol_open ("en_US", &ec);
|
||||
|
||||
/* make sure we didn't fail. */
|
||||
assert (U_SUCCESS (ec));
|
||||
TEST_ASSERT (U_SUCCESS (ec));
|
||||
|
||||
ucol_setStrength( coll, UCOL_IDENTICAL);
|
||||
|
||||
/* open a search looking for 0 */
|
||||
search = usearch_openFromCollator (pattern, 1, text, 8, coll, NULL, &ec);
|
||||
assert (U_SUCCESS (ec));
|
||||
search = usearch_openFromCollator (pattern, 1, text, 9, coll, NULL, &ec);
|
||||
TEST_ASSERT (U_SUCCESS (ec));
|
||||
|
||||
pos = usearch_first(search, &ec);
|
||||
len = usearch_getMatchedLength(search);
|
||||
|
@ -2310,6 +2329,7 @@ static void TestSearchForNull(void)
|
|||
|
||||
for(pos = usearch_first (search, &ec); pos != USEARCH_DONE; pos = usearch_next(search, &ec))
|
||||
{
|
||||
log_verbose("Match at %d\n", pos);
|
||||
count += 1;
|
||||
}
|
||||
|
||||
|
@ -2317,6 +2337,9 @@ static void TestSearchForNull(void)
|
|||
{
|
||||
log_err("Expected %d search hits, found %d\n", expectedNum, count);
|
||||
}
|
||||
#else
|
||||
log_info("Note: test disabled because it is known to fail (#4184).\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue