1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is JavaScript Engine testing utilities.
17 * The Initial Developer of the Original Code is
19 * Portions created by the Initial Developer are Copyright (C) 2007
20 * the Initial Developer. All Rights Reserved.
22 * Contributor(s): nanto_vi (TOYAMA Nao)
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
38 //-----------------------------------------------------------------------------
39 var BUGNUMBER = 363578;
40 var summary = '15.9.4.3 - Date.UTC edge-case arguments.';
45 //-----------------------------------------------------------------------------
47 //-----------------------------------------------------------------------------
52 printBugNumber(BUGNUMBER);
53 printStatus (summary);
58 actual = (new Date(Date.UTC(2006, 0, 0)).getUTCDate());
59 reportCompare(expect, actual, summary + ': date 0');
62 actual = (new Date(Date.UTC(2006, 0, 0, 0)).getUTCHours());
63 reportCompare(expect, actual, summary + ': hours 0');
66 actual = (new Date(Date.UTC(2006, 0, 0, 0, 0)).getUTCMinutes());
67 reportCompare(expect, actual, summary + ': minutes 0');
70 actual = (new Date(Date.UTC(2006, 0, 0, 0, 0, 0)).getUTCSeconds());
71 reportCompare(expect, actual, summary + ': seconds 0');
74 actual = (new Date(Date.UTC(2006, 0, 0, 0, 0, 0, 0)).getUTCMilliseconds());
75 reportCompare(expect, actual, summary + ': milliseconds 0');
80 actual = (new Date(Date.UTC(2006, 0, -1)).getUTCDate());
81 reportCompare(expect, actual, summary + ': date -1');
84 actual = (new Date(Date.UTC(2006, 0, 0, -1)).getUTCHours());
85 reportCompare(expect, actual, summary + ': hours -1');
88 actual = (new Date(Date.UTC(2006, 0, 0, 0, -1)).getUTCMinutes());
89 reportCompare(expect, actual, summary + ': minutes -1');
92 actual = (new Date(Date.UTC(2006, 0, 0, 0, 0, -1)).getUTCSeconds());
93 reportCompare(expect, actual, summary + ': seconds -1');
96 actual = (new Date(Date.UTC(2006, 0, 0, 0, 0, 0, -1)).getUTCMilliseconds());
97 reportCompare(expect, actual, summary + ': milliseconds -1');
102 actual = isNaN(new Date(Date.UTC(2006, 0, undefined)).getUTCDate());
103 reportCompare(expect, actual, summary + ': date undefined');
106 actual = isNaN(new Date(Date.UTC(2006, 0, 0, undefined)).getUTCHours());
107 reportCompare(expect, actual, summary + ': hours undefined');
110 actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, undefined)).getUTCMinutes());
111 reportCompare(expect, actual, summary + ': minutes undefined');
114 actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, 0, undefined)).getUTCSeconds());
115 reportCompare(expect, actual, summary + ': seconds undefined');
118 actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, 0, 0, undefined)).getUTCMilliseconds());
119 reportCompare(expect, actual, summary + ': milliseconds undefined');
124 actual = isNaN(new Date(Date.UTC(2006, 0, {})).getUTCDate());
125 reportCompare(expect, actual, summary + ': date {}');
128 actual = isNaN(new Date(Date.UTC(2006, 0, 0, {})).getUTCHours());
129 reportCompare(expect, actual, summary + ': hours {}');
132 actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, {})).getUTCMinutes());
133 reportCompare(expect, actual, summary + ': minutes {}');
136 actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, 0, {})).getUTCSeconds());
137 reportCompare(expect, actual, summary + ': seconds {}');
140 actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, 0, 0, {})).getUTCMilliseconds());
141 reportCompare(expect, actual, summary + ': milliseconds {}');
146 actual = (new Date(Date.UTC(2006, 0, null)).getUTCDate());
147 reportCompare(expect, actual, summary + ': date null');
150 actual = (new Date(Date.UTC(2006, 0, 0, null)).getUTCHours());
151 reportCompare(expect, actual, summary + ': hours null');
154 actual = (new Date(Date.UTC(2006, 0, 0, 0, null)).getUTCMinutes());
155 reportCompare(expect, actual, summary + ': minutes null');
158 actual = (new Date(Date.UTC(2006, 0, 0, 0, 0, null)).getUTCSeconds());
159 reportCompare(expect, actual, summary + ': seconds null');
162 actual = (new Date(Date.UTC(2006, 0, 0, 0, 0, 0, null)).getUTCMilliseconds());
163 reportCompare(expect, actual, summary + ': milliseconds null');
168 actual = isNaN(new Date(Date.UTC(2006, 0, Infinity)).getUTCDate());
169 reportCompare(expect, actual, summary + ': date Infinity');
172 actual = isNaN(new Date(Date.UTC(2006, 0, 0, Infinity)).getUTCHours());
173 reportCompare(expect, actual, summary + ': hours Infinity');
176 actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, Infinity)).getUTCMinutes());
177 reportCompare(expect, actual, summary + ': minutes Infinity');
180 actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, 0, Infinity)).getUTCSeconds());
181 reportCompare(expect, actual, summary + ': seconds Infinity');
184 actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, 0, 0, Infinity)).getUTCMilliseconds());
185 reportCompare(expect, actual, summary + ': milliseconds Infinity');
190 actual = isNaN(new Date(Date.UTC(2006, 0, -Infinity)).getUTCDate());
191 reportCompare(expect, actual, summary + ': date -Infinity');
194 actual = isNaN(new Date(Date.UTC(2006, 0, 0, -Infinity)).getUTCHours());
195 reportCompare(expect, actual, summary + ': hours -Infinity');
198 actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, -Infinity)).getUTCMinutes());
199 reportCompare(expect, actual, summary + ': minutes -Infinity');
202 actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, 0, -Infinity)).getUTCSeconds());
203 reportCompare(expect, actual, summary + ': seconds -Infinity');
206 actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, 0, 0, -Infinity)).getUTCMilliseconds());
207 reportCompare(expect, actual, summary + ': milliseconds -Infinity');
212 actual = isNaN(new Date(Date.UTC(2006, 0, NaN)).getUTCDate());
213 reportCompare(expect, actual, summary + ': date NaN');
216 actual = isNaN(new Date(Date.UTC(2006, 0, 0, NaN)).getUTCHours());
217 reportCompare(expect, actual, summary + ': hours NaN');
220 actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, NaN)).getUTCMinutes());
221 reportCompare(expect, actual, summary + ': minutes NaN');
224 actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, 0, NaN)).getUTCSeconds());
225 reportCompare(expect, actual, summary + ': seconds NaN');
228 actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, 0, 0, NaN)).getUTCMilliseconds());
229 reportCompare(expect, actual, summary + ': milliseconds NaN');