1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
|
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//-----------------------------------------------------------------------------
var BUGNUMBER = 363578;
var summary = '15.9.4.3 - Date.UTC edge-case arguments.';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
//
expect = 31;
actual = (new Date(Date.UTC(2006, 0, 0)).getUTCDate());
reportCompare(expect, actual, summary + ': date 0');
expect = 0;
actual = (new Date(Date.UTC(2006, 0, 0, 0)).getUTCHours());
reportCompare(expect, actual, summary + ': hours 0');
expect = 0;
actual = (new Date(Date.UTC(2006, 0, 0, 0, 0)).getUTCMinutes());
reportCompare(expect, actual, summary + ': minutes 0');
expect = 0;
actual = (new Date(Date.UTC(2006, 0, 0, 0, 0, 0)).getUTCSeconds());
reportCompare(expect, actual, summary + ': seconds 0');
expect = 0;
actual = (new Date(Date.UTC(2006, 0, 0, 0, 0, 0, 0)).getUTCMilliseconds());
reportCompare(expect, actual, summary + ': milliseconds 0');
//
expect = 30;
actual = (new Date(Date.UTC(2006, 0, -1)).getUTCDate());
reportCompare(expect, actual, summary + ': date -1');
expect = 23;
actual = (new Date(Date.UTC(2006, 0, 0, -1)).getUTCHours());
reportCompare(expect, actual, summary + ': hours -1');
expect = 59;
actual = (new Date(Date.UTC(2006, 0, 0, 0, -1)).getUTCMinutes());
reportCompare(expect, actual, summary + ': minutes -1');
expect = 59;
actual = (new Date(Date.UTC(2006, 0, 0, 0, 0, -1)).getUTCSeconds());
reportCompare(expect, actual, summary + ': seconds -1');
expect = 999;
actual = (new Date(Date.UTC(2006, 0, 0, 0, 0, 0, -1)).getUTCMilliseconds());
reportCompare(expect, actual, summary + ': milliseconds -1');
//
expect = true;
actual = isNaN(new Date(Date.UTC(2006, 0, undefined)).getUTCDate());
reportCompare(expect, actual, summary + ': date undefined');
expect = true;
actual = isNaN(new Date(Date.UTC(2006, 0, 0, undefined)).getUTCHours());
reportCompare(expect, actual, summary + ': hours undefined');
expect = true;
actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, undefined)).getUTCMinutes());
reportCompare(expect, actual, summary + ': minutes undefined');
expect = true;
actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, 0, undefined)).getUTCSeconds());
reportCompare(expect, actual, summary + ': seconds undefined');
expect = true;
actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, 0, 0, undefined)).getUTCMilliseconds());
reportCompare(expect, actual, summary + ': milliseconds undefined');
//
expect = true;
actual = isNaN(new Date(Date.UTC(2006, 0, {})).getUTCDate());
reportCompare(expect, actual, summary + ': date {}');
expect = true;
actual = isNaN(new Date(Date.UTC(2006, 0, 0, {})).getUTCHours());
reportCompare(expect, actual, summary + ': hours {}');
expect = true;
actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, {})).getUTCMinutes());
reportCompare(expect, actual, summary + ': minutes {}');
expect = true;
actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, 0, {})).getUTCSeconds());
reportCompare(expect, actual, summary + ': seconds {}');
expect = true;
actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, 0, 0, {})).getUTCMilliseconds());
reportCompare(expect, actual, summary + ': milliseconds {}');
//
expect = 31;
actual = (new Date(Date.UTC(2006, 0, null)).getUTCDate());
reportCompare(expect, actual, summary + ': date null');
expect = 0;
actual = (new Date(Date.UTC(2006, 0, 0, null)).getUTCHours());
reportCompare(expect, actual, summary + ': hours null');
expect = 0;
actual = (new Date(Date.UTC(2006, 0, 0, 0, null)).getUTCMinutes());
reportCompare(expect, actual, summary + ': minutes null');
expect = 0;
actual = (new Date(Date.UTC(2006, 0, 0, 0, 0, null)).getUTCSeconds());
reportCompare(expect, actual, summary + ': seconds null');
expect = 0;
actual = (new Date(Date.UTC(2006, 0, 0, 0, 0, 0, null)).getUTCMilliseconds());
reportCompare(expect, actual, summary + ': milliseconds null');
//
expect = true;
actual = isNaN(new Date(Date.UTC(2006, 0, Infinity)).getUTCDate());
reportCompare(expect, actual, summary + ': date Infinity');
expect = true;
actual = isNaN(new Date(Date.UTC(2006, 0, 0, Infinity)).getUTCHours());
reportCompare(expect, actual, summary + ': hours Infinity');
expect = true;
actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, Infinity)).getUTCMinutes());
reportCompare(expect, actual, summary + ': minutes Infinity');
expect = true;
actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, 0, Infinity)).getUTCSeconds());
reportCompare(expect, actual, summary + ': seconds Infinity');
expect = true;
actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, 0, 0, Infinity)).getUTCMilliseconds());
reportCompare(expect, actual, summary + ': milliseconds Infinity');
//
expect = true;
actual = isNaN(new Date(Date.UTC(2006, 0, -Infinity)).getUTCDate());
reportCompare(expect, actual, summary + ': date -Infinity');
expect = true;
actual = isNaN(new Date(Date.UTC(2006, 0, 0, -Infinity)).getUTCHours());
reportCompare(expect, actual, summary + ': hours -Infinity');
expect = true;
actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, -Infinity)).getUTCMinutes());
reportCompare(expect, actual, summary + ': minutes -Infinity');
expect = true;
actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, 0, -Infinity)).getUTCSeconds());
reportCompare(expect, actual, summary + ': seconds -Infinity');
expect = true;
actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, 0, 0, -Infinity)).getUTCMilliseconds());
reportCompare(expect, actual, summary + ': milliseconds -Infinity');
//
expect = true;
actual = isNaN(new Date(Date.UTC(2006, 0, NaN)).getUTCDate());
reportCompare(expect, actual, summary + ': date NaN');
expect = true;
actual = isNaN(new Date(Date.UTC(2006, 0, 0, NaN)).getUTCHours());
reportCompare(expect, actual, summary + ': hours NaN');
expect = true;
actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, NaN)).getUTCMinutes());
reportCompare(expect, actual, summary + ': minutes NaN');
expect = true;
actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, 0, NaN)).getUTCSeconds());
reportCompare(expect, actual, summary + ': seconds NaN');
expect = true;
actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, 0, 0, NaN)).getUTCMilliseconds());
reportCompare(expect, actual, summary + ': milliseconds NaN');
exitFunc ('test');
}
|