ICU-13328 Adding tests for mixed letter and combining mark.

X-SVN-Rev: 41329
This commit is contained in:
Shane Carr 2018-05-05 02:33:21 +00:00
parent 2f310a3fb1
commit a4b1517e11
3 changed files with 25 additions and 0 deletions

View File

@ -91,6 +91,7 @@ void IntlTestSpoof::runIndexedTest( int32_t index, UBool exec, const char* &name
TESTCASE_AUTO(testBug12825);
TESTCASE_AUTO(testBug12815);
TESTCASE_AUTO(testBug13314_MixedNumbers);
TESTCASE_AUTO(testBug13328_MixedCombiningMarks);
TESTCASE_AUTO_END;
}
@ -697,4 +698,16 @@ void IntlTestSpoof::testBug13314_MixedNumbers() {
assertEquals("The '33' string does not fail spoof", 0, failedChecks);
}
void IntlTestSpoof::testBug13328_MixedCombiningMarks() {
UErrorCode status = U_ZERO_ERROR;
LocalUSpoofCheckerPointer sc(uspoof_open(&status));
TEST_ASSERT_SUCCESS(status);
int32_t failedChecks = uspoof_check2UnicodeString(sc.getAlias(), u"\u0061\u0F84", nullptr, &status);
TEST_ASSERT_SUCCESS(status);
assertEquals(
"The mismatched combining marks string fails spoof",
USPOOF_RESTRICTION_LEVEL,
failedChecks);
}
#endif /* !UCONFIG_NO_REGULAR_EXPRESSIONS && !UCONFIG_NO_NORMALIZATION && !UCONFIG_NO_FILE_IO */

View File

@ -52,6 +52,8 @@ public:
void testBug13314_MixedNumbers();
void testBug13328_MixedCombiningMarks();
// Internal function to run a single skeleton test case.
void checkSkeleton(const USpoofChecker *sc, uint32_t flags,
const char *input, const char *expected, int32_t lineNum);

View File

@ -845,4 +845,14 @@ public class SpoofCheckerTest extends TestFmwk {
SpoofChecker sc2 = new SpoofChecker.Builder(sc1).build();
assertEquals("Copy constructor should produce identical instances", sc1, sc2);
}
@Test
public void testBug13328_MixedCombiningMarks() {
SpoofChecker sc = new SpoofChecker.Builder().build();
CheckResult checkResult = new CheckResult();
sc.failsChecks("\u0061\u0F84", checkResult);
assertEquals("The mismatched combining marks string fails spoof",
SpoofChecker.RESTRICTION_LEVEL,
checkResult.checks);
}
}