]> git.saurik.com Git - apple/icu.git/blob - icuSources/test/intltest/incaltst.cpp
ICU-6.2.22.tar.gz
[apple/icu.git] / icuSources / test / intltest / incaltst.cpp
1 /***********************************************************************
2 * COPYRIGHT:
3 * Copyright (c) 1997-2004, International Business Machines Corporation
4 * and others. All Rights Reserved.
5 ***********************************************************************/
6
7 /* Test Internationalized Calendars for C++ */
8
9 #include "unicode/utypes.h"
10 #include "string.h"
11 #include "unicode/locid.h"
12
13 #if !UCONFIG_NO_FORMATTING
14
15 #include <stdio.h>
16 #include "caltest.h"
17
18 #define CHECK(status, msg) \
19 if (U_FAILURE(status)) { \
20 errln((UnicodeString(u_errorName(status)) + UnicodeString(" : " ) )+ msg); \
21 return; \
22 }
23
24
25 static UnicodeString escape( const UnicodeString&src)
26 {
27 UnicodeString dst;
28 dst.remove();
29 for (int32_t i = 0; i < src.length(); ++i) {
30 UChar c = src[i];
31 if(c < 0x0080)
32 dst += c;
33 else {
34 dst += UnicodeString("[");
35 char buf [8];
36 sprintf(buf, "%#x", c);
37 dst += UnicodeString(buf);
38 dst += UnicodeString("]");
39 }
40 }
41
42 return dst;
43 }
44
45
46 #include "incaltst.h"
47 #include "unicode/gregocal.h"
48 #include "unicode/smpdtfmt.h"
49 #include "unicode/simpletz.h"
50
51 // *****************************************************************************
52 // class IntlCalendarTest
53 // *****************************************************************************
54 //--- move to CalendarTest?
55
56 static const double JULIAN_EPOCH = -210866760000000.;
57
58
59 // Turn this on to dump the calendar fields
60 #define U_DEBUG_DUMPCALS
61
62
63 #define CASE(id,test) case id: name = #test; if (exec) { logln(#test "---"); logln((UnicodeString)""); test(); } break
64
65
66 void IntlCalendarTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ )
67 {
68 if (exec) logln("TestSuite IntlCalendarTest");
69 switch (index) {
70 CASE(0,TestTypes);
71 CASE(1,TestGregorian);
72 CASE(2,TestBuddhist);
73 CASE(3,TestJapanese);
74 CASE(4,TestBuddhistFormat);
75 CASE(5,TestJapaneseFormat);
76 default: name = ""; break;
77 }
78 }
79
80 #undef CASE
81
82 // ---------------------------------------------------------------------------------
83
84
85 /**
86 * Test various API methods for API completeness.
87 */
88 void
89 IntlCalendarTest::TestTypes()
90 {
91 Calendar *c = NULL;
92 UErrorCode status = U_ZERO_ERROR;
93 int j;
94 const char *locs [40] = { "en_US_VALLEYGIRL",
95 "en_US_VALLEYGIRL@collation=phonebook;calendar=japanese",
96 "en_US_VALLEYGIRL@collation=phonebook;calendar=gregorian",
97 "ja_JP@calendar=japanese",
98 "th_TH@calendar=buddhist",
99 "ja_JP_TRADITIONAL",
100 "th_TH_TRADITIONAL",
101 "th_TH_TRADITIONAL@calendar=gregorian",
102 "en_US", NULL };
103 const char *types[40] = { "gregorian",
104 "japanese",
105 "gregorian",
106 "japanese",
107 "buddhist",
108 "japanese",
109 "buddhist",
110 "gregorian",
111 "gregorian", NULL };
112
113 for(j=0;locs[j];j++) {
114 logln(UnicodeString("Creating calendar of locale ") + locs[j]);
115 status = U_ZERO_ERROR;
116 c = Calendar::createInstance(locs[j], status);
117 CHECK(status, "creating '" + UnicodeString(locs[j]) + "' calendar");
118 if(U_SUCCESS(status)) {
119 logln(UnicodeString(" type is ") + c->getType());
120 if(strcmp(c->getType(), types[j])) {
121 errln(UnicodeString(locs[j]) + UnicodeString("Calendar type ") + c->getType() + " instead of " + types[j]);
122 }
123 }
124 delete c;
125 }
126 }
127
128
129
130 /**
131 * Run a test of a quasi-Gregorian calendar. This is a calendar
132 * that behaves like a Gregorian but has different year/era mappings.
133 * The int[] data array should have the format:
134 *
135 * { era, year, gregorianYear, month, dayOfMonth, ... ... , -1 }
136 */
137 void IntlCalendarTest::quasiGregorianTest(Calendar& cal, const Locale& gcl, const int32_t *data) {
138 UErrorCode status = U_ZERO_ERROR;
139 // As of JDK 1.4.1_01, using the Sun JDK GregorianCalendar as
140 // a reference throws us off by one hour. This is most likely
141 // due to the JDK 1.4 incorporation of historical time zones.
142 //java.util.Calendar grego = java.util.Calendar.getInstance();
143 Calendar *grego = Calendar::createInstance(gcl, status);
144
145 int32_t tz1 = cal.get(UCAL_ZONE_OFFSET,status);
146 int32_t tz2 = grego -> get (UCAL_ZONE_OFFSET, status);
147 if(tz1 != tz2) {
148 errln((UnicodeString)"cal's tz " + tz1 + " != grego's tz " + tz2);
149 }
150
151 for (int32_t i=0; data[i]!=-1; ) {
152 int32_t era = data[i++];
153 int32_t year = data[i++];
154 int32_t gregorianYear = data[i++];
155 int32_t month = data[i++];
156 int32_t dayOfMonth = data[i++];
157
158 grego->clear();
159 grego->set(gregorianYear, month, dayOfMonth);
160 UDate D = grego->getTime(status);
161
162 cal.clear();
163 cal.set(UCAL_ERA, era);
164 cal.set(year, month, dayOfMonth);
165 UDate d = cal.getTime(status);
166 #ifdef U_DEBUG_DUMPCALS
167 logln((UnicodeString)"cal : " + CalendarTest::calToStr(cal));
168 logln((UnicodeString)"grego: " + CalendarTest::calToStr(*grego));
169 #endif
170 if (d == D) {
171 logln(UnicodeString("OK: ") + era + ":" + year + "/" + (month+1) + "/" + dayOfMonth +
172 " => " + d + " (" + UnicodeString(cal.getType()) + ")");
173 } else {
174 errln(UnicodeString("Fail: (fields to millis)") + era + ":" + year + "/" + (month+1) + "/" + dayOfMonth +
175 " => " + d + ", expected " + D + " (" + UnicodeString(cal.getType()) + "Off by: " + (d-D));
176 }
177
178 // Now, set the gregorian millis on the other calendar
179 cal.clear();
180 cal.setTime(D, status);
181 int e = cal.get(UCAL_ERA, status);
182 int y = cal.get(UCAL_YEAR, status);
183 #ifdef U_DEBUG_DUMPCALS
184 logln((UnicodeString)"cal : " + CalendarTest::calToStr(cal));
185 logln((UnicodeString)"grego: " + CalendarTest::calToStr(*grego));
186 #endif
187 if (y == year && e == era) {
188 logln((UnicodeString)"OK: " + D + " => " + cal.get(UCAL_ERA, status) + ":" +
189 cal.get(UCAL_YEAR, status) + "/" +
190 (cal.get(UCAL_MONTH, status)+1) + "/" + cal.get(UCAL_DATE, status) + " (" + UnicodeString(cal.getType()) + ")");
191 } else {
192 errln((UnicodeString)"Fail: (millis to fields)" + D + " => " + cal.get(UCAL_ERA, status) + ":" +
193 cal.get(UCAL_YEAR, status) + "/" +
194 (cal.get(UCAL_MONTH, status)+1) + "/" + cal.get(UCAL_DATE, status) +
195 ", expected " + era + ":" + year + "/" + (month+1) + "/" +
196 dayOfMonth + " (" + UnicodeString(cal.getType()));
197 }
198 }
199 delete grego;
200 CHECK(status, "err during quasiGregorianTest()");
201 }
202
203 // Verify that Gregorian works like Gregorian
204 void IntlCalendarTest::TestGregorian() {
205 UDate timeA = Calendar::getNow();
206 int32_t data[] = {
207 GregorianCalendar::AD, 1868, 1868, UCAL_SEPTEMBER, 8,
208 GregorianCalendar::AD, 1868, 1868, UCAL_SEPTEMBER, 9,
209 GregorianCalendar::AD, 1869, 1869, UCAL_JUNE, 4,
210 GregorianCalendar::AD, 1912, 1912, UCAL_JULY, 29,
211 GregorianCalendar::AD, 1912, 1912, UCAL_JULY, 30,
212 GregorianCalendar::AD, 1912, 1912, UCAL_AUGUST, 1,
213 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
214 };
215
216 Calendar *cal;
217 UErrorCode status = U_ZERO_ERROR;
218 cal = Calendar::createInstance(/*"de_DE", */ status);
219 CHECK(status, UnicodeString("Creating de_CH calendar"));
220 // Sanity check the calendar
221 UDate timeB = Calendar::getNow();
222 UDate timeCal = cal->getTime(status);
223
224 if(!(timeA <= timeCal) || !(timeCal <= timeB)) {
225 errln((UnicodeString)"Error: Calendar time " + timeCal +
226 " is not within sampled times [" + timeA + " to " + timeB + "]!");
227 }
228 // end sanity check
229
230 // Note, the following is a good way to test the sanity of the constructed calendars,
231 // using Collation as a delay-loop:
232 //
233 // $ intltest format/IntlCalendarTest collate/G7CollationTest format/IntlCalendarTest
234
235 quasiGregorianTest(*cal,Locale("fr_FR"),data);
236 delete cal;
237 }
238
239 /**
240 * Verify that BuddhistCalendar shifts years to Buddhist Era but otherwise
241 * behaves like GregorianCalendar.
242 */
243 void IntlCalendarTest::TestBuddhist() {
244 // BE 2542 == 1999 CE
245 UDate timeA = Calendar::getNow();
246
247 int32_t data[] = {
248 0, // B. era [928479600000]
249 2542, // B. year
250 1999, // G. year
251 UCAL_JUNE, // month
252 4, // day
253
254 0, // B. era [-79204842000000]
255 3, // B. year
256 -540, // G. year
257 UCAL_FEBRUARY, // month
258 12, // day
259
260 0, // test month calculation: 4795 BE = 4252 AD is a leap year, but 4795 AD is not.
261 4795, // BE [72018057600000]
262 4252, // AD
263 UCAL_FEBRUARY,
264 29,
265
266 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1
267 };
268 Calendar *cal;
269 UErrorCode status = U_ZERO_ERROR;
270 cal = Calendar::createInstance("th_TH@calendar=buddhist", status);
271 CHECK(status, UnicodeString("Creating th_TH@calendar=buddhist calendar"));
272
273 // Sanity check the calendar
274 UDate timeB = Calendar::getNow();
275 UDate timeCal = cal->getTime(status);
276
277 if(!(timeA <= timeCal) || !(timeCal <= timeB)) {
278 errln((UnicodeString)"Error: Calendar time " + timeCal +
279 " is not within sampled times [" + timeA + " to " + timeB + "]!");
280 }
281 // end sanity check
282
283
284 quasiGregorianTest(*cal,Locale("th_TH"),data);
285 delete cal;
286 }
287
288 /**
289 * Verify that JapaneseCalendar shifts years to Japanese Eras but otherwise
290 * behaves like GregorianCalendar.
291 */
292 void IntlCalendarTest::TestJapanese() {
293 UDate timeA = Calendar::getNow();
294
295 /* Sorry.. japancal.h is private! */
296 #define JapaneseCalendar_MEIJI 232
297 #define JapaneseCalendar_TAISHO 233
298 #define JapaneseCalendar_SHOWA 234
299 #define JapaneseCalendar_HEISEI 235
300
301 // BE 2542 == 1999 CE
302 int32_t data[] = {
303 // Jera Jyr Gyear m d
304 JapaneseCalendar_MEIJI, 1, 1868, UCAL_SEPTEMBER, 8,
305 JapaneseCalendar_MEIJI, 1, 1868, UCAL_SEPTEMBER, 9,
306 JapaneseCalendar_MEIJI, 2, 1869, UCAL_JUNE, 4,
307 JapaneseCalendar_MEIJI, 45, 1912, UCAL_JULY, 29,
308 JapaneseCalendar_TAISHO, 1, 1912, UCAL_JULY, 30,
309 JapaneseCalendar_TAISHO, 1, 1912, UCAL_AUGUST, 1,
310
311 // new tests (not in java)
312 JapaneseCalendar_SHOWA, 64, 1989, UCAL_JANUARY, 7, // Test current era transition (different code path than others)
313 JapaneseCalendar_HEISEI, 1, 1989, UCAL_JANUARY, 8,
314 JapaneseCalendar_HEISEI, 1, 1989, UCAL_JANUARY, 9,
315 JapaneseCalendar_HEISEI, 1, 1989, UCAL_DECEMBER, 20,
316 JapaneseCalendar_HEISEI, 15, 2003, UCAL_MAY, 22,
317 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1
318 };
319
320 Calendar *cal;
321 UErrorCode status = U_ZERO_ERROR;
322 cal = Calendar::createInstance("ja_JP@calendar=japanese", status);
323 CHECK(status, UnicodeString("Creating ja_JP@calendar=japanese calendar"));
324 // Sanity check the calendar
325 UDate timeB = Calendar::getNow();
326 UDate timeCal = cal->getTime(status);
327
328 if(!(timeA <= timeCal) || !(timeCal <= timeB)) {
329 errln((UnicodeString)"Error: Calendar time " + timeCal +
330 " is not within sampled times [" + timeA + " to " + timeB + "]!");
331 }
332 // end sanity check
333 quasiGregorianTest(*cal,Locale("ja_JP"),data);
334 delete cal;
335 }
336
337 void IntlCalendarTest::TestBuddhistFormat() {
338 UErrorCode status = U_ZERO_ERROR;
339
340 // Test simple parse/format with adopt
341
342 // First, a contrived english test..
343 UDate aDate = 999932400000.0;
344 SimpleDateFormat *fmt = new SimpleDateFormat(UnicodeString("MMMM d, yyyy G"), Locale("en_US@calendar=buddhist"), status);
345 CHECK(status, "creating date format instance");
346 SimpleDateFormat *fmt2 = new SimpleDateFormat(UnicodeString("MMMM d, yyyy G"), Locale("en_US@calendar=gregorian"), status);
347 CHECK(status, "creating gregorian date format instance");
348 if(!fmt) {
349 errln("Coudln't create en_US instance");
350 } else {
351 UnicodeString str;
352 fmt2->format(aDate, str);
353 logln(UnicodeString() + "Test Date: " + str);
354 str.remove();
355 fmt->format(aDate, str);
356 logln(UnicodeString() + "as Buddhist Calendar: " + escape(str));
357 UnicodeString expected("September 8, 2544 BE");
358 if(str != expected) {
359 errln("Expected " + escape(expected) + " but got " + escape(str));
360 }
361 UDate otherDate = fmt->parse(expected, status);
362 if(otherDate != aDate) {
363 UnicodeString str3;
364 fmt->format(otherDate, str3);
365 errln("Parse incorrect of " + escape(expected) + " - wanted " + aDate + " but got " + otherDate + ", " + escape(str3));
366 } else {
367 logln("Parsed OK: " + expected);
368 }
369 delete fmt;
370 }
371 delete fmt2;
372
373 CHECK(status, "Error occured testing Buddhist Calendar in English ");
374
375 status = U_ZERO_ERROR;
376 // Now, try in Thai
377 {
378 UnicodeString expect = CharsToUnicodeString("\\u0E27\\u0E31\\u0E19\\u0E40\\u0E2A\\u0E32\\u0E23\\u0E4C\\u0E17\\u0E35\\u0E48"
379 " 8 \\u0E01\\u0E31\\u0e19\\u0e22\\u0e32\\u0e22\\u0e19 \\u0e1e.\\u0e28. 2544");
380 UDate expectDate = 999932400000.0;
381 Locale loc("th_TH_TRADITIONAL"); // legacy
382
383 simpleTest(loc, expect, expectDate, status);
384 }
385 status = U_ZERO_ERROR;
386 {
387 UnicodeString expect = CharsToUnicodeString("\\u0E27\\u0E31\\u0E19\\u0E40\\u0E2A\\u0E32\\u0E23\\u0E4C\\u0E17\\u0E35\\u0E48"
388 " 8 \\u0E01\\u0E31\\u0e19\\u0e22\\u0e32\\u0e22\\u0e19 \\u0e1e.\\u0e28. 2544");
389 UDate expectDate = 999932400000.0;
390 Locale loc("th_TH@calendar=buddhist");
391
392 simpleTest(loc, expect, expectDate, status);
393 }
394 status = U_ZERO_ERROR;
395 {
396 UnicodeString expect = CharsToUnicodeString("\\u0E27\\u0E31\\u0E19\\u0E40\\u0E2A\\u0E32\\u0E23\\u0E4C\\u0E17\\u0E35\\u0E48"
397 " 8 \\u0E01\\u0E31\\u0e19\\u0e22\\u0e32\\u0e22\\u0e19 \\u0e04.\\u0e28. 2001");
398 UDate expectDate = 999932400000.0;
399 Locale loc("th_TH@calendar=gregorian");
400
401 simpleTest(loc, expect, expectDate, status);
402 }
403 status = U_ZERO_ERROR;
404 {
405 UnicodeString expect = CharsToUnicodeString("\\u0E27\\u0E31\\u0E19\\u0E40\\u0E2A\\u0E32\\u0E23\\u0E4C\\u0E17\\u0E35\\u0E48"
406 " 8 \\u0E01\\u0E31\\u0e19\\u0e22\\u0e32\\u0e22\\u0e19 \\u0e04.\\u0e28. 2001");
407 UDate expectDate = 999932400000.0;
408 Locale loc("th_TH_TRADITIONAL@calendar=gregorian");
409
410 simpleTest(loc, expect, expectDate, status);
411 }
412 }
413
414
415 void IntlCalendarTest::TestJapaneseFormat() {
416 Calendar *cal;
417 UErrorCode status = U_ZERO_ERROR;
418 cal = Calendar::createInstance("ja_JP_TRADITIONAL", status);
419 CHECK(status, UnicodeString("Creating ja_JP_TRADITIONAL calendar"));
420
421 Calendar *cal2 = cal->clone();
422 delete cal;
423 cal = NULL;
424
425 // Test simple parse/format with adopt
426
427 UDate aDate = 999932400000.0;
428 SimpleDateFormat *fmt = new SimpleDateFormat(UnicodeString("MMMM d, yy G"), Locale("en_US@calendar=japanese"), status);
429 SimpleDateFormat *fmt2 = new SimpleDateFormat(UnicodeString("MMMM d, yy G"), Locale("en_US@calendar=gregorian"), status);
430 CHECK(status, "creating date format instance");
431 if(!fmt) {
432 errln("Coudln't create en_US instance");
433 } else {
434 UnicodeString str;
435 fmt2->format(aDate, str);
436 logln(UnicodeString() + "Test Date: " + str);
437 str.remove();
438 fmt->format(aDate, str);
439 logln(UnicodeString() + "as Japanese Calendar: " + str);
440 UnicodeString expected("September 8, 13 Heisei");
441 if(str != expected) {
442 errln("Expected " + expected + " but got " + str);
443 }
444 UDate otherDate = fmt->parse(expected, status);
445 if(otherDate != aDate) {
446 UnicodeString str3;
447 ParsePosition pp;
448 fmt->parse(expected, *cal2, pp);
449 fmt->format(otherDate, str3);
450 errln("Parse incorrect of " + expected + " - wanted " + aDate + " but got " + " = " + otherDate + ", " + str3 + " = " + CalendarTest::calToStr(*cal2) );
451
452 } else {
453 logln("Parsed OK: " + expected);
454 }
455 delete fmt;
456 }
457
458 // Test parse with incomplete information
459 fmt = new SimpleDateFormat(UnicodeString("G y"), Locale("en_US@calendar=japanese"), status);
460 aDate = -3197120400000.;
461 CHECK(status, "creating date format instance");
462 if(!fmt) {
463 errln("Coudln't create en_US instance");
464 } else {
465 UnicodeString str;
466 fmt2->format(aDate, str);
467 logln(UnicodeString() + "Test Date: " + str);
468 str.remove();
469 fmt->format(aDate, str);
470 logln(UnicodeString() + "as Japanese Calendar: " + str);
471 UnicodeString expected("Meiji 1");
472 if(str != expected) {
473 errln("Expected " + expected + " but got " + str);
474 }
475 UDate otherDate = fmt->parse(expected, status);
476 if(otherDate != aDate) {
477 UnicodeString str3;
478 ParsePosition pp;
479 fmt->parse(expected, *cal2, pp);
480 fmt->format(otherDate, str3);
481 errln("Parse incorrect of " + expected + " - wanted " + aDate + " but got " + " = " +
482 otherDate + ", " + str3 + " = " + CalendarTest::calToStr(*cal2) );
483 } else {
484 logln("Parsed OK: " + expected);
485 }
486 delete fmt;
487 }
488
489 delete cal2;
490 delete fmt2;
491 CHECK(status, "Error occured");
492
493 // Now, try in Japanese
494 {
495 UnicodeString expect = CharsToUnicodeString("\\u5e73\\u621013\\u5e749\\u67088\\u65e5\\u571f\\u66dc\\u65e5");
496 UDate expectDate = 999932400000.0; // Testing a recent date
497 Locale loc("ja_JP@calendar=japanese");
498
499 status = U_ZERO_ERROR;
500 simpleTest(loc, expect, expectDate, status);
501 }
502 {
503 UnicodeString expect = CharsToUnicodeString("\\u5e73\\u621013\\u5e749\\u67088\\u65e5\\u571f\\u66dc\\u65e5");
504 UDate expectDate = 999932400000.0; // Testing a recent date
505 Locale loc("ja_JP_TRADITIONAL"); // legacy
506
507 status = U_ZERO_ERROR;
508 simpleTest(loc, expect, expectDate, status);
509 }
510 {
511 UnicodeString expect = CharsToUnicodeString("\\u5b89\\u6c385\\u5e747\\u67084\\u65e5\\u6728\\u66dc\\u65e5");
512 UDate expectDate = -6106035600000.0;
513 Locale loc("ja_JP@calendar=japanese");
514
515 status = U_ZERO_ERROR;
516 simpleTest(loc, expect, expectDate, status);
517
518 }
519 { // Jitterbug 1869 - this is an ambiguous era. (Showa 64 = Jan 6 1989, but Showa could be 2 other eras) )
520 UnicodeString expect = CharsToUnicodeString("\\u662d\\u548c64\\u5e741\\u67086\\u65e5\\u91d1\\u66dc\\u65e5");
521 UDate expectDate = 600076800000.0;
522 Locale loc("ja_JP@calendar=japanese");
523
524 status = U_ZERO_ERROR;
525 simpleTest(loc, expect, expectDate, status);
526
527 }
528 { // This Feb 29th falls on a leap year by gregorian year, but not by Japanese year.
529 UnicodeString expect = CharsToUnicodeString("\\u5EB7\\u6B632\\u5e742\\u670829\\u65e5\\u65e5\\u66dc\\u65e5");
530 // Add -1:00 to the following for historical TZ - aliu
531 UDate expectDate = -16214403600000.0; // courtesy of date format round trip test
532 Locale loc("ja_JP@calendar=japanese");
533
534 status = U_ZERO_ERROR;
535 simpleTest(loc, expect, expectDate, status);
536
537 }
538 }
539
540 void IntlCalendarTest::simpleTest(const Locale& loc, const UnicodeString& expect, UDate expectDate, UErrorCode& status)
541 {
542 UnicodeString tmp;
543 UDate d;
544 DateFormat *fmt0 = DateFormat::createDateTimeInstance(DateFormat::kFull, DateFormat::kFull);
545
546 logln("Try format/parse of " + (UnicodeString)loc.getName());
547 DateFormat *fmt2 = DateFormat::createDateInstance(DateFormat::kFull, loc);
548 if(fmt2) {
549 fmt2->format(expectDate, tmp);
550 logln(escape(tmp) + " ( in locale " + loc.getName() + ")");
551 if(tmp != expect) {
552 errln(UnicodeString("Failed to format " ) + loc.getName() + " expected " + escape(expect) + " got " + escape(tmp) );
553 }
554
555 d = fmt2->parse(expect,status);
556 CHECK(status, "Error occured parsing " + UnicodeString(loc.getName()));
557 if(d != expectDate) {
558 fmt2->format(d,tmp);
559 errln(UnicodeString("Failed to parse " ) + escape(expect) + ", " + loc.getName() + " expect " + (double)expectDate + " got " + (double)d + " " + escape(tmp));
560 logln( "wanted " + escape(fmt0->format(expectDate,tmp.remove())) + " but got " + escape(fmt0->format(d,tmp.remove())));
561 }
562 delete fmt2;
563 } else {
564 errln((UnicodeString)"Can't create " + loc.getName() + " date instance");
565 }
566 delete fmt0;
567 }
568
569 #undef CHECK
570
571 #endif /* #if !UCONFIG_NO_FORMATTING */
572
573 //eof