]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - tests/mozilla/ecma/Date/15.9.2.2-4.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / mozilla / ecma / Date / 15.9.2.2-4.js
index b63bb3e960c2d2aefde55ae5c660b86ca732735d..e8dabadfc2f38902855cd069ea99db7d952ba054 100644 (file)
@@ -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() {