Skip to content

Commit

Permalink
ICU-22365 Add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankYFTang committed Jul 1, 2023
1 parent 09fb90f commit 36c417a
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions icu4c/source/test/cintltst/ulocbuildertst.c
Original file line number Diff line number Diff line change
Expand Up @@ -1130,6 +1130,7 @@ static void TestAddRemoveUnicodeLocaleAttributeWellFormed() {
}
}
*/
static void TestAddUnicodeLocaleAttributeIllFormed() {
static const char* illFormed[] = {
"aa",
Expand All @@ -1143,18 +1144,22 @@ static void TestAddUnicodeLocaleAttributeIllFormed() {
"1ZB30zfk9-abc",
"2ck30zfk9-adsf023-234kcZ",
};
for (const char* ill : illFormed) {
for (int i = 0; i < UPRV_LENGTHOF(illFormed); i++) {
const char* ill = illFormed[i];
UErrorCode status = U_ZERO_ERROR;
LocaleBuilder bld;
bld.addUnicodeLocaleAttribute(ill);
Locale loc = bld.build(status);
ULocaleBuilder bld = ulb_open();
ulb_addUnicodeLocaleAttribute(bld, ill);
char buffer[ULOC_FULLNAME_CAPACITY];
ulb_build(bld, buffer, ULOC_FULLNAME_CAPACITY, &status);
if (status != U_ILLEGAL_ARGUMENT_ERROR) {
errln("addUnicodeLocaleAttribute(\"%s\") should fail but has no Error\n",
log_err("addUnicodeLocaleAttribute(\"%s\") should fail but has no Error\n",
ill);
}
ulb_close(bld);
}
}

/*
static void TestSetExtensionU() {
LocaleBuilder bld;
bld.setLanguage("zh");
Expand Down Expand Up @@ -1706,7 +1711,9 @@ void addLocaleBuilderTest(TestNode** root)
/*
TESTCASE(TestAddRemoveUnicodeLocaleAttribute);
TESTCASE(TestAddRemoveUnicodeLocaleAttributeWellFormed);
*/
TESTCASE(TestAddUnicodeLocaleAttributeIllFormed);
/*
TESTCASE(TestSetExtensionU);
TESTCASE(TestSetExtensionValidateUWellFormed);
TESTCASE(TestSetExtensionValidateUIllFormed);
Expand Down

0 comments on commit 36c417a

Please sign in to comment.