X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/2d39b0e377c0896910ee49ae70082ba665faf986..ed1e77d3adeb83d26fd1dfb16dd84cabdcefd250:/tests/mozilla/ecma/Date/15.9.2.2-4.js diff --git a/tests/mozilla/ecma/Date/15.9.2.2-4.js b/tests/mozilla/ecma/Date/15.9.2.2-4.js index b63bb3e..e8dabad 100644 --- a/tests/mozilla/ecma/Date/15.9.2.2-4.js +++ b/tests/mozilla/ecma/Date/15.9.2.2-4.js @@ -35,7 +35,6 @@ var VERSION = 9706; startTest(); var SECTION = "15.9.2.2"; - var TOLERANCE = 100; var TITLE = "The Date Constructor Called as a Function"; writeHeaderToLog(SECTION+" "+TITLE ); @@ -49,25 +48,26 @@ function getTestCases() { var array = new Array(); var item = 0; + // allow up to 1 second difference due to possibility + // the date may change by 1 second in between calls to Date + + var d1; + var d2; + // Dates around feb 29, 2000 - array[item++] = new TestCase( SECTION, "Date( 2000,1,29,0,0,0)", (new Date()).toString(), Date(2000,1,29,0,0,0)); - array[item++] = new TestCase( SECTION, "Date( 2000,1,28,23,59,59)", (new Date()).toString(), Date( 2000,1,28,23,59,59)); - array[item++] = new TestCase( SECTION, "Date( 2000,1,27,16,0,0)", (new Date()).toString(), Date(2000,1,27,16,0,0)); + d1 = new Date(); + d2 = Date.parse(Date(2000,1,29,0,0,0)); + array[item++] = new TestCase(SECTION, "Date(2000,1,29,0,0,0)", true, d2 - d1 <= 1000); -/* - // Dates around jan 1, 2005 - array[item++] = new TestCase( SECTION, "Date(2004,11,31,23,59,59)", (new Date()).toString(), Date(2004,11,31,23,59,59)); - array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,0)", (new Date()).toString(), Date(2005,0,1,0,0,0) ); - array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,1)", (new Date()).toString(), Date(2005,0,1,0,0,1) ); - array[item++] = new TestCase( SECTION, "Date(2004,11,31,16,0,0,0)", (new Date()).toString(), Date(2004,11,31,16,0,0,0)); + d1 = new Date(); + d2 = Date.parse(Date(2000,1,28,23,59,59)); + array[item++] = new TestCase(SECTION, "Date(2000,1,28,23,59,59)", true, d2 - d1 <= 1000); + + d1 = new Date(); + d2 = Date.parse(Date(2000,1,27,16,0,0)); + array[item++] = new TestCase(SECTION, "Date(2000,1,27,16,0,0)", true, d2 - d1 <= 1000); - // Dates around jan 1, 2032 - array[item++] = new TestCase( SECTION, "Date(2031,11,31,23,59,59)", (new Date()).toString(), Date(2031,11,31,23,59,59)); - array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,0)", (new Date()).toString(), Date(2032,0,1,0,0,0) ); - array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,1)", (new Date()).toString(), Date(2032,0,1,0,0,1) ); - array[item++] = new TestCase( SECTION, "Date(2031,11,31,16,0,0,0)", (new Date()).toString(), Date(2031,11,31,16,0,0,0)); -*/ return ( array ); } function test() {