mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-10 07:39:16 +00:00
ICU-315 more S/390 and EBCDIC changes
X-SVN-Rev: 1045
This commit is contained in:
parent
2b5a36af8c
commit
fb52c91781
5 changed files with 57 additions and 62 deletions
|
@ -826,22 +826,22 @@ void MessageFormatRegressionTest::Test4120552()
|
|||
*/
|
||||
void MessageFormatRegressionTest::Test4142938()
|
||||
{
|
||||
UnicodeString pat( (UnicodeString)"''Vous'' {0,choice,0#n''|1#}avez sélectionné " +
|
||||
"{0,choice,0#aucun|1#{0}} client{0,choice,0#s|1#|2#s} " +
|
||||
UnicodeString pat = CharsToUnicodeString("''Vous'' {0,choice,0#n''|1#}avez s\\u00E9lectionn\\u00E9 "
|
||||
"{0,choice,0#aucun|1#{0}} client{0,choice,0#s|1#|2#s} "
|
||||
"personnel{0,choice,0#s|1#|2#s}.");
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
MessageFormat *mf = new MessageFormat(pat, status);
|
||||
failure(status, "new MessageFormat");
|
||||
|
||||
UnicodeString PREFIX [] = {
|
||||
(UnicodeString) "'Vous' n'avez sélectionné aucun clients personnels.",
|
||||
(UnicodeString) "'Vous' avez sélectionné ",
|
||||
(UnicodeString) "'Vous' avez sélectionné "
|
||||
CharsToUnicodeString("'Vous' n'avez s\\u00E9lectionn\\u00E9 aucun clients personnels."),
|
||||
CharsToUnicodeString("'Vous' avez s\\u00E9lectionn\\u00E9 "),
|
||||
CharsToUnicodeString("'Vous' avez s\\u00E9lectionn\\u00E9 ")
|
||||
};
|
||||
UnicodeString SUFFIX [] = {
|
||||
(UnicodeString) "",
|
||||
(UnicodeString) " client personnel.",
|
||||
(UnicodeString) " clients personnels."
|
||||
UnicodeString(),
|
||||
UNICODE_STRING(" client personnel.", 18),
|
||||
UNICODE_STRING(" clients personnels.", 20)
|
||||
};
|
||||
|
||||
for (int i=0; i<3; i++) {
|
||||
|
|
|
@ -736,7 +736,7 @@ void NumberFormatTest::TestPatterns2(void) {
|
|||
expectPat(fmt, "AA#,##0.00ZZ*^");
|
||||
|
||||
// 12 3456789012
|
||||
UnicodeString exp("AA*^#,##0.00ZZ");
|
||||
UnicodeString exp("AA*^#,##0.00ZZ", "");
|
||||
fmt.setFormatWidth(12);
|
||||
fmt.setPadPosition(DecimalFormat::kPadAfterPrefix);
|
||||
expectPat(fmt, exp);
|
||||
|
|
|
@ -58,17 +58,39 @@ public:
|
|||
virtual void TestExponent(void);
|
||||
virtual void TestScientific(void);
|
||||
void expect(NumberFormat& fmt, const UnicodeString& str, int32_t n);
|
||||
void expect(NumberFormat& fmt, const char *str, int32_t n) {
|
||||
expect(fmt, UnicodeString(str, ""), n);
|
||||
}
|
||||
void expect(NumberFormat& fmt, const Formattable& n,
|
||||
const UnicodeString& exp);
|
||||
void expect(NumberFormat& fmt, const Formattable& n,
|
||||
const char *exp) {
|
||||
expect(fmt, n, UnicodeString(exp, ""));
|
||||
}
|
||||
void expect(NumberFormat* fmt, const Formattable& n,
|
||||
const UnicodeString& exp, UErrorCode);
|
||||
void expect(NumberFormat* fmt, const Formattable& n,
|
||||
const char *exp, UErrorCode errorCode) {
|
||||
expect(fmt, n, UnicodeString(exp, ""), errorCode);
|
||||
}
|
||||
void TestPad(void);
|
||||
void TestPatterns2(void);
|
||||
void expectPad(DecimalFormat& fmt, const UnicodeString& pat,
|
||||
int32_t pos);
|
||||
void expectPad(DecimalFormat& fmt, const char *pat,
|
||||
int32_t pos) {
|
||||
expectPad(fmt, pat, pos, 0, (UChar)0);
|
||||
}
|
||||
void expectPad(DecimalFormat& fmt, const UnicodeString& pat,
|
||||
int32_t pos, int32_t width, UChar pad);
|
||||
void expectPad(DecimalFormat& fmt, const char *pat,
|
||||
int32_t pos, int32_t width, UChar pad) {
|
||||
expectPad(fmt, UnicodeString(pat, ""), pos, width, pad);
|
||||
}
|
||||
void expectPat(DecimalFormat& fmt, const UnicodeString& exp);
|
||||
void expectPat(DecimalFormat& fmt, const char *exp) {
|
||||
expectPat(fmt, UnicodeString(exp, ""));
|
||||
}
|
||||
enum { ILLEGAL = -1 };
|
||||
|
||||
public: // package
|
||||
|
|
|
@ -106,38 +106,9 @@ NumberFormatRegressionTest::failure(UErrorCode status, const UnicodeString& msg)
|
|||
/**
|
||||
* Convert Java-style strings with \u Unicode escapes into UnicodeString objects
|
||||
*/
|
||||
static UnicodeString str(const char *input)
|
||||
inline UnicodeString str(const char *input)
|
||||
{
|
||||
static const UnicodeString digitString1("0123456789ABCDEF");
|
||||
static const UnicodeString digitString2("0123456789abcdef");
|
||||
|
||||
UnicodeString result(input);
|
||||
int index = 0;
|
||||
|
||||
while ((index = result.indexOf("\\u")) != -1)
|
||||
{
|
||||
if (index + 6 <= result.length())
|
||||
{
|
||||
UChar c = 0;
|
||||
for (int i = index + 2; i < index + 6; i++) {
|
||||
UTextOffset value = digitString1.indexOf(result[i]);
|
||||
|
||||
if (value == -1) {
|
||||
value = digitString2.indexOf(result[i]);
|
||||
}
|
||||
c = (UChar)(c * 16 + value);
|
||||
}
|
||||
UnicodeString replace;
|
||||
replace += c;
|
||||
result.replace(index, 6, replace);
|
||||
}
|
||||
index += 1;
|
||||
}
|
||||
|
||||
//cout << "Converted |" << input << "| to ";
|
||||
//print(result,"");
|
||||
|
||||
return result;
|
||||
return CharsToUnicodeString(input);
|
||||
}
|
||||
|
||||
/* @bug 4075713
|
||||
|
@ -2012,12 +1983,12 @@ void NumberFormatRegressionTest::Test4212072(void) {
|
|||
sym.setMinusSign(0x5e);
|
||||
fmt.setDecimalFormatSymbols(sym);
|
||||
s.remove();
|
||||
if (fmt.format((int32_t)-1, s, pos) != UnicodeString("^1")) {
|
||||
if (fmt.format((int32_t)-1, s, pos) != UNICODE_STRING("^1", 2)) {
|
||||
errln(UnicodeString("FAIL: -1 x (minus=^) -> ") + s +
|
||||
", exp ^1");
|
||||
}
|
||||
s.remove();
|
||||
if (fmt.getNegativePrefix(s) != UnicodeString("^")) {
|
||||
if (fmt.getNegativePrefix(s) != UnicodeString((UChar)0x5e)) {
|
||||
errln(UnicodeString("FAIL: (minus=^).getNegativePrefix -> ") +
|
||||
s + ", exp ^");
|
||||
}
|
||||
|
@ -2028,12 +1999,12 @@ void NumberFormatRegressionTest::Test4212072(void) {
|
|||
sym.setPercent(0x5e);
|
||||
fmt.setDecimalFormatSymbols(sym);
|
||||
s.remove();
|
||||
if (fmt.format(0.25, s, pos) != UnicodeString("25^")) {
|
||||
if (fmt.format(0.25, s, pos) != UNICODE_STRING("25^", 3)) {
|
||||
errln(UnicodeString("FAIL: 0.25 x (percent=^) -> ") + s +
|
||||
", exp 25^");
|
||||
}
|
||||
s.remove();
|
||||
if (fmt.getPositiveSuffix(s) != UnicodeString("^")) {
|
||||
if (fmt.getPositiveSuffix(s) != UnicodeString((UChar)0x5e)) {
|
||||
errln(UnicodeString("FAIL: (percent=^).getPositiveSuffix -> ") +
|
||||
s + ", exp ^");
|
||||
}
|
||||
|
@ -2044,12 +2015,12 @@ void NumberFormatRegressionTest::Test4212072(void) {
|
|||
sym.setPerMill(0x5e);
|
||||
fmt.setDecimalFormatSymbols(sym);
|
||||
s.remove();
|
||||
if (fmt.format(0.25, s, pos) != UnicodeString("250^")) {
|
||||
if (fmt.format(0.25, s, pos) != UNICODE_STRING("250^", 4)) {
|
||||
errln(UnicodeString("FAIL: 0.25 x (permill=^) -> ") + s +
|
||||
", exp 250^");
|
||||
}
|
||||
s.remove();
|
||||
if (fmt.getPositiveSuffix(s) != UnicodeString("^")) {
|
||||
if (fmt.getPositiveSuffix(s) != UnicodeString((UChar)0x5e)) {
|
||||
errln(UnicodeString("FAIL: (permill=^).getPositiveSuffix -> ") +
|
||||
s + ", exp ^");
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ void TransliteratorTest::TestSimpleRules(void) {
|
|||
* [exz]|d no match, copy d to transliterated buffer
|
||||
* [exzd]| done
|
||||
*/
|
||||
expect(UnicodeString("ab>x|y;") +
|
||||
expect(UnicodeString("ab>x|y;", "") +
|
||||
"yc>z",
|
||||
"eabcd", "exzd"); /* Another set of rules:
|
||||
* 1. ab>x|yzacw
|
||||
|
@ -140,15 +140,17 @@ void TransliteratorTest::TestSimpleRules(void) {
|
|||
UErrorCode status = U_ZERO_ERROR;
|
||||
RuleBasedTransliterator t(
|
||||
"<ID>",
|
||||
UnicodeString("dummy=").append((UChar)0xE100) + ";" +
|
||||
" vowel = [aeiouAEIOU];" +
|
||||
" lu = [:Lu:];" +
|
||||
UnicodeString("dummy=").append((UChar)0xE100) +
|
||||
UnicodeString(
|
||||
";"
|
||||
" vowel = [aeiouAEIOU];"
|
||||
" lu = [:Lu:];"
|
||||
|
||||
" {vowel} ({lu}) > ! ;" +
|
||||
" {vowel} > & ;" +
|
||||
" !) {lu} > ^ ;" +
|
||||
" {lu} > * ;" +
|
||||
" a > ERROR",
|
||||
" {vowel} ({lu}) > ! ;"
|
||||
" {vowel} > & ;"
|
||||
" !) {lu} > ^ ;"
|
||||
" {lu} > * ;"
|
||||
" a > ERROR", ""),
|
||||
status);
|
||||
if (U_FAILURE(status)) {
|
||||
errln("FAIL: RBT constructor failed");
|
||||
|
@ -164,13 +166,13 @@ void TransliteratorTest::TestInlineSet(void) {
|
|||
expect("[:Ll:] (x) > y; [:Ll:] > z;", "aAbxq", "zAyzz");
|
||||
expect("a[0-9]b > qrs", "1a7b9", "1qrs9");
|
||||
|
||||
expect((UnicodeString)
|
||||
"digit = [0-9];" +
|
||||
"alpha = [a-zA-Z];" +
|
||||
"alphanumeric = [{digit}{alpha}];" + // ***
|
||||
"special = [^{alphanumeric}];" + // ***
|
||||
"{alphanumeric} > -;" +
|
||||
"{special} > *;",
|
||||
expect(UnicodeString(
|
||||
"digit = [0-9];"
|
||||
"alpha = [a-zA-Z];"
|
||||
"alphanumeric = [{digit}{alpha}];" // ***
|
||||
"special = [^{alphanumeric}];" // ***
|
||||
"{alphanumeric} > -;"
|
||||
"{special} > *;", ""),
|
||||
|
||||
"thx-1138", "---*----");
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue