Lines Matching refs:strsrch
338 static UBool assertEqualWithUStringSearch( UStringSearch *strsrch, in assertEqualWithUStringSearch() argument
350 usearch_setAttribute(strsrch, USEARCH_ELEMENT_COMPARISON, search.elemCompare, &status); in assertEqualWithUStringSearch()
356 if (usearch_getMatchedStart(strsrch) != USEARCH_DONE || in assertEqualWithUStringSearch()
357 usearch_getMatchedLength(strsrch) != 0) { in assertEqualWithUStringSearch()
363 usearch_next(strsrch, &status); in assertEqualWithUStringSearch()
364 if (matchindex != usearch_getMatchedStart(strsrch) || in assertEqualWithUStringSearch()
365 matchlength != (uint32_t)usearch_getMatchedLength(strsrch)) { in assertEqualWithUStringSearch()
366 char *str = toCharString(usearch_getText(strsrch, &textlength)); in assertEqualWithUStringSearch()
368 str = toCharString(usearch_getPattern(strsrch, &textlength)); in assertEqualWithUStringSearch()
371 usearch_getMatchedStart(strsrch), usearch_getMatchedLength(strsrch), in assertEqualWithUStringSearch()
377 if (usearch_getMatchedText(strsrch, matchtext, 128, &status) != in assertEqualWithUStringSearch()
380 usearch_getText(strsrch, &textlength) + matchindex, in assertEqualWithUStringSearch()
387 usearch_next(strsrch, &status); in assertEqualWithUStringSearch()
388 if (usearch_getMatchedStart(strsrch) != USEARCH_DONE || in assertEqualWithUStringSearch()
389 usearch_getMatchedLength(strsrch) != 0) { in assertEqualWithUStringSearch()
390 char *str = toCharString(usearch_getText(strsrch, &textlength)); in assertEqualWithUStringSearch()
392 str = toCharString(usearch_getPattern(strsrch, &textlength)); in assertEqualWithUStringSearch()
395 usearch_getMatchedStart(strsrch), in assertEqualWithUStringSearch()
396 usearch_getMatchedLength(strsrch)); in assertEqualWithUStringSearch()
405 usearch_previous(strsrch, &status); in assertEqualWithUStringSearch()
406 if (matchindex != usearch_getMatchedStart(strsrch) || in assertEqualWithUStringSearch()
407 matchlength != (uint32_t)usearch_getMatchedLength(strsrch)) { in assertEqualWithUStringSearch()
408 char *str = toCharString(usearch_getText(strsrch, &textlength)); in assertEqualWithUStringSearch()
410 str = toCharString(usearch_getPattern(strsrch, &textlength)); in assertEqualWithUStringSearch()
413 usearch_getMatchedStart(strsrch), usearch_getMatchedLength(strsrch), in assertEqualWithUStringSearch()
418 if (usearch_getMatchedText(strsrch, matchtext, 128, &status) != in assertEqualWithUStringSearch()
421 usearch_getText(strsrch, &textlength) + matchindex, in assertEqualWithUStringSearch()
429 usearch_previous(strsrch, &status); in assertEqualWithUStringSearch()
430 if (usearch_getMatchedStart(strsrch) != USEARCH_DONE || in assertEqualWithUStringSearch()
431 usearch_getMatchedLength(strsrch) != 0) { in assertEqualWithUStringSearch()
432 char *str = toCharString(usearch_getText(strsrch, &textlength)); in assertEqualWithUStringSearch()
434 str = toCharString(usearch_getPattern(strsrch, &textlength)); in assertEqualWithUStringSearch()
437 usearch_getMatchedStart(strsrch), in assertEqualWithUStringSearch()
438 usearch_getMatchedLength(strsrch)); in assertEqualWithUStringSearch()
443 isOverlap = (usearch_getAttribute(strsrch, USEARCH_OVERLAP) == USEARCH_ON); in assertEqualWithUStringSearch()
451 usearch_following(strsrch, nextStart, &status); in assertEqualWithUStringSearch()
454 … if (usearch_getMatchedStart(strsrch) != USEARCH_DONE || usearch_getMatchedLength(strsrch) != 0) { in assertEqualWithUStringSearch()
455 char *str = toCharString(usearch_getText(strsrch, &textlength)); in assertEqualWithUStringSearch()
457 str = toCharString(usearch_getPattern(strsrch, &textlength)); in assertEqualWithUStringSearch()
461 usearch_getMatchedStart(strsrch), in assertEqualWithUStringSearch()
462 usearch_getMatchedLength(strsrch)); in assertEqualWithUStringSearch()
470 if (usearch_getMatchedStart(strsrch) != matchindex in assertEqualWithUStringSearch()
471 || usearch_getMatchedLength(strsrch) != matchlength in assertEqualWithUStringSearch()
473 char *str = toCharString(usearch_getText(strsrch, &textlength)); in assertEqualWithUStringSearch()
475 str = toCharString(usearch_getPattern(strsrch, &textlength)); in assertEqualWithUStringSearch()
479 usearch_getMatchedStart(strsrch), usearch_getMatchedLength(strsrch), in assertEqualWithUStringSearch()
484 if (isOverlap || usearch_getMatchedLength(strsrch) == 0) { in assertEqualWithUStringSearch()
485 nextStart = usearch_getMatchedStart(strsrch) + 1; in assertEqualWithUStringSearch()
487 nextStart = usearch_getMatchedStart(strsrch) + usearch_getMatchedLength(strsrch); in assertEqualWithUStringSearch()
499 usearch_getText(strsrch, &nextStart); in assertEqualWithUStringSearch()
502 usearch_preceding(strsrch, nextStart, &status); in assertEqualWithUStringSearch()
505 … if (usearch_getMatchedStart(strsrch) != USEARCH_DONE || usearch_getMatchedLength(strsrch) != 0) { in assertEqualWithUStringSearch()
506 char *str = toCharString(usearch_getText(strsrch, &textlength)); in assertEqualWithUStringSearch()
508 str = toCharString(usearch_getPattern(strsrch, &textlength)); in assertEqualWithUStringSearch()
512 usearch_getMatchedStart(strsrch), in assertEqualWithUStringSearch()
513 usearch_getMatchedLength(strsrch)); in assertEqualWithUStringSearch()
522 if (usearch_getMatchedStart(strsrch) != matchindex in assertEqualWithUStringSearch()
523 || usearch_getMatchedLength(strsrch) != matchlength in assertEqualWithUStringSearch()
525 char *str = toCharString(usearch_getText(strsrch, &textlength)); in assertEqualWithUStringSearch()
527 str = toCharString(usearch_getPattern(strsrch, &textlength)); in assertEqualWithUStringSearch()
531 usearch_getMatchedStart(strsrch), usearch_getMatchedLength(strsrch), in assertEqualWithUStringSearch()
540 …usearch_setAttribute(strsrch, USEARCH_ELEMENT_COMPARISON, USEARCH_STANDARD_ELEMENT_COMPARISON, &st… in assertEqualWithUStringSearch()
551 UStringSearch *strsrch; in assertEqual() local
558 strsrch = usearch_openFromCollator(pattern, -1, text, -1, collator, in assertEqual()
565 if (!assertEqualWithUStringSearch(strsrch, search)) { in assertEqual()
567 usearch_close(strsrch); in assertEqual()
571 usearch_close(strsrch); in assertEqual()
582 UStringSearch *strsrch; in assertCanonicalEqual() local
590 strsrch = usearch_openFromCollator(pattern, -1, text, -1, collator, in assertCanonicalEqual()
592 usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, USEARCH_ON, in assertCanonicalEqual()
600 if (!assertEqualWithUStringSearch(strsrch, search)) { in assertCanonicalEqual()
602 usearch_close(strsrch); in assertCanonicalEqual()
610 usearch_close(strsrch); in assertCanonicalEqual()
623 UStringSearch *strsrch; in assertEqualWithAttribute() local
629 strsrch = usearch_openFromCollator(pattern, -1, text, -1, collator, in assertEqualWithAttribute()
631 usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, canonical, in assertEqualWithAttribute()
633 usearch_setAttribute(strsrch, USEARCH_OVERLAP, overlap, &status); in assertEqualWithAttribute()
640 if (!assertEqualWithUStringSearch(strsrch, search)) { in assertEqualWithAttribute()
642 usearch_close(strsrch); in assertEqualWithAttribute()
646 usearch_close(strsrch); in assertEqualWithAttribute()
726 UStringSearch *strsrch; in TestBreakIterator() local
744 strsrch = usearch_openFromCollator(pattern, -1, text, -1, EN_US_, NULL, in TestBreakIterator()
751 usearch_setBreakIterator(strsrch, NULL, &status); in TestBreakIterator()
752 if (U_FAILURE(status) || usearch_getBreakIterator(strsrch) != NULL) { in TestBreakIterator()
757 usearch_setBreakIterator(strsrch, EN_CHARACTERBREAKER_, &status); in TestBreakIterator()
759 usearch_getBreakIterator(strsrch) != EN_CHARACTERBREAKER_) { in TestBreakIterator()
764 usearch_setBreakIterator(strsrch, EN_WORDBREAKER_, &status); in TestBreakIterator()
766 usearch_getBreakIterator(strsrch) != EN_WORDBREAKER_) { in TestBreakIterator()
771 usearch_close(strsrch); in TestBreakIterator()
784 strsrch = usearch_openFromCollator(pattern, -1, text, -1, collator, in TestBreakIterator()
787 usearch_getBreakIterator(strsrch) != breaker) { in TestBreakIterator()
789 if (strsrch != NULL) { in TestBreakIterator()
790 usearch_close(strsrch); in TestBreakIterator()
793 if (!assertEqualWithUStringSearch(strsrch, *search)) { in TestBreakIterator()
795 usearch_close(strsrch); in TestBreakIterator()
800 usearch_setBreakIterator(strsrch, breaker, &status); in TestBreakIterator()
801 if (U_FAILURE(status) || usearch_getBreakIterator(strsrch) != breaker) { in TestBreakIterator()
803 usearch_close(strsrch); in TestBreakIterator()
806 usearch_reset(strsrch); in TestBreakIterator()
807 if (!assertEqualWithUStringSearch(strsrch, *search)) { in TestBreakIterator()
809 usearch_close(strsrch); in TestBreakIterator()
812 usearch_close(strsrch); in TestBreakIterator()
885 UStringSearch *strsrch; in TestOverlap() local
890 strsrch = usearch_openFromCollator(pattern, -1, text, -1, collator, in TestOverlap()
899 usearch_setAttribute(strsrch, USEARCH_OVERLAP, USEARCH_ON, &status); in TestOverlap()
901 usearch_getAttribute(strsrch, USEARCH_OVERLAP) != USEARCH_ON) { in TestOverlap()
904 if (!assertEqualWithUStringSearch(strsrch, *search)) { in TestOverlap()
905 usearch_close(strsrch); in TestOverlap()
909 usearch_setAttribute(strsrch, USEARCH_OVERLAP, USEARCH_OFF, &status); in TestOverlap()
911 usearch_getAttribute(strsrch, USEARCH_OVERLAP) != USEARCH_OFF) { in TestOverlap()
914 usearch_reset(strsrch); in TestOverlap()
915 if (!assertEqualWithUStringSearch(strsrch, *search)) { in TestOverlap()
916 usearch_close(strsrch); in TestOverlap()
921 usearch_close(strsrch); in TestOverlap()
934 UStringSearch *strsrch; in TestCollator() local
943 strsrch = usearch_open(pattern, 2, text, 5, "en_US", NULL, &status); in TestCollator()
951 tailored = usearch_getCollator(strsrch); in TestCollator()
952 if (usearch_next(strsrch, &status) != -1) { in TestCollator()
956 usearch_reset(strsrch); in TestCollator()
957 if (usearch_next(strsrch, &status) != 1) { in TestCollator()
960 usearch_close(strsrch); in TestCollator()
970 strsrch = usearch_openFromCollator(pattern, -1, text, -1, EN_US_, in TestCollator()
975 if (!assertEqualWithUStringSearch(strsrch, COLLATOR[0])) { in TestCollator()
986 usearch_setCollator(strsrch, tailored, &status); in TestCollator()
987 if (U_FAILURE(status) || usearch_getCollator(strsrch) != tailored) { in TestCollator()
990 usearch_reset(strsrch); in TestCollator()
991 if (!assertEqualWithUStringSearch(strsrch, COLLATOR[1])) { in TestCollator()
995 usearch_setCollator(strsrch, EN_US_, &status); in TestCollator()
996 usearch_reset(strsrch); in TestCollator()
997 if (U_FAILURE(status) || usearch_getCollator(strsrch) != EN_US_) { in TestCollator()
1000 if (!assertEqualWithUStringSearch(strsrch, COLLATOR[0])) { in TestCollator()
1005 usearch_close(strsrch); in TestCollator()
1014 UStringSearch *strsrch; in TestPattern() local
1039 strsrch = usearch_openFromCollator(pattern, -1, text, -1, EN_US_, in TestPattern()
1050 usearch_setPattern(strsrch, NULL, 3, &status); in TestPattern()
1055 usearch_setPattern(strsrch, pattern, 0, &status); in TestPattern()
1064 temp = usearch_getPattern(strsrch, &templength); in TestPattern()
1068 if (!assertEqualWithUStringSearch(strsrch, PATTERN[0])) { in TestPattern()
1073 usearch_setPattern(strsrch, pattern, -1, &status); in TestPattern()
1074 temp = usearch_getPattern(strsrch, &templength); in TestPattern()
1079 usearch_reset(strsrch); in TestPattern()
1083 if (!assertEqualWithUStringSearch(strsrch, PATTERN[1])) { in TestPattern()
1088 usearch_setPattern(strsrch, pattern, -1, &status); in TestPattern()
1089 temp = usearch_getPattern(strsrch, &templength); in TestPattern()
1094 usearch_reset(strsrch); in TestPattern()
1098 if (!assertEqualWithUStringSearch(strsrch, PATTERN[0])) { in TestPattern()
1106 usearch_setPattern(strsrch, bigpattern, -1, &status); in TestPattern()
1113 if (strsrch != NULL) { in TestPattern()
1114 usearch_close(strsrch); in TestPattern()
1121 UStringSearch *strsrch; in TestText() local
1147 strsrch = usearch_openFromCollator(pattern, -1, text, -1, EN_US_, in TestText()
1154 temp = usearch_getText(strsrch, &templength); in TestText()
1158 if (!assertEqualWithUStringSearch(strsrch, TEXT[0])) { in TestText()
1163 usearch_setText(strsrch, text, -1, &status); in TestText()
1164 temp = usearch_getText(strsrch, &templength); in TestText()
1172 if (!assertEqualWithUStringSearch(strsrch, TEXT[1])) { in TestText()
1177 usearch_setText(strsrch, text, -1, &status); in TestText()
1178 temp = usearch_getText(strsrch, &templength); in TestText()
1186 if (!assertEqualWithUStringSearch(strsrch, TEXT[0])) { in TestText()
1190 if (strsrch != NULL) { in TestText()
1191 usearch_close(strsrch); in TestText()
1221 UStringSearch *strsrch; in TestGetSetOffset() local
1233 strsrch = usearch_openFromCollator(pattern, 16, text, 32, EN_US_, NULL, in TestGetSetOffset()
1236 usearch_setOffset(strsrch, -1, &status); in TestGetSetOffset()
1240 usearch_setOffset(strsrch, 128, &status); in TestGetSetOffset()
1253 usearch_setText(strsrch, text, -1, &status); in TestGetSetOffset()
1254 usearch_setPattern(strsrch, pattern, -1, &status); in TestGetSetOffset()
1255 ucol_setStrength(usearch_getCollator(strsrch), search.strength); in TestGetSetOffset()
1256 usearch_reset(strsrch); in TestGetSetOffset()
1259 usearch_next(strsrch, &status); in TestGetSetOffset()
1260 if (matchindex != usearch_getMatchedStart(strsrch) || in TestGetSetOffset()
1261 matchlength != (uint32_t)usearch_getMatchedLength(strsrch)) { in TestGetSetOffset()
1262 char *str = toCharString(usearch_getText(strsrch, in TestGetSetOffset()
1265 str = toCharString(usearch_getPattern(strsrch, &textlength)); in TestGetSetOffset()
1268 usearch_getMatchedStart(strsrch), in TestGetSetOffset()
1269 usearch_getMatchedLength(strsrch)); in TestGetSetOffset()
1272 usearch_setOffset(strsrch, matchindex + matchlength, &status); in TestGetSetOffset()
1273 usearch_previous(strsrch, &status); in TestGetSetOffset()
1274 if (matchindex != usearch_getMatchedStart(strsrch) || in TestGetSetOffset()
1275 matchlength != (uint32_t)usearch_getMatchedLength(strsrch)) { in TestGetSetOffset()
1276 char *str = toCharString(usearch_getText(strsrch, in TestGetSetOffset()
1279 str = toCharString(usearch_getPattern(strsrch, &textlength)); in TestGetSetOffset()
1282 usearch_getMatchedStart(strsrch), in TestGetSetOffset()
1283 usearch_getMatchedLength(strsrch)); in TestGetSetOffset()
1286 usearch_setOffset(strsrch, matchindex + matchlength, &status); in TestGetSetOffset()
1290 usearch_setOffset(strsrch, search.offset[count + 1] + 1, in TestGetSetOffset()
1292 if (usearch_getOffset(strsrch) != search.offset[count + 1] + 1) { in TestGetSetOffset()
1300 usearch_next(strsrch, &status); in TestGetSetOffset()
1301 if (usearch_getMatchedStart(strsrch) != USEARCH_DONE) { in TestGetSetOffset()
1302 char *str = toCharString(usearch_getText(strsrch, &textlength)); in TestGetSetOffset()
1304 str = toCharString(usearch_getPattern(strsrch, &textlength)); in TestGetSetOffset()
1307 usearch_getMatchedStart(strsrch), in TestGetSetOffset()
1308 usearch_getMatchedLength(strsrch)); in TestGetSetOffset()
1312 ucol_setStrength(usearch_getCollator(strsrch), UCOL_TERTIARY); in TestGetSetOffset()
1313 usearch_close(strsrch); in TestGetSetOffset()
1322 UStringSearch *strsrch; in TestGetSetAttribute() local
1338 strsrch = usearch_openFromCollator(pattern, 16, text, 32, EN_US_, NULL, in TestGetSetAttribute()
1345 usearch_setAttribute(strsrch, USEARCH_OVERLAP, USEARCH_DEFAULT, &status); in TestGetSetAttribute()
1347 usearch_getAttribute(strsrch, USEARCH_OVERLAP) != USEARCH_OFF) { in TestGetSetAttribute()
1350 usearch_setAttribute(strsrch, USEARCH_OVERLAP, USEARCH_ON, &status); in TestGetSetAttribute()
1352 usearch_getAttribute(strsrch, USEARCH_OVERLAP) != USEARCH_ON) { in TestGetSetAttribute()
1355 usearch_setAttribute(strsrch, USEARCH_OVERLAP, USEARCH_OFF, &status); in TestGetSetAttribute()
1357 usearch_getAttribute(strsrch, USEARCH_OVERLAP) != USEARCH_OFF) { in TestGetSetAttribute()
1360 usearch_setAttribute(strsrch, USEARCH_OVERLAP, in TestGetSetAttribute()
1366 usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, USEARCH_DEFAULT, in TestGetSetAttribute()
1369 usearch_getAttribute(strsrch, USEARCH_CANONICAL_MATCH) != in TestGetSetAttribute()
1373 usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, USEARCH_ON, in TestGetSetAttribute()
1376 usearch_getAttribute(strsrch, USEARCH_CANONICAL_MATCH) != in TestGetSetAttribute()
1380 usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, USEARCH_OFF, in TestGetSetAttribute()
1383 usearch_getAttribute(strsrch, USEARCH_CANONICAL_MATCH) != in TestGetSetAttribute()
1387 usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, in TestGetSetAttribute()
1393 usearch_setAttribute(strsrch, USEARCH_ATTRIBUTE_COUNT, USEARCH_DEFAULT, in TestGetSetAttribute()
1399 usearch_close(strsrch); in TestGetSetAttribute()
1411 UStringSearch *strsrch; in TestGetMatch() local
1429 strsrch = usearch_openFromCollator(pattern, -1, text, -1, EN_US_, in TestGetMatch()
1433 if (strsrch != NULL) { in TestGetMatch()
1434 usearch_close(strsrch); in TestGetMatch()
1441 usearch_next(strsrch, &status); in TestGetMatch()
1442 if (matchindex != usearch_getMatchedStart(strsrch) || in TestGetMatch()
1443 matchlength != usearch_getMatchedLength(strsrch)) { in TestGetMatch()
1444 char *str = toCharString(usearch_getText(strsrch, &textlength)); in TestGetMatch()
1446 str = toCharString(usearch_getPattern(strsrch, &textlength)); in TestGetMatch()
1449 usearch_getMatchedStart(strsrch), in TestGetMatch()
1450 usearch_getMatchedLength(strsrch)); in TestGetMatch()
1461 if (usearch_getMatchedText(strsrch, NULL, 0, &status) != in TestGetMatch()
1466 if (usearch_getMatchedText(strsrch, matchtext, 0, &status) != in TestGetMatch()
1471 if (usearch_getMatchedText(strsrch, matchtext, matchlength, &status) in TestGetMatch()
1477 if (usearch_getMatchedText(strsrch, matchtext, 128, &status) != in TestGetMatch()
1480 usearch_getText(strsrch, &textlength) + matchindex, in TestGetMatch()
1489 usearch_next(strsrch, &status); in TestGetMatch()
1490 if (usearch_getMatchedStart(strsrch) != USEARCH_DONE || in TestGetMatch()
1491 usearch_getMatchedLength(strsrch) != 0) { in TestGetMatch()
1495 if (usearch_getMatchedText(strsrch, matchtext, 128, &status) != in TestGetMatch()
1499 usearch_close(strsrch); in TestGetMatch()
1518 UStringSearch *strsrch; in TestSetMatch() local
1527 strsrch = usearch_openFromCollator(pattern, -1, text, -1, EN_US_, in TestSetMatch()
1531 if (strsrch != NULL) { in TestSetMatch()
1532 usearch_close(strsrch); in TestSetMatch()
1542 if (usearch_first(strsrch, &status) != search.offset[0] || in TestSetMatch()
1546 if (usearch_last(strsrch, &status) != search.offset[size -1] || in TestSetMatch()
1553 if (usearch_following(strsrch, search.offset[offsetIndex + 2] - 1, in TestSetMatch()
1561 if (usearch_preceding(strsrch, search.offset[offsetIndex + 1] + in TestSetMatch()
1572 if (usearch_following(strsrch, u_strlen(text), &status) != in TestSetMatch()
1576 if (usearch_preceding(strsrch, 0, &status) != USEARCH_DONE) { in TestSetMatch()
1580 usearch_close(strsrch); in TestSetMatch()
1591 UStringSearch *strsrch; in TestReset() local
1598 strsrch = usearch_openFromCollator(pattern, 1, text, 9, in TestReset()
1602 if (strsrch != NULL) { in TestReset()
1603 usearch_close(strsrch); in TestReset()
1607 usearch_setAttribute(strsrch, USEARCH_OVERLAP, USEARCH_ON, &status); in TestReset()
1608 usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, USEARCH_ON, in TestReset()
1610 usearch_setOffset(strsrch, 9, &status); in TestReset()
1615 usearch_reset(strsrch); in TestReset()
1616 if (usearch_getAttribute(strsrch, USEARCH_OVERLAP) != USEARCH_OFF || in TestReset()
1617 usearch_getAttribute(strsrch, USEARCH_CANONICAL_MATCH) != in TestReset()
1619 usearch_getOffset(strsrch) != 0 || in TestReset()
1620 usearch_getMatchedLength(strsrch) != 0 || in TestReset()
1621 usearch_getMatchedStart(strsrch) != USEARCH_DONE) { in TestReset()
1624 usearch_previous(strsrch, &status); in TestReset()
1625 if (usearch_getMatchedStart(strsrch) != 7 || in TestReset()
1626 usearch_getMatchedLength(strsrch) != 1) { in TestReset()
1630 usearch_close(strsrch); in TestReset()
1660 UStringSearch *strsrch; in TestContraction() local
1675 strsrch = usearch_openFromCollator(pattern, 1, text, 1, collator, NULL, in TestContraction()
1684 usearch_setText(strsrch, text, -1, &status); in TestContraction()
1685 usearch_setPattern(strsrch, pattern, -1, &status); in TestContraction()
1686 if (!assertEqualWithUStringSearch(strsrch, CONTRACTION[count])) { in TestContraction()
1691 usearch_close(strsrch); in TestContraction()
1702 UStringSearch *strsrch; in TestIgnorable() local
1719 strsrch = usearch_openFromCollator(pattern, 1, text, 1, collator, NULL, in TestIgnorable()
1728 usearch_setText(strsrch, text, -1, &status); in TestIgnorable()
1729 usearch_setPattern(strsrch, pattern, -1, &status); in TestIgnorable()
1730 if (!assertEqualWithUStringSearch(strsrch, IGNORABLE[count])) { in TestIgnorable()
1735 usearch_close(strsrch); in TestIgnorable()
1744 UStringSearch *strsrch = NULL; in TestDiacriticMatch() local
1752 strsrch = usearch_open(pattern, 1, text, 1, uloc_getDefault(), NULL, &status); in TestDiacriticMatch()
1772 usearch_setCollator(strsrch, coll, &status); in TestDiacriticMatch()
1780 usearch_setText(strsrch, text, -1, &status); in TestDiacriticMatch()
1781 usearch_setPattern(strsrch, pattern, -1, &status); in TestDiacriticMatch()
1782 if (!assertEqualWithUStringSearch(strsrch, search)) { in TestDiacriticMatch()
1789 usearch_close(strsrch); in TestDiacriticMatch()
1869 UStringSearch *strsrch; in TestBreakIteratorCanonical() local
1875 strsrch = usearch_openFromCollator(pattern, -1, text, -1, collator, in TestBreakIteratorCanonical()
1884 usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, USEARCH_ON, in TestBreakIteratorCanonical()
1887 usearch_getBreakIterator(strsrch) != breaker) { in TestBreakIteratorCanonical()
1889 usearch_close(strsrch); in TestBreakIteratorCanonical()
1892 if (!assertEqualWithUStringSearch(strsrch, *search)) { in TestBreakIteratorCanonical()
1894 usearch_close(strsrch); in TestBreakIteratorCanonical()
1899 usearch_setBreakIterator(strsrch, breaker, &status); in TestBreakIteratorCanonical()
1900 if (U_FAILURE(status) || usearch_getBreakIterator(strsrch) != breaker) { in TestBreakIteratorCanonical()
1902 usearch_close(strsrch); in TestBreakIteratorCanonical()
1905 usearch_reset(strsrch); in TestBreakIteratorCanonical()
1906 usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, USEARCH_ON, in TestBreakIteratorCanonical()
1908 if (!assertEqualWithUStringSearch(strsrch, *search)) { in TestBreakIteratorCanonical()
1910 usearch_close(strsrch); in TestBreakIteratorCanonical()
1913 usearch_close(strsrch); in TestBreakIteratorCanonical()
1986 UStringSearch *strsrch; in TestOverlapCanonical() local
1991 strsrch = usearch_openFromCollator(pattern, -1, text, -1, collator, in TestOverlapCanonical()
2000 usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, USEARCH_ON, in TestOverlapCanonical()
2002 usearch_setAttribute(strsrch, USEARCH_OVERLAP, USEARCH_ON, &status); in TestOverlapCanonical()
2004 usearch_getAttribute(strsrch, USEARCH_OVERLAP) != USEARCH_ON) { in TestOverlapCanonical()
2007 if (!assertEqualWithUStringSearch(strsrch, *search)) { in TestOverlapCanonical()
2008 usearch_close(strsrch); in TestOverlapCanonical()
2012 usearch_setAttribute(strsrch, USEARCH_OVERLAP, USEARCH_OFF, &status); in TestOverlapCanonical()
2014 usearch_getAttribute(strsrch, USEARCH_OVERLAP) != USEARCH_OFF) { in TestOverlapCanonical()
2017 usearch_reset(strsrch); in TestOverlapCanonical()
2018 if (!assertEqualWithUStringSearch(strsrch, *search)) { in TestOverlapCanonical()
2019 usearch_close(strsrch); in TestOverlapCanonical()
2024 usearch_close(strsrch); in TestOverlapCanonical()
2037 UStringSearch *strsrch; in TestCollatorCanonical() local
2047 strsrch = usearch_openFromCollator(pattern, -1, text, -1, EN_US_, in TestCollatorCanonical()
2056 usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, USEARCH_ON, in TestCollatorCanonical()
2061 if (!assertEqualWithUStringSearch(strsrch, COLLATORCANONICAL[0])) { in TestCollatorCanonical()
2072 usearch_setCollator(strsrch, tailored, &status); in TestCollatorCanonical()
2073 if (U_FAILURE(status) || usearch_getCollator(strsrch) != tailored) { in TestCollatorCanonical()
2076 usearch_reset(strsrch); in TestCollatorCanonical()
2077 usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, USEARCH_ON, in TestCollatorCanonical()
2079 if (!assertEqualWithUStringSearch(strsrch, COLLATORCANONICAL[1])) { in TestCollatorCanonical()
2083 usearch_setCollator(strsrch, EN_US_, &status); in TestCollatorCanonical()
2084 usearch_reset(strsrch); in TestCollatorCanonical()
2085 usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, USEARCH_ON, in TestCollatorCanonical()
2087 if (U_FAILURE(status) || usearch_getCollator(strsrch) != EN_US_) { in TestCollatorCanonical()
2090 if (!assertEqualWithUStringSearch(strsrch, COLLATORCANONICAL[0])) { in TestCollatorCanonical()
2095 usearch_close(strsrch); in TestCollatorCanonical()
2104 UStringSearch *strsrch; in TestPatternCanonical() local
2120 strsrch = usearch_openFromCollator(pattern, -1, text, -1, EN_US_, in TestPatternCanonical()
2122 usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, USEARCH_ON, in TestPatternCanonical()
2128 temp = usearch_getPattern(strsrch, &templength); in TestPatternCanonical()
2132 if (!assertEqualWithUStringSearch(strsrch, PATTERNCANONICAL[0])) { in TestPatternCanonical()
2137 usearch_setPattern(strsrch, pattern, -1, &status); in TestPatternCanonical()
2138 temp = usearch_getPattern(strsrch, &templength); in TestPatternCanonical()
2143 usearch_reset(strsrch); in TestPatternCanonical()
2144 usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, USEARCH_ON, in TestPatternCanonical()
2149 if (!assertEqualWithUStringSearch(strsrch, PATTERNCANONICAL[1])) { in TestPatternCanonical()
2154 usearch_setPattern(strsrch, pattern, -1, &status); in TestPatternCanonical()
2155 temp = usearch_getPattern(strsrch, &templength); in TestPatternCanonical()
2160 usearch_reset(strsrch); in TestPatternCanonical()
2161 usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, USEARCH_ON, in TestPatternCanonical()
2166 if (!assertEqualWithUStringSearch(strsrch, PATTERNCANONICAL[0])) { in TestPatternCanonical()
2171 if (strsrch != NULL) { in TestPatternCanonical()
2172 usearch_close(strsrch); in TestPatternCanonical()
2179 UStringSearch *strsrch; in TestTextCanonical() local
2194 strsrch = usearch_openFromCollator(pattern, -1, text, -1, EN_US_, in TestTextCanonical()
2196 usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, USEARCH_ON, in TestTextCanonical()
2203 temp = usearch_getText(strsrch, &templength); in TestTextCanonical()
2207 if (!assertEqualWithUStringSearch(strsrch, TEXTCANONICAL[0])) { in TestTextCanonical()
2212 usearch_setText(strsrch, text, -1, &status); in TestTextCanonical()
2213 temp = usearch_getText(strsrch, &templength); in TestTextCanonical()
2221 if (!assertEqualWithUStringSearch(strsrch, TEXTCANONICAL[1])) { in TestTextCanonical()
2226 usearch_setText(strsrch, text, -1, &status); in TestTextCanonical()
2227 temp = usearch_getText(strsrch, &templength); in TestTextCanonical()
2235 if (!assertEqualWithUStringSearch(strsrch, TEXTCANONICAL[0])) { in TestTextCanonical()
2239 if (strsrch != NULL) { in TestTextCanonical()
2240 usearch_close(strsrch); in TestTextCanonical()
2270 UStringSearch *strsrch; in TestGetSetOffsetCanonical() local
2281 strsrch = usearch_openFromCollator(pattern, 16, text, 32, EN_US_, NULL, in TestGetSetOffsetCanonical()
2284 collator = usearch_getCollator(strsrch); in TestGetSetOffsetCanonical()
2287 usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, USEARCH_ON, in TestGetSetOffsetCanonical()
2291 usearch_setOffset(strsrch, -1, &status); in TestGetSetOffsetCanonical()
2295 usearch_setOffset(strsrch, 128, &status); in TestGetSetOffsetCanonical()
2313 usearch_setText(strsrch, text, -1, &status); in TestGetSetOffsetCanonical()
2314 usearch_setPattern(strsrch, pattern, -1, &status); in TestGetSetOffsetCanonical()
2317 usearch_next(strsrch, &status); in TestGetSetOffsetCanonical()
2318 if (matchindex != usearch_getMatchedStart(strsrch) || in TestGetSetOffsetCanonical()
2319 matchlength != (uint32_t)usearch_getMatchedLength(strsrch)) { in TestGetSetOffsetCanonical()
2320 char *str = toCharString(usearch_getText(strsrch, in TestGetSetOffsetCanonical()
2323 str = toCharString(usearch_getPattern(strsrch, &textlength)); in TestGetSetOffsetCanonical()
2326 usearch_getMatchedStart(strsrch), in TestGetSetOffsetCanonical()
2327 usearch_getMatchedLength(strsrch)); in TestGetSetOffsetCanonical()
2333 usearch_setOffset(strsrch, search.offset[count + 1] + 1, in TestGetSetOffsetCanonical()
2335 if (usearch_getOffset(strsrch) != search.offset[count + 1] + 1) { in TestGetSetOffsetCanonical()
2343 usearch_next(strsrch, &status); in TestGetSetOffsetCanonical()
2344 if (usearch_getMatchedStart(strsrch) != USEARCH_DONE) { in TestGetSetOffsetCanonical()
2345 char *str = toCharString(usearch_getText(strsrch, &textlength)); in TestGetSetOffsetCanonical()
2347 str = toCharString(usearch_getPattern(strsrch, &textlength)); in TestGetSetOffsetCanonical()
2350 usearch_getMatchedStart(strsrch), in TestGetSetOffsetCanonical()
2351 usearch_getMatchedLength(strsrch)); in TestGetSetOffsetCanonical()
2358 usearch_close(strsrch); in TestGetSetOffsetCanonical()
2388 UStringSearch *strsrch = NULL; in TestContractionCanonical() local
2403 strsrch = usearch_openFromCollator(pattern, 1, text, 1, collator, NULL, in TestContractionCanonical()
2405 usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, USEARCH_ON, in TestContractionCanonical()
2414 usearch_setText(strsrch, text, -1, &status); in TestContractionCanonical()
2415 usearch_setPattern(strsrch, pattern, -1, &status); in TestContractionCanonical()
2416 if (!assertEqualWithUStringSearch(strsrch, in TestContractionCanonical()
2422 usearch_close(strsrch); in TestContractionCanonical()
2428 UStringSearch *strsrch = NULL; in TestNumeric() local
2444 strsrch = usearch_openFromCollator(pattern, 1, text, 1, coll, NULL, &status); in TestNumeric()
2448 if(strsrch) { in TestNumeric()
2449 usearch_close(strsrch); in TestNumeric()