Add test for u_charFromName
Bug: 349571269
Test: atest CtsIcu4cTestCases:android.icu4c.cts.Icu4cGTests
Change-Id: I1cb29347cba806acc7121a7f5c44654ef4059395
diff --git a/libicu/test/src/uchar_test.cpp b/libicu/test/src/uchar_test.cpp
index 09c54fb..77fc3d0 100644
--- a/libicu/test/src/uchar_test.cpp
+++ b/libicu/test/src/uchar_test.cpp
@@ -31,3 +31,13 @@
ASSERT_EQ(U'1', u_toupper(U'1'));
ASSERT_EQ(U'Ë', u_toupper(U'ë'));
}
+
+TEST(Icu4cUCharTest, test_u_charFromName) {
+ UErrorCode err;
+ ASSERT_EQ(0x0020, u_charFromName(U_UNICODE_CHAR_NAME, "SPACE", &err));
+ ASSERT_EQ(0x0061, u_charFromName(U_UNICODE_CHAR_NAME, "LATIN SMALL LETTER A", &err));
+ ASSERT_EQ(0x0042, u_charFromName(U_UNICODE_CHAR_NAME, "LATIN CAPITAL LETTER B", &err));
+ ASSERT_EQ(0x00a2, u_charFromName(U_UNICODE_CHAR_NAME, "CENT SIGN", &err));
+ ASSERT_EQ(0xffe5, u_charFromName(U_UNICODE_CHAR_NAME, "FULLWIDTH YEN SIGN", &err));
+ ASSERT_EQ(0x3401, u_charFromName(U_UNICODE_CHAR_NAME, "CJK UNIFIED IDEOGRAPH-3401", &err));
+}