Debian Codegraph @

rhino/testsrc/tests/ecma/Date/15.9.2.2-2.js

raw symbols SCIP
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 gTestfile = '15.9.2.2-2.js';
7
8 /**
9 File Name: 15.9.2.2.js
10 ECMA Section: 15.9.2.2 Date constructor used as a function
11 Date( year, month, date, hours, minutes, seconds )
12 Description: The arguments are accepted, but are completely ignored.
13 A string is created and returned as if by the
14 expression (new Date()).toString().
15
16 Author: [email protected]
17 Date: 28 october 1997
18 Version: 9706
19
20 */
21 var VERSION = 9706;
22 startTest();
23 var SECTION = "15.9.2.2";
24 var TOLERANCE = 100;
25 var TITLE = "The Date Constructor Called as a Function";
26
27 writeHeaderToLog(SECTION+" "+TITLE );
28
29 // allow up to 1 second difference due to possibility
30 // the date may change by 1 second in between calls to Date
31
32 var d1;
33 var d2;
34
35 // Dates around 2000
36 d1 = new Date();
37 d2 = Date.parse(Date(1999,11,15,59,59));
38 new TestCase( SECTION, "Date(1999,11,15,59,59)", true, d2 - d1 <= 1000);
39
40 d1 = new Date();
41 d2 = Date.parse(Date(1999,11,16,0,0,0));
42 new TestCase( SECTION, "Date(1999,11,16,0,0,0)", true, d2 - d1 <= 1000);
43
44 d1 = new Date();
45 d2 = Date.parse(Date(1999,11,31,23,59,59));
46 new TestCase( SECTION, "Date(1999,11,31,23,59,59)", true, d2 - d1 <= 1000);
47
48 d1 = new Date();
49 d2 = Date.parse(Date(2000,0,0,0,0,0));
50 new TestCase( SECTION, "Date(2000,0,1,0,0,0)", true, d2 - d1 <= 1000);
51
52 d1 = new Date();
53 d2 = Date.parse(Date(2000,0,0,0,0,1));
54 new TestCase( SECTION, "Date(2000,0,1,0,0,1)", true, d2 - d1 <= 1000)
55
56 test();