Lines Matching refs:strsrch

336 static UBool assertEqualWithUStringSearch(      UStringSearch *strsrch,  in assertEqualWithUStringSearch()  argument
348 usearch_setAttribute(strsrch, USEARCH_ELEMENT_COMPARISON, search.elemCompare, &status); in assertEqualWithUStringSearch()
354 if (usearch_getMatchedStart(strsrch) != USEARCH_DONE || in assertEqualWithUStringSearch()
355 usearch_getMatchedLength(strsrch) != 0) { in assertEqualWithUStringSearch()
361 usearch_next(strsrch, &status); in assertEqualWithUStringSearch()
362 if (matchindex != usearch_getMatchedStart(strsrch) || in assertEqualWithUStringSearch()
363 matchlength != (uint32_t)usearch_getMatchedLength(strsrch)) { in assertEqualWithUStringSearch()
364 char *str = toCharString(usearch_getText(strsrch, &textlength)); in assertEqualWithUStringSearch()
366 str = toCharString(usearch_getPattern(strsrch, &textlength)); in assertEqualWithUStringSearch()
369 usearch_getMatchedStart(strsrch), usearch_getMatchedLength(strsrch), in assertEqualWithUStringSearch()
375 if (usearch_getMatchedText(strsrch, matchtext, 128, &status) != in assertEqualWithUStringSearch()
378 usearch_getText(strsrch, &textlength) + matchindex, in assertEqualWithUStringSearch()
385 usearch_next(strsrch, &status); in assertEqualWithUStringSearch()
386 if (usearch_getMatchedStart(strsrch) != USEARCH_DONE || in assertEqualWithUStringSearch()
387 usearch_getMatchedLength(strsrch) != 0) { in assertEqualWithUStringSearch()
388 char *str = toCharString(usearch_getText(strsrch, &textlength)); in assertEqualWithUStringSearch()
390 str = toCharString(usearch_getPattern(strsrch, &textlength)); in assertEqualWithUStringSearch()
393 usearch_getMatchedStart(strsrch), in assertEqualWithUStringSearch()
394 usearch_getMatchedLength(strsrch)); in assertEqualWithUStringSearch()
403 usearch_previous(strsrch, &status); in assertEqualWithUStringSearch()
404 if (matchindex != usearch_getMatchedStart(strsrch) || in assertEqualWithUStringSearch()
405 matchlength != (uint32_t)usearch_getMatchedLength(strsrch)) { in assertEqualWithUStringSearch()
406 char *str = toCharString(usearch_getText(strsrch, &textlength)); in assertEqualWithUStringSearch()
408 str = toCharString(usearch_getPattern(strsrch, &textlength)); in assertEqualWithUStringSearch()
411 usearch_getMatchedStart(strsrch), usearch_getMatchedLength(strsrch), in assertEqualWithUStringSearch()
416 if (usearch_getMatchedText(strsrch, matchtext, 128, &status) != in assertEqualWithUStringSearch()
419 usearch_getText(strsrch, &textlength) + matchindex, in assertEqualWithUStringSearch()
427 usearch_previous(strsrch, &status); in assertEqualWithUStringSearch()
428 if (usearch_getMatchedStart(strsrch) != USEARCH_DONE || in assertEqualWithUStringSearch()
429 usearch_getMatchedLength(strsrch) != 0) { in assertEqualWithUStringSearch()
430 char *str = toCharString(usearch_getText(strsrch, &textlength)); in assertEqualWithUStringSearch()
432 str = toCharString(usearch_getPattern(strsrch, &textlength)); in assertEqualWithUStringSearch()
435 usearch_getMatchedStart(strsrch), in assertEqualWithUStringSearch()
436 usearch_getMatchedLength(strsrch)); in assertEqualWithUStringSearch()
441 isOverlap = (usearch_getAttribute(strsrch, USEARCH_OVERLAP) == USEARCH_ON); in assertEqualWithUStringSearch()
449 usearch_following(strsrch, nextStart, &status); in assertEqualWithUStringSearch()
452 … if (usearch_getMatchedStart(strsrch) != USEARCH_DONE || usearch_getMatchedLength(strsrch) != 0) { in assertEqualWithUStringSearch()
453 char *str = toCharString(usearch_getText(strsrch, &textlength)); in assertEqualWithUStringSearch()
455 str = toCharString(usearch_getPattern(strsrch, &textlength)); in assertEqualWithUStringSearch()
459 usearch_getMatchedStart(strsrch), in assertEqualWithUStringSearch()
460 usearch_getMatchedLength(strsrch)); in assertEqualWithUStringSearch()
468 if (usearch_getMatchedStart(strsrch) != matchindex in assertEqualWithUStringSearch()
469 || usearch_getMatchedLength(strsrch) != matchlength in assertEqualWithUStringSearch()
471 char *str = toCharString(usearch_getText(strsrch, &textlength)); in assertEqualWithUStringSearch()
473 str = toCharString(usearch_getPattern(strsrch, &textlength)); in assertEqualWithUStringSearch()
477 usearch_getMatchedStart(strsrch), usearch_getMatchedLength(strsrch), in assertEqualWithUStringSearch()
482 if (isOverlap || usearch_getMatchedLength(strsrch) == 0) { in assertEqualWithUStringSearch()
483 nextStart = usearch_getMatchedStart(strsrch) + 1; in assertEqualWithUStringSearch()
485 nextStart = usearch_getMatchedStart(strsrch) + usearch_getMatchedLength(strsrch); in assertEqualWithUStringSearch()
497 usearch_getText(strsrch, &nextStart); in assertEqualWithUStringSearch()
500 usearch_preceding(strsrch, nextStart, &status); in assertEqualWithUStringSearch()
503 … if (usearch_getMatchedStart(strsrch) != USEARCH_DONE || usearch_getMatchedLength(strsrch) != 0) { in assertEqualWithUStringSearch()
504 char *str = toCharString(usearch_getText(strsrch, &textlength)); in assertEqualWithUStringSearch()
506 str = toCharString(usearch_getPattern(strsrch, &textlength)); in assertEqualWithUStringSearch()
510 usearch_getMatchedStart(strsrch), in assertEqualWithUStringSearch()
511 usearch_getMatchedLength(strsrch)); in assertEqualWithUStringSearch()
520 if (usearch_getMatchedStart(strsrch) != matchindex in assertEqualWithUStringSearch()
521 || usearch_getMatchedLength(strsrch) != matchlength in assertEqualWithUStringSearch()
523 char *str = toCharString(usearch_getText(strsrch, &textlength)); in assertEqualWithUStringSearch()
525 str = toCharString(usearch_getPattern(strsrch, &textlength)); in assertEqualWithUStringSearch()
529 usearch_getMatchedStart(strsrch), usearch_getMatchedLength(strsrch), in assertEqualWithUStringSearch()
538 …usearch_setAttribute(strsrch, USEARCH_ELEMENT_COMPARISON, USEARCH_STANDARD_ELEMENT_COMPARISON, &st… in assertEqualWithUStringSearch()
549 UStringSearch *strsrch; in assertEqual() local
556 strsrch = usearch_openFromCollator(pattern, -1, text, -1, collator, in assertEqual()
563 if (!assertEqualWithUStringSearch(strsrch, search)) { in assertEqual()
565 usearch_close(strsrch); in assertEqual()
569 usearch_close(strsrch); in assertEqual()
580 UStringSearch *strsrch; in assertCanonicalEqual() local
588 strsrch = usearch_openFromCollator(pattern, -1, text, -1, collator, in assertCanonicalEqual()
590 usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, USEARCH_ON, in assertCanonicalEqual()
598 if (!assertEqualWithUStringSearch(strsrch, search)) { in assertCanonicalEqual()
600 usearch_close(strsrch); in assertCanonicalEqual()
608 usearch_close(strsrch); in assertCanonicalEqual()
621 UStringSearch *strsrch; in assertEqualWithAttribute() local
627 strsrch = usearch_openFromCollator(pattern, -1, text, -1, collator, in assertEqualWithAttribute()
629 usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, canonical, in assertEqualWithAttribute()
631 usearch_setAttribute(strsrch, USEARCH_OVERLAP, overlap, &status); in assertEqualWithAttribute()
638 if (!assertEqualWithUStringSearch(strsrch, search)) { in assertEqualWithAttribute()
640 usearch_close(strsrch); in assertEqualWithAttribute()
644 usearch_close(strsrch); in assertEqualWithAttribute()
724 UStringSearch *strsrch; in TestBreakIterator() local
742 strsrch = usearch_openFromCollator(pattern, -1, text, -1, EN_US_, NULL, in TestBreakIterator()
749 usearch_setBreakIterator(strsrch, NULL, &status); in TestBreakIterator()
750 if (U_FAILURE(status) || usearch_getBreakIterator(strsrch) != NULL) { in TestBreakIterator()
755 usearch_setBreakIterator(strsrch, EN_CHARACTERBREAKER_, &status); in TestBreakIterator()
757 usearch_getBreakIterator(strsrch) != EN_CHARACTERBREAKER_) { in TestBreakIterator()
762 usearch_setBreakIterator(strsrch, EN_WORDBREAKER_, &status); in TestBreakIterator()
764 usearch_getBreakIterator(strsrch) != EN_WORDBREAKER_) { in TestBreakIterator()
769 usearch_close(strsrch); in TestBreakIterator()
782 strsrch = usearch_openFromCollator(pattern, -1, text, -1, collator, in TestBreakIterator()
785 usearch_getBreakIterator(strsrch) != breaker) { in TestBreakIterator()
787 if (strsrch != NULL) { in TestBreakIterator()
788 usearch_close(strsrch); in TestBreakIterator()
791 if (!assertEqualWithUStringSearch(strsrch, *search)) { in TestBreakIterator()
793 usearch_close(strsrch); in TestBreakIterator()
798 usearch_setBreakIterator(strsrch, breaker, &status); in TestBreakIterator()
799 if (U_FAILURE(status) || usearch_getBreakIterator(strsrch) != breaker) { in TestBreakIterator()
801 usearch_close(strsrch); in TestBreakIterator()
804 usearch_reset(strsrch); in TestBreakIterator()
805 if (!assertEqualWithUStringSearch(strsrch, *search)) { in TestBreakIterator()
807 usearch_close(strsrch); in TestBreakIterator()
810 usearch_close(strsrch); in TestBreakIterator()
883 UStringSearch *strsrch; in TestOverlap() local
888 strsrch = usearch_openFromCollator(pattern, -1, text, -1, collator, in TestOverlap()
897 usearch_setAttribute(strsrch, USEARCH_OVERLAP, USEARCH_ON, &status); in TestOverlap()
899 usearch_getAttribute(strsrch, USEARCH_OVERLAP) != USEARCH_ON) { in TestOverlap()
902 if (!assertEqualWithUStringSearch(strsrch, *search)) { in TestOverlap()
903 usearch_close(strsrch); in TestOverlap()
907 usearch_setAttribute(strsrch, USEARCH_OVERLAP, USEARCH_OFF, &status); in TestOverlap()
909 usearch_getAttribute(strsrch, USEARCH_OVERLAP) != USEARCH_OFF) { in TestOverlap()
912 usearch_reset(strsrch); in TestOverlap()
913 if (!assertEqualWithUStringSearch(strsrch, *search)) { in TestOverlap()
914 usearch_close(strsrch); in TestOverlap()
919 usearch_close(strsrch); in TestOverlap()
932 UStringSearch *strsrch; in TestCollator() local
941 strsrch = usearch_open(pattern, 2, text, 5, "en_US", NULL, &status); in TestCollator()
949 tailored = usearch_getCollator(strsrch); in TestCollator()
950 if (usearch_next(strsrch, &status) != -1) { in TestCollator()
954 usearch_reset(strsrch); in TestCollator()
955 if (usearch_next(strsrch, &status) != 1) { in TestCollator()
958 usearch_close(strsrch); in TestCollator()
968 strsrch = usearch_openFromCollator(pattern, -1, text, -1, EN_US_, in TestCollator()
973 if (!assertEqualWithUStringSearch(strsrch, COLLATOR[0])) { in TestCollator()
984 usearch_setCollator(strsrch, tailored, &status); in TestCollator()
985 if (U_FAILURE(status) || usearch_getCollator(strsrch) != tailored) { in TestCollator()
988 usearch_reset(strsrch); in TestCollator()
989 if (!assertEqualWithUStringSearch(strsrch, COLLATOR[1])) { in TestCollator()
993 usearch_setCollator(strsrch, EN_US_, &status); in TestCollator()
994 usearch_reset(strsrch); in TestCollator()
995 if (U_FAILURE(status) || usearch_getCollator(strsrch) != EN_US_) { in TestCollator()
998 if (!assertEqualWithUStringSearch(strsrch, COLLATOR[0])) { in TestCollator()
1003 usearch_close(strsrch); in TestCollator()
1012 UStringSearch *strsrch; in TestPattern() local
1037 strsrch = usearch_openFromCollator(pattern, -1, text, -1, EN_US_, in TestPattern()
1048 usearch_setPattern(strsrch, NULL, 3, &status); in TestPattern()
1053 usearch_setPattern(strsrch, pattern, 0, &status); in TestPattern()
1062 temp = usearch_getPattern(strsrch, &templength); in TestPattern()
1066 if (!assertEqualWithUStringSearch(strsrch, PATTERN[0])) { in TestPattern()
1071 usearch_setPattern(strsrch, pattern, -1, &status); in TestPattern()
1072 temp = usearch_getPattern(strsrch, &templength); in TestPattern()
1077 usearch_reset(strsrch); in TestPattern()
1081 if (!assertEqualWithUStringSearch(strsrch, PATTERN[1])) { in TestPattern()
1086 usearch_setPattern(strsrch, pattern, -1, &status); in TestPattern()
1087 temp = usearch_getPattern(strsrch, &templength); in TestPattern()
1092 usearch_reset(strsrch); in TestPattern()
1096 if (!assertEqualWithUStringSearch(strsrch, PATTERN[0])) { in TestPattern()
1104 usearch_setPattern(strsrch, bigpattern, -1, &status); in TestPattern()
1111 if (strsrch != NULL) { in TestPattern()
1112 usearch_close(strsrch); in TestPattern()
1119 UStringSearch *strsrch; in TestText() local
1145 strsrch = usearch_openFromCollator(pattern, -1, text, -1, EN_US_, in TestText()
1152 temp = usearch_getText(strsrch, &templength); in TestText()
1156 if (!assertEqualWithUStringSearch(strsrch, TEXT[0])) { in TestText()
1161 usearch_setText(strsrch, text, -1, &status); in TestText()
1162 temp = usearch_getText(strsrch, &templength); in TestText()
1170 if (!assertEqualWithUStringSearch(strsrch, TEXT[1])) { in TestText()
1175 usearch_setText(strsrch, text, -1, &status); in TestText()
1176 temp = usearch_getText(strsrch, &templength); in TestText()
1184 if (!assertEqualWithUStringSearch(strsrch, TEXT[0])) { in TestText()
1188 if (strsrch != NULL) { in TestText()
1189 usearch_close(strsrch); in TestText()
1219 UStringSearch *strsrch; in TestGetSetOffset() local
1231 strsrch = usearch_openFromCollator(pattern, 16, text, 32, EN_US_, NULL, in TestGetSetOffset()
1234 usearch_setOffset(strsrch, -1, &status); in TestGetSetOffset()
1238 usearch_setOffset(strsrch, 128, &status); in TestGetSetOffset()
1251 usearch_setText(strsrch, text, -1, &status); in TestGetSetOffset()
1252 usearch_setPattern(strsrch, pattern, -1, &status); in TestGetSetOffset()
1253 ucol_setStrength(usearch_getCollator(strsrch), search.strength); in TestGetSetOffset()
1254 usearch_reset(strsrch); in TestGetSetOffset()
1257 usearch_next(strsrch, &status); in TestGetSetOffset()
1258 if (matchindex != usearch_getMatchedStart(strsrch) || in TestGetSetOffset()
1259 matchlength != (uint32_t)usearch_getMatchedLength(strsrch)) { in TestGetSetOffset()
1260 char *str = toCharString(usearch_getText(strsrch, in TestGetSetOffset()
1263 str = toCharString(usearch_getPattern(strsrch, &textlength)); in TestGetSetOffset()
1266 usearch_getMatchedStart(strsrch), in TestGetSetOffset()
1267 usearch_getMatchedLength(strsrch)); in TestGetSetOffset()
1270 usearch_setOffset(strsrch, matchindex + matchlength, &status); in TestGetSetOffset()
1271 usearch_previous(strsrch, &status); in TestGetSetOffset()
1272 if (matchindex != usearch_getMatchedStart(strsrch) || in TestGetSetOffset()
1273 matchlength != (uint32_t)usearch_getMatchedLength(strsrch)) { in TestGetSetOffset()
1274 char *str = toCharString(usearch_getText(strsrch, in TestGetSetOffset()
1277 str = toCharString(usearch_getPattern(strsrch, &textlength)); in TestGetSetOffset()
1280 usearch_getMatchedStart(strsrch), in TestGetSetOffset()
1281 usearch_getMatchedLength(strsrch)); in TestGetSetOffset()
1284 usearch_setOffset(strsrch, matchindex + matchlength, &status); in TestGetSetOffset()
1288 usearch_setOffset(strsrch, search.offset[count + 1] + 1, in TestGetSetOffset()
1290 if (usearch_getOffset(strsrch) != search.offset[count + 1] + 1) { in TestGetSetOffset()
1298 usearch_next(strsrch, &status); in TestGetSetOffset()
1299 if (usearch_getMatchedStart(strsrch) != USEARCH_DONE) { in TestGetSetOffset()
1300 char *str = toCharString(usearch_getText(strsrch, &textlength)); in TestGetSetOffset()
1302 str = toCharString(usearch_getPattern(strsrch, &textlength)); in TestGetSetOffset()
1305 usearch_getMatchedStart(strsrch), in TestGetSetOffset()
1306 usearch_getMatchedLength(strsrch)); in TestGetSetOffset()
1310 ucol_setStrength(usearch_getCollator(strsrch), UCOL_TERTIARY); in TestGetSetOffset()
1311 usearch_close(strsrch); in TestGetSetOffset()
1320 UStringSearch *strsrch; in TestGetSetAttribute() local
1336 strsrch = usearch_openFromCollator(pattern, 16, text, 32, EN_US_, NULL, in TestGetSetAttribute()
1343 usearch_setAttribute(strsrch, USEARCH_OVERLAP, USEARCH_DEFAULT, &status); in TestGetSetAttribute()
1345 usearch_getAttribute(strsrch, USEARCH_OVERLAP) != USEARCH_OFF) { in TestGetSetAttribute()
1348 usearch_setAttribute(strsrch, USEARCH_OVERLAP, USEARCH_ON, &status); in TestGetSetAttribute()
1350 usearch_getAttribute(strsrch, USEARCH_OVERLAP) != USEARCH_ON) { in TestGetSetAttribute()
1353 usearch_setAttribute(strsrch, USEARCH_OVERLAP, USEARCH_OFF, &status); in TestGetSetAttribute()
1355 usearch_getAttribute(strsrch, USEARCH_OVERLAP) != USEARCH_OFF) { in TestGetSetAttribute()
1358 usearch_setAttribute(strsrch, USEARCH_OVERLAP, in TestGetSetAttribute()
1364 usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, USEARCH_DEFAULT, in TestGetSetAttribute()
1367 usearch_getAttribute(strsrch, USEARCH_CANONICAL_MATCH) != in TestGetSetAttribute()
1371 usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, USEARCH_ON, in TestGetSetAttribute()
1374 usearch_getAttribute(strsrch, USEARCH_CANONICAL_MATCH) != in TestGetSetAttribute()
1378 usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, USEARCH_OFF, in TestGetSetAttribute()
1381 usearch_getAttribute(strsrch, USEARCH_CANONICAL_MATCH) != in TestGetSetAttribute()
1385 usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, in TestGetSetAttribute()
1391 usearch_setAttribute(strsrch, USEARCH_ATTRIBUTE_COUNT, USEARCH_DEFAULT, in TestGetSetAttribute()
1397 usearch_close(strsrch); in TestGetSetAttribute()
1409 UStringSearch *strsrch; in TestGetMatch() local
1427 strsrch = usearch_openFromCollator(pattern, -1, text, -1, EN_US_, in TestGetMatch()
1431 if (strsrch != NULL) { in TestGetMatch()
1432 usearch_close(strsrch); in TestGetMatch()
1439 usearch_next(strsrch, &status); in TestGetMatch()
1440 if (matchindex != usearch_getMatchedStart(strsrch) || in TestGetMatch()
1441 matchlength != usearch_getMatchedLength(strsrch)) { in TestGetMatch()
1442 char *str = toCharString(usearch_getText(strsrch, &textlength)); in TestGetMatch()
1444 str = toCharString(usearch_getPattern(strsrch, &textlength)); in TestGetMatch()
1447 usearch_getMatchedStart(strsrch), in TestGetMatch()
1448 usearch_getMatchedLength(strsrch)); in TestGetMatch()
1459 if (usearch_getMatchedText(strsrch, NULL, 0, &status) != in TestGetMatch()
1464 if (usearch_getMatchedText(strsrch, matchtext, 0, &status) != in TestGetMatch()
1469 if (usearch_getMatchedText(strsrch, matchtext, matchlength, &status) in TestGetMatch()
1475 if (usearch_getMatchedText(strsrch, matchtext, 128, &status) != in TestGetMatch()
1478 usearch_getText(strsrch, &textlength) + matchindex, in TestGetMatch()
1487 usearch_next(strsrch, &status); in TestGetMatch()
1488 if (usearch_getMatchedStart(strsrch) != USEARCH_DONE || in TestGetMatch()
1489 usearch_getMatchedLength(strsrch) != 0) { in TestGetMatch()
1493 if (usearch_getMatchedText(strsrch, matchtext, 128, &status) != in TestGetMatch()
1497 usearch_close(strsrch); in TestGetMatch()
1516 UStringSearch *strsrch; in TestSetMatch() local
1525 strsrch = usearch_openFromCollator(pattern, -1, text, -1, EN_US_, in TestSetMatch()
1529 if (strsrch != NULL) { in TestSetMatch()
1530 usearch_close(strsrch); in TestSetMatch()
1540 if (usearch_first(strsrch, &status) != search.offset[0] || in TestSetMatch()
1544 if (usearch_last(strsrch, &status) != search.offset[size -1] || in TestSetMatch()
1551 if (usearch_following(strsrch, search.offset[offsetIndex + 2] - 1, in TestSetMatch()
1559 if (usearch_preceding(strsrch, search.offset[offsetIndex + 1] + in TestSetMatch()
1570 if (usearch_following(strsrch, u_strlen(text), &status) != in TestSetMatch()
1574 if (usearch_preceding(strsrch, 0, &status) != USEARCH_DONE) { in TestSetMatch()
1578 usearch_close(strsrch); in TestSetMatch()
1589 UStringSearch *strsrch; in TestReset() local
1596 strsrch = usearch_openFromCollator(pattern, 1, text, 9, in TestReset()
1600 if (strsrch != NULL) { in TestReset()
1601 usearch_close(strsrch); in TestReset()
1605 usearch_setAttribute(strsrch, USEARCH_OVERLAP, USEARCH_ON, &status); in TestReset()
1606 usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, USEARCH_ON, in TestReset()
1608 usearch_setOffset(strsrch, 9, &status); in TestReset()
1613 usearch_reset(strsrch); in TestReset()
1614 if (usearch_getAttribute(strsrch, USEARCH_OVERLAP) != USEARCH_OFF || in TestReset()
1615 usearch_getAttribute(strsrch, USEARCH_CANONICAL_MATCH) != in TestReset()
1617 usearch_getOffset(strsrch) != 0 || in TestReset()
1618 usearch_getMatchedLength(strsrch) != 0 || in TestReset()
1619 usearch_getMatchedStart(strsrch) != USEARCH_DONE) { in TestReset()
1622 usearch_previous(strsrch, &status); in TestReset()
1623 if (usearch_getMatchedStart(strsrch) != 7 || in TestReset()
1624 usearch_getMatchedLength(strsrch) != 1) { in TestReset()
1628 usearch_close(strsrch); in TestReset()
1658 UStringSearch *strsrch; in TestContraction() local
1673 strsrch = usearch_openFromCollator(pattern, 1, text, 1, collator, NULL, in TestContraction()
1682 usearch_setText(strsrch, text, -1, &status); in TestContraction()
1683 usearch_setPattern(strsrch, pattern, -1, &status); in TestContraction()
1684 if (!assertEqualWithUStringSearch(strsrch, CONTRACTION[count])) { in TestContraction()
1689 usearch_close(strsrch); in TestContraction()
1700 UStringSearch *strsrch; in TestIgnorable() local
1717 strsrch = usearch_openFromCollator(pattern, 1, text, 1, collator, NULL, in TestIgnorable()
1726 usearch_setText(strsrch, text, -1, &status); in TestIgnorable()
1727 usearch_setPattern(strsrch, pattern, -1, &status); in TestIgnorable()
1728 if (!assertEqualWithUStringSearch(strsrch, IGNORABLE[count])) { in TestIgnorable()
1733 usearch_close(strsrch); in TestIgnorable()
1742 UStringSearch *strsrch = NULL; in TestDiacriticMatch() local
1750 strsrch = usearch_open(pattern, 1, text, 1, uloc_getDefault(), NULL, &status); in TestDiacriticMatch()
1770 usearch_setCollator(strsrch, coll, &status); in TestDiacriticMatch()
1778 usearch_setText(strsrch, text, -1, &status); in TestDiacriticMatch()
1779 usearch_setPattern(strsrch, pattern, -1, &status); in TestDiacriticMatch()
1780 if (!assertEqualWithUStringSearch(strsrch, search)) { in TestDiacriticMatch()
1787 usearch_close(strsrch); in TestDiacriticMatch()
1867 UStringSearch *strsrch; in TestBreakIteratorCanonical() local
1873 strsrch = usearch_openFromCollator(pattern, -1, text, -1, collator, in TestBreakIteratorCanonical()
1882 usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, USEARCH_ON, in TestBreakIteratorCanonical()
1885 usearch_getBreakIterator(strsrch) != breaker) { in TestBreakIteratorCanonical()
1887 usearch_close(strsrch); in TestBreakIteratorCanonical()
1890 if (!assertEqualWithUStringSearch(strsrch, *search)) { in TestBreakIteratorCanonical()
1892 usearch_close(strsrch); in TestBreakIteratorCanonical()
1897 usearch_setBreakIterator(strsrch, breaker, &status); in TestBreakIteratorCanonical()
1898 if (U_FAILURE(status) || usearch_getBreakIterator(strsrch) != breaker) { in TestBreakIteratorCanonical()
1900 usearch_close(strsrch); in TestBreakIteratorCanonical()
1903 usearch_reset(strsrch); in TestBreakIteratorCanonical()
1904 usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, USEARCH_ON, in TestBreakIteratorCanonical()
1906 if (!assertEqualWithUStringSearch(strsrch, *search)) { in TestBreakIteratorCanonical()
1908 usearch_close(strsrch); in TestBreakIteratorCanonical()
1911 usearch_close(strsrch); in TestBreakIteratorCanonical()
1984 UStringSearch *strsrch; in TestOverlapCanonical() local
1989 strsrch = usearch_openFromCollator(pattern, -1, text, -1, collator, in TestOverlapCanonical()
1998 usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, USEARCH_ON, in TestOverlapCanonical()
2000 usearch_setAttribute(strsrch, USEARCH_OVERLAP, USEARCH_ON, &status); in TestOverlapCanonical()
2002 usearch_getAttribute(strsrch, USEARCH_OVERLAP) != USEARCH_ON) { in TestOverlapCanonical()
2005 if (!assertEqualWithUStringSearch(strsrch, *search)) { in TestOverlapCanonical()
2006 usearch_close(strsrch); in TestOverlapCanonical()
2010 usearch_setAttribute(strsrch, USEARCH_OVERLAP, USEARCH_OFF, &status); in TestOverlapCanonical()
2012 usearch_getAttribute(strsrch, USEARCH_OVERLAP) != USEARCH_OFF) { in TestOverlapCanonical()
2015 usearch_reset(strsrch); in TestOverlapCanonical()
2016 if (!assertEqualWithUStringSearch(strsrch, *search)) { in TestOverlapCanonical()
2017 usearch_close(strsrch); in TestOverlapCanonical()
2022 usearch_close(strsrch); in TestOverlapCanonical()
2035 UStringSearch *strsrch; in TestCollatorCanonical() local
2045 strsrch = usearch_openFromCollator(pattern, -1, text, -1, EN_US_, in TestCollatorCanonical()
2054 usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, USEARCH_ON, in TestCollatorCanonical()
2059 if (!assertEqualWithUStringSearch(strsrch, COLLATORCANONICAL[0])) { in TestCollatorCanonical()
2070 usearch_setCollator(strsrch, tailored, &status); in TestCollatorCanonical()
2071 if (U_FAILURE(status) || usearch_getCollator(strsrch) != tailored) { in TestCollatorCanonical()
2074 usearch_reset(strsrch); in TestCollatorCanonical()
2075 usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, USEARCH_ON, in TestCollatorCanonical()
2077 if (!assertEqualWithUStringSearch(strsrch, COLLATORCANONICAL[1])) { in TestCollatorCanonical()
2081 usearch_setCollator(strsrch, EN_US_, &status); in TestCollatorCanonical()
2082 usearch_reset(strsrch); in TestCollatorCanonical()
2083 usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, USEARCH_ON, in TestCollatorCanonical()
2085 if (U_FAILURE(status) || usearch_getCollator(strsrch) != EN_US_) { in TestCollatorCanonical()
2088 if (!assertEqualWithUStringSearch(strsrch, COLLATORCANONICAL[0])) { in TestCollatorCanonical()
2093 usearch_close(strsrch); in TestCollatorCanonical()
2102 UStringSearch *strsrch; in TestPatternCanonical() local
2118 strsrch = usearch_openFromCollator(pattern, -1, text, -1, EN_US_, in TestPatternCanonical()
2120 usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, USEARCH_ON, in TestPatternCanonical()
2126 temp = usearch_getPattern(strsrch, &templength); in TestPatternCanonical()
2130 if (!assertEqualWithUStringSearch(strsrch, PATTERNCANONICAL[0])) { in TestPatternCanonical()
2135 usearch_setPattern(strsrch, pattern, -1, &status); in TestPatternCanonical()
2136 temp = usearch_getPattern(strsrch, &templength); in TestPatternCanonical()
2141 usearch_reset(strsrch); in TestPatternCanonical()
2142 usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, USEARCH_ON, in TestPatternCanonical()
2147 if (!assertEqualWithUStringSearch(strsrch, PATTERNCANONICAL[1])) { in TestPatternCanonical()
2152 usearch_setPattern(strsrch, pattern, -1, &status); in TestPatternCanonical()
2153 temp = usearch_getPattern(strsrch, &templength); in TestPatternCanonical()
2158 usearch_reset(strsrch); in TestPatternCanonical()
2159 usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, USEARCH_ON, in TestPatternCanonical()
2164 if (!assertEqualWithUStringSearch(strsrch, PATTERNCANONICAL[0])) { in TestPatternCanonical()
2169 if (strsrch != NULL) { in TestPatternCanonical()
2170 usearch_close(strsrch); in TestPatternCanonical()
2177 UStringSearch *strsrch; in TestTextCanonical() local
2192 strsrch = usearch_openFromCollator(pattern, -1, text, -1, EN_US_, in TestTextCanonical()
2194 usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, USEARCH_ON, in TestTextCanonical()
2201 temp = usearch_getText(strsrch, &templength); in TestTextCanonical()
2205 if (!assertEqualWithUStringSearch(strsrch, TEXTCANONICAL[0])) { in TestTextCanonical()
2210 usearch_setText(strsrch, text, -1, &status); in TestTextCanonical()
2211 temp = usearch_getText(strsrch, &templength); in TestTextCanonical()
2219 if (!assertEqualWithUStringSearch(strsrch, TEXTCANONICAL[1])) { in TestTextCanonical()
2224 usearch_setText(strsrch, text, -1, &status); in TestTextCanonical()
2225 temp = usearch_getText(strsrch, &templength); in TestTextCanonical()
2233 if (!assertEqualWithUStringSearch(strsrch, TEXTCANONICAL[0])) { in TestTextCanonical()
2237 if (strsrch != NULL) { in TestTextCanonical()
2238 usearch_close(strsrch); in TestTextCanonical()
2268 UStringSearch *strsrch; in TestGetSetOffsetCanonical() local
2279 strsrch = usearch_openFromCollator(pattern, 16, text, 32, EN_US_, NULL, in TestGetSetOffsetCanonical()
2282 collator = usearch_getCollator(strsrch); in TestGetSetOffsetCanonical()
2285 usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, USEARCH_ON, in TestGetSetOffsetCanonical()
2289 usearch_setOffset(strsrch, -1, &status); in TestGetSetOffsetCanonical()
2293 usearch_setOffset(strsrch, 128, &status); in TestGetSetOffsetCanonical()
2311 usearch_setText(strsrch, text, -1, &status); in TestGetSetOffsetCanonical()
2312 usearch_setPattern(strsrch, pattern, -1, &status); in TestGetSetOffsetCanonical()
2315 usearch_next(strsrch, &status); in TestGetSetOffsetCanonical()
2316 if (matchindex != usearch_getMatchedStart(strsrch) || in TestGetSetOffsetCanonical()
2317 matchlength != (uint32_t)usearch_getMatchedLength(strsrch)) { in TestGetSetOffsetCanonical()
2318 char *str = toCharString(usearch_getText(strsrch, in TestGetSetOffsetCanonical()
2321 str = toCharString(usearch_getPattern(strsrch, &textlength)); in TestGetSetOffsetCanonical()
2324 usearch_getMatchedStart(strsrch), in TestGetSetOffsetCanonical()
2325 usearch_getMatchedLength(strsrch)); in TestGetSetOffsetCanonical()
2331 usearch_setOffset(strsrch, search.offset[count + 1] + 1, in TestGetSetOffsetCanonical()
2333 if (usearch_getOffset(strsrch) != search.offset[count + 1] + 1) { in TestGetSetOffsetCanonical()
2341 usearch_next(strsrch, &status); in TestGetSetOffsetCanonical()
2342 if (usearch_getMatchedStart(strsrch) != USEARCH_DONE) { in TestGetSetOffsetCanonical()
2343 char *str = toCharString(usearch_getText(strsrch, &textlength)); in TestGetSetOffsetCanonical()
2345 str = toCharString(usearch_getPattern(strsrch, &textlength)); in TestGetSetOffsetCanonical()
2348 usearch_getMatchedStart(strsrch), in TestGetSetOffsetCanonical()
2349 usearch_getMatchedLength(strsrch)); in TestGetSetOffsetCanonical()
2356 usearch_close(strsrch); in TestGetSetOffsetCanonical()
2386 UStringSearch *strsrch = NULL; in TestContractionCanonical() local
2401 strsrch = usearch_openFromCollator(pattern, 1, text, 1, collator, NULL, in TestContractionCanonical()
2403 usearch_setAttribute(strsrch, USEARCH_CANONICAL_MATCH, USEARCH_ON, in TestContractionCanonical()
2412 usearch_setText(strsrch, text, -1, &status); in TestContractionCanonical()
2413 usearch_setPattern(strsrch, pattern, -1, &status); in TestContractionCanonical()
2414 if (!assertEqualWithUStringSearch(strsrch, in TestContractionCanonical()
2420 usearch_close(strsrch); in TestContractionCanonical()
2426 UStringSearch *strsrch = NULL; in TestNumeric() local
2442 strsrch = usearch_openFromCollator(pattern, 1, text, 1, coll, NULL, &status); in TestNumeric()
2446 if(strsrch) { in TestNumeric()
2447 usearch_close(strsrch); in TestNumeric()