js/src/tests/ecma/Date/15.9.2.2-6.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/ecma/Date/15.9.2.2-6.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,51 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +
    1.10 +/**
    1.11 +   File Name:          15.9.2.2.js
    1.12 +   ECMA Section:       15.9.2.2 Date constructor used as a function
    1.13 +   Date( year, month, date, hours, minutes, seconds )
    1.14 +   Description:        The arguments are accepted, but are completely ignored.
    1.15 +   A string is created and returned as if by the
    1.16 +   expression (new Date()).toString().
    1.17 +
    1.18 +   Author:             christine@netscape.com
    1.19 +   Date:               28 october 1997
    1.20 +   Version:            9706
    1.21 +
    1.22 +*/
    1.23 +var VERSION = 9706;
    1.24 +startTest();
    1.25 +var SECTION = "15.9.2.2";
    1.26 +var TOLERANCE = 100;
    1.27 +var TITLE = "The Date Constructor Called as a Function";
    1.28 +
    1.29 +writeHeaderToLog(SECTION+" "+TITLE );
    1.30 +
    1.31 +// allow up to 1 second difference due to possibility
    1.32 +// the date may change by 1 second in between calls to Date
    1.33 +
    1.34 +var d1;
    1.35 +var d2;
    1.36 +
    1.37 +// Dates around jan 1, 2032
    1.38 +d1 = new Date();
    1.39 +d2 = Date.parse(Date(2031,11,31,23,59,59));
    1.40 +new TestCase(SECTION, "Date(2031,11,31,23,59,59)", true, d2 - d1 <= 1000);
    1.41 +
    1.42 +d1 = new Date();
    1.43 +d2 = Date.parse(Date(2032,0,1,0,0,0));
    1.44 +new TestCase(SECTION, "Date(2032,0,1,0,0,0)", true, d2 - d1 <= 1000);
    1.45 +
    1.46 +d1 = new Date();
    1.47 +d2 = Date.parse(Date(2032,0,1,0,0,1));
    1.48 +new TestCase(SECTION, "Date(2032,0,1,0,0,1)", true, d2 - d1 <= 1000);
    1.49 +
    1.50 +d1 = new Date();
    1.51 +d2 = Date.parse(Date(2031,11,31,16,0,0,0));
    1.52 +new TestCase(SECTION, "Date(2031,11,31,16,0,0,0)", true, d2 - d1 <= 1000);
    1.53 +
    1.54 +test();

mercurial