+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/***********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2012, International Business Machines Corporation
+ * Copyright (c) 1997-2014, International Business Machines Corporation
* and others. All Rights Reserved.
***********************************************************************/
// *****************************************************************************
//--- move to CalendarTest?
-static const double JULIAN_EPOCH = -210866760000000.;
-
-
// Turn this on to dump the calendar fields
#define U_DEBUG_DUMPCALS
// Test simple parse/format with adopt
- // First, a contrived english test..
+ // First, a contrived English test..
UDate aDate = 999932400000.0;
SimpleDateFormat *fmt = new SimpleDateFormat(UnicodeString("MMMM d, yyyy G"), Locale("en_US@calendar=buddhist"), status);
CHECK(status, "creating date format instance");
SimpleDateFormat *fmt2 = new SimpleDateFormat(UnicodeString("MMMM d, yyyy G"), Locale("en_US@calendar=gregorian"), status);
CHECK(status, "creating gregorian date format instance");
if(!fmt) {
- errln("Coudln't create en_US instance");
+ errln("Couldn't create en_US instance");
} else {
UnicodeString str;
fmt2->format(aDate, str);
}
delete fmt2;
- CHECK(status, "Error occured testing Buddhist Calendar in English ");
+ CHECK(status, "Error occurred testing Buddhist Calendar in English ");
status = U_ZERO_ERROR;
// Now, try in Thai
SimpleDateFormat *fmt2 = new SimpleDateFormat(UnicodeString("MMMM d, yyyy G"), Locale("en_US@calendar=gregorian"), status);
CHECK(status, "creating date format instance");
if(!fmt) {
- errln("Coudln't create en_US instance");
+ errln("Couldn't create en_US instance");
} else {
UnicodeString str;
fmt2->format(aDate, str);
delete cal2;
delete fmt2;
- CHECK(status, "Error occured");
+ CHECK(status, "Error occurred");
// Now, try in Japanese
{
- UnicodeString expect = CharsToUnicodeString("\\u5e73\\u621013\\u5e749\\u67088\\u65e5\\u571f\\u66dc\\u65e5");
+ UnicodeString expect = CharsToUnicodeString("\\u5e73\\u621013\\u5e749\\u67088\\u65e5 \\u571f\\u66dc\\u65e5");
UDate expectDate = 999932400000.0; // Testing a recent date
Locale loc("ja_JP@calendar=japanese");
simpleTest(loc, expect, expectDate, status);
}
{
- UnicodeString expect = CharsToUnicodeString("\\u5e73\\u621013\\u5e749\\u67088\\u65e5\\u571f\\u66dc\\u65e5");
+ UnicodeString expect = CharsToUnicodeString("\\u5e73\\u621013\\u5e749\\u67088\\u65e5 \\u571f\\u66dc\\u65e5");
UDate expectDate = 999932400000.0; // Testing a recent date
Locale loc("ja_JP_TRADITIONAL"); // legacy
simpleTest(loc, expect, expectDate, status);
}
{
- UnicodeString expect = CharsToUnicodeString("\\u5b89\\u6c385\\u5e747\\u67084\\u65e5\\u6728\\u66dc\\u65e5");
+ UnicodeString expect = CharsToUnicodeString("\\u5b89\\u6c385\\u5e747\\u67084\\u65e5 \\u6728\\u66dc\\u65e5");
UDate expectDate = -6106032422000.0; // 1776-07-04T00:00:00Z-075258
Locale loc("ja_JP@calendar=japanese");
}
{ // Jitterbug 1869 - this is an ambiguous era. (Showa 64 = Jan 6 1989, but Showa could be 2 other eras) )
- UnicodeString expect = CharsToUnicodeString("\\u662d\\u548c64\\u5e741\\u67086\\u65e5\\u91d1\\u66dc\\u65e5");
+ UnicodeString expect = CharsToUnicodeString("\\u662d\\u548c64\\u5e741\\u67086\\u65e5 \\u91d1\\u66dc\\u65e5");
UDate expectDate = 600076800000.0;
Locale loc("ja_JP@calendar=japanese");
}
{ // This Feb 29th falls on a leap year by gregorian year, but not by Japanese year.
- UnicodeString expect = CharsToUnicodeString("\\u5EB7\\u6B632\\u5e742\\u670829\\u65e5\\u65e5\\u66dc\\u65e5");
+ UnicodeString expect = CharsToUnicodeString("\\u5EB7\\u6B632\\u5e742\\u670829\\u65e5 \\u65e5\\u66dc\\u65e5");
UDate expectDate = -16214400422000.0; // 1456-03-09T00:00Z-075258
Locale loc("ja_JP@calendar=japanese");
SimpleDateFormat *fmt = new SimpleDateFormat(UnicodeString("y.M.d"), Locale("ja_JP@calendar=japanese"), status);
CHECK(status, "creating date format instance");
if(!fmt) {
- errln("Coudln't create en_US instance");
+ errln("Couldn't create en_US instance");
} else {
UErrorCode s2 = U_ZERO_ERROR;
cal2->clear();
SimpleDateFormat *fmt = new SimpleDateFormat(UnicodeString("y"), Locale("ja_JP@calendar=japanese"), status);
CHECK(status, "creating date format instance");
if(!fmt) {
- errln("Coudln't create en_US instance");
+ errln("Couldn't create en_US instance");
} else {
UErrorCode s2 = U_ZERO_ERROR;
cal2->clear();
UnicodeString gregorianDate("January 18, 2007 AD");
UDate aDate = fmt2->parse(gregorianDate, status);
if(!fmt) {
- errln("Coudln't create en_US instance");
+ errln("Couldn't create en_US instance");
} else {
UnicodeString str;
fmt->format(aDate, str);
}
d = fmt2->parse(expect,status);
- CHECK(status, "Error occured parsing " + UnicodeString(loc.getName()));
+ CHECK(status, "Error occurred parsing " + UnicodeString(loc.getName()));
if(d != expectDate) {
fmt2->format(d,tmp);
errln(UnicodeString("Failed to parse " ) + escape(expect) + ", " + loc.getName() + " expect " + (double)expectDate + " got " + (double)d + " " + escape(tmp));