+
+void UnicodeTest::TestBinaryValues() {
+ /*
+ * Unicode 5.1 explicitly defines binary property value aliases.
+ * Verify that they are all recognized.
+ */
+ UErrorCode errorCode=U_ZERO_ERROR;
+ UnicodeSet alpha(UNICODE_STRING_SIMPLE("[:Alphabetic:]"), errorCode);
+ if(U_FAILURE(errorCode)) {
+ errln("UnicodeSet([:Alphabetic:]) failed - %s\n", u_errorName(errorCode));
+ return;
+ }
+
+ static const char *const falseValues[]={ "N", "No", "F", "False" };
+ static const char *const trueValues[]={ "Y", "Yes", "T", "True" };
+ int32_t i;
+ for(i=0; i<LENGTHOF(falseValues); ++i) {
+ UnicodeString pattern=UNICODE_STRING_SIMPLE("[:Alphabetic=:]");
+ pattern.insert(pattern.length()-2, UnicodeString(falseValues[i], -1, US_INV));
+ errorCode=U_ZERO_ERROR;
+ UnicodeSet set(pattern, errorCode);
+ if(U_FAILURE(errorCode)) {
+ errln("UnicodeSet([:Alphabetic=%s:]) failed - %s\n", falseValues[i], u_errorName(errorCode));
+ continue;
+ }
+ set.complement();
+ if(set!=alpha) {
+ errln("UnicodeSet([:Alphabetic=%s:]).complement()!=UnicodeSet([:Alphabetic:])\n", falseValues[i]);
+ }
+ }
+ for(i=0; i<LENGTHOF(trueValues); ++i) {
+ UnicodeString pattern=UNICODE_STRING_SIMPLE("[:Alphabetic=:]");
+ pattern.insert(pattern.length()-2, UnicodeString(trueValues[i], -1, US_INV));
+ errorCode=U_ZERO_ERROR;
+ UnicodeSet set(pattern, errorCode);
+ if(U_FAILURE(errorCode)) {
+ errln("UnicodeSet([:Alphabetic=%s:]) failed - %s\n", trueValues[i], u_errorName(errorCode));
+ continue;
+ }
+ if(set!=alpha) {
+ errln("UnicodeSet([:Alphabetic=%s:])!=UnicodeSet([:Alphabetic:])\n", trueValues[i]);
+ }
+ }
+}