Debian Codegraph @

js/src/tests/test262/built-ins/Date/UTC/infinity-make-day.js

raw
1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 esid: sec-date.utc
5 description: Infinite values specified to MakeDay produce NaN
6 info: |
7 [...]
8 9. Return TimeClip(MakeDate(MakeDay(yr, m, dt), MakeTime(h, min, s, milli))).
9
10 MakeDay (year, month, date)
11
12 1. If year is not finite or month is not finite or date is not finite, return
13 NaN.
14 ---*/
15
16 assert.sameValue(Date.UTC(Infinity), NaN, 'year: Infinity - single arg');
17 assert.sameValue(Date.UTC(-Infinity), NaN, 'year: -Infinity - single arg');
18
19 assert.sameValue(Date.UTC(Infinity, 0), NaN, 'year: Infinity');
20 assert.sameValue(Date.UTC(-Infinity, 0), NaN, 'year: -Infinity');
21
22 assert.sameValue(Date.UTC(0, Infinity), NaN, 'month: Infinity');
23 assert.sameValue(Date.UTC(0, -Infinity), NaN, 'month: -Infinity');
24
25 assert.sameValue(Date.UTC(0, 0, Infinity), NaN, 'date: Infinity');
26 assert.sameValue(Date.UTC(0, 0, -Infinity), NaN, 'date: -Infinity');
27
28
29 reportCompare(0, 0);