diff options
author | Jonathan Kew <jfkthame@googlemail.com> | 2007-11-21 12:29:46 +0000 |
---|---|---|
committer | Jonathan Kew <jfkthame@googlemail.com> | 2007-11-21 12:29:46 +0000 |
commit | 952d69f85d43b087ce9fa79d3fc6f1c076000bc7 (patch) | |
tree | dd6937a6486e80e1638618308481075efab000ae /Build/source/libs/icu-xetex/test/intltest/miscdtfm.cpp | |
parent | 888236cb9df7b7d7b5a3e2d784037a9a59511c53 (diff) |
updated icu-xetex library for XeTeX 0.997
git-svn-id: svn://tug.org/texlive/trunk@5536 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/icu-xetex/test/intltest/miscdtfm.cpp')
-rw-r--r-- | Build/source/libs/icu-xetex/test/intltest/miscdtfm.cpp | 59 |
1 files changed, 36 insertions, 23 deletions
diff --git a/Build/source/libs/icu-xetex/test/intltest/miscdtfm.cpp b/Build/source/libs/icu-xetex/test/intltest/miscdtfm.cpp index e1415ecf3a1..0a5fb0bb1ed 100644 --- a/Build/source/libs/icu-xetex/test/intltest/miscdtfm.cpp +++ b/Build/source/libs/icu-xetex/test/intltest/miscdtfm.cpp @@ -1,6 +1,6 @@ /*********************************************************************** * COPYRIGHT: - * Copyright (c) 1997-2005, International Business Machines Corporation + * Copyright (c) 1997-2006, International Business Machines Corporation * and others. All Rights Reserved. ***********************************************************************/ @@ -122,7 +122,7 @@ DateFormatMiscTests::test4097450() { log(dformat[i] + "\t" + dstring[i] + "\t"); formatter = new SimpleDateFormat(dformat[i], status); - failure(status, "new SimpleDateFormat"); + if(failure(status, "new SimpleDateFormat")) return; //try { UnicodeString str; FieldPosition pos(FieldPosition::DONT_CARE); @@ -157,9 +157,9 @@ DateFormatMiscTests::test4099975() { UErrorCode status = U_ZERO_ERROR; DateFormatSymbols* symbols = new DateFormatSymbols(Locale::getUS(), status); - failure(status, "new DateFormatSymbols"); + if(failure(status, "new DateFormatSymbols")) return; SimpleDateFormat *df = new SimpleDateFormat(UnicodeString("E hh:mm"), *symbols, status); - failure(status, "new SimpleDateFormat"); + if(failure(status, "new SimpleDateFormat")) return; UnicodeString format0; format0 = df->format(d, format0); UnicodeString localizedPattern0; @@ -189,9 +189,9 @@ DateFormatMiscTests::test4099975() { UErrorCode status = U_ZERO_ERROR; DateFormatSymbols* symbols = new DateFormatSymbols(Locale::getUS(), status); - failure(status, "new DateFormatSymbols"); + if(failure(status, "new DateFormatSymbols")) return; SimpleDateFormat *df = new SimpleDateFormat(UnicodeString("E hh:mm"), status); - failure(status, "new SimpleDateFormat"); + if(failure(status, "new SimpleDateFormat")) return; df->setDateFormatSymbols(*symbols); UnicodeString format0; format0 = df->format(d, format0); @@ -220,9 +220,9 @@ DateFormatMiscTests::test4099975() { UErrorCode status = U_ZERO_ERROR; DateFormatSymbols* symbols = new DateFormatSymbols(Locale::getUS(), status); - failure(status, "new DateFormatSymbols"); + if(failure(status, "new DateFormatSymbols")) return; SimpleDateFormat *df = new SimpleDateFormat(UnicodeString("E hh:mm"), symbols, status); - failure(status, "new SimpleDateFormat"); + if(failure(status, "new SimpleDateFormat")) return; UnicodeString format0; format0 = df->format(d, format0); UnicodeString localizedPattern0; @@ -251,7 +251,7 @@ DateFormatMiscTests::test4099975() DateFormatSymbols* symbols = new DateFormatSymbols(Locale::getUS(), status); failure(status, "new DateFormatSymbols"); SimpleDateFormat *df = new SimpleDateFormat(UnicodeString("E hh:mm"), status); - failure(status, "new SimpleDateFormat"); + if(failure(status, "new SimpleDateFormat")) return; df-> adoptDateFormatSymbols(symbols); UnicodeString format0; format0 = df->format(d, format0); @@ -308,11 +308,17 @@ DateFormatMiscTests::test4117335() 0x6e96, 0x6642 }; + UChar jdtLongC [] = {0x65E5, 0x672C, 0x590F, 0x6642, 0x9593}; + UnicodeString jstLong(jstLongC, 5, 5); UnicodeString jstShort = "JST"; - + UnicodeString tzID = "Asia/Tokyo"; + + UnicodeString jdtLong(jdtLongC, 5, 5); + + UnicodeString jdtShort = "JDT"; UErrorCode status = U_ZERO_ERROR; DateFormatSymbols *symbols = new DateFormatSymbols(Locale::getJapan(), status); if(U_FAILURE(status)) { @@ -338,25 +344,32 @@ DateFormatMiscTests::test4117335() int32_t rowCount, colCount; const UnicodeString **zones = symbols->getZoneStrings(rowCount, colCount); - int pos = 5; - logln(UnicodeString("Long zone name = ") + zones[pos][1]); - if (zones[pos][1] != jstLong) { - errln("*** Should have been " + prettify(jstLong)+ " but it is: " + prettify(zones[pos][1])); + //don't hard code the index .. compute it. + int32_t index = -1; + for (int32_t i = 0; i < rowCount; ++i) { + if (tzID == (zones[i][0])) { + index = i; + break; + } + } + logln(UnicodeString("Long zone name = ") + zones[index][1]); + if (zones[index][1] != jstLong) { + errln("*** Should have been " + prettify(jstLong)+ " but it is: " + prettify(zones[index][1])); //throw new Exception("Error in long TZ name"); } - logln(UnicodeString("Short zone name = ") + zones[pos][2]); - if (zones[pos][2] != jstShort) { - errln("*** Should have been " + prettify(jstShort) + " but it is: " + prettify(zones[pos][2])); + logln(UnicodeString("Short zone name = ") + zones[index][2]); + if (zones[index][2] != jstShort) { + errln("*** Should have been " + prettify(jstShort) + " but it is: " + prettify(zones[index][2])); //throw new Exception("Error in short TZ name"); } - logln(UnicodeString("Long zone name = ") + zones[pos][3]); - if (zones[pos][3] != jstLong) { - errln("*** Should have been " + prettify(jstLong) + " but it is: " + prettify(zones[pos][3])); + logln(UnicodeString("Long zone name = ") + zones[index][3]); + if (zones[index][3] != jdtLong) { + errln("*** Should have been " + prettify(jstLong) + " but it is: " + prettify(zones[index][3])); //throw new Exception("Error in long TZ name"); } - logln(UnicodeString("SHORT zone name = ") + zones[pos][4]); - if (zones[pos][4] != jstShort) { - errln("*** Should have been " + prettify(jstShort)+ " but it is: " + prettify(zones[pos][4])); + logln(UnicodeString("SHORT zone name = ") + zones[index][4]); + if (zones[index][4] != jdtShort) { + errln("*** Should have been " + prettify(jstShort)+ " but it is: " + prettify(zones[index][4])); //throw new Exception("Error in short TZ name"); } delete symbols; |