From b2f7dc119438d3b66f39531acdfc41bbe5e816ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Wed, 1 Jun 2022 16:45:30 +0200 Subject: [PATCH] Expect precise result for negative fractional units Fixes #3544 --- .../compare/argument-string-negative-fractional-units.js | 4 ++-- .../from/argument-string-negative-fractional-units.js | 4 ++-- .../add/argument-string-negative-fractional-units.js | 4 ++-- .../subtract/argument-string-negative-fractional-units.js | 4 ++-- .../add/argument-string-negative-fractional-units.js | 4 ++-- .../subtract/argument-string-negative-fractional-units.js | 4 ++-- .../add/argument-string-negative-fractional-units.js | 4 ++-- .../subtract/argument-string-negative-fractional-units.js | 4 ++-- .../add/argument-string-negative-fractional-units.js | 4 ++-- .../subtract/argument-string-negative-fractional-units.js | 4 ++-- .../add/argument-string-negative-fractional-units.js | 4 ++-- .../subtract/argument-string-negative-fractional-units.js | 4 ++-- 12 files changed, 24 insertions(+), 24 deletions(-) diff --git a/test/built-ins/Temporal/Duration/compare/argument-string-negative-fractional-units.js b/test/built-ins/Temporal/Duration/compare/argument-string-negative-fractional-units.js index d5552dab18..b120807814 100644 --- a/test/built-ins/Temporal/Duration/compare/argument-string-negative-fractional-units.js +++ b/test/built-ins/Temporal/Duration/compare/argument-string-negative-fractional-units.js @@ -7,13 +7,13 @@ description: Strings with fractional duration units are treated with the correct features: [Temporal] ---*/ -const expectedHours = new Temporal.Duration(0, 0, 0, 0, -24, -34, -4, -404, -442, -799); +const expectedHours = new Temporal.Duration(0, 0, 0, 0, -24, -34, -4, -404, -442, -800); const resultHours1 = Temporal.Duration.compare("-PT24.567890123H", expectedHours); assert.sameValue(resultHours1, 0, "negative fractional hours (first argument)"); const resultHours2 = Temporal.Duration.compare(expectedHours, "-PT24.567890123H"); assert.sameValue(resultHours2, 0, "negative fractional hours (second argument)"); -const expectedMinutes = new Temporal.Duration(0, 0, 0, 0, 0, -1440, -34, -73, -407, -379); +const expectedMinutes = new Temporal.Duration(0, 0, 0, 0, 0, -1440, -34, -73, -407, -380); const resultMinutes1 = Temporal.Duration.compare("-PT1440.567890123M", expectedMinutes); assert.sameValue(resultMinutes1, 0, "negative fractional minutes (first argument)"); const resultMinutes2 = Temporal.Duration.compare("-PT1440.567890123M", expectedMinutes); diff --git a/test/built-ins/Temporal/Duration/from/argument-string-negative-fractional-units.js b/test/built-ins/Temporal/Duration/from/argument-string-negative-fractional-units.js index b9d66b3a7f..0374db15e6 100644 --- a/test/built-ins/Temporal/Duration/from/argument-string-negative-fractional-units.js +++ b/test/built-ins/Temporal/Duration/from/argument-string-negative-fractional-units.js @@ -9,7 +9,7 @@ features: [Temporal] ---*/ const resultHours = Temporal.Duration.from("-PT24.567890123H"); -TemporalHelpers.assertDuration(resultHours, 0, 0, 0, 0, -24, -34, -4, -404, -442, -799, "negative fractional hours"); +TemporalHelpers.assertDuration(resultHours, 0, 0, 0, 0, -24, -34, -4, -404, -442, -800, "negative fractional hours"); const resultMinutes = Temporal.Duration.from("-PT1440.567890123M"); -TemporalHelpers.assertDuration(resultMinutes, 0, 0, 0, 0, 0, -1440, -34, -73, -407, -379, "negative fractional minutes"); +TemporalHelpers.assertDuration(resultMinutes, 0, 0, 0, 0, 0, -1440, -34, -73, -407, -380, "negative fractional minutes"); diff --git a/test/built-ins/Temporal/Duration/prototype/add/argument-string-negative-fractional-units.js b/test/built-ins/Temporal/Duration/prototype/add/argument-string-negative-fractional-units.js index 8c4b038a5d..e0e0e56b45 100644 --- a/test/built-ins/Temporal/Duration/prototype/add/argument-string-negative-fractional-units.js +++ b/test/built-ins/Temporal/Duration/prototype/add/argument-string-negative-fractional-units.js @@ -11,7 +11,7 @@ features: [Temporal] const instance = new Temporal.Duration(); const resultHours = instance.add("-PT24.567890123H"); -TemporalHelpers.assertDuration(resultHours, 0, 0, 0, 0, -24, -34, -4, -404, -442, -799, "negative fractional hours"); +TemporalHelpers.assertDuration(resultHours, 0, 0, 0, 0, -24, -34, -4, -404, -442, -800, "negative fractional hours"); const resultMinutes = instance.add("-PT1440.567890123M"); -TemporalHelpers.assertDuration(resultMinutes, 0, 0, 0, 0, 0, -1440, -34, -73, -407, -379, "negative fractional minutes"); +TemporalHelpers.assertDuration(resultMinutes, 0, 0, 0, 0, 0, -1440, -34, -73, -407, -380, "negative fractional minutes"); diff --git a/test/built-ins/Temporal/Duration/prototype/subtract/argument-string-negative-fractional-units.js b/test/built-ins/Temporal/Duration/prototype/subtract/argument-string-negative-fractional-units.js index 3c940f26d3..ed9359905a 100644 --- a/test/built-ins/Temporal/Duration/prototype/subtract/argument-string-negative-fractional-units.js +++ b/test/built-ins/Temporal/Duration/prototype/subtract/argument-string-negative-fractional-units.js @@ -11,7 +11,7 @@ features: [Temporal] const instance = new Temporal.Duration(); const resultHours = instance.subtract("-PT24.567890123H"); -TemporalHelpers.assertDuration(resultHours, 0, 0, 0, 0, 24, 34, 4, 404, 442, 799, "negative fractional hours"); +TemporalHelpers.assertDuration(resultHours, 0, 0, 0, 0, 24, 34, 4, 404, 442, 800, "negative fractional hours"); const resultMinutes = instance.subtract("-PT1440.567890123M"); -TemporalHelpers.assertDuration(resultMinutes, 0, 0, 0, 0, 0, 1440, 34, 73, 407, 379, "negative fractional minutes"); +TemporalHelpers.assertDuration(resultMinutes, 0, 0, 0, 0, 0, 1440, 34, 73, 407, 380, "negative fractional minutes"); diff --git a/test/built-ins/Temporal/Instant/prototype/add/argument-string-negative-fractional-units.js b/test/built-ins/Temporal/Instant/prototype/add/argument-string-negative-fractional-units.js index 9fee0fa701..fa7b07b164 100644 --- a/test/built-ins/Temporal/Instant/prototype/add/argument-string-negative-fractional-units.js +++ b/test/built-ins/Temporal/Instant/prototype/add/argument-string-negative-fractional-units.js @@ -10,7 +10,7 @@ features: [Temporal] const instance = new Temporal.Instant(1_000_000_000_000_000_000n); const resultHours = instance.add("-PT24.567890123H"); -assert.sameValue(resultHours.epochNanoseconds, 999_911_555_595_557_201n, "negative fractional hours"); +assert.sameValue(resultHours.epochNanoseconds, 999_911_555_595_557_200n, "negative fractional hours"); const resultMinutes = instance.add("-PT1440.567890123M"); -assert.sameValue(resultMinutes.epochNanoseconds, 999_913_565_926_592_621n, "negative fractional minutes"); +assert.sameValue(resultMinutes.epochNanoseconds, 999_913_565_926_592_620n, "negative fractional minutes"); diff --git a/test/built-ins/Temporal/Instant/prototype/subtract/argument-string-negative-fractional-units.js b/test/built-ins/Temporal/Instant/prototype/subtract/argument-string-negative-fractional-units.js index 4ae54767a6..4ccd9225e1 100644 --- a/test/built-ins/Temporal/Instant/prototype/subtract/argument-string-negative-fractional-units.js +++ b/test/built-ins/Temporal/Instant/prototype/subtract/argument-string-negative-fractional-units.js @@ -10,7 +10,7 @@ features: [Temporal] const instance = new Temporal.Instant(1_000_000_000_000_000_000n); const resultHours = instance.subtract("-PT24.567890123H"); -assert.sameValue(resultHours.epochNanoseconds, 1_000_088_444_404_442_799n, "negative fractional hours"); +assert.sameValue(resultHours.epochNanoseconds, 1_000_088_444_404_442_800n, "negative fractional hours"); const resultMinutes = instance.subtract("-PT1440.567890123M"); -assert.sameValue(resultMinutes.epochNanoseconds, 1_000_086_434_073_407_379n, "negative fractional minutes"); +assert.sameValue(resultMinutes.epochNanoseconds, 1_000_086_434_073_407_380n, "negative fractional minutes"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/add/argument-string-negative-fractional-units.js b/test/built-ins/Temporal/PlainDateTime/prototype/add/argument-string-negative-fractional-units.js index 093b91ecc1..4e62a03530 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/add/argument-string-negative-fractional-units.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/add/argument-string-negative-fractional-units.js @@ -11,7 +11,7 @@ features: [Temporal] const instance = new Temporal.PlainDateTime(2000, 5, 2); const resultHours = instance.add("-PT24.567890123H"); -TemporalHelpers.assertPlainDateTime(resultHours, 2000, 4, "M04", 30, 23, 25, 55, 595, 557, 201, "negative fractional hours"); +TemporalHelpers.assertPlainDateTime(resultHours, 2000, 4, "M04", 30, 23, 25, 55, 595, 557, 200, "negative fractional hours"); const resultMinutes = instance.add("-PT1440.567890123M"); -TemporalHelpers.assertPlainDateTime(resultMinutes, 2000, 4, "M04", 30, 23, 59, 25, 926, 592, 621, "negative fractional minutes"); +TemporalHelpers.assertPlainDateTime(resultMinutes, 2000, 4, "M04", 30, 23, 59, 25, 926, 592, 620, "negative fractional minutes"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/subtract/argument-string-negative-fractional-units.js b/test/built-ins/Temporal/PlainDateTime/prototype/subtract/argument-string-negative-fractional-units.js index 2add82f7df..24655cde84 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/subtract/argument-string-negative-fractional-units.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/subtract/argument-string-negative-fractional-units.js @@ -11,7 +11,7 @@ features: [Temporal] const instance = new Temporal.PlainDateTime(2000, 5, 2); const resultHours = instance.subtract("-PT24.567890123H"); -TemporalHelpers.assertPlainDateTime(resultHours, 2000, 5, "M05", 3, 0, 34, 4, 404, 442, 799, "negative fractional hours"); +TemporalHelpers.assertPlainDateTime(resultHours, 2000, 5, "M05", 3, 0, 34, 4, 404, 442, 800, "negative fractional hours"); const resultMinutes = instance.subtract("-PT1440.567890123M"); -TemporalHelpers.assertPlainDateTime(resultMinutes, 2000, 5, "M05", 3, 0, 0, 34, 73, 407, 379, "negative fractional minutes"); +TemporalHelpers.assertPlainDateTime(resultMinutes, 2000, 5, "M05", 3, 0, 0, 34, 73, 407, 380, "negative fractional minutes"); diff --git a/test/built-ins/Temporal/PlainTime/prototype/add/argument-string-negative-fractional-units.js b/test/built-ins/Temporal/PlainTime/prototype/add/argument-string-negative-fractional-units.js index 81a981bd6e..8fb1e03826 100644 --- a/test/built-ins/Temporal/PlainTime/prototype/add/argument-string-negative-fractional-units.js +++ b/test/built-ins/Temporal/PlainTime/prototype/add/argument-string-negative-fractional-units.js @@ -11,7 +11,7 @@ features: [Temporal] const instance = new Temporal.PlainTime(); const resultHours = instance.add("-PT24.567890123H"); -TemporalHelpers.assertPlainTime(resultHours, 23, 25, 55, 595, 557, 201, "negative fractional hours"); +TemporalHelpers.assertPlainTime(resultHours, 23, 25, 55, 595, 557, 200, "negative fractional hours"); const resultMinutes = instance.add("-PT1440.567890123M"); -TemporalHelpers.assertPlainTime(resultMinutes, 23, 59, 25, 926, 592, 621, "negative fractional minutes"); +TemporalHelpers.assertPlainTime(resultMinutes, 23, 59, 25, 926, 592, 620, "negative fractional minutes"); diff --git a/test/built-ins/Temporal/PlainTime/prototype/subtract/argument-string-negative-fractional-units.js b/test/built-ins/Temporal/PlainTime/prototype/subtract/argument-string-negative-fractional-units.js index 6ccef17a29..882df84bc9 100644 --- a/test/built-ins/Temporal/PlainTime/prototype/subtract/argument-string-negative-fractional-units.js +++ b/test/built-ins/Temporal/PlainTime/prototype/subtract/argument-string-negative-fractional-units.js @@ -11,7 +11,7 @@ features: [Temporal] const instance = new Temporal.PlainTime(); const resultHours = instance.subtract("-PT24.567890123H"); -TemporalHelpers.assertPlainTime(resultHours, 0, 34, 4, 404, 442, 799, "negative fractional hours"); +TemporalHelpers.assertPlainTime(resultHours, 0, 34, 4, 404, 442, 800, "negative fractional hours"); const resultMinutes = instance.subtract("-PT1440.567890123M"); -TemporalHelpers.assertPlainTime(resultMinutes, 0, 0, 34, 73, 407, 379, "negative fractional minutes"); +TemporalHelpers.assertPlainTime(resultMinutes, 0, 0, 34, 73, 407, 380, "negative fractional minutes"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/add/argument-string-negative-fractional-units.js b/test/built-ins/Temporal/ZonedDateTime/prototype/add/argument-string-negative-fractional-units.js index 0c62f3b949..fc2260bb13 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/add/argument-string-negative-fractional-units.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/add/argument-string-negative-fractional-units.js @@ -10,7 +10,7 @@ features: [Temporal] const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC"); const resultHours = instance.add("-PT24.567890123H"); -assert.sameValue(resultHours.epochNanoseconds, 999_911_555_595_557_201n, "negative fractional hours"); +assert.sameValue(resultHours.epochNanoseconds, 999_911_555_595_557_200n, "negative fractional hours"); const resultMinutes = instance.add("-PT1440.567890123M"); -assert.sameValue(resultMinutes.epochNanoseconds, 999_913_565_926_592_621n, "negative fractional minutes"); +assert.sameValue(resultMinutes.epochNanoseconds, 999_913_565_926_592_620n, "negative fractional minutes"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/subtract/argument-string-negative-fractional-units.js b/test/built-ins/Temporal/ZonedDateTime/prototype/subtract/argument-string-negative-fractional-units.js index 5ccf12840e..c3cd496674 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/subtract/argument-string-negative-fractional-units.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/subtract/argument-string-negative-fractional-units.js @@ -10,7 +10,7 @@ features: [Temporal] const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC"); const resultHours = instance.subtract("-PT24.567890123H"); -assert.sameValue(resultHours.epochNanoseconds, 1_000_088_444_404_442_799n, "negative fractional hours"); +assert.sameValue(resultHours.epochNanoseconds, 1_000_088_444_404_442_800n, "negative fractional hours"); const resultMinutes = instance.subtract("-PT1440.567890123M"); -assert.sameValue(resultMinutes.epochNanoseconds, 1_000_086_434_073_407_379n, "negative fractional minutes"); +assert.sameValue(resultMinutes.epochNanoseconds, 1_000_086_434_073_407_380n, "negative fractional minutes");