U_NAMESPACE_USE
-// Define UChar constants using hex for EBCDIC compatibility
-// Used #define to reduce private static exports and memory access time.
-#define SET_OPEN ((UChar)0x005B) /*[*/
-#define SET_CLOSE ((UChar)0x005D) /*]*/
-#define HYPHEN ((UChar)0x002D) /*-*/
-#define COMPLEMENT ((UChar)0x005E) /*^*/
-#define COLON ((UChar)0x003A) /*:*/
-#define BACKSLASH ((UChar)0x005C) /*\*/
-#define INTERSECTION ((UChar)0x0026) /*&*/
-#define UPPER_U ((UChar)0x0055) /*U*/
-#define LOWER_U ((UChar)0x0075) /*u*/
-#define OPEN_BRACE ((UChar)123) /*{*/
-#define CLOSE_BRACE ((UChar)125) /*}*/
-#define UPPER_P ((UChar)0x0050) /*P*/
-#define LOWER_P ((UChar)0x0070) /*p*/
-#define UPPER_N ((UChar)78) /*N*/
-#define EQUALS ((UChar)0x003D) /*=*/
-
-//static const UChar POSIX_OPEN[] = { SET_OPEN,COLON,0 }; // "[:"
-static const UChar POSIX_CLOSE[] = { COLON,SET_CLOSE,0 }; // ":]"
-//static const UChar PERL_OPEN[] = { BACKSLASH,LOWER_P,0 }; // "\\p"
-//static const UChar PERL_CLOSE[] = { CLOSE_BRACE,0 }; // "}"
-//static const UChar NAME_OPEN[] = { BACKSLASH,UPPER_N,0 }; // "\\N"
-static const UChar HYPHEN_RIGHT_BRACE[] = {HYPHEN,SET_CLOSE,0}; /*-]*/
-
// Special property set IDs
static const char ANY[] = "ANY"; // [\u0000-\U0010FFFF]
static const char ASCII[] = "ASCII"; // [\u0000-\u007F]
#define NAME_PROP "na"
#define NAME_PROP_LENGTH 2
-/**
- * Delimiter string used in patterns to close a category reference:
- * ":]". Example: "[:Lu:]".
- */
-//static const UChar CATEGORY_CLOSE[] = {COLON, SET_CLOSE, 0x0000}; /* ":]" */
-
// Cached sets ------------------------------------------------------------- ***
U_CDECL_BEGIN
static inline UBool
isPerlOpen(const UnicodeString &pattern, int32_t pos) {
UChar c;
- return pattern.charAt(pos)==BACKSLASH && ((c=pattern.charAt(pos+1))==LOWER_P || c==UPPER_P);
+ return pattern.charAt(pos)==u'\\' && ((c=pattern.charAt(pos+1))==u'p' || c==u'P');
}
/*static inline UBool
isPerlClose(const UnicodeString &pattern, int32_t pos) {
- return pattern.charAt(pos)==CLOSE_BRACE;
+ return pattern.charAt(pos)==u'}';
}*/
static inline UBool
isNameOpen(const UnicodeString &pattern, int32_t pos) {
- return pattern.charAt(pos)==BACKSLASH && pattern.charAt(pos+1)==UPPER_N;
+ return pattern.charAt(pos)==u'\\' && pattern.charAt(pos+1)==u'N';
}
static inline UBool
isPOSIXOpen(const UnicodeString &pattern, int32_t pos) {
- return pattern.charAt(pos)==SET_OPEN && pattern.charAt(pos+1)==COLON;
+ return pattern.charAt(pos)==u'[' && pattern.charAt(pos+1)==u':';
}
/*static inline UBool
isPOSIXClose(const UnicodeString &pattern, int32_t pos) {
- return pattern.charAt(pos)==COLON && pattern.charAt(pos+1)==SET_CLOSE;
+ return pattern.charAt(pos)==u':' && pattern.charAt(pos+1)==u']';
}*/
// TODO memory debugging provided inside uniset.cpp
while (mode != 2 && !chars.atEnd()) {
U_ASSERT((lastItem == 0 && op == 0) ||
- (lastItem == 1 && (op == 0 || op == HYPHEN /*'-'*/)) ||
- (lastItem == 2 && (op == 0 || op == HYPHEN /*'-'*/ ||
- op == INTERSECTION /*'&'*/)));
+ (lastItem == 1 && (op == 0 || op == u'-')) ||
+ (lastItem == 2 && (op == 0 || op == u'-' || op == u'&')));
UChar32 c = 0;
UBool literal = FALSE;
c = chars.next(opts, literal, ec);
if (U_FAILURE(ec)) return;
- if (c == 0x5B /*'['*/ && !literal) {
+ if (c == u'[' && !literal) {
if (mode == 1) {
chars.setPos(backup); // backup
setMode = 1;
} else {
// Handle opening '[' delimiter
mode = 1;
- patLocal.append((UChar) 0x5B /*'['*/);
+ patLocal.append(u'[');
chars.getPos(backup); // prepare to backup
c = chars.next(opts, literal, ec);
if (U_FAILURE(ec)) return;
- if (c == 0x5E /*'^'*/ && !literal) {
+ if (c == u'^' && !literal) {
invert = TRUE;
- patLocal.append((UChar) 0x5E /*'^'*/);
+ patLocal.append(u'^');
chars.getPos(backup); // prepare to backup
c = chars.next(opts, literal, ec);
if (U_FAILURE(ec)) return;
}
// Fall through to handle special leading '-';
// otherwise restart loop for nested [], \p{}, etc.
- if (c == HYPHEN /*'-'*/) {
+ if (c == u'-') {
literal = TRUE;
// Fall through to handle literal '-' below
} else {
op = 0;
}
- if (op == HYPHEN /*'-'*/ || op == INTERSECTION /*'&'*/) {
+ if (op == u'-' || op == u'&') {
patLocal.append(op);
}
}
switch (op) {
- case HYPHEN: /*'-'*/
+ case u'-':
removeAll(*nested);
break;
- case INTERSECTION: /*'&'*/
+ case u'&':
retainAll(*nested);
break;
case 0:
if (!literal) {
switch (c) {
- case 0x5D /*']'*/:
+ case u']':
if (lastItem == 1) {
add(lastChar, lastChar);
_appendToPat(patLocal, lastChar, FALSE);
}
// Treat final trailing '-' as a literal
- if (op == HYPHEN /*'-'*/) {
+ if (op == u'-') {
add(op, op);
patLocal.append(op);
- } else if (op == INTERSECTION /*'&'*/) {
+ } else if (op == u'&') {
// syntaxError(chars, "Trailing '&'");
ec = U_MALFORMED_SET;
return;
}
- patLocal.append((UChar) 0x5D /*']'*/);
+ patLocal.append(u']');
mode = 2;
continue;
- case HYPHEN /*'-'*/:
+ case u'-':
if (op == 0) {
if (lastItem != 0) {
op = (UChar) c;
add(c, c);
c = chars.next(opts, literal, ec);
if (U_FAILURE(ec)) return;
- if (c == 0x5D /*']'*/ && !literal) {
- patLocal.append(HYPHEN_RIGHT_BRACE, 2);
+ if (c == u']' && !literal) {
+ patLocal.append(u"-]", 2);
mode = 2;
continue;
}
// syntaxError(chars, "'-' not after char or set");
ec = U_MALFORMED_SET;
return;
- case INTERSECTION /*'&'*/:
+ case u'&':
if (lastItem == 2 && op == 0) {
op = (UChar) c;
continue;
// syntaxError(chars, "'&' not after set");
ec = U_MALFORMED_SET;
return;
- case 0x5E /*'^'*/:
+ case u'^':
// syntaxError(chars, "'^' not after '['");
ec = U_MALFORMED_SET;
return;
- case 0x7B /*'{'*/:
+ case u'{':
if (op != 0) {
// syntaxError(chars, "Missing operand after operator");
ec = U_MALFORMED_SET;
while (!chars.atEnd()) {
c = chars.next(opts, literal, ec);
if (U_FAILURE(ec)) return;
- if (c == 0x7D /*'}'*/ && !literal) {
+ if (c == u'}' && !literal) {
ok = TRUE;
break;
}
// we don't need to drop through to the further
// processing
add(buf);
- patLocal.append((UChar) 0x7B /*'{'*/);
+ patLocal.append(u'{');
_appendToPat(patLocal, buf, FALSE);
- patLocal.append((UChar) 0x7D /*'}'*/);
+ patLocal.append(u'}');
continue;
case SymbolTable::SYMBOL_REF:
// symbols nosymbols
chars.getPos(backup);
c = chars.next(opts, literal, ec);
if (U_FAILURE(ec)) return;
- UBool anchor = (c == 0x5D /*']'*/ && !literal);
+ UBool anchor = (c == u']' && !literal);
if (symbols == 0 && !anchor) {
c = SymbolTable::SYMBOL_REF;
chars.setPos(backup);
add(U_ETHER);
usePat = TRUE;
patLocal.append((UChar) SymbolTable::SYMBOL_REF);
- patLocal.append((UChar) 0x5D /*']'*/);
+ patLocal.append(u']');
mode = 2;
continue;
}
lastChar = c;
break;
case 1:
- if (op == HYPHEN /*'-'*/) {
+ if (op == u'-') {
if (lastChar >= c) {
// Don't allow redundant (a-a) or empty (b-a) ranges;
// these are most likely typos.
RuleCharacterIterator::Pos pos;
chars.getPos(pos);
UChar32 c = chars.next(iterOpts, literal, ec);
- if (c == 0x5B /*'['*/ || c == 0x5C /*'\\'*/) {
+ if (c == u'[' || c == u'\\') {
UChar32 d = chars.next(iterOpts & ~RuleCharacterIterator::SKIP_WHITESPACE,
literal, ec);
- result = (c == 0x5B /*'['*/) ? (d == 0x3A /*':'*/) :
- (d == 0x4E /*'N'*/ || d == 0x70 /*'p'*/ || d == 0x50 /*'P'*/);
+ result = (c == u'[') ? (d == u':') :
+ (d == u'N' || d == u'p' || d == u'P');
}
chars.setPos(pos);
return result && U_SUCCESS(ec);
posix = TRUE;
pos += 2;
pos = ICU_Utility::skipWhitespace(pattern, pos);
- if (pos < pattern.length() && pattern.charAt(pos) == COMPLEMENT) {
+ if (pos < pattern.length() && pattern.charAt(pos) == u'^') {
++pos;
invert = TRUE;
}
} else if (isPerlOpen(pattern, pos) || isNameOpen(pattern, pos)) {
UChar c = pattern.charAt(pos+1);
- invert = (c == UPPER_P);
- isName = (c == UPPER_N);
+ invert = (c == u'P');
+ isName = (c == u'N');
pos += 2;
pos = ICU_Utility::skipWhitespace(pattern, pos);
- if (pos == pattern.length() || pattern.charAt(pos++) != OPEN_BRACE) {
+ if (pos == pattern.length() || pattern.charAt(pos++) != u'{') {
// Syntax error; "\p" or "\P" not followed by "{"
FAIL(ec);
}
// Look for the matching close delimiter, either :] or }
int32_t close;
if (posix) {
- close = pattern.indexOf(POSIX_CLOSE, 2, pos);
+ close = pattern.indexOf(u":]", 2, pos);
} else {
- close = pattern.indexOf(CLOSE_BRACE, pos);
+ close = pattern.indexOf(u'}', pos);
}
if (close < 0) {
// Syntax error; close delimiter missing
// Look for an '=' sign. If this is present, we will parse a
// medium \p{gc=Cf} or long \p{GeneralCategory=Format}
// pattern.
- int32_t equals = pattern.indexOf(EQUALS, pos);
+ int32_t equals = pattern.indexOf(u'=', pos);
UnicodeString propName, valueName;
if (equals >= 0 && equals < close && !isName) {
// Equals seen; parse medium/long pattern
const char* exp2[] = {"aa", "ab", "ac", NOT, "xy", NULL};
expectToPattern(*s, "[a-z{aa}{ab}{ac}]", exp2);
- s->applyPattern(UNICODE_STRING_SIMPLE("[a-z {\\{l} {r\\}}]"), ec);
+ s->applyPattern(u"[a-z {\\{l} {r\\}}]", ec);
if (U_FAILURE(ec)) break;
const char* exp3[] = {"{l", "r}", NOT, "xy", NULL};
- expectToPattern(*s, UNICODE_STRING_SIMPLE("[a-z{r\\}}{\\{l}]"), exp3);
+ expectToPattern(*s, u"[a-z{r\\}}{\\{l}]", exp3);
s->add("[]");
const char* exp4[] = {"{l", "r}", "[]", NOT, "xy", NULL};
- expectToPattern(*s, UNICODE_STRING_SIMPLE("[a-z{\\[\\]}{r\\}}{\\{l}]"), exp4);
+ expectToPattern(*s, u"[a-z{\\[\\]}{r\\}}{\\{l}]", exp4);
- s->applyPattern(UNICODE_STRING_SIMPLE("[a-z {\\u4E01\\u4E02}{\\n\\r}]"), ec);
+ s->applyPattern(u"[a-z {\\u4E01\\u4E02}{\\n\\r}]", ec);
if (U_FAILURE(ec)) break;
const char* exp5[] = {"\\u4E01\\u4E02", "\n\r", NULL};
- expectToPattern(*s, UNICODE_STRING_SIMPLE("[a-z{\\u000A\\u000D}{\\u4E01\\u4E02}]"), exp5);
+ expectToPattern(*s, u"[a-z{\\u000A\\u000D}{\\u4E01\\u4E02}]", exp5);
// j2189
s->clear();
// JB#3400: For 2 character ranges prefer [ab] to [a-b]
UnicodeSet s;
- s.add((UChar)97, (UChar)98); // 'a', 'b'
+ s.add(u'a', u'b');
expectToPattern(s, "[ab]", NULL);
}
// Throw in a test of complement
set.complement();
UnicodeString exp;
- exp.append((UChar)0x0000).append("aeeoouu").append((UChar)(0x007a+1)).append((UChar)0xFFFF);
+ exp.append((UChar)0x0000).append("aeeoouu").append((UChar)(u'z'+1)).append(u'\uFFFF');
expectPairs(set, exp);
}
// set1 and set2 used to be built with the obsolete constructor taking
// UCharCategory values; replaced with pattern constructors
// markus 20030502
- UnicodeSet *set1=new UnicodeSet(UNICODE_STRING_SIMPLE("\\p{Lowercase Letter}"), status); // :Ll: Letter, lowercase
- UnicodeSet *set1a=new UnicodeSet(UNICODE_STRING_SIMPLE("[:Ll:]"), status); // Letter, lowercase
+ UnicodeSet *set1=new UnicodeSet(u"\\p{Lowercase Letter}", status); // :Ll: Letter, lowercase
+ UnicodeSet *set1a=new UnicodeSet(u"[:Ll:]", status); // Letter, lowercase
if (U_FAILURE(status)){
dataerrln((UnicodeString)"FAIL: Can't construst set with category->Ll" + " - " + UnicodeString(u_errorName(status)));
return;
}
- UnicodeSet *set2=new UnicodeSet(UNICODE_STRING_SIMPLE("\\p{Decimal Number}"), status); //Number, Decimal digit
- UnicodeSet *set2a=new UnicodeSet(UNICODE_STRING_SIMPLE("[:Nd:]"), status); //Number, Decimal digit
+ UnicodeSet *set2=new UnicodeSet(u"\\p{Decimal Number}", status); //Number, Decimal digit
+ UnicodeSet *set2a=new UnicodeSet(u"[:Nd:]", status); //Number, Decimal digit
if (U_FAILURE(status)){
errln((UnicodeString)"FAIL: Can't construct set with category->Nd");
return;
errln("FAIL: UnicodeSetIterator::getString");
}
- set.add((UChar32)0x61, (UChar32)0x7A);
+ set.add(u'a', u'z');
set.complementAll("alan");
exp.applyPattern("[{ab}b-kmo-z]", status);
if (U_FAILURE(status)) { errln("FAIL"); return; }
if (!set.containsNone(exp)) { errln("FAIL: containsNone(UnicodeSet)"); }
if (set.containsSome(exp)) { errln("FAIL: containsSome(UnicodeSet)"); }
- if (set.containsNone((UChar32)0x61, (UChar32)0x7A)) {
+ if (set.containsNone(u'a', u'z')) {
errln("FAIL: containsNone(UChar32, UChar32)");
}
- if (!set.containsSome((UChar32)0x61, (UChar32)0x7A)) {
+ if (!set.containsSome(u'a', u'z')) {
errln("FAIL: containsSome(UChar32, UChar32)");
}
- if (!set.containsNone((UChar32)0x41, (UChar32)0x5A)) {
+ if (!set.containsNone(u'A', u'Z')) {
errln("FAIL: containsNone(UChar32, UChar32)");
}
- if (set.containsSome((UChar32)0x41, (UChar32)0x5A)) {
+ if (set.containsSome(u'A', u'Z')) {
errln("FAIL: containsSome(UChar32, UChar32)");
}
if (U_FAILURE(status)) { errln("FAIL"); return; }
if (set != exp) { errln("FAIL: retainAll(\"star\")"); return; }
- set.retain((UChar32)0x73);
+ set.retain(u's');
exp.applyPattern("[s]", status);
if (U_FAILURE(status)) { errln("FAIL"); return; }
if (set != exp) { errln("FAIL: retain('s')"); return; }
uint16_t buf[32];
int32_t slen = set.serialize(buf, UPRV_LENGTHOF(buf), status);
if (U_FAILURE(status)) { errln("FAIL: serialize"); return; }
- if (slen != 3 || buf[0] != 2 || buf[1] != 0x73 || buf[2] != 0x74) {
+ if (slen != 3 || buf[0] != 2 || buf[1] != u's' || buf[2] != u't') {
errln("FAIL: serialize");
return;
}
TEST_ASSERT((void *)constSetx == (void *)constUSet);
// span(UnicodeString) and spanBack(UnicodeString) convenience methods
- UnicodeString longString=UNICODE_STRING_SIMPLE("aaaaaaaaaabbbbbbbbbbcccccccccc");
+ UnicodeString longString=u"aaaaaaaaaabbbbbbbbbbcccccccccc";
UnicodeSet ac(0x61, 0x63);
ac.remove(0x62).freeze();
if( ac.span(longString, -5, USET_SPAN_CONTAINED)!=10 ||
// 6 code points, 3 ranges, 2 strings, 8 total elements
// Iteration will access them in sorted order - a, b, c, y, z, U0001abcd, "str1", "str2"
- UnicodeSet set(UNICODE_STRING_SIMPLE("[zabyc\\U0001abcd{str1}{str2}]"), ec);
+ UnicodeSet set(u"[zabyc\\U0001abcd{str1}{str2}]", ec);
TEST_ASSERT_SUCCESS(ec);
UnicodeSetIterator it(set);
* Test the [:Latin:] syntax.
*/
void UnicodeSetTest::TestScriptSet() {
- expectContainment(UNICODE_STRING_SIMPLE("[:Latin:]"), "aA", CharsToUnicodeString("\\u0391\\u03B1"));
+ expectContainment(u"[:Latin:]", "aA", CharsToUnicodeString("\\u0391\\u03B1"));
- expectContainment(UNICODE_STRING_SIMPLE("[:Greek:]"), CharsToUnicodeString("\\u0391\\u03B1"), "aA");
+ expectContainment(u"[:Greek:]", CharsToUnicodeString("\\u0391\\u03B1"), "aA");
/* Jitterbug 1423 */
- expectContainment(UNICODE_STRING_SIMPLE("[[:Common:][:Inherited:]]"), CharsToUnicodeString("\\U00003099\\U0001D169\\u0000"), "aA");
+ expectContainment(u"[[:Common:][:Inherited:]]", CharsToUnicodeString("\\U00003099\\U0001D169\\u0000"), "aA");
}
{
UErrorCode status = U_ZERO_ERROR;
UnicodeSet s1("[:alpha:]", status);
- UnicodeSet s2(UNICODE_STRING_SIMPLE("\\p{Alphabetic}"), status);
+ UnicodeSet s2(u"\\p{Alphabetic}", status);
TEST_ASSERT_SUCCESS(status);
TEST_ASSERT(s1==s2);
}
{
UErrorCode status = U_ZERO_ERROR;
UnicodeSet s1("[:lower:]", status);
- UnicodeSet s2(UNICODE_STRING_SIMPLE("\\p{lowercase}"), status);
+ UnicodeSet s2(u"\\p{lowercase}", status);
TEST_ASSERT_SUCCESS(status);
TEST_ASSERT(s1==s2);
}
{
UErrorCode status = U_ZERO_ERROR;
UnicodeSet s1("[:upper:]", status);
- UnicodeSet s2(UNICODE_STRING_SIMPLE("\\p{Uppercase}"), status);
+ UnicodeSet s2(u"\\p{Uppercase}", status);
TEST_ASSERT_SUCCESS(status);
TEST_ASSERT(s1==s2);
}
{
UErrorCode status = U_ZERO_ERROR;
UnicodeSet s1("[:punct:]", status);
- UnicodeSet s2(UNICODE_STRING_SIMPLE("\\p{gc=Punctuation}"), status);
+ UnicodeSet s2(u"\\p{gc=Punctuation}", status);
TEST_ASSERT_SUCCESS(status);
TEST_ASSERT(s1==s2);
}
{
UErrorCode status = U_ZERO_ERROR;
UnicodeSet s1("[:digit:]", status);
- UnicodeSet s2(UNICODE_STRING_SIMPLE("\\p{gc=DecimalNumber}"), status);
+ UnicodeSet s2(u"\\p{gc=DecimalNumber}", status);
TEST_ASSERT_SUCCESS(status);
TEST_ASSERT(s1==s2);
}
{
UErrorCode status = U_ZERO_ERROR;
UnicodeSet s1("[:xdigit:]", status);
- UnicodeSet s2(UNICODE_STRING_SIMPLE("[\\p{DecimalNumber}\\p{HexDigit}]"), status);
+ UnicodeSet s2(u"[\\p{DecimalNumber}\\p{HexDigit}]", status);
TEST_ASSERT_SUCCESS(status);
TEST_ASSERT(s1==s2);
}
{
UErrorCode status = U_ZERO_ERROR;
UnicodeSet s1("[:alnum:]", status);
- UnicodeSet s2(UNICODE_STRING_SIMPLE("[\\p{Alphabetic}\\p{DecimalNumber}]"), status);
+ UnicodeSet s2(u"[\\p{Alphabetic}\\p{DecimalNumber}]", status);
TEST_ASSERT_SUCCESS(status);
TEST_ASSERT(s1==s2);
}
{
UErrorCode status = U_ZERO_ERROR;
UnicodeSet s1("[:space:]", status);
- UnicodeSet s2(UNICODE_STRING_SIMPLE("\\p{Whitespace}"), status);
+ UnicodeSet s2(u"\\p{Whitespace}", status);
TEST_ASSERT_SUCCESS(status);
TEST_ASSERT(s1==s2);
}
UErrorCode status = U_ZERO_ERROR;
UnicodeSet s1("[:blank:]", status);
TEST_ASSERT_SUCCESS(status);
- UnicodeSet s2(UNICODE_STRING_SIMPLE("[\\p{Whitespace}-[\\u000a\\u000B\\u000c\\u000d\\u0085\\p{LineSeparator}\\p{ParagraphSeparator}]]"),
+ UnicodeSet s2(u"[\\p{Whitespace}-[\\u000a\\u000B\\u000c\\u000d\\u0085\\p{LineSeparator}\\p{ParagraphSeparator}]]",
status);
TEST_ASSERT_SUCCESS(status);
TEST_ASSERT(s1==s2);
UErrorCode status = U_ZERO_ERROR;
UnicodeSet s1("[:cntrl:]", status);
TEST_ASSERT_SUCCESS(status);
- UnicodeSet s2(UNICODE_STRING_SIMPLE("\\p{Control}"), status);
+ UnicodeSet s2(u"\\p{Control}", status);
TEST_ASSERT_SUCCESS(status);
TEST_ASSERT(s1==s2);
}
UErrorCode status = U_ZERO_ERROR;
UnicodeSet s1("[:graph:]", status);
TEST_ASSERT_SUCCESS(status);
- UnicodeSet s2(UNICODE_STRING_SIMPLE("[^\\p{Whitespace}\\p{Control}\\p{Surrogate}\\p{Unassigned}]"), status);
+ UnicodeSet s2(u"[^\\p{Whitespace}\\p{Control}\\p{Surrogate}\\p{Unassigned}]", status);
TEST_ASSERT_SUCCESS(status);
TEST_ASSERT(s1==s2);
}
UErrorCode status = U_ZERO_ERROR;
UnicodeSet s1("[:print:]", status);
TEST_ASSERT_SUCCESS(status);
- UnicodeSet s2(UNICODE_STRING_SIMPLE("[[:graph:][:blank:]-[\\p{Control}]]") ,status);
+ UnicodeSet s2(u"[[:graph:][:blank:]-[\\p{Control}]]", status);
TEST_ASSERT_SUCCESS(status);
TEST_ASSERT(s1==s2);
}
if (c != -1) {
errln("FAIL: charAt(<out of range>) = %X", c);
}
- int32_t j = set.indexOf((UChar32)0x71/*'q'*/);
+ int32_t j = set.indexOf(u'q');
if (j != -1) {
errln((UnicodeString)"FAIL: indexOf('q') = " + j);
}
if (U_FAILURE(ec)) {
continue;
}
- if (set.contains((UChar)0x0644)){
+ if (set.contains(u'\u0644')){
errln((UnicodeString)"FAIL: " + escape(pat) + " contains(U+0664)");
}
for (int32_t i=0; i<set.getRangeCount(); ++i) {
UnicodeString str("Range ");
- str.append((UChar)(0x30 + i))
+ str.append((UChar)(u'0' + i))
.append(": ")
.append((UChar32)set.getRangeStart(i))
.append(" - ")
}
}
-static UChar toHexString(int32_t i) { return (UChar)(i + (i < 10 ? 0x30 : (0x41 - 10))); }
+static UChar toHexString(int32_t i) { return (UChar)(i + (i < 10 ? u'0' : (u'A' - 10))); }
void
UnicodeSetTest::doAssert(UBool condition, const char *message)
buf += c;
} else {
if (c <= 0xFFFF) {
- buf += (UChar)0x5c; buf += (UChar)0x75;
+ buf += u"\\u";
} else {
- buf += (UChar)0x5c; buf += (UChar)0x55;
+ buf += u"\\U";
buf += toHexString((c & 0xF0000000) >> 28);
buf += toHexString((c & 0x0F000000) >> 24);
buf += toHexString((c & 0x00F00000) >> 20);
applyPattern(wsPattern, USET_IGNORE_SPACE, NULL, errorCode).
applyPattern(wsPattern, pos, USET_IGNORE_SPACE, NULL, errorCode).
applyIntPropertyValue(UCHAR_CANONICAL_COMBINING_CLASS, 230, errorCode).
- applyPropertyAlias(UNICODE_STRING_SIMPLE("Assigned"), UnicodeString(), errorCode);
+ applyPropertyAlias(u"Assigned", UnicodeString(), errorCode);
if(frozen!=idSet || !(frozen==idSet)) {
errln("FAIL: UnicodeSet::applyXYZ() modified a frozen set");
}
errln("FAIL: UnicodeSet(%s).containsAll(%s[:-4]) should be TRUE", pattern, string);
}
- string16=UNICODE_STRING_SIMPLE("byayaxya");
+ string16=u"byayaxya";
const UChar *s16=string16.getBuffer();
int32_t length16=string16.length();
(void)length16; // Suppress set but not used warning.
errln("FAIL: Unable to create UnicodeSet(%s) - %s", pattern, u_errorName(errorCode));
return;
}
- string16=UNICODE_STRING_SIMPLE("acdabcdabccd");
+ string16=u"acdabcdabccd";
s16=string16.getBuffer();
length16=string16.length();
if( set.span(s16, 12, USET_SPAN_CONTAINED)!=12 ||
errln("FAIL: Unable to create UnicodeSet(%s) - %s", pattern, u_errorName(errorCode));
return;
}
- string16=UNICODE_STRING_SIMPLE("abbcdabcdabd");
+ string16=u"abbcdabcdabd";
s16=string16.getBuffer();
length16=string16.length();
if( set.spanBack(s16, 12, USET_SPAN_CONTAINED)!=0 ||