]> granicus.if.org Git - icu/commitdiff
ICU-13314 Adding tests for user-raised confusables cases.
authorShane Carr <shane@unicode.org>
Sat, 5 May 2018 02:25:30 +0000 (02:25 +0000)
committerShane Carr <shane@unicode.org>
Sat, 5 May 2018 02:25:30 +0000 (02:25 +0000)
X-SVN-Rev: 41328

icu4c/source/test/intltest/itspoof.cpp
icu4c/source/test/intltest/itspoof.h

index ac7a14cbfed1dd57f353691b78b28c5bea6c0ee8..8980eb1f6739c79a8b9a63a6b2f10988b7c39f0c 100644 (file)
@@ -90,6 +90,7 @@ void IntlTestSpoof::runIndexedTest( int32_t index, UBool exec, const char* &name
     TESTCASE_AUTO(testBug12153);
     TESTCASE_AUTO(testBug12825);
     TESTCASE_AUTO(testBug12815);
+    TESTCASE_AUTO(testBug13314_MixedNumbers);
     TESTCASE_AUTO_END;
 }
 
@@ -682,4 +683,18 @@ void IntlTestSpoof::testBug12815() {
     TEST_ASSERT_SUCCESS(status);
 }
 
+void IntlTestSpoof::testBug13314_MixedNumbers() {
+    UErrorCode status = U_ZERO_ERROR;
+    LocalUSpoofCheckerPointer sc(uspoof_open(&status));
+    TEST_ASSERT_SUCCESS(status);
+    uspoof_setChecks(sc.getAlias(), USPOOF_ALL_CHECKS, &status);
+    TEST_ASSERT_SUCCESS(status);
+    int32_t failedChecks = uspoof_areConfusableUnicodeString(sc.getAlias(), u"列", u"列", &status);
+    TEST_ASSERT_SUCCESS(status);
+    assertEquals("The CJK strings should be confusable", USPOOF_SINGLE_SCRIPT_CONFUSABLE, failedChecks);
+    failedChecks = uspoof_check2UnicodeString(sc.getAlias(), u"3Ȝ", nullptr, &status);
+    TEST_ASSERT_SUCCESS(status);
+    assertEquals("The '33' string does not fail spoof", 0, failedChecks);
+}
+
 #endif /* !UCONFIG_NO_REGULAR_EXPRESSIONS && !UCONFIG_NO_NORMALIZATION && !UCONFIG_NO_FILE_IO */
index 614e4735e7638fb616e510273afb137558ceda94..e7124bd6c418951bacf4d8d60370cce815c82b0b 100644 (file)
@@ -50,6 +50,8 @@ public:
 
     void testBug12815();
 
+    void testBug13314_MixedNumbers();
+
     // 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);