ICU-9227 just add tests for fieldDifference fwd/backward on either side of era boundary and across era boundary
X-SVN-Rev: 32263
This commit is contained in:
parent
8db60a2d2b
commit
1b1314e50f
@ -1738,6 +1738,7 @@ typedef struct {
|
||||
const char * locale;
|
||||
UDate start;
|
||||
UDate target;
|
||||
UBool progressive; /* TRUE to compute progressive difference for each field, FALSE to reset calendar after each call */
|
||||
int32_t yDiff;
|
||||
int32_t MDiff;
|
||||
int32_t dDiff;
|
||||
@ -1750,18 +1751,37 @@ static const UChar tzUSPacific[] = { 0x55,0x53,0x2F,0x50,0x61,0x63,0x69,0x66,0x6
|
||||
static const UChar tzGMT[] = { 0x47,0x4D,0x54,0 }; /* "GMT" */
|
||||
|
||||
static const TFDItem tfdItems[] = {
|
||||
/* timezone locale start target yDf MDf dDf HDf mDf sDf */
|
||||
/* timezone locale start target progres yDf MDf dDf HDf mDf sDf */
|
||||
/* For these we compute the progressive difference for each field - not resetting the calendar after each call */
|
||||
{ tzUSPacific, "en_US", 1267459800000.0, 1277772600000.0, 0, 3, 27, 9, 40, 0 }, /* 2010-Mar-01 08:10 -> 2010-Jun-28 17:50 */
|
||||
{ tzUSPacific, "en_US", 1267459800000.0, 1299089280000.0, 1, 0, 1, 1, 58, 0 }, /* 2010-Mar-01 08:10 -> 2011-Mar-02 10:08 */
|
||||
{ tzUSPacific, "en_US", 1267459800000.0, 1277772600000.0, TRUE, 0, 3, 27, 9, 40, 0 }, /* 2010-Mar-01 08:10 -> 2010-Jun-28 17:50 */
|
||||
{ tzUSPacific, "en_US", 1267459800000.0, 1299089280000.0, TRUE, 1, 0, 1, 1, 58, 0 }, /* 2010-Mar-01 08:10 -> 2011-Mar-02 10:08 */
|
||||
/* For these we compute the total difference for each field - resetting the calendar after each call */
|
||||
{ tzGMT, "en_US", 0.0, 1073692800000.0, 34, 408, 12427, 298248, 17894880, 1073692800 }, /* 1970-Jan-01 00:00 -> 2004-Jan-10 00:00:00 */
|
||||
{ tzGMT, "en_US", 0.0, 1073779200000.0, 34, 408, 12428, 298272, 17896320, 1073779200 }, /* 1970-Jan-01 00:00 -> 2004-Jan-11 00:00:00 */
|
||||
{ tzGMT, "en_US", 0.0, 2147472000000.0, 68, 816, 24855, 596520, 35791200, 2147472000 }, /* 1970-Jan-01 00:00 -> 2038-Jan-19 00:00:00 */
|
||||
{ tzGMT, "en_US", 0.0, 2147558400000.0, 68, 816, 24856, 596544, 35792640, 0x7FFFFFFF }, /* 1970-Jan-01 00:00 -> 2038-Jan-20 00:00:00, seconds diff overflow */
|
||||
{ tzGMT, "en_US", 0.0, -1073692800000.0, -34,-408,-12427,-298248,-17894880,-1073692800 }, /* 1970-Jan-01 00:00 -> 1935-Dec-24 00:00:00 */
|
||||
{ tzGMT, "en_US", 0.0, -1073779200000.0, -34,-408,-12428,-298272,-17896320,-1073779200 }, /* 1970-Jan-01 00:00 -> 1935-Dec-23 00:00:00 */
|
||||
{ NULL, NULL, 0.0, 0.0, 0, 0, 0, 0, 0, 0 } /* terminator */
|
||||
{ tzGMT, "en_US", 0.0, 1073692800000.0, FALSE, 34, 408, 12427, 298248, 17894880, 1073692800 }, /* 1970-Jan-01 00:00 -> 2004-Jan-10 00:00 */
|
||||
{ tzGMT, "en_US", 0.0, 1073779200000.0, FALSE, 34, 408, 12428, 298272, 17896320, 1073779200 }, /* 1970-Jan-01 00:00 -> 2004-Jan-11 00:00 */
|
||||
{ tzGMT, "en_US", 0.0, 2147472000000.0, FALSE, 68, 816, 24855, 596520, 35791200, 2147472000 }, /* 1970-Jan-01 00:00 -> 2038-Jan-19 00:00 */
|
||||
{ tzGMT, "en_US", 0.0, 2147558400000.0, FALSE, 68, 816, 24856, 596544, 35792640, 0x7FFFFFFF }, /* 1970-Jan-01 00:00 -> 2038-Jan-20 00:00, seconds diff overflow */
|
||||
{ tzGMT, "en_US", 0.0, -1073692800000.0, FALSE, -34,-408,-12427,-298248,-17894880,-1073692800 }, /* 1970-Jan-01 00:00 -> 1935-Dec-24 00:00 */
|
||||
{ tzGMT, "en_US", 0.0, -1073779200000.0, FALSE, -34,-408,-12428,-298272,-17896320,-1073779200 }, /* 1970-Jan-01 00:00 -> 1935-Dec-23 00:00 */
|
||||
/* check fwd/backward on either side of era boundary and across era boundary */
|
||||
{ tzGMT, "en_US", -61978089600000.0,-61820409600000.0, FALSE, 4, 59, 1825, 43800, 2628000, 157680000 }, /* CE 5-Dec-31 00:00 -> CE 10-Dec-30 00:00 */
|
||||
{ tzGMT, "en_US", -61820409600000.0,-61978089600000.0, FALSE, -4, -59, -1825, -43800, -2628000, -157680000 }, /* CE 10-Dec-30 00:00 -> CE 5-Dec-31 00:00 */
|
||||
{ tzGMT, "en_US", -62451129600000.0,-62293449600000.0, FALSE, 4, 59, 1825, 43800, 2628000, 157680000 }, /* BCE 10-Jan-04 00:00 -> BCE 5-Jan-03 00:00 */
|
||||
{ tzGMT, "en_US", -62293449600000.0,-62451129600000.0, FALSE, -4, -59, -1825, -43800, -2628000, -157680000 }, /* BCE 5-Jan-03 00:00 -> BCE 10-Jan-04 00:00 */
|
||||
{ tzGMT, "en_US", -62293449600000.0,-61978089600000.0, FALSE, 9, 119, 3650, 87600, 5256000, 315360000 }, /* BCE 5-Jan-03 00:00 -> CE 5-Dec-31 00:00 */
|
||||
{ tzGMT, "en_US", -61978089600000.0,-62293449600000.0, FALSE, -9,-119, -3650, -87600, -5256000, -315360000 }, /* CE 5-Dec-31 00:00 -> BCE 5-Jan-03 00:00 */
|
||||
{ tzGMT, "en@calendar=roc", -1672704000000.0, -1515024000000.0, FALSE, 4, 59, 1825, 43800, 2628000, 157680000 }, /* MG 5-Dec-30 00:00 -> MG 10-Dec-29 00:00 */
|
||||
{ tzGMT, "en@calendar=roc", -1515024000000.0, -1672704000000.0, FALSE, -4, -59, -1825, -43800, -2628000, -157680000 }, /* MG 10-Dec-29 00:00 -> MG 5-Dec-30 00:00 */
|
||||
{ tzGMT, "en@calendar=roc", -2145744000000.0, -1988064000000.0, FALSE, 4, 59, 1825, 43800, 2628000, 157680000 }, /* BMG 10-Jan-03 00:00 -> BMG 5-Jan-02 00:00 */
|
||||
{ tzGMT, "en@calendar=roc", -1988064000000.0, -2145744000000.0, FALSE, -4, -59, -1825, -43800, -2628000, -157680000 }, /* BMG 5-Jan-02 00:00 -> BMG 10-Jan-03 00:00 */
|
||||
{ tzGMT, "en@calendar=roc", -1988064000000.0, -1672704000000.0, FALSE, 9, 119, 3650, 87600, 5256000, 315360000 }, /* BMG 5-Jan-02 00:00 -> MG 5-Dec-30 00:00 */
|
||||
{ tzGMT, "en@calendar=roc", -1672704000000.0, -1988064000000.0, FALSE, -9,-119, -3650, -87600, -5256000, -315360000 }, /* MG 5-Dec-30 00:00 -> BMG 5-Jan-02 00:00 */
|
||||
{ tzGMT, "en@calendar=coptic",-53026531200000.0,-52868851200000.0, FALSE, 4, 64, 1825, 43800, 2628000, 157680000 }, /* Er1 5-Nas-05 00:00 -> Er1 10-Nas-04 00:00 */
|
||||
{ tzGMT, "en@calendar=coptic",-52868851200000.0,-53026531200000.0, FALSE, -4, -64, -1825, -43800, -2628000, -157680000 }, /* Er1 10-Nas-04 00:00 -> Er1 5-Nas-05 00:00 */
|
||||
{ tzGMT, "en@calendar=coptic",-53499571200000.0,-53341891200000.0, FALSE, 4, 64, 1825, 43800, 2628000, 157680000 }, /* Er0 10-Tou-04 00:00 -> Er0 5-Tou-02 00:00 */
|
||||
{ tzGMT, "en@calendar=coptic",-53341891200000.0,-53499571200000.0, FALSE, -4, -64, -1825, -43800, -2628000, -157680000 }, /* Er0 5-Tou-02 00:00 -> Er0 10-Tou-04 00:00 */
|
||||
{ tzGMT, "en@calendar=coptic",-53341891200000.0,-53026531200000.0, FALSE, 9, 129, 3650, 87600, 5256000, 315360000 }, /* Er0 5-Tou-02 00:00 -> Er1 5-Nas-05 00:00 */
|
||||
{ tzGMT, "en@calendar=coptic",-53026531200000.0,-53341891200000.0, FALSE, -9,-129, -3650, -87600, -5256000, -315360000 }, /* Er1 5-Nas-05 00:00 -> Er0 5-Tou-02 00:00 */
|
||||
{ NULL, NULL, 0.0, 0.0, FALSE, 0, 0, 0, 0, 0, 0 } /* terminator */
|
||||
};
|
||||
|
||||
void TestFieldDifference() {
|
||||
@ -1773,7 +1793,7 @@ void TestFieldDifference() {
|
||||
log_err("FAIL: for locale \"%s\", ucal_open had status %s\n", tfdItemPtr->locale, u_errorName(status) );
|
||||
} else {
|
||||
int32_t yDf, MDf, dDf, HDf, mDf, sDf;
|
||||
if (tfdItemPtr->start != 0.0) {
|
||||
if (tfdItemPtr->progressive) {
|
||||
ucal_setMillis(ucal, tfdItemPtr->start, &status);
|
||||
yDf = ucal_getFieldDifference(ucal, tfdItemPtr->target, UCAL_YEAR, &status);
|
||||
MDf = ucal_getFieldDifference(ucal, tfdItemPtr->target, UCAL_MONTH, &status);
|
||||
|
Loading…
Reference in New Issue
Block a user