Skip to content

Commit c7bbdd4

Browse files
anbaMs2ger
authored andcommitted
Remove test data from other calendars
1 parent c9ab199 commit c7bbdd4

5 files changed

Lines changed: 158 additions & 450 deletions

File tree

test/staging/Intl402/Temporal/old/islamic-calendars-islamic-civil.js

Lines changed: 28 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -3,102 +3,35 @@
33

44
/*---
55
esid: sec-temporal-intl
6-
description: Islamic calendars (note there are 5 variants)
6+
description: Islamic calendar "islamic-civil".
77
features: [Temporal]
88
---*/
99

10-
// Test data obtained from ICU
11-
12-
const tests = [
13-
{
14-
calendar: "islamic",
15-
choices: [
16-
// Approximations of the observational Islamic calendar as computed by ICU4C.
17-
{
18-
inLeapYear: false,
19-
daysInYear: 354,
20-
daysInMonth12: 29,
21-
isoDate: "2023-07-18",
22-
},
23-
24-
// Approximations of the observational Islamic calendar as computed by ICU4X.
25-
{
26-
inLeapYear: true,
27-
daysInYear: 355,
28-
daysInMonth12: 30,
29-
isoDate: "2023-07-19",
30-
}
31-
],
32-
},
33-
{
34-
calendar: "islamic-umalqura",
35-
inLeapYear: false,
36-
daysInYear: 354,
37-
daysInMonth12: 30,
38-
isoDate: "2023-07-19",
39-
},
40-
{
41-
calendar: "islamic-civil",
42-
inLeapYear: true,
43-
daysInYear: 355,
44-
daysInMonth12: 30,
45-
isoDate: "2023-07-19",
46-
},
47-
{
48-
calendar: "islamic-rgsa",
49-
choices: [
50-
// Approximations of the observational Islamic calendar as computed by ICU4C.
51-
{
52-
inLeapYear: false,
53-
daysInYear: 354,
54-
daysInMonth12: 29,
55-
isoDate: "2023-07-18",
56-
},
57-
58-
// Approximations of the observational Islamic calendar as computed by ICU4X.
59-
{
60-
inLeapYear: true,
61-
daysInYear: 355,
62-
daysInMonth12: 30,
63-
isoDate: "2023-07-19",
64-
}
65-
],
66-
},
67-
{
68-
calendar: "islamic-tbla",
69-
inLeapYear: true,
70-
daysInYear: 355,
71-
daysInMonth12: 30,
72-
isoDate: "2023-07-18",
73-
}
74-
];
10+
const calendar = "islamic-civil";
7511

76-
for (const test of tests) {
77-
const { calendar, choices = [test] } = test;
78-
const year = 1445;
79-
const date = Temporal.PlainDate.from({ year, month: 1, day: 1, calendar });
80-
assert.sameValue(date.calendarId, calendar);
81-
assert.sameValue(date.year, year);
82-
assert.sameValue(date.month, 1);
83-
assert.sameValue(date.monthCode, "M01");
84-
assert.sameValue(date.day, 1);
85-
86-
// Match the possible choice by comparing the ISO date value.
87-
const choice = choices.find(({ isoDate }) => {
88-
return date.toString().startsWith(isoDate);
89-
});
90-
assert(choice !== undefined, `No applicable choice found for calendar: ${calendar}`);
91-
92-
const { inLeapYear, daysInYear, daysInMonth12, isoDate } = choice;
93-
94-
assert.sameValue(date.inLeapYear, inLeapYear);
95-
assert.sameValue(date.daysInYear, daysInYear);
96-
assert.sameValue(date.monthsInYear, 12);
97-
assert.sameValue(date.dayOfYear, 1);
98-
const startOfNextYear = date.with({ year: year + 1 });
99-
const lastDayOfThisYear = startOfNextYear.subtract({ days: 1 });
100-
assert.sameValue(lastDayOfThisYear.dayOfYear, daysInYear);
101-
const dateMonth12 = date.with({ month: 12 });
102-
assert.sameValue(dateMonth12.daysInMonth, daysInMonth12);
103-
assert.sameValue(date.toString(), `${isoDate}[u-ca=${calendar}]`, "ISO reference date");
104-
}
12+
// Test data obtained from ICU
13+
const inLeapYear = true;
14+
const daysInYear = 355;
15+
const daysInMonth12 = 30;
16+
const isoDate = "2023-07-19";
17+
18+
const year = 1445;
19+
const date = Temporal.PlainDate.from({ year, month: 1, day: 1, calendar });
20+
assert.sameValue(date.calendarId, calendar);
21+
assert.sameValue(date.year, year);
22+
assert.sameValue(date.month, 1);
23+
assert.sameValue(date.monthCode, "M01");
24+
assert.sameValue(date.day, 1);
25+
26+
assert.sameValue(date.inLeapYear, inLeapYear);
27+
assert.sameValue(date.daysInYear, daysInYear);
28+
assert.sameValue(date.monthsInYear, 12);
29+
assert.sameValue(date.dayOfYear, 1);
30+
31+
const startOfNextYear = date.with({ year: year + 1 });
32+
const lastDayOfThisYear = startOfNextYear.subtract({ days: 1 });
33+
assert.sameValue(lastDayOfThisYear.dayOfYear, daysInYear);
34+
35+
const dateMonth12 = date.with({ month: 12 });
36+
assert.sameValue(dateMonth12.daysInMonth, daysInMonth12);
37+
assert.sameValue(date.toString(), `${isoDate}[u-ca=${calendar}]`, "ISO reference date");

test/staging/Intl402/Temporal/old/islamic-calendars-islamic-rgsa.js

Lines changed: 37 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -3,102 +3,57 @@
33

44
/*---
55
esid: sec-temporal-intl
6-
description: Islamic calendars (note there are 5 variants)
6+
description: Islamic calendar "islamic-rgsa".
77
features: [Temporal]
88
---*/
99

10+
const calendar = "islamic-rgsa";
11+
1012
// Test data obtained from ICU
1113

12-
const tests = [
14+
const choices = [
15+
// Approximations of the observational Islamic calendar as computed by ICU4C.
1316
{
14-
calendar: "islamic",
15-
choices: [
16-
// Approximations of the observational Islamic calendar as computed by ICU4C.
17-
{
18-
inLeapYear: false,
19-
daysInYear: 354,
20-
daysInMonth12: 29,
21-
isoDate: "2023-07-18",
22-
},
23-
24-
// Approximations of the observational Islamic calendar as computed by ICU4X.
25-
{
26-
inLeapYear: true,
27-
daysInYear: 355,
28-
daysInMonth12: 30,
29-
isoDate: "2023-07-19",
30-
}
31-
],
32-
},
33-
{
34-
calendar: "islamic-umalqura",
3517
inLeapYear: false,
3618
daysInYear: 354,
37-
daysInMonth12: 30,
38-
isoDate: "2023-07-19",
39-
},
40-
{
41-
calendar: "islamic-civil",
42-
inLeapYear: true,
43-
daysInYear: 355,
44-
daysInMonth12: 30,
45-
isoDate: "2023-07-19",
19+
daysInMonth12: 29,
20+
isoDate: "2023-07-18",
4621
},
47-
{
48-
calendar: "islamic-rgsa",
49-
choices: [
50-
// Approximations of the observational Islamic calendar as computed by ICU4C.
51-
{
52-
inLeapYear: false,
53-
daysInYear: 354,
54-
daysInMonth12: 29,
55-
isoDate: "2023-07-18",
56-
},
5722

58-
// Approximations of the observational Islamic calendar as computed by ICU4X.
59-
{
60-
inLeapYear: true,
61-
daysInYear: 355,
62-
daysInMonth12: 30,
63-
isoDate: "2023-07-19",
64-
}
65-
],
66-
},
23+
// Approximations of the observational Islamic calendar as computed by ICU4X.
6724
{
68-
calendar: "islamic-tbla",
6925
inLeapYear: true,
7026
daysInYear: 355,
7127
daysInMonth12: 30,
72-
isoDate: "2023-07-18",
28+
isoDate: "2023-07-19",
7329
}
7430
];
7531

76-
for (const test of tests) {
77-
const { calendar, choices = [test] } = test;
78-
const year = 1445;
79-
const date = Temporal.PlainDate.from({ year, month: 1, day: 1, calendar });
80-
assert.sameValue(date.calendarId, calendar);
81-
assert.sameValue(date.year, year);
82-
assert.sameValue(date.month, 1);
83-
assert.sameValue(date.monthCode, "M01");
84-
assert.sameValue(date.day, 1);
85-
86-
// Match the possible choice by comparing the ISO date value.
87-
const choice = choices.find(({ isoDate }) => {
88-
return date.toString().startsWith(isoDate);
89-
});
90-
assert(choice !== undefined, `No applicable choice found for calendar: ${calendar}`);
91-
92-
const { inLeapYear, daysInYear, daysInMonth12, isoDate } = choice;
93-
94-
assert.sameValue(date.inLeapYear, inLeapYear);
95-
assert.sameValue(date.daysInYear, daysInYear);
96-
assert.sameValue(date.monthsInYear, 12);
97-
assert.sameValue(date.dayOfYear, 1);
98-
const startOfNextYear = date.with({ year: year + 1 });
99-
const lastDayOfThisYear = startOfNextYear.subtract({ days: 1 });
100-
assert.sameValue(lastDayOfThisYear.dayOfYear, daysInYear);
101-
const dateMonth12 = date.with({ month: 12 });
102-
assert.sameValue(dateMonth12.daysInMonth, daysInMonth12);
103-
assert.sameValue(date.toString(), `${isoDate}[u-ca=${calendar}]`, "ISO reference date");
104-
}
32+
const year = 1445;
33+
const date = Temporal.PlainDate.from({ year, month: 1, day: 1, calendar });
34+
assert.sameValue(date.calendarId, calendar);
35+
assert.sameValue(date.year, year);
36+
assert.sameValue(date.month, 1);
37+
assert.sameValue(date.monthCode, "M01");
38+
assert.sameValue(date.day, 1);
39+
40+
// Match the possible choice by comparing the ISO date value.
41+
const choice = choices.find(({ isoDate }) => {
42+
return date.toString().startsWith(isoDate);
43+
});
44+
assert(choice !== undefined, `No applicable choice found for calendar: ${calendar}`);
45+
46+
const { inLeapYear, daysInYear, daysInMonth12, isoDate } = choice;
47+
48+
assert.sameValue(date.inLeapYear, inLeapYear);
49+
assert.sameValue(date.daysInYear, daysInYear);
50+
assert.sameValue(date.monthsInYear, 12);
51+
assert.sameValue(date.dayOfYear, 1);
52+
53+
const startOfNextYear = date.with({ year: year + 1 });
54+
const lastDayOfThisYear = startOfNextYear.subtract({ days: 1 });
55+
assert.sameValue(lastDayOfThisYear.dayOfYear, daysInYear);
56+
57+
const dateMonth12 = date.with({ month: 12 });
58+
assert.sameValue(dateMonth12.daysInMonth, daysInMonth12);
59+
assert.sameValue(date.toString(), `${isoDate}[u-ca=${calendar}]`, "ISO reference date");

0 commit comments

Comments
 (0)