]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma/Date/15.9.1.1-2.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.1.1-2.js
24 ECMA Section: 15.9.1.1 Time Range
26 - leap seconds are ignored
27 - assume 86400000 ms / day
28 - numbers range fom +/- 9,007,199,254,740,991
29 - ms precision for any instant that is within
30 approximately +/-285,616 years from 1 jan 1970
32 - range of times supported is -100,000,000 days
33 to 100,000,000 days from 1 jan 1970 12:00 am
34 - time supported is 8.64e5*10e8 milliseconds from
35 1 jan 1970 UTC (+/-273972.6027397 years)
36 Author: christine@netscape.com
42 writeHeaderToLog("15.9.1.1 Time Range");
44 for ( M_SECS
= 0, CURRENT_YEAR
= 1970;
45 M_SECS
> -8640000000000000;
46 tc
++, M_SECS
-= FOUR_HUNDRED_YEARS
, CURRENT_YEAR
-= 400 ) {
48 testcases
[tc
] = new TestCase( SECTION
, "new Date("+M_SECS
+")", CURRENT_YEAR
, (new Date( M_SECS
)).getUTCFullYear() );
50 testcases
[tc
].passed
= writeTestCaseResult(
53 testcases
[tc
].description
+ " = " +
54 testcases
[tc
].actual
);
56 if ( ! testcases
[tc
].passed
) {
57 testcases
[tc
].reason
= "wrong year value";
65 // every one hundred years contains:
66 // 24 years with 366 days
68 // every four hundred years contains:
69 // 97 years with 366 days
70 // 303 years with 365 days
72 // 86400000*366*97 = 3067372800000
73 // +86400000*365*303 = + 9555408000000
76 var FOUR_HUNDRED_YEARS
= 1.26227808e+13;
77 var SECTION
= "15.9.1.1-2";
79 var testcases
= new Array();