]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma/Date/15.9.2.2-3.js
1 /* The contents of this file are subject to the Netscape Public
2 * License Version 1.1 (the "License"); you may not use this file
3 * except in compliance with the License. You may obtain a copy of
4 * the License at http://www.mozilla.org/NPL/
6 * Software distributed under the License is distributed on an "AS
7 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
8 * implied. See the License for the specific language governing
9 * rights and limitations under the License.
11 * The Original Code is Mozilla Communicator client code, released March
14 * The Initial Developer of the Original Code is Netscape Communications
15 * Corporation. Portions created by Netscape are
16 * Copyright (C) 1998 Netscape Communications Corporation. All
23 File Name: 15.9.2.2.js
24 ECMA Section: 15.9.2.2 Date constructor used as a function
25 Date( year, month, date, hours, minutes, seconds )
26 Description: The arguments are accepted, but are completely ignored.
27 A string is created and returned as if by the
28 expression (new Date()).toString().
30 Author: christine@netscape.com
37 var SECTION
= "15.9.2.2";
38 var TITLE
= "The Date Constructor Called as a Function";
40 writeHeaderToLog(SECTION
+" "+TITLE
);
42 var testcases
= getTestCases();
44 // all tests must call a function that returns an array of TestCase objects.
47 function getTestCases() {
48 var array
= new Array();
51 // allow up to 1 second difference due to possibility
52 // the date may change by 1 second in between calls to Date
60 d2
= Date
.parse(Date(1899,11,31,23,59,59));
61 array
[item
++] = new TestCase( SECTION
, "Date(1899,11,31,23,59,59)", true, d2
- d1
<= 1000);
64 d2
= Date
.parse(Date(1900,0,1,0,0,0));
65 array
[item
++] = new TestCase( SECTION
, "Date(1900,0,1,0,0,0)", true, d2
- d1
<= 1000);
68 d2
= Date
.parse(Date(1900,0,1,0,0,1) );
69 array
[item
++] = new TestCase( SECTION
, "Date(1900,0,1,0,0,1)", true, d2
- d1
<= 1000);
72 d2
= Date
.parse(Date(1899,11,31,16,0,0,0));
73 array
[item
++] = new TestCase( SECTION
, "Date(1899,11,31,16,0,0,0)", true, d2
- d1
<= 1000);
78 for ( tc
=0; tc
< testcases
.length
; tc
++ ) {
79 testcases
[tc
].passed
= writeTestCaseResult(
82 testcases
[tc
].description
+" = "+
83 testcases
[tc
].actual
);
85 testcases
[tc
].reason
+= ( testcases
[tc
].passed
) ? "" : "wrong value ";