]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma/Date/15.9.1.1-1.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-1.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)
37 - this test generates its own data -- it does not
38 read data from a file.
39 Author: christine@netscape.com
48 writeHeaderToLog("15.8.1.1 Time Range");
50 for ( M_SECS
= 0, CURRENT_YEAR
= 1970;
51 M_SECS
< 8640000000000000;
52 tc
++, M_SECS
+= FOUR_HUNDRED_YEARS
, CURRENT_YEAR
+= 400 ) {
54 testcases
[tc
] = new TestCase( SECTION
, "new Date("+M_SECS
+")", CURRENT_YEAR
, (new Date( M_SECS
)).getUTCFullYear() );
56 testcases
[tc
].passed
= writeTestCaseResult(
59 testcases
[tc
].description
+" = "+
60 testcases
[tc
].actual
);
62 if ( ! testcases
[tc
].passed
) {
63 testcases
[tc
].reason
= "wrong year value";
72 // every one hundred years contains:
73 // 24 years with 366 days
75 // every four hundred years contains:
76 // 97 years with 366 days
77 // 303 years with 365 days
79 // 86400000*365*97 = 3067372800000
80 // +86400000*366*303 = + 9555408000000
82 var FOUR_HUNDRED_YEARS
= 1.26227808e+13;
83 var SECTION
= "15.9.1.1-1";
85 var testcases
= new Array();