Temporal: Add some assertion messages to help with debugging

This commit is contained in:
Philip Chimento 2022-10-03 15:48:13 -07:00 committed by Philip Chimento
parent e292fb80de
commit 89116e95dd
2 changed files with 5 additions and 5 deletions

View File

@ -85,12 +85,12 @@ let total = duration.total({unit: "hours"});
// is 4000.0000000000005.
const expected = 4000.0000000000005;
assert.sameValue(expected, 4000.0000000000002777);
assert.sameValue(expected, 4000.0000000000002777, "the float representation of the result is 4000.0000000000005");
// The next Number in direction -Infinity is less precise.
assert.sameValue(nextDown(expected), 4000);
assert.sameValue(nextDown(expected), 4000, "the next Number in direction -Infinity is less precise");
// The next Number in direction +Infinity is less precise.
assert.sameValue(nextUp(expected), 4000.000000000001);
assert.sameValue(nextUp(expected), 4000.000000000001, "the next Number in direction +Infinity is less precise");
assert.sameValue(total, expected);
assert.sameValue(total, expected, "return value of total()");

View File

@ -64,7 +64,7 @@ function test(todayInstant, tomorrowInstant, expected) {
let zdt = new Temporal.ZonedDateTime(0n, timeZone);
let zdt_hoursInDay = zdt.hoursInDay;
assert.sameValue(zdt_hoursInDay, expected);
assert.sameValue(zdt_hoursInDay, expected, "hoursInDay return value");
// Ensure the |expected| value is actually correctly rounded.