Debian Codegraph @

js/src/tests/test262/intl402/Temporal/ZonedDateTime/compare/exhaustive.js

raw
1 // |reftest| shell-option(--enable-temporal) skip-if(!this.hasOwnProperty('Temporal')||!xulRuntime.shell) -- Temporal is not enabled unconditionally, requires shell-options
2 // Copyright (C) 2023 Igalia, S.L. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4
5 /*---
6 esid: sec-temporal.zoneddatetime.compare
7 description: Tests for compare() with each possible outcome
8 features: [Temporal]
9 ---*/
10
11 const tz1 = "UTC";
12 const tz2 = "-00:30";
13 const cal1 = "iso8601";
14 const cal2 = "gregory";
15
16 assert.sameValue(
17 Temporal.ZonedDateTime.compare(new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, tz1, cal1), new Temporal.ZonedDateTime(500_000_000_000_000_000n, tz2, cal2)),
18 1,
19 ">"
20 );
21 assert.sameValue(
22 Temporal.ZonedDateTime.compare(new Temporal.ZonedDateTime(-1000n, tz1, cal1), new Temporal.ZonedDateTime(1000n, tz2, cal2)),
23 -1,
24 "<"
25 );
26 assert.sameValue(
27 Temporal.ZonedDateTime.compare(new Temporal.ZonedDateTime(123_456_789n, tz1, cal1), new Temporal.ZonedDateTime(123_456_789n, tz2, cal2)),
28 0,
29 "="
30 );
31
32 reportCompare(0, 0);