Debian Codegraph @

js/src/tests/test262/built-ins/Date/S15.9.3.1_A6_T5.js

raw
1 // Copyright 2009 the Sputnik authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 info: |
6 The [[Value]] property of the newly constructed object
7 with supplied "undefined" argument should be NaN
8 esid: sec-date-year-month-date-hours-minutes-seconds-ms
9 description: 6 arguments, (year, month, date, hours, minutes, seconds)
10 ---*/
11
12 function DateValue(year, month, date, hours, minutes, seconds, ms) {
13 return new Date(year, month, date, hours, minutes, seconds, ms).valueOf();
14 }
15
16 var x;
17 x = DateValue(1899, 11, 31, 23, 59, 59);
18 assert.sameValue(x, NaN, 'The value of x is expected to equal NaN');
19
20 x = DateValue(1899, 12, 1, 0, 0, 0);
21 assert.sameValue(x, NaN, 'The value of x is expected to equal NaN');
22
23 x = DateValue(1900, 0, 1, 0, 0, 0);
24 assert.sameValue(x, NaN, 'The value of x is expected to equal NaN');
25
26 x = DateValue(1969, 11, 31, 23, 59, 59);
27 assert.sameValue(x, NaN, 'The value of x is expected to equal NaN');
28
29 x = DateValue(1969, 12, 1, 0, 0, 0);
30 assert.sameValue(x, NaN, 'The value of x is expected to equal NaN');
31
32 x = DateValue(1970, 0, 1, 0, 0, 0);
33 assert.sameValue(x, NaN, 'The value of x is expected to equal NaN');
34
35 x = DateValue(1999, 11, 31, 23, 59, 59);
36 assert.sameValue(x, NaN, 'The value of x is expected to equal NaN');
37
38 x = DateValue(1999, 12, 1, 0, 0, 0);
39 assert.sameValue(x, NaN, 'The value of x is expected to equal NaN');
40
41 x = DateValue(2000, 0, 1, 0, 0, 0);
42 assert.sameValue(x, NaN, 'The value of x is expected to equal NaN');
43
44 x = DateValue(2099, 11, 31, 23, 59, 59);
45 assert.sameValue(x, NaN, 'The value of x is expected to equal NaN');
46
47 x = DateValue(2099, 12, 1, 0, 0, 0);
48 assert.sameValue(x, NaN, 'The value of x is expected to equal NaN');
49
50 x = DateValue(2100, 0, 1, 0, 0, 0);
51 assert.sameValue(x, NaN, 'The value of x is expected to equal NaN');
52
53 reportCompare(0, 0);