Remove simple.js

This commit is contained in:
Frank Tang 2021-08-04 14:20:09 -07:00 committed by Rick Waldron
parent 8f2434ba4d
commit 1a36125f25
2 changed files with 0 additions and 157 deletions

View File

@ -1,107 +0,0 @@
// Copyright (C) 2021 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.calendar.prototype.dateadd
description: Temporal.Calendar.prototype.dateAdd
info: |
1. Let calendar be the this value.
2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]).
3. Assert: calendar.[[Identifier]] is "iso8601".
4. Set date to ? ToTemporalDate(date).
5. Set duration to ? ToTemporalDuration(duration).
6. Set options to ? GetOptionsObject(options).
7. Let overflow be ? ToTemporalOverflow(options).
8. Let result be ? AddISODate(date.[[ISOYear]], date.[[ISOMonth]], date.[[ISODay]], duration.[[Years]], duration.[[Months]], duration.[[Weeks]], duration.[[Days]], overflow).
9. Return ? CreateTemporalDate(result.[[Year]], result.[[Month]], result.[[Day]], calendar).
features: [Temporal]
---*/
let cal = new Temporal.Calendar("iso8601");
let p1y = new Temporal.Duration(1);
let p4y = new Temporal.Duration(4);
let p5m = new Temporal.Duration(0, 5);
let p1y2m = new Temporal.Duration(1,2);
let p1y4d = new Temporal.Duration(1,0,0,4);
let p1y2m4d = new Temporal.Duration(1,2,0,4);
let p10d = new Temporal.Duration(0,0,0,10);
let p1w = new Temporal.Duration(0,0,1);
let p6w = new Temporal.Duration(0,0,6);
let p2w3d = new Temporal.Duration(0,0,2,3);
let p1y2w = new Temporal.Duration(1,0,2);
let p2m3w = new Temporal.Duration(0,2,3);
assert.sameValue("2021-02-28", cal.dateAdd("2020-02-29", p1y).toJSON());
assert.sameValue("2024-02-29", cal.dateAdd("2020-02-29", p4y).toJSON());
assert.sameValue("2022-07-16", cal.dateAdd("2021-07-16", p1y).toJSON());
assert.sameValue("2021-12-16", cal.dateAdd("2021-07-16", p5m).toJSON());
assert.sameValue("2022-01-16", cal.dateAdd("2021-08-16", p5m).toJSON());
assert.sameValue("2022-03-31", cal.dateAdd("2021-10-31", p5m).toJSON());
assert.sameValue("2022-02-28", cal.dateAdd("2021-09-30", p5m).toJSON());
assert.sameValue("2020-02-29", cal.dateAdd("2019-09-30", p5m).toJSON());
assert.sameValue("2020-03-01", cal.dateAdd("2019-10-01", p5m).toJSON());
assert.sameValue("2022-09-16", cal.dateAdd("2021-07-16", p1y2m).toJSON());
assert.sameValue("2023-01-30", cal.dateAdd("2021-11-30", p1y2m).toJSON());
assert.sameValue("2023-02-28", cal.dateAdd("2021-12-31", p1y2m).toJSON());
assert.sameValue("2024-02-29", cal.dateAdd("2022-12-31", p1y2m).toJSON());
assert.sameValue("2022-07-20", cal.dateAdd("2021-07-16", p1y4d).toJSON());
assert.sameValue("2022-03-03", cal.dateAdd("2021-02-27", p1y4d).toJSON());
assert.sameValue("2024-03-02", cal.dateAdd("2023-02-27", p1y4d).toJSON());
assert.sameValue("2023-01-03", cal.dateAdd("2021-12-30", p1y4d).toJSON());
assert.sameValue("2022-08-03", cal.dateAdd("2021-07-30", p1y4d).toJSON());
assert.sameValue("2022-07-04", cal.dateAdd("2021-06-30", p1y4d).toJSON());
assert.sameValue("2022-09-20", cal.dateAdd("2021-07-16", p1y2m4d).toJSON());
assert.sameValue("2022-05-01", cal.dateAdd("2021-02-27", p1y2m4d).toJSON());
assert.sameValue("2022-04-30", cal.dateAdd("2021-02-26", p1y2m4d).toJSON());
assert.sameValue("2024-04-30", cal.dateAdd("2023-02-26", p1y2m4d).toJSON());
assert.sameValue("2023-03-04", cal.dateAdd("2021-12-30", p1y2m4d).toJSON());
assert.sameValue("2022-10-04", cal.dateAdd("2021-07-30", p1y2m4d).toJSON());
assert.sameValue("2022-09-03", cal.dateAdd("2021-06-30", p1y2m4d).toJSON());
assert.sameValue("2021-07-26", cal.dateAdd("2021-07-16", p10d).toJSON());
assert.sameValue("2021-08-05", cal.dateAdd("2021-07-26", p10d).toJSON());
assert.sameValue("2022-01-05", cal.dateAdd("2021-12-26", p10d).toJSON());
assert.sameValue("2020-03-07", cal.dateAdd("2020-02-26", p10d).toJSON());
assert.sameValue("2021-03-08", cal.dateAdd("2021-02-26", p10d).toJSON());
assert.sameValue("2020-02-29", cal.dateAdd("2020-02-19", p10d).toJSON());
assert.sameValue("2021-03-01", cal.dateAdd("2021-02-19", p10d).toJSON());
assert.sameValue("2021-02-26", cal.dateAdd("2021-02-19", p1w).toJSON());
assert.sameValue("2021-03-06", cal.dateAdd("2021-02-27", p1w).toJSON());
assert.sameValue("2020-03-05", cal.dateAdd("2020-02-27", p1w).toJSON());
assert.sameValue("2021-12-31", cal.dateAdd("2021-12-24", p1w).toJSON());
assert.sameValue("2022-01-03", cal.dateAdd("2021-12-27", p1w).toJSON());
assert.sameValue("2021-02-03", cal.dateAdd("2021-01-27", p1w).toJSON());
assert.sameValue("2021-07-04", cal.dateAdd("2021-06-27", p1w).toJSON());
assert.sameValue("2021-08-03", cal.dateAdd("2021-07-27", p1w).toJSON());
assert.sameValue("2021-04-02", cal.dateAdd("2021-02-19", p6w).toJSON());
assert.sameValue("2021-04-10", cal.dateAdd("2021-02-27", p6w).toJSON());
assert.sameValue("2020-04-09", cal.dateAdd("2020-02-27", p6w).toJSON());
assert.sameValue("2022-02-04", cal.dateAdd("2021-12-24", p6w).toJSON());
assert.sameValue("2022-02-07", cal.dateAdd("2021-12-27", p6w).toJSON());
assert.sameValue("2021-03-10", cal.dateAdd("2021-01-27", p6w).toJSON());
assert.sameValue("2021-08-08", cal.dateAdd("2021-06-27", p6w).toJSON());
assert.sameValue("2021-09-07", cal.dateAdd("2021-07-27", p6w).toJSON());
assert.sameValue("2020-03-17", cal.dateAdd("2020-02-29", p2w3d).toJSON());
assert.sameValue("2020-03-16", cal.dateAdd("2020-02-28", p2w3d).toJSON());
assert.sameValue("2021-03-17", cal.dateAdd("2021-02-28", p2w3d).toJSON());
assert.sameValue("2021-01-14", cal.dateAdd("2020-12-28", p2w3d).toJSON());
assert.sameValue("2021-03-14", cal.dateAdd("2020-02-29", p1y2w).toJSON());
assert.sameValue("2021-03-14", cal.dateAdd("2020-02-28", p1y2w).toJSON());
assert.sameValue("2022-03-14", cal.dateAdd("2021-02-28", p1y2w).toJSON());
assert.sameValue("2022-01-11", cal.dateAdd("2020-12-28", p1y2w).toJSON());
assert.sameValue("2020-05-20", cal.dateAdd("2020-02-29", p2m3w).toJSON());
assert.sameValue("2020-05-19", cal.dateAdd("2020-02-28", p2m3w).toJSON());
assert.sameValue("2021-05-19", cal.dateAdd("2021-02-28", p2m3w).toJSON());
assert.sameValue("2021-03-21", cal.dateAdd("2020-12-28", p2m3w).toJSON());
assert.sameValue("2020-03-20", cal.dateAdd("2019-12-28", p2m3w).toJSON());
assert.sameValue("2020-01-18", cal.dateAdd("2019-10-28", p2m3w).toJSON());
assert.sameValue("2020-01-21", cal.dateAdd("2019-10-31", p2m3w).toJSON());

View File

@ -1,50 +0,0 @@
// Copyright (C) 2021 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.calendar.prototype.datefromfields
description: Temporal.Calendar.prototype.dateFromFields
info: |
1. Let calendar be the this value.
2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]).
3. Assert: calendar.[[Identifier]] is "iso8601".
4. If Type(fields) is not Object, throw a TypeError exception.
5. Set options to ? GetOptionsObject(options).
6. Let result be ? ISODateFromFields(fields, options).
7. Return ? CreateTemporalDate(result.[[Year]], result.[[Month]], result.[[Day]], calendar).
features: [Temporal]
---*/
let cal = new Temporal.Calendar("iso8601")
assert.sameValue("2021-07-15", cal.dateFromFields({year: 2021, month: 7, day: 15}).toJSON());
assert.sameValue("2021-07-03", cal.dateFromFields({year: 2021, month: 7, day: 3}).toJSON());
assert.sameValue("2021-12-31", cal.dateFromFields({year: 2021, month: 12, day: 31}).toJSON());
assert.sameValue("2021-07-15", cal.dateFromFields({year: 2021, monthCode: "M07", day: 15}).toJSON());
assert.sameValue("2021-07-03", cal.dateFromFields({year: 2021, monthCode: "M07", day: 3}).toJSON());
assert.sameValue("2021-12-31", cal.dateFromFields({year: 2021, monthCode: "M12", day: 31}).toJSON());
assert.sameValue("2021-01-31", cal.dateFromFields({year: 2021, month: 1, day: 133}).toJSON());
assert.sameValue("2021-02-28", cal.dateFromFields({year: 2021, month: 2, day: 133}).toJSON());
assert.sameValue("2021-03-31", cal.dateFromFields({year: 2021, month: 3, day: 9033}).toJSON());
assert.sameValue("2021-04-30", cal.dateFromFields({year: 2021, month: 4, day: 50}).toJSON());
assert.sameValue("2021-05-31", cal.dateFromFields({year: 2021, month: 5, day: 77}).toJSON());
assert.sameValue("2021-06-30", cal.dateFromFields({year: 2021, month: 6, day: 33}).toJSON());
assert.sameValue("2021-07-31", cal.dateFromFields({year: 2021, month: 7, day: 33}).toJSON());
assert.sameValue("2021-08-31", cal.dateFromFields({year: 2021, month: 8, day: 300}).toJSON());
assert.sameValue("2021-09-30", cal.dateFromFields({year: 2021, month: 9, day: 400}).toJSON());
assert.sameValue("2021-10-31", cal.dateFromFields({year: 2021, month: 10, day: 400}).toJSON());
assert.sameValue("2021-11-30", cal.dateFromFields({year: 2021, month: 11, day: 400}).toJSON());
assert.sameValue("2021-12-31", cal.dateFromFields({year: 2021, month: 12, day: 500}).toJSON());
assert.sameValue("2021-12-31", cal.dateFromFields({year: 2021, month: 13, day: 500}).toJSON());
assert.sameValue("2021-12-31", cal.dateFromFields({year: 2021, month: 999999, day: 500}).toJSON());
assert.sameValue("2021-01-31", cal.dateFromFields({year: 2021, monthCode: "M01", day: 133}).toJSON());
assert.sameValue("2021-02-28", cal.dateFromFields({year: 2021, monthCode: "M02", day: 133}).toJSON());
assert.sameValue("2021-03-31", cal.dateFromFields({year: 2021, monthCode: "M03", day: 9033}).toJSON());
assert.sameValue("2021-04-30", cal.dateFromFields({year: 2021, monthCode: "M04", day: 50}).toJSON());
assert.sameValue("2021-05-31", cal.dateFromFields({year: 2021, monthCode: "M05", day: 77}).toJSON());
assert.sameValue("2021-06-30", cal.dateFromFields({year: 2021, monthCode: "M06", day: 33}).toJSON());
assert.sameValue("2021-07-31", cal.dateFromFields({year: 2021, monthCode: "M07", day: 33}).toJSON());
assert.sameValue("2021-08-31", cal.dateFromFields({year: 2021, monthCode: "M08", day: 300}).toJSON());
assert.sameValue("2021-09-30", cal.dateFromFields({year: 2021, monthCode: "M09", day: 400}).toJSON());
assert.sameValue("2021-10-31", cal.dateFromFields({year: 2021, monthCode: "M10", day: 400}).toJSON());
assert.sameValue("2021-11-30", cal.dateFromFields({year: 2021, monthCode: "M11", day: 400}).toJSON());
assert.sameValue("2021-12-31", cal.dateFromFields({year: 2021, monthCode: "M12", day: 500}).toJSON());