Remove test data from other calendars

This commit is contained in:
André Bargull 2025-03-21 18:23:54 +01:00 committed by Ms2ger
parent c9ab199907
commit c7bbdd435f
5 changed files with 150 additions and 442 deletions

View File

@ -3,102 +3,35 @@
/*---
esid: sec-temporal-intl
description: Islamic calendars (note there are 5 variants)
description: Islamic calendar "islamic-civil".
features: [Temporal]
---*/
const calendar = "islamic-civil";
// Test data obtained from ICU
const inLeapYear = true;
const daysInYear = 355;
const daysInMonth12 = 30;
const isoDate = "2023-07-19";
const tests = [
{
calendar: "islamic",
choices: [
// Approximations of the observational Islamic calendar as computed by ICU4C.
{
inLeapYear: false,
daysInYear: 354,
daysInMonth12: 29,
isoDate: "2023-07-18",
},
const year = 1445;
const date = Temporal.PlainDate.from({ year, month: 1, day: 1, calendar });
assert.sameValue(date.calendarId, calendar);
assert.sameValue(date.year, year);
assert.sameValue(date.month, 1);
assert.sameValue(date.monthCode, "M01");
assert.sameValue(date.day, 1);
// Approximations of the observational Islamic calendar as computed by ICU4X.
{
inLeapYear: true,
daysInYear: 355,
daysInMonth12: 30,
isoDate: "2023-07-19",
}
],
},
{
calendar: "islamic-umalqura",
inLeapYear: false,
daysInYear: 354,
daysInMonth12: 30,
isoDate: "2023-07-19",
},
{
calendar: "islamic-civil",
inLeapYear: true,
daysInYear: 355,
daysInMonth12: 30,
isoDate: "2023-07-19",
},
{
calendar: "islamic-rgsa",
choices: [
// Approximations of the observational Islamic calendar as computed by ICU4C.
{
inLeapYear: false,
daysInYear: 354,
daysInMonth12: 29,
isoDate: "2023-07-18",
},
assert.sameValue(date.inLeapYear, inLeapYear);
assert.sameValue(date.daysInYear, daysInYear);
assert.sameValue(date.monthsInYear, 12);
assert.sameValue(date.dayOfYear, 1);
// Approximations of the observational Islamic calendar as computed by ICU4X.
{
inLeapYear: true,
daysInYear: 355,
daysInMonth12: 30,
isoDate: "2023-07-19",
}
],
},
{
calendar: "islamic-tbla",
inLeapYear: true,
daysInYear: 355,
daysInMonth12: 30,
isoDate: "2023-07-18",
}
];
const startOfNextYear = date.with({ year: year + 1 });
const lastDayOfThisYear = startOfNextYear.subtract({ days: 1 });
assert.sameValue(lastDayOfThisYear.dayOfYear, daysInYear);
for (const test of tests) {
const { calendar, choices = [test] } = test;
const year = 1445;
const date = Temporal.PlainDate.from({ year, month: 1, day: 1, calendar });
assert.sameValue(date.calendarId, calendar);
assert.sameValue(date.year, year);
assert.sameValue(date.month, 1);
assert.sameValue(date.monthCode, "M01");
assert.sameValue(date.day, 1);
// Match the possible choice by comparing the ISO date value.
const choice = choices.find(({ isoDate }) => {
return date.toString().startsWith(isoDate);
});
assert(choice !== undefined, `No applicable choice found for calendar: ${calendar}`);
const { inLeapYear, daysInYear, daysInMonth12, isoDate } = choice;
assert.sameValue(date.inLeapYear, inLeapYear);
assert.sameValue(date.daysInYear, daysInYear);
assert.sameValue(date.monthsInYear, 12);
assert.sameValue(date.dayOfYear, 1);
const startOfNextYear = date.with({ year: year + 1 });
const lastDayOfThisYear = startOfNextYear.subtract({ days: 1 });
assert.sameValue(lastDayOfThisYear.dayOfYear, daysInYear);
const dateMonth12 = date.with({ month: 12 });
assert.sameValue(dateMonth12.daysInMonth, daysInMonth12);
assert.sameValue(date.toString(), `${isoDate}[u-ca=${calendar}]`, "ISO reference date");
}
const dateMonth12 = date.with({ month: 12 });
assert.sameValue(dateMonth12.daysInMonth, daysInMonth12);
assert.sameValue(date.toString(), `${isoDate}[u-ca=${calendar}]`, "ISO reference date");

View File

@ -3,102 +3,57 @@
/*---
esid: sec-temporal-intl
description: Islamic calendars (note there are 5 variants)
description: Islamic calendar "islamic-rgsa".
features: [Temporal]
---*/
const calendar = "islamic-rgsa";
// Test data obtained from ICU
const tests = [
const choices = [
// Approximations of the observational Islamic calendar as computed by ICU4C.
{
calendar: "islamic",
choices: [
// Approximations of the observational Islamic calendar as computed by ICU4C.
{
inLeapYear: false,
daysInYear: 354,
daysInMonth12: 29,
isoDate: "2023-07-18",
},
// Approximations of the observational Islamic calendar as computed by ICU4X.
{
inLeapYear: true,
daysInYear: 355,
daysInMonth12: 30,
isoDate: "2023-07-19",
}
],
},
{
calendar: "islamic-umalqura",
inLeapYear: false,
daysInYear: 354,
daysInMonth12: 30,
isoDate: "2023-07-19",
},
{
calendar: "islamic-civil",
inLeapYear: true,
daysInYear: 355,
daysInMonth12: 30,
isoDate: "2023-07-19",
},
{
calendar: "islamic-rgsa",
choices: [
// Approximations of the observational Islamic calendar as computed by ICU4C.
{
inLeapYear: false,
daysInYear: 354,
daysInMonth12: 29,
isoDate: "2023-07-18",
},
// Approximations of the observational Islamic calendar as computed by ICU4X.
{
inLeapYear: true,
daysInYear: 355,
daysInMonth12: 30,
isoDate: "2023-07-19",
}
],
},
{
calendar: "islamic-tbla",
inLeapYear: true,
daysInYear: 355,
daysInMonth12: 30,
daysInMonth12: 29,
isoDate: "2023-07-18",
},
// Approximations of the observational Islamic calendar as computed by ICU4X.
{
inLeapYear: true,
daysInYear: 355,
daysInMonth12: 30,
isoDate: "2023-07-19",
}
];
for (const test of tests) {
const { calendar, choices = [test] } = test;
const year = 1445;
const date = Temporal.PlainDate.from({ year, month: 1, day: 1, calendar });
assert.sameValue(date.calendarId, calendar);
assert.sameValue(date.year, year);
assert.sameValue(date.month, 1);
assert.sameValue(date.monthCode, "M01");
assert.sameValue(date.day, 1);
const year = 1445;
const date = Temporal.PlainDate.from({ year, month: 1, day: 1, calendar });
assert.sameValue(date.calendarId, calendar);
assert.sameValue(date.year, year);
assert.sameValue(date.month, 1);
assert.sameValue(date.monthCode, "M01");
assert.sameValue(date.day, 1);
// Match the possible choice by comparing the ISO date value.
const choice = choices.find(({ isoDate }) => {
return date.toString().startsWith(isoDate);
});
assert(choice !== undefined, `No applicable choice found for calendar: ${calendar}`);
// Match the possible choice by comparing the ISO date value.
const choice = choices.find(({ isoDate }) => {
return date.toString().startsWith(isoDate);
});
assert(choice !== undefined, `No applicable choice found for calendar: ${calendar}`);
const { inLeapYear, daysInYear, daysInMonth12, isoDate } = choice;
const { inLeapYear, daysInYear, daysInMonth12, isoDate } = choice;
assert.sameValue(date.inLeapYear, inLeapYear);
assert.sameValue(date.daysInYear, daysInYear);
assert.sameValue(date.monthsInYear, 12);
assert.sameValue(date.dayOfYear, 1);
const startOfNextYear = date.with({ year: year + 1 });
const lastDayOfThisYear = startOfNextYear.subtract({ days: 1 });
assert.sameValue(lastDayOfThisYear.dayOfYear, daysInYear);
const dateMonth12 = date.with({ month: 12 });
assert.sameValue(dateMonth12.daysInMonth, daysInMonth12);
assert.sameValue(date.toString(), `${isoDate}[u-ca=${calendar}]`, "ISO reference date");
}
assert.sameValue(date.inLeapYear, inLeapYear);
assert.sameValue(date.daysInYear, daysInYear);
assert.sameValue(date.monthsInYear, 12);
assert.sameValue(date.dayOfYear, 1);
const startOfNextYear = date.with({ year: year + 1 });
const lastDayOfThisYear = startOfNextYear.subtract({ days: 1 });
assert.sameValue(lastDayOfThisYear.dayOfYear, daysInYear);
const dateMonth12 = date.with({ month: 12 });
assert.sameValue(dateMonth12.daysInMonth, daysInMonth12);
assert.sameValue(date.toString(), `${isoDate}[u-ca=${calendar}]`, "ISO reference date");

View File

@ -3,102 +3,35 @@
/*---
esid: sec-temporal-intl
description: Islamic calendars (note there are 5 variants)
description: Islamic calendar "islamic-tbla".
features: [Temporal]
---*/
const calendar = "islamic-tbla";
// Test data obtained from ICU
const inLeapYear = true;
const daysInYear = 355;
const daysInMonth12 = 30;
const isoDate = "2023-07-18";
const tests = [
{
calendar: "islamic",
choices: [
// Approximations of the observational Islamic calendar as computed by ICU4C.
{
inLeapYear: false,
daysInYear: 354,
daysInMonth12: 29,
isoDate: "2023-07-18",
},
const year = 1445;
const date = Temporal.PlainDate.from({ year, month: 1, day: 1, calendar });
assert.sameValue(date.calendarId, calendar);
assert.sameValue(date.year, year);
assert.sameValue(date.month, 1);
assert.sameValue(date.monthCode, "M01");
assert.sameValue(date.day, 1);
// Approximations of the observational Islamic calendar as computed by ICU4X.
{
inLeapYear: true,
daysInYear: 355,
daysInMonth12: 30,
isoDate: "2023-07-19",
}
],
},
{
calendar: "islamic-umalqura",
inLeapYear: false,
daysInYear: 354,
daysInMonth12: 30,
isoDate: "2023-07-19",
},
{
calendar: "islamic-civil",
inLeapYear: true,
daysInYear: 355,
daysInMonth12: 30,
isoDate: "2023-07-19",
},
{
calendar: "islamic-rgsa",
choices: [
// Approximations of the observational Islamic calendar as computed by ICU4C.
{
inLeapYear: false,
daysInYear: 354,
daysInMonth12: 29,
isoDate: "2023-07-18",
},
assert.sameValue(date.inLeapYear, inLeapYear);
assert.sameValue(date.daysInYear, daysInYear);
assert.sameValue(date.monthsInYear, 12);
assert.sameValue(date.dayOfYear, 1);
// Approximations of the observational Islamic calendar as computed by ICU4X.
{
inLeapYear: true,
daysInYear: 355,
daysInMonth12: 30,
isoDate: "2023-07-19",
}
],
},
{
calendar: "islamic-tbla",
inLeapYear: true,
daysInYear: 355,
daysInMonth12: 30,
isoDate: "2023-07-18",
}
];
const startOfNextYear = date.with({ year: year + 1 });
const lastDayOfThisYear = startOfNextYear.subtract({ days: 1 });
assert.sameValue(lastDayOfThisYear.dayOfYear, daysInYear);
for (const test of tests) {
const { calendar, choices = [test] } = test;
const year = 1445;
const date = Temporal.PlainDate.from({ year, month: 1, day: 1, calendar });
assert.sameValue(date.calendarId, calendar);
assert.sameValue(date.year, year);
assert.sameValue(date.month, 1);
assert.sameValue(date.monthCode, "M01");
assert.sameValue(date.day, 1);
// Match the possible choice by comparing the ISO date value.
const choice = choices.find(({ isoDate }) => {
return date.toString().startsWith(isoDate);
});
assert(choice !== undefined, `No applicable choice found for calendar: ${calendar}`);
const { inLeapYear, daysInYear, daysInMonth12, isoDate } = choice;
assert.sameValue(date.inLeapYear, inLeapYear);
assert.sameValue(date.daysInYear, daysInYear);
assert.sameValue(date.monthsInYear, 12);
assert.sameValue(date.dayOfYear, 1);
const startOfNextYear = date.with({ year: year + 1 });
const lastDayOfThisYear = startOfNextYear.subtract({ days: 1 });
assert.sameValue(lastDayOfThisYear.dayOfYear, daysInYear);
const dateMonth12 = date.with({ month: 12 });
assert.sameValue(dateMonth12.daysInMonth, daysInMonth12);
assert.sameValue(date.toString(), `${isoDate}[u-ca=${calendar}]`, "ISO reference date");
}
const dateMonth12 = date.with({ month: 12 });
assert.sameValue(dateMonth12.daysInMonth, daysInMonth12);
assert.sameValue(date.toString(), `${isoDate}[u-ca=${calendar}]`, "ISO reference date");

View File

@ -3,102 +3,35 @@
/*---
esid: sec-temporal-intl
description: Islamic calendars (note there are 5 variants)
description: Islamic calendar "islamic-umalqura".
features: [Temporal]
---*/
const calendar = "islamic-umalqura";
// Test data obtained from ICU
const inLeapYear = false;
const daysInYear = 354;
const daysInMonth12 = 30;
const isoDate = "2023-07-19";
const tests = [
{
calendar: "islamic",
choices: [
// Approximations of the observational Islamic calendar as computed by ICU4C.
{
inLeapYear: false,
daysInYear: 354,
daysInMonth12: 29,
isoDate: "2023-07-18",
},
const year = 1445;
const date = Temporal.PlainDate.from({ year, month: 1, day: 1, calendar });
assert.sameValue(date.calendarId, calendar);
assert.sameValue(date.year, year);
assert.sameValue(date.month, 1);
assert.sameValue(date.monthCode, "M01");
assert.sameValue(date.day, 1);
// Approximations of the observational Islamic calendar as computed by ICU4X.
{
inLeapYear: true,
daysInYear: 355,
daysInMonth12: 30,
isoDate: "2023-07-19",
}
],
},
{
calendar: "islamic-umalqura",
inLeapYear: false,
daysInYear: 354,
daysInMonth12: 30,
isoDate: "2023-07-19",
},
{
calendar: "islamic-civil",
inLeapYear: true,
daysInYear: 355,
daysInMonth12: 30,
isoDate: "2023-07-19",
},
{
calendar: "islamic-rgsa",
choices: [
// Approximations of the observational Islamic calendar as computed by ICU4C.
{
inLeapYear: false,
daysInYear: 354,
daysInMonth12: 29,
isoDate: "2023-07-18",
},
assert.sameValue(date.inLeapYear, inLeapYear);
assert.sameValue(date.daysInYear, daysInYear);
assert.sameValue(date.monthsInYear, 12);
assert.sameValue(date.dayOfYear, 1);
// Approximations of the observational Islamic calendar as computed by ICU4X.
{
inLeapYear: true,
daysInYear: 355,
daysInMonth12: 30,
isoDate: "2023-07-19",
}
],
},
{
calendar: "islamic-tbla",
inLeapYear: true,
daysInYear: 355,
daysInMonth12: 30,
isoDate: "2023-07-18",
}
];
const startOfNextYear = date.with({ year: year + 1 });
const lastDayOfThisYear = startOfNextYear.subtract({ days: 1 });
assert.sameValue(lastDayOfThisYear.dayOfYear, daysInYear);
for (const test of tests) {
const { calendar, choices = [test] } = test;
const year = 1445;
const date = Temporal.PlainDate.from({ year, month: 1, day: 1, calendar });
assert.sameValue(date.calendarId, calendar);
assert.sameValue(date.year, year);
assert.sameValue(date.month, 1);
assert.sameValue(date.monthCode, "M01");
assert.sameValue(date.day, 1);
// Match the possible choice by comparing the ISO date value.
const choice = choices.find(({ isoDate }) => {
return date.toString().startsWith(isoDate);
});
assert(choice !== undefined, `No applicable choice found for calendar: ${calendar}`);
const { inLeapYear, daysInYear, daysInMonth12, isoDate } = choice;
assert.sameValue(date.inLeapYear, inLeapYear);
assert.sameValue(date.daysInYear, daysInYear);
assert.sameValue(date.monthsInYear, 12);
assert.sameValue(date.dayOfYear, 1);
const startOfNextYear = date.with({ year: year + 1 });
const lastDayOfThisYear = startOfNextYear.subtract({ days: 1 });
assert.sameValue(lastDayOfThisYear.dayOfYear, daysInYear);
const dateMonth12 = date.with({ month: 12 });
assert.sameValue(dateMonth12.daysInMonth, daysInMonth12);
assert.sameValue(date.toString(), `${isoDate}[u-ca=${calendar}]`, "ISO reference date");
}
const dateMonth12 = date.with({ month: 12 });
assert.sameValue(dateMonth12.daysInMonth, daysInMonth12);
assert.sameValue(date.toString(), `${isoDate}[u-ca=${calendar}]`, "ISO reference date");

View File

@ -3,102 +3,56 @@
/*---
esid: sec-temporal-intl
description: Islamic calendars (note there are 5 variants)
description: Islamic calendar "islamic".
features: [Temporal]
---*/
// Test data obtained from ICU
const calendar = "islamic";
const tests = [
// Test data obtained from ICU.
const choices = [
// Approximations of the observational Islamic calendar as computed by ICU4C.
{
calendar: "islamic",
choices: [
// Approximations of the observational Islamic calendar as computed by ICU4C.
{
inLeapYear: false,
daysInYear: 354,
daysInMonth12: 29,
isoDate: "2023-07-18",
},
// Approximations of the observational Islamic calendar as computed by ICU4X.
{
inLeapYear: true,
daysInYear: 355,
daysInMonth12: 30,
isoDate: "2023-07-19",
}
],
},
{
calendar: "islamic-umalqura",
inLeapYear: false,
daysInYear: 354,
daysInMonth12: 30,
isoDate: "2023-07-19",
},
{
calendar: "islamic-civil",
inLeapYear: true,
daysInYear: 355,
daysInMonth12: 30,
isoDate: "2023-07-19",
},
{
calendar: "islamic-rgsa",
choices: [
// Approximations of the observational Islamic calendar as computed by ICU4C.
{
inLeapYear: false,
daysInYear: 354,
daysInMonth12: 29,
isoDate: "2023-07-18",
},
// Approximations of the observational Islamic calendar as computed by ICU4X.
{
inLeapYear: true,
daysInYear: 355,
daysInMonth12: 30,
isoDate: "2023-07-19",
}
],
},
{
calendar: "islamic-tbla",
inLeapYear: true,
daysInYear: 355,
daysInMonth12: 30,
daysInMonth12: 29,
isoDate: "2023-07-18",
},
// Approximations of the observational Islamic calendar as computed by ICU4X.
{
inLeapYear: true,
daysInYear: 355,
daysInMonth12: 30,
isoDate: "2023-07-19",
}
];
for (const test of tests) {
const { calendar, choices = [test] } = test;
const year = 1445;
const date = Temporal.PlainDate.from({ year, month: 1, day: 1, calendar });
assert.sameValue(date.calendarId, calendar);
assert.sameValue(date.year, year);
assert.sameValue(date.month, 1);
assert.sameValue(date.monthCode, "M01");
assert.sameValue(date.day, 1);
const year = 1445;
const date = Temporal.PlainDate.from({ year, month: 1, day: 1, calendar });
assert.sameValue(date.calendarId, calendar);
assert.sameValue(date.year, year);
assert.sameValue(date.month, 1);
assert.sameValue(date.monthCode, "M01");
assert.sameValue(date.day, 1);
// Match the possible choice by comparing the ISO date value.
const choice = choices.find(({ isoDate }) => {
return date.toString().startsWith(isoDate);
});
assert(choice !== undefined, `No applicable choice found for calendar: ${calendar}`);
// Match the possible choice by comparing the ISO date value.
const choice = choices.find(({ isoDate }) => {
return date.toString().startsWith(isoDate);
});
assert(choice !== undefined, `No applicable choice found for calendar: ${calendar}`);
const { inLeapYear, daysInYear, daysInMonth12, isoDate } = choice;
const { inLeapYear, daysInYear, daysInMonth12, isoDate } = choice;
assert.sameValue(date.inLeapYear, inLeapYear);
assert.sameValue(date.daysInYear, daysInYear);
assert.sameValue(date.monthsInYear, 12);
assert.sameValue(date.dayOfYear, 1);
const startOfNextYear = date.with({ year: year + 1 });
const lastDayOfThisYear = startOfNextYear.subtract({ days: 1 });
assert.sameValue(lastDayOfThisYear.dayOfYear, daysInYear);
const dateMonth12 = date.with({ month: 12 });
assert.sameValue(dateMonth12.daysInMonth, daysInMonth12);
assert.sameValue(date.toString(), `${isoDate}[u-ca=${calendar}]`, "ISO reference date");
}
assert.sameValue(date.inLeapYear, inLeapYear);
assert.sameValue(date.daysInYear, daysInYear);
assert.sameValue(date.monthsInYear, 12);
assert.sameValue(date.dayOfYear, 1);
const startOfNextYear = date.with({ year: year + 1 });
const lastDayOfThisYear = startOfNextYear.subtract({ days: 1 });
assert.sameValue(lastDayOfThisYear.dayOfYear, daysInYear);
const dateMonth12 = date.with({ month: 12 });
assert.sameValue(dateMonth12.daysInMonth, daysInMonth12);
assert.sameValue(date.toString(), `${isoDate}[u-ca=${calendar}]`, "ISO reference date");