From 1f872827e33a96779ca679bf6b3655483deba1af Mon Sep 17 00:00:00 2001 From: Andrew J Macheret Date: Wed, 7 Nov 2007 00:07:35 +0000 Subject: [PATCH] ICU-4081 Ported more tests and fixed more problems revealed by tests X-SVN-Rev: 22896 --- icu4c/source/i18n/chnsecal.cpp | 2 + icu4c/source/test/testdata/calendar.txt | 117 +++++++++++++++++++++++- 2 files changed, 118 insertions(+), 1 deletion(-) diff --git a/icu4c/source/i18n/chnsecal.cpp b/icu4c/source/i18n/chnsecal.cpp index 016cf8f433..f63bd29fbb 100644 --- a/icu4c/source/i18n/chnsecal.cpp +++ b/icu4c/source/i18n/chnsecal.cpp @@ -91,10 +91,12 @@ Calendar* ChineseCalendar::clone() const { ChineseCalendar::ChineseCalendar(const Locale& aLocale, UErrorCode& success) : Calendar(TimeZone::createDefault(), aLocale, success) { + isLeapYear = FALSE; setTimeInMillis(getNow(), success); // Call this again now that the vtable is set up properly. } ChineseCalendar::ChineseCalendar(const ChineseCalendar& other) : Calendar(other) { + isLeapYear = other.isLeapYear; } ChineseCalendar::~ChineseCalendar() diff --git a/icu4c/source/test/testdata/calendar.txt b/icu4c/source/test/testdata/calendar.txt index 4c4d586c46..715f15e15b 100644 --- a/icu4c/source/test/testdata/calendar.txt +++ b/icu4c/source/test/testdata/calendar.txt @@ -158,7 +158,7 @@ calendar:table(nofallback) { "ERA=1,YEAR=2,MONTH=JUNE,DATE=4", // tw }, - //chinese + //chinese add tests { // normal "en_US@calendar=chinese", "EXTENDED_YEAR=4642,MONTH=2,DATE=15,IS_LEAP_MONTH=0", // ch @@ -229,6 +229,121 @@ calendar:table(nofallback) { "MONTH=3", // month + 3 "EXTENDED_YEAR=4638,MONTH=5,DATE=29,IS_LEAP_MONTH=0", // ch }, + + // chinese roll tests + { // normal + "en_US@calendar=chinese", + "EXTENDED_YEAR=4642,MONTH=2,DATE=15,IS_LEAP_MONTH=0", // ch + "roll", + "MONTH=3", // month + 3 + "EXTENDED_YEAR=4642,MONTH=5,DATE=15,IS_LEAP_MONTH=0", // ch + }, + { // normal + "en_US@calendar=chinese", + "EXTENDED_YEAR=4642,MONTH=2,DATE=15,IS_LEAP_MONTH=0", // ch + "roll", + "MONTH=11", // month + 11 + "EXTENDED_YEAR=4642,MONTH=1,DATE=15,IS_LEAP_MONTH=0", // ch + }, + { // across year + "en_US@calendar=chinese", + "EXTENDED_YEAR=4639,MONTH=11,DATE=15,IS_LEAP_MONTH=0", // ch + "roll", + "MONTH=1", // month + 1 + "EXTENDED_YEAR=4639,MONTH=0,DATE=15,IS_LEAP_MONTH=0", // ch + }, + { // across year + "en_US@calendar=chinese", + "EXTENDED_YEAR=4640,MONTH=0,DATE=15,IS_LEAP_MONTH=0", // ch + "roll", + "MONTH=-1", // month - 1 + "EXTENDED_YEAR=4640,MONTH=11,DATE=15,IS_LEAP_MONTH=0", // ch + }, + { // month=3 is a leap month + "en_US@calendar=chinese", + "EXTENDED_YEAR=4638,MONTH=2,DATE=15,IS_LEAP_MONTH=0", // ch + "roll", + "MONTH=3", // month + 3 + "EXTENDED_YEAR=4638,MONTH=4,DATE=15,IS_LEAP_MONTH=0", // ch + }, + { // month=3 is a leap month + "en_US@calendar=chinese", + "EXTENDED_YEAR=4638,MONTH=2,DATE=15,IS_LEAP_MONTH=0", // ch + "roll", + "MONTH=3", // month + 16 + "EXTENDED_YEAR=4638,MONTH=4,DATE=15,IS_LEAP_MONTH=0", // ch + }, + { // month=3 is a leap month + "en_US@calendar=chinese", + "EXTENDED_YEAR=4638,MONTH=2,DATE=15,IS_LEAP_MONTH=0", // ch + "roll", + "MONTH=2", // month + 2 + "EXTENDED_YEAR=4638,MONTH=3,DATE=15,IS_LEAP_MONTH=1", // ch + }, + { // month=3 is a leap month + "en_US@calendar=chinese", + "EXTENDED_YEAR=4638,MONTH=2,DATE=15,IS_LEAP_MONTH=0", // ch + "roll", + "MONTH=28", // month + 28 + "EXTENDED_YEAR=4638,MONTH=3,DATE=15,IS_LEAP_MONTH=1", // ch + }, + { // month=3 is a leap month + "en_US@calendar=chinese", + "EXTENDED_YEAR=4638,MONTH=3,DATE=15,IS_LEAP_MONTH=0", // ch + "roll", + "MONTH=1", // month + 1 + "EXTENDED_YEAR=4638,MONTH=3,DATE=15,IS_LEAP_MONTH=1", // ch + }, + { // month=3 is a leap month + "en_US@calendar=chinese", + "EXTENDED_YEAR=4638,MONTH=3,DATE=15,IS_LEAP_MONTH=0", // ch + "roll", + "MONTH=-12", // month - 12 + "EXTENDED_YEAR=4638,MONTH=3,DATE=15,IS_LEAP_MONTH=1", // ch + }, + { // month=3 is a leap month + "en_US@calendar=chinese", + "EXTENDED_YEAR=4638,MONTH=3,DATE=15,IS_LEAP_MONTH=1", // ch + "roll", + "MONTH=1", // month + 1 + "EXTENDED_YEAR=4638,MONTH=4,DATE=15,IS_LEAP_MONTH=0", // ch + }, + { // month=3 is a leap month + "en_US@calendar=chinese", + "EXTENDED_YEAR=4638,MONTH=3,DATE=15,IS_LEAP_MONTH=1", // ch + "roll", + "MONTH=-25", // month - 25 + "EXTENDED_YEAR=4638,MONTH=4,DATE=15,IS_LEAP_MONTH=0", // ch + }, + { // dom should pin + "en_US@calendar=chinese", + "EXTENDED_YEAR=4638,MONTH=3,DATE=30,IS_LEAP_MONTH=0", // ch + "roll", + "MONTH=1", // month + 1 + "EXTENDED_YEAR=4638,MONTH=3,DATE=29,IS_LEAP_MONTH=1", // ch + }, + { // dom should pin + "en_US@calendar=chinese", + "EXTENDED_YEAR=4638,MONTH=3,DATE=30,IS_LEAP_MONTH=0", // ch + "roll", + "MONTH=14", // month + 14 + "EXTENDED_YEAR=4638,MONTH=3,DATE=29,IS_LEAP_MONTH=1", // ch + }, + { // no dom pin + "en_US@calendar=chinese", + "EXTENDED_YEAR=4638,MONTH=3,DATE=30,IS_LEAP_MONTH=0", // ch + "roll", + "MONTH=15", // month + 15 + "EXTENDED_YEAR=4638,MONTH=4,DATE=30,IS_LEAP_MONTH=0", // ch + }, + { // dom should pin + "en_US@calendar=chinese", + "EXTENDED_YEAR=4638,MONTH=3,DATE=30,IS_LEAP_MONTH=0", // ch + "roll", + "MONTH=-10", // month - 10 + "EXTENDED_YEAR=4638,MONTH=5,DATE=29,IS_LEAP_MONTH=0", // ch + }, + } } }