summaryrefslogtreecommitdiffstats
path: root/JavaScriptCore/tests/mozilla/ecma/Date
diff options
context:
space:
mode:
Diffstat (limited to 'JavaScriptCore/tests/mozilla/ecma/Date')
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.1.1-1.js87
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.1.1-2.js82
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.1.js108
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-1.js105
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-2.js99
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-3.js92
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-4.js85
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-5.js78
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-6.js72
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-1.js274
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-2.js231
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-3.js209
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-4.js193
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-5.js170
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-1.js241
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-2.js219
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-3.js205
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-4.js188
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-5.js170
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-1.js300
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-2.js275
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-3.js253
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-4.js222
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-5.js190
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.4.2-1.js63
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.4.2.js213
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.4.3.js209
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.1.js59
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-1.js111
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-10.js102
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-11.js101
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-12.js100
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-13.js97
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-2.js110
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-3.js109
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-4.js107
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-5.js107
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-6.js106
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-7.js105
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-8.js104
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-9.js103
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-1.js99
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-2.js96
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-3.js95
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-4.js95
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-5.js95
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-6.js96
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-7.js98
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-1.js105
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-2.js104
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-3.js103
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-4.js102
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-5.js101
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-6.js100
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-7.js98
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-8.js95
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-1.js78
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-2.js75
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-3.js75
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-4.js75
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-5.js75
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-6.js78
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-7.js80
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-8.js95
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.14.js96
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.15.js97
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.16.js96
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.17.js97
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.18.js97
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.19.js97
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.2-1.js152
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.2-2-n.js77
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.2.js152
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.20.js97
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-1.js97
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-2.js95
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-3.js78
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-4.js78
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-5.js78
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-6.js79
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-7.js78
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-8.js86
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-1.js100
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-2.js99
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-3.js98
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-4.js97
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-5.js96
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-6.js95
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-7.js93
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-8.js90
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-1.js157
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-10.js156
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-11.js155
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-12.js153
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-13.js150
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-14.js148
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-15.js144
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-16.js143
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-17.js142
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-18.js139
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-2.js111
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-3-n.js70
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-4.js122
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-5.js122
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-6.js122
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-7.js122
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-8.js111
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-9.js112
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-1.js151
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-2.js150
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-3.js149
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-4.js148
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-5.js141
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-6.js140
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-7.js139
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-8.js135
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.25-1.js190
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.26-1.js203
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.27-1.js202
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.28-1.js216
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.29-1.js210
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.3-1-n.js73
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.3-2.js107
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.30-1.js215
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.31-1.js212
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.32-1.js157
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.33-1.js156
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.34-1.js220
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.35-1.js143
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-1.js245
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-2.js231
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-3.js218
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-4.js205
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-5.js192
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-6.js179
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-7.js164
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-1.js235
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-2.js209
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-3.js195
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-4.js177
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-5.js160
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.4-1.js96
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.4-2-n.js67
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.5.js123
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.6.js114
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.7.js114
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.8.js120
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.9.js120
-rw-r--r--JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.js81
149 files changed, 19743 insertions, 0 deletions
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.1.1-1.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.1.1-1.js
new file mode 100644
index 0000000..4d936af
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.1.1-1.js
@@ -0,0 +1,87 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.1.1-1.js
+ ECMA Section: 15.9.1.1 Time Range
+ Description:
+ - leap seconds are ignored
+ - assume 86400000 ms / day
+ - numbers range fom +/- 9,007,199,254,740,991
+ - ms precision for any instant that is within
+ approximately +/-285,616 years from 1 jan 1970
+ UTC
+ - range of times supported is -100,000,000 days
+ to 100,000,000 days from 1 jan 1970 12:00 am
+ - time supported is 8.64e5*10e8 milliseconds from
+ 1 jan 1970 UTC (+/-273972.6027397 years)
+
+ - this test generates its own data -- it does not
+ read data from a file.
+ Author: christine@netscape.com
+ Date: 7 july 1997
+
+ Static variables:
+ FOUR_HUNDRED_YEARS
+
+*/
+
+function test() {
+ writeHeaderToLog("15.8.1.1 Time Range");
+
+ for ( M_SECS = 0, CURRENT_YEAR = 1970;
+ M_SECS < 8640000000000000;
+ tc++, M_SECS += FOUR_HUNDRED_YEARS, CURRENT_YEAR += 400 ) {
+
+ testcases[tc] = new TestCase( SECTION, "new Date("+M_SECS+")", CURRENT_YEAR, (new Date( M_SECS)).getUTCFullYear() );
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ if ( ! testcases[tc].passed ) {
+ testcases[tc].reason = "wrong year value";
+ }
+ }
+
+ stopTest();
+
+ return ( testcases );
+}
+
+// every one hundred years contains:
+// 24 years with 366 days
+//
+// every four hundred years contains:
+// 97 years with 366 days
+// 303 years with 365 days
+//
+// 86400000*365*97 = 3067372800000
+// +86400000*366*303 = + 9555408000000
+// = 1.26227808e+13
+ var FOUR_HUNDRED_YEARS = 1.26227808e+13;
+ var SECTION = "15.9.1.1-1";
+ var tc = 0;
+ var testcases = new Array();
+
+ test();
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.1.1-2.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.1.1-2.js
new file mode 100644
index 0000000..c66ce38
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.1.1-2.js
@@ -0,0 +1,82 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.1.1-2.js
+ ECMA Section: 15.9.1.1 Time Range
+ Description:
+ - leap seconds are ignored
+ - assume 86400000 ms / day
+ - numbers range fom +/- 9,007,199,254,740,991
+ - ms precision for any instant that is within
+ approximately +/-285,616 years from 1 jan 1970
+ UTC
+ - range of times supported is -100,000,000 days
+ to 100,000,000 days from 1 jan 1970 12:00 am
+ - time supported is 8.64e5*10e8 milliseconds from
+ 1 jan 1970 UTC (+/-273972.6027397 years)
+ Author: christine@netscape.com
+ Date: 9 july 1997
+*/
+
+function test() {
+
+ writeHeaderToLog("15.8.1.1 Time Range");
+
+ for ( M_SECS = 0, CURRENT_YEAR = 1970;
+ M_SECS > -8640000000000000;
+ tc++, M_SECS -= FOUR_HUNDRED_YEARS, CURRENT_YEAR -= 400 ) {
+
+ testcases[tc] = new TestCase( SECTION, "new Date("+M_SECS+")", CURRENT_YEAR, (new Date( M_SECS )).getUTCFullYear() );
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description + " = " +
+ testcases[tc].actual );
+
+ if ( ! testcases[tc].passed ) {
+ testcases[tc].reason = "wrong year value";
+ }
+ }
+
+ stopTest();
+
+ return ( testcases );
+}
+ // every one hundred years contains:
+ // 24 years with 366 days
+ //
+ // every four hundred years contains:
+ // 97 years with 366 days
+ // 303 years with 365 days
+ //
+ // 86400000*366*97 = 3067372800000
+ // +86400000*365*303 = + 9555408000000
+ // = 1.26227808e+13
+
+ var FOUR_HUNDRED_YEARS = 1.26227808e+13;
+ var SECTION = "15.9.1.1-2";
+ var tc = 0;
+ var testcases = new Array();
+
+ test();
+
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.1.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.1.js
new file mode 100644
index 0000000..3545806
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.1.js
@@ -0,0 +1,108 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.2.1.js
+ ECMA Section: 15.9.2.1 Date constructor used as a function
+ Date( year, month, date, hours, minutes, seconds, ms )
+ Description: The arguments are accepted, but are completely ignored.
+ A string is created and returned as if by the
+ expression (new Date()).toString().
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+ var VERSION = "ECMA_1";
+ startTest();
+ var SECTION = "15.9.2.1";
+ var TITLE = "Date Constructor used as a function";
+ var TYPEOF = "string";
+ var TOLERANCE = 1000;
+
+ writeHeaderToLog("15.9.2.1 The Date Constructor Called as a Function: " +
+ "Date( year, month, date, hours, minutes, seconds, ms )" );
+ var tc= 0;
+ var testcases = getTestCases();
+
+// all tests must call a function that returns an array of TestCase objects.
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ var TODAY = new Date();
+
+ // Dates around 1970
+
+ array[item++] = new TestCase( SECTION, "Date(1970,0,1,0,0,0,0)", (new Date()).toString(), Date(1970,0,1,0,0,0,0) );
+ array[item++] = new TestCase( SECTION, "Date(1969,11,31,15,59,59,999)", (new Date()).toString(), Date(1969,11,31,15,59,59,999))
+ array[item++] = new TestCase( SECTION, "Date(1969,11,31,16,0,0,0)", (new Date()).toString(), Date(1969,11,31,16,0,0,0))
+ array[item++] = new TestCase( SECTION, "Date(1969,11,31,16,0,0,1)", (new Date()).toString(), Date(1969,11,31,16,0,0,1))
+
+ // Dates around 2000
+ array[item++] = new TestCase( SECTION, "Date(1999,11,15,59,59,999)", (new Date()).toString(), Date(1999,11,15,59,59,999));
+ array[item++] = new TestCase( SECTION, "Date(1999,11,16,0,0,0,0)", (new Date()).toString(), Date(1999,11,16,0,0,0,0));
+ array[item++] = new TestCase( SECTION, "Date(1999,11,31,23,59,59,999)", (new Date()).toString(), Date(1999,11,31,23,59,59,999) );
+ array[item++] = new TestCase( SECTION, "Date(2000,0,1,0,0,0,0)", (new Date()).toString(), Date(2000,0,0,0,0,0,0) );
+ array[item++] = new TestCase( SECTION, "Date(2000,0,1,0,0,0,1)", (new Date()).toString(), Date(2000,0,0,0,0,0,1) );
+
+ // Dates around 1900
+
+ array[item++] = new TestCase( SECTION, "Date(1899,11,31,23,59,59,999)", (new Date()).toString(), Date(1899,11,31,23,59,59,999));
+ array[item++] = new TestCase( SECTION, "Date(1900,0,1,0,0,0,0)", (new Date()).toString(), Date(1900,0,1,0,0,0,0) );
+ array[item++] = new TestCase( SECTION, "Date(1900,0,1,0,0,0,1)", (new Date()).toString(), Date(1900,0,1,0,0,0,1) );
+ array[item++] = new TestCase( SECTION, "Date(1899,11,31,16,0,0,0,0)", (new Date()).toString(), Date(1899,11,31,16,0,0,0,0));
+
+ // Dates around feb 29, 2000
+
+ array[item++] = new TestCase( SECTION, "Date( 2000,1,29,0,0,0,0)", (new Date()).toString(), Date(2000,1,29,0,0,0,0));
+ array[item++] = new TestCase( SECTION, "Date( 2000,1,28,23,59,59,999)", (new Date()).toString(), Date( 2000,1,28,23,59,59,999));
+ array[item++] = new TestCase( SECTION, "Date( 2000,1,27,16,0,0,0)", (new Date()).toString(), Date(2000,1,27,16,0,0,0));
+
+ // Dates around jan 1, 2005
+ array[item++] = new TestCase( SECTION, "Date(2004,11,31,23,59,59,999)", (new Date()).toString(), Date(2004,11,31,23,59,59,999));
+ array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,0,0)", (new Date()).toString(), Date(2005,0,1,0,0,0,0) );
+ array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,0,1)", (new Date()).toString(), Date(2005,0,1,0,0,0,1) );
+ array[item++] = new TestCase( SECTION, "Date(2004,11,31,16,0,0,0,0)", (new Date()).toString(), Date(2004,11,31,16,0,0,0,0));
+
+ // Dates around jan 1, 2032
+ array[item++] = new TestCase( SECTION, "Date(2031,11,31,23,59,59,999)", (new Date()).toString(), Date(2031,11,31,23,59,59,999));
+ array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,0,0)", (new Date()).toString(), Date(2032,0,1,0,0,0,0) );
+ array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,0,1)", (new Date()).toString(), Date(2032,0,1,0,0,0,1) );
+ array[item++] = new TestCase( SECTION, "Date(2031,11,31,16,0,0,0,0)", (new Date()).toString(), Date(2031,11,31,16,0,0,0,0));
+
+ return ( array );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-1.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-1.js
new file mode 100644
index 0000000..8ad5694
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-1.js
@@ -0,0 +1,105 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.2.2.js
+ ECMA Section: 15.9.2.2 Date constructor used as a function
+ Date( year, month, date, hours, minutes, seconds )
+ Description: The arguments are accepted, but are completely ignored.
+ A string is created and returned as if by the
+ expression (new Date()).toString().
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
+
+*/
+ 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 );
+ var tc= 0;
+ var testcases = getTestCases();
+
+// all tests must call a function that returns an array of TestCase objects.
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // Dates around 1970
+
+ array[item++] = new TestCase( SECTION, "Date(1970,0,1,0,0,0)", (new Date()).toString(), Date(1970,0,1,0,0,0) );
+ array[item++] = new TestCase( SECTION, "Date(1969,11,31,15,59,59)", (new Date()).toString(), Date(1969,11,31,15,59,59))
+ array[item++] = new TestCase( SECTION, "Date(1969,11,31,16,0,0)", (new Date()).toString(), Date(1969,11,31,16,0,0))
+ array[item++] = new TestCase( SECTION, "Date(1969,11,31,16,0,1)", (new Date()).toString(), Date(1969,11,31,16,0,1))
+/*
+ // Dates around 2000
+ array[item++] = new TestCase( SECTION, "Date(1999,11,15,59,59)", (new Date()).toString(), Date(1999,11,15,59,59));
+ array[item++] = new TestCase( SECTION, "Date(1999,11,16,0,0,0)", (new Date()).toString(), Date(1999,11,16,0,0,0));
+ array[item++] = new TestCase( SECTION, "Date(1999,11,31,23,59,59)", (new Date()).toString(), Date(1999,11,31,23,59,59) );
+ array[item++] = new TestCase( SECTION, "Date(2000,0,1,0,0,0)", (new Date()).toString(), Date(2000,0,0,0,0,0) );
+ array[item++] = new TestCase( SECTION, "Date(2000,0,1,0,0,1)", (new Date()).toString(), Date(2000,0,0,0,0,1) );
+
+ // Dates around 1900
+
+ array[item++] = new TestCase( SECTION, "Date(1899,11,31,23,59,59)", (new Date()).toString(), Date(1899,11,31,23,59,59));
+ array[item++] = new TestCase( SECTION, "Date(1900,0,1,0,0,0)", (new Date()).toString(), Date(1900,0,1,0,0,0) );
+ array[item++] = new TestCase( SECTION, "Date(1900,0,1,0,0,1)", (new Date()).toString(), Date(1900,0,1,0,0,1) );
+ array[item++] = new TestCase( SECTION, "Date(1899,11,31,16,0,0,0)", (new Date()).toString(), Date(1899,11,31,16,0,0,0));
+
+ // 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));
+
+ // 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));
+
+ // 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() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-2.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-2.js
new file mode 100644
index 0000000..5baaf53
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-2.js
@@ -0,0 +1,99 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.2.2.js
+ ECMA Section: 15.9.2.2 Date constructor used as a function
+ Date( year, month, date, hours, minutes, seconds )
+ Description: The arguments are accepted, but are completely ignored.
+ A string is created and returned as if by the
+ expression (new Date()).toString().
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
+
+*/
+ 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 );
+ var tc= 0;
+ var testcases = getTestCases();
+
+// all tests must call a function that returns an array of TestCase objects.
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // Dates around 2000
+ array[item++] = new TestCase( SECTION, "Date(1999,11,15,59,59)", (new Date()).toString(), Date(1999,11,15,59,59));
+ array[item++] = new TestCase( SECTION, "Date(1999,11,16,0,0,0)", (new Date()).toString(), Date(1999,11,16,0,0,0));
+ array[item++] = new TestCase( SECTION, "Date(1999,11,31,23,59,59)", (new Date()).toString(), Date(1999,11,31,23,59,59) );
+ array[item++] = new TestCase( SECTION, "Date(2000,0,1,0,0,0)", (new Date()).toString(), Date(2000,0,0,0,0,0) );
+ array[item++] = new TestCase( SECTION, "Date(2000,0,1,0,0,1)", (new Date()).toString(), Date(2000,0,0,0,0,1) );
+
+/*
+ // Dates around 1900
+
+ array[item++] = new TestCase( SECTION, "Date(1899,11,31,23,59,59)", (new Date()).toString(), Date(1899,11,31,23,59,59));
+ array[item++] = new TestCase( SECTION, "Date(1900,0,1,0,0,0)", (new Date()).toString(), Date(1900,0,1,0,0,0) );
+ array[item++] = new TestCase( SECTION, "Date(1900,0,1,0,0,1)", (new Date()).toString(), Date(1900,0,1,0,0,1) );
+ array[item++] = new TestCase( SECTION, "Date(1899,11,31,16,0,0,0)", (new Date()).toString(), Date(1899,11,31,16,0,0,0));
+
+ // 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));
+
+ // 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));
+
+ // 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() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-3.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-3.js
new file mode 100644
index 0000000..59255e2
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-3.js
@@ -0,0 +1,92 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.2.2.js
+ ECMA Section: 15.9.2.2 Date constructor used as a function
+ Date( year, month, date, hours, minutes, seconds )
+ Description: The arguments are accepted, but are completely ignored.
+ A string is created and returned as if by the
+ expression (new Date()).toString().
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
+
+*/
+ 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 );
+ var tc= 0;
+ var testcases = getTestCases();
+
+// all tests must call a function that returns an array of TestCase objects.
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // Dates around 1900
+
+ array[item++] = new TestCase( SECTION, "Date(1899,11,31,23,59,59)", (new Date()).toString(), Date(1899,11,31,23,59,59));
+ array[item++] = new TestCase( SECTION, "Date(1900,0,1,0,0,0)", (new Date()).toString(), Date(1900,0,1,0,0,0) );
+ array[item++] = new TestCase( SECTION, "Date(1900,0,1,0,0,1)", (new Date()).toString(), Date(1900,0,1,0,0,1) );
+ array[item++] = new TestCase( SECTION, "Date(1899,11,31,16,0,0,0)", (new Date()).toString(), Date(1899,11,31,16,0,0,0));
+
+/*
+ // 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));
+
+ // 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));
+
+ // 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() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-4.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-4.js
new file mode 100644
index 0000000..b63bb3e
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-4.js
@@ -0,0 +1,85 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.2.2.js
+ ECMA Section: 15.9.2.2 Date constructor used as a function
+ Date( year, month, date, hours, minutes, seconds )
+ Description: The arguments are accepted, but are completely ignored.
+ A string is created and returned as if by the
+ expression (new Date()).toString().
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
+
+*/
+ 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 );
+ var tc= 0;
+ var testcases = getTestCases();
+
+// all tests must call a function that returns an array of TestCase objects.
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // 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));
+
+/*
+ // 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));
+
+ // 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() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-5.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-5.js
new file mode 100644
index 0000000..5422682
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-5.js
@@ -0,0 +1,78 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.2.2.js
+ ECMA Section: 15.9.2.2 Date constructor used as a function
+ Date( year, month, date, hours, minutes, seconds )
+ Description: The arguments are accepted, but are completely ignored.
+ A string is created and returned as if by the
+ expression (new Date()).toString().
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
+
+*/
+ 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 );
+ var tc= 0;
+ var testcases = getTestCases();
+
+// all tests must call a function that returns an array of TestCase objects.
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // 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));
+/*
+ // 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() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-6.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-6.js
new file mode 100644
index 0000000..8e269d0
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.2.2-6.js
@@ -0,0 +1,72 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.2.2.js
+ ECMA Section: 15.9.2.2 Date constructor used as a function
+ Date( year, month, date, hours, minutes, seconds )
+ Description: The arguments are accepted, but are completely ignored.
+ A string is created and returned as if by the
+ expression (new Date()).toString().
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
+
+*/
+ 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 );
+ var tc= 0;
+ var testcases = getTestCases();
+
+// all tests must call a function that returns an array of TestCase objects.
+ test();
+
+function getTestCases() {
+ var array = new Array();
+ var item = 0;
+
+ // 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() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-1.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-1.js
new file mode 100644
index 0000000..3090055
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-1.js
@@ -0,0 +1,274 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
+
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
+
+
+ This tests the returned value of a newly constructed
+ Date object.
+
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+ var SECTION = "15.9.3.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )";
+
+ var TIME = 0;
+ var UTC_YEAR = 1;
+ var UTC_MONTH = 2;
+ var UTC_DATE = 3;
+ var UTC_DAY = 4;
+ var UTC_HOURS = 5;
+ var UTC_MINUTES = 6;
+ var UTC_SECONDS = 7;
+ var UTC_MS = 8;
+
+ var YEAR = 9;
+ var MONTH = 10;
+ var DATE = 11;
+ var DAY = 12;
+ var HOURS = 13;
+ var MINUTES = 14;
+ var SECONDS = 15;
+ var MS = 16;
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ getTestCases();
+ test();
+
+function getTestCases( ) {
+ // all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
+ var TZ_ADJUST = TZ_PST * msPerHour;
+
+ // Dates around 1970
+
+ addNewTestCase( new Date( 1969,11,31,15,59,59,999),
+ "new Date( 1969,11,31,15,59,59,999)",
+ [TIME_1970-1,1969,11,31,3,23,59,59,999,1969,11,31,3,15,59,59,999] );
+
+ addNewTestCase( new Date( 1969,11,31,23,59,59,999),
+ "new Date( 1969,11,31,23,59,59,999)",
+ [TIME_1970-TZ_ADJUST-1,1970,0,1,4,7,59,59,999,1969,11,31,3,23,59,59,999] );
+
+ addNewTestCase( new Date( 1970,0,1,0,0,0,0),
+ "new Date( 1970,0,1,0,0,0,0)",
+ [TIME_1970-TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+ addNewTestCase( new Date( 1969,11,31,16,0,0,0),
+ "new Date( 1969,11,31,16,0,0,0)",
+ [TIME_1970,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+
+ addNewTestCase( new Date(1969,12,1,0,0,0,0),
+ "new Date(1969,12,1,0,0,0,0)",
+ [TIME_1970-TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+ addNewTestCase( new Date(1969,11,32,0,0,0,0),
+ "new Date(1969,11,32,0,0,0,0)",
+ [TIME_1970-TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+ addNewTestCase( new Date(1969,11,31,24,0,0,0),
+ "new Date(1969,11,31,24,0,0,0)",
+ [TIME_1970-TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+ addNewTestCase( new Date(1969,11,31,23,60,0,0),
+ "new Date(1969,11,31,23,60,0,0)",
+ [TIME_1970-TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+ addNewTestCase( new Date(1969,11,31,23,59,60,0),
+ "new Date(1969,11,31,23,59,60,0)",
+ [TIME_1970-TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+ addNewTestCase( new Date(1969,11,31,23,59,59,1000),
+ "new Date(1969,11,31,23,59,59,1000)",
+ [TIME_1970-TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+ // Dates around 2000
+
+ addNewTestCase( new Date( 1999,11,31,15,59,59,999),
+ "new Date( 1999,11,31,15,59,59,999)",
+ [TIME_2000-1,1999,11,31,5,23,59,59,999,1999,11,31,5,15,59,59,999] );
+
+ addNewTestCase( new Date( 1999,11,31,16,0,0,0),
+ "new Date( 1999,11,31,16,0,0,0)",
+ [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5, 16,0,0,0] );
+
+ addNewTestCase( new Date( 1999,11,31,23,59,59,999),
+ "new Date( 1999,11,31,23,59,59,999)",
+ [TIME_2000-TZ_ADJUST-1,2000,0,1,6,7,59,59,999,1999,11,31,5,23,59,59,999] );
+
+ addNewTestCase( new Date( 2000,0,1,0,0,0,0),
+ "new Date( 2000,0,1,0,0,0,0)",
+ [TIME_2000-TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date( 2000,0,1,0,0,0,1),
+ "new Date( 2000,0,1,0,0,0,1)",
+ [TIME_2000-TZ_ADJUST+1,2000,0,1,6,8,0,0,1,2000,0,1,6,0,0,0,1] );
+
+ // Dates around 29 Feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + ( 30 * msPerDay ) + ( 29 * msPerDay );
+
+ addNewTestCase( new Date(2000,1,28,16,0,0,0),
+ "new Date(2000,1,28,16,0,0,0)",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+
+ addNewTestCase( new Date(2000,1,29,0,0,0,0),
+ "new Date(2000,1,29,0,0,0,0)",
+ [UTC_FEB_29_2000-TZ_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+ addNewTestCase( new Date(2000,1,28,24,0,0,0),
+ "new Date(2000,1,28,24,0,0,0)",
+ [UTC_FEB_29_2000-TZ_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+ // Dates around 1900
+
+ addNewTestCase( new Date(1899,11,31,16,0,0,0),
+ "new Date(1899,11,31,16,0,0,0)",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date(1899,11,31,15,59,59,999),
+ "new Date(1899,11,31,15,59,59,999)",
+ [TIME_1900-1,1899,11,31,0,23,59,59,999,1899,11,31,0,15,59,59,999] );
+
+ addNewTestCase( new Date(1899,11,31,23,59,59,999),
+ "new Date(1899,11,31,23,59,59,999)",
+ [TIME_1900-TZ_ADJUST-1,1900,0,1,1,7,59,59,999,1899,11,31,0,23,59,59,999] );
+
+ addNewTestCase( new Date(1900,0,1,0,0,0,0),
+ "new Date(1900,0,1,0,0,0,0)",
+ [TIME_1900-TZ_ADJUST,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+ addNewTestCase( new Date(1900,0,1,0,0,0,1),
+ "new Date(1900,0,1,0,0,0,1)",
+ [TIME_1900-TZ_ADJUST+1,1900,0,1,1,8,0,0,1,1900,0,1,1,0,0,0,1] );
+
+ // Dates around 2005
+
+ var UTC_YEAR_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+ TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004);
+
+ addNewTestCase( new Date(2005,0,1,0,0,0,0),
+ "new Date(2005,0,1,0,0,0,0)",
+ [UTC_YEAR_2005-TZ_ADJUST,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date(2004,11,31,16,0,0,0),
+ "new Date(2004,11,31,16,0,0,0)",
+ [UTC_YEAR_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
+
+/*
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
+
+ // Daylight Savings test case
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ addNewTestCase( new Date(1998,3,5,1,59,59,999),
+ "new Date(1998,3,5,1,59,59,999)",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+
+ addNewTestCase( new Date(1998,3,5,2,0,0,0),
+ "new Date(1998,3,5,2,0,0,0)",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addNewTestCase ( new Date(1998,9,25,1,59,59,999),
+ "new Date(1998,9,25,1,59,59,999)",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+
+ addNewTestCase ( new Date(1998,9,25,2,0,0,0),
+ "new Date(1998,9,25,2,0,0,0)",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+*/
+}
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
+
+ var item = testcases.length;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+}
+
+
+function test() {
+ for( tc = 0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = " +
+ testcases[tc].actual );
+ }
+ stopTest();
+ return testcases;
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-2.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-2.js
new file mode 100644
index 0000000..13d0ab6
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-2.js
@@ -0,0 +1,231 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
+
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
+
+
+ This tests the returned value of a newly constructed
+ Date object.
+
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+ var SECTION = "15.9.3.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )";
+
+ var TIME = 0;
+ var UTC_YEAR = 1;
+ var UTC_MONTH = 2;
+ var UTC_DATE = 3;
+ var UTC_DAY = 4;
+ var UTC_HOURS = 5;
+ var UTC_MINUTES = 6;
+ var UTC_SECONDS = 7;
+ var UTC_MS = 8;
+
+ var YEAR = 9;
+ var MONTH = 10;
+ var DATE = 11;
+ var DAY = 12;
+ var HOURS = 13;
+ var MINUTES = 14;
+ var SECONDS = 15;
+ var MS = 16;
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ getTestCases();
+ test();
+
+function getTestCases( ) {
+ // all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
+ var TZ_ADJUST = TZ_PST * msPerHour;
+
+ // Dates around 2000
+
+ addNewTestCase( new Date( 1999,11,31,15,59,59,999),
+ "new Date( 1999,11,31,15,59,59,999)",
+ [TIME_2000-1,1999,11,31,5,23,59,59,999,1999,11,31,5,15,59,59,999] );
+
+ addNewTestCase( new Date( 1999,11,31,16,0,0,0),
+ "new Date( 1999,11,31,16,0,0,0)",
+ [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5, 16,0,0,0] );
+
+ addNewTestCase( new Date( 1999,11,31,23,59,59,999),
+ "new Date( 1999,11,31,23,59,59,999)",
+ [TIME_2000-TZ_ADJUST-1,2000,0,1,6,7,59,59,999,1999,11,31,5,23,59,59,999] );
+
+ addNewTestCase( new Date( 2000,0,1,0,0,0,0),
+ "new Date( 2000,0,1,0,0,0,0)",
+ [TIME_2000-TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date( 2000,0,1,0,0,0,1),
+ "new Date( 2000,0,1,0,0,0,1)",
+ [TIME_2000-TZ_ADJUST+1,2000,0,1,6,8,0,0,1,2000,0,1,6,0,0,0,1] );
+/*
+ // Dates around 29 Feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + ( 30 * msPerDay ) + ( 29 * msPerDay );
+
+ addNewTestCase( new Date(2000,1,28,16,0,0,0),
+ "new Date(2000,1,28,16,0,0,0)",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+
+ addNewTestCase( new Date(2000,1,29,0,0,0,0),
+ "new Date(2000,1,29,0,0,0,0)",
+ [UTC_FEB_29_2000-TZ_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+ addNewTestCase( new Date(2000,1,28,24,0,0,0),
+ "new Date(2000,1,28,24,0,0,0)",
+ [UTC_FEB_29_2000-TZ_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+ // Dates around 1900
+
+ addNewTestCase( new Date(1899,11,31,16,0,0,0),
+ "new Date(1899,11,31,16,0,0,0)",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date(1899,11,31,15,59,59,999),
+ "new Date(1899,11,31,15,59,59,999)",
+ [TIME_1900-1,1899,11,31,0,23,59,59,999,1899,11,31,0,15,59,59,999] );
+
+ addNewTestCase( new Date(1899,11,31,23,59,59,999),
+ "new Date(1899,11,31,23,59,59,999)",
+ [TIME_1900-TZ_ADJUST-1,1900,0,1,1,7,59,59,999,1899,11,31,0,23,59,59,999] );
+
+ addNewTestCase( new Date(1900,0,1,0,0,0,0),
+ "new Date(1900,0,1,0,0,0,0)",
+ [TIME_1900-TZ_ADJUST,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+ addNewTestCase( new Date(1900,0,1,0,0,0,1),
+ "new Date(1900,0,1,0,0,0,1)",
+ [TIME_1900-TZ_ADJUST+1,1900,0,1,1,8,0,0,1,1900,0,1,1,0,0,0,1] );
+
+ // Dates around 2005
+
+ var UTC_YEAR_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+ TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004);
+
+ addNewTestCase( new Date(2005,0,1,0,0,0,0),
+ "new Date(2005,0,1,0,0,0,0)",
+ [UTC_YEAR_2005-TZ_ADJUST,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date(2004,11,31,16,0,0,0),
+ "new Date(2004,11,31,16,0,0,0)",
+ [UTC_YEAR_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
+*/
+/*
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
+
+ // Daylight Savings test case
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ addNewTestCase( new Date(1998,3,5,1,59,59,999),
+ "new Date(1998,3,5,1,59,59,999)",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+
+ addNewTestCase( new Date(1998,3,5,2,0,0,0),
+ "new Date(1998,3,5,2,0,0,0)",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addNewTestCase ( new Date(1998,9,25,1,59,59,999),
+ "new Date(1998,9,25,1,59,59,999)",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+
+ addNewTestCase ( new Date(1998,9,25,2,0,0,0),
+ "new Date(1998,9,25,2,0,0,0)",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+*/
+}
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
+
+ var item = testcases.length;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+}
+
+function test() {
+ for( tc = 0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = " +
+ testcases[tc].actual );
+ }
+ stopTest();
+ return testcases;
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-3.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-3.js
new file mode 100644
index 0000000..ced3027
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-3.js
@@ -0,0 +1,209 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
+
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
+
+
+ This tests the returned value of a newly constructed
+ Date object.
+
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+ var SECTION = "15.9.3.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )";
+
+ var TIME = 0;
+ var UTC_YEAR = 1;
+ var UTC_MONTH = 2;
+ var UTC_DATE = 3;
+ var UTC_DAY = 4;
+ var UTC_HOURS = 5;
+ var UTC_MINUTES = 6;
+ var UTC_SECONDS = 7;
+ var UTC_MS = 8;
+
+ var YEAR = 9;
+ var MONTH = 10;
+ var DATE = 11;
+ var DAY = 12;
+ var HOURS = 13;
+ var MINUTES = 14;
+ var SECONDS = 15;
+ var MS = 16;
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ getTestCases();
+ test();
+
+function getTestCases( ) {
+ // all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
+ var TZ_ADJUST = TZ_PST * msPerHour;
+
+ // Dates around 29 Feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + ( 30 * msPerDay ) + ( 29 * msPerDay );
+
+ addNewTestCase( new Date(2000,1,28,16,0,0,0),
+ "new Date(2000,1,28,16,0,0,0)",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+
+ addNewTestCase( new Date(2000,1,29,0,0,0,0),
+ "new Date(2000,1,29,0,0,0,0)",
+ [UTC_FEB_29_2000-TZ_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+ addNewTestCase( new Date(2000,1,28,24,0,0,0),
+ "new Date(2000,1,28,24,0,0,0)",
+ [UTC_FEB_29_2000-TZ_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+/*
+ // Dates around 1900
+
+ addNewTestCase( new Date(1899,11,31,16,0,0,0),
+ "new Date(1899,11,31,16,0,0,0)",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date(1899,11,31,15,59,59,999),
+ "new Date(1899,11,31,15,59,59,999)",
+ [TIME_1900-1,1899,11,31,0,23,59,59,999,1899,11,31,0,15,59,59,999] );
+
+ addNewTestCase( new Date(1899,11,31,23,59,59,999),
+ "new Date(1899,11,31,23,59,59,999)",
+ [TIME_1900-TZ_ADJUST-1,1900,0,1,1,7,59,59,999,1899,11,31,0,23,59,59,999] );
+
+ addNewTestCase( new Date(1900,0,1,0,0,0,0),
+ "new Date(1900,0,1,0,0,0,0)",
+ [TIME_1900-TZ_ADJUST,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+ addNewTestCase( new Date(1900,0,1,0,0,0,1),
+ "new Date(1900,0,1,0,0,0,1)",
+ [TIME_1900-TZ_ADJUST+1,1900,0,1,1,8,0,0,1,1900,0,1,1,0,0,0,1] );
+
+ // Dates around 2005
+
+ var UTC_YEAR_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+ TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004);
+
+ addNewTestCase( new Date(2005,0,1,0,0,0,0),
+ "new Date(2005,0,1,0,0,0,0)",
+ [UTC_YEAR_2005-TZ_ADJUST,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date(2004,11,31,16,0,0,0),
+ "new Date(2004,11,31,16,0,0,0)",
+ [UTC_YEAR_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
+*/
+/*
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
+
+ // Daylight Savings test case
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ addNewTestCase( new Date(1998,3,5,1,59,59,999),
+ "new Date(1998,3,5,1,59,59,999)",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+
+ addNewTestCase( new Date(1998,3,5,2,0,0,0),
+ "new Date(1998,3,5,2,0,0,0)",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addNewTestCase ( new Date(1998,9,25,1,59,59,999),
+ "new Date(1998,9,25,1,59,59,999)",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+
+ addNewTestCase ( new Date(1998,9,25,2,0,0,0),
+ "new Date(1998,9,25,2,0,0,0)",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+*/
+}
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
+
+ var item = testcases.length;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+}
+
+function test() {
+ for( tc = 0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = " +
+ testcases[tc].actual );
+ }
+ stopTest();
+ return testcases;
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-4.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-4.js
new file mode 100644
index 0000000..0f18b12
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-4.js
@@ -0,0 +1,193 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
+
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
+
+
+ This tests the returned value of a newly constructed
+ Date object.
+
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+ var SECTION = "15.9.3.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )";
+
+ var TIME = 0;
+ var UTC_YEAR = 1;
+ var UTC_MONTH = 2;
+ var UTC_DATE = 3;
+ var UTC_DAY = 4;
+ var UTC_HOURS = 5;
+ var UTC_MINUTES = 6;
+ var UTC_SECONDS = 7;
+ var UTC_MS = 8;
+
+ var YEAR = 9;
+ var MONTH = 10;
+ var DATE = 11;
+ var DAY = 12;
+ var HOURS = 13;
+ var MINUTES = 14;
+ var SECONDS = 15;
+ var MS = 16;
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ getTestCases();
+ test();
+
+function getTestCases( ) {
+ // all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
+ var TZ_ADJUST = TZ_PST * msPerHour;
+
+ // Dates around 1900
+
+ addNewTestCase( new Date(1899,11,31,16,0,0,0),
+ "new Date(1899,11,31,16,0,0,0)",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date(1899,11,31,15,59,59,999),
+ "new Date(1899,11,31,15,59,59,999)",
+ [TIME_1900-1,1899,11,31,0,23,59,59,999,1899,11,31,0,15,59,59,999] );
+
+ addNewTestCase( new Date(1899,11,31,23,59,59,999),
+ "new Date(1899,11,31,23,59,59,999)",
+ [TIME_1900-TZ_ADJUST-1,1900,0,1,1,7,59,59,999,1899,11,31,0,23,59,59,999] );
+
+ addNewTestCase( new Date(1900,0,1,0,0,0,0),
+ "new Date(1900,0,1,0,0,0,0)",
+ [TIME_1900-TZ_ADJUST,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+ addNewTestCase( new Date(1900,0,1,0,0,0,1),
+ "new Date(1900,0,1,0,0,0,1)",
+ [TIME_1900-TZ_ADJUST+1,1900,0,1,1,8,0,0,1,1900,0,1,1,0,0,0,1] );
+/*
+ // Dates around 2005
+
+ var UTC_YEAR_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+ TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004);
+
+ addNewTestCase( new Date(2005,0,1,0,0,0,0),
+ "new Date(2005,0,1,0,0,0,0)",
+ [UTC_YEAR_2005-TZ_ADJUST,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date(2004,11,31,16,0,0,0),
+ "new Date(2004,11,31,16,0,0,0)",
+ [UTC_YEAR_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
+*/
+/*
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
+
+ // Daylight Savings test case
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ addNewTestCase( new Date(1998,3,5,1,59,59,999),
+ "new Date(1998,3,5,1,59,59,999)",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+
+ addNewTestCase( new Date(1998,3,5,2,0,0,0),
+ "new Date(1998,3,5,2,0,0,0)",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addNewTestCase ( new Date(1998,9,25,1,59,59,999),
+ "new Date(1998,9,25,1,59,59,999)",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+
+ addNewTestCase ( new Date(1998,9,25,2,0,0,0),
+ "new Date(1998,9,25,2,0,0,0)",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+*/
+}
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
+
+ var item = testcases.length;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+}
+
+function test() {
+ for( tc = 0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = " +
+ testcases[tc].actual );
+ }
+ stopTest();
+ return testcases;
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-5.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-5.js
new file mode 100644
index 0000000..0b7d436
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.1-5.js
@@ -0,0 +1,170 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
+
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
+
+
+ This tests the returned value of a newly constructed
+ Date object.
+
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+ var SECTION = "15.9.3.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )";
+
+ var TIME = 0;
+ var UTC_YEAR = 1;
+ var UTC_MONTH = 2;
+ var UTC_DATE = 3;
+ var UTC_DAY = 4;
+ var UTC_HOURS = 5;
+ var UTC_MINUTES = 6;
+ var UTC_SECONDS = 7;
+ var UTC_MS = 8;
+
+ var YEAR = 9;
+ var MONTH = 10;
+ var DATE = 11;
+ var DAY = 12;
+ var HOURS = 13;
+ var MINUTES = 14;
+ var SECONDS = 15;
+ var MS = 16;
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ getTestCases();
+ test();
+
+function getTestCases( ) {
+ // all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
+ var TZ_ADJUST = TZ_PST * msPerHour;
+
+ // Dates around 2005
+
+ var UTC_YEAR_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+ TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004);
+
+ addNewTestCase( new Date(2005,0,1,0,0,0,0),
+ "new Date(2005,0,1,0,0,0,0)",
+ [UTC_YEAR_2005-TZ_ADJUST,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date(2004,11,31,16,0,0,0),
+ "new Date(2004,11,31,16,0,0,0)",
+ [UTC_YEAR_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
+/*
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
+
+ // Daylight Savings test case
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ addNewTestCase( new Date(1998,3,5,1,59,59,999),
+ "new Date(1998,3,5,1,59,59,999)",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+
+ addNewTestCase( new Date(1998,3,5,2,0,0,0),
+ "new Date(1998,3,5,2,0,0,0)",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addNewTestCase ( new Date(1998,9,25,1,59,59,999),
+ "new Date(1998,9,25,1,59,59,999)",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+
+ addNewTestCase ( new Date(1998,9,25,2,0,0,0),
+ "new Date(1998,9,25,2,0,0,0)",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+*/
+}
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
+
+ var item = testcases.length;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+}
+
+function test() {
+ for( tc = 0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = " +
+ testcases[tc].actual );
+ }
+ stopTest();
+ return testcases;
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-1.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-1.js
new file mode 100644
index 0000000..718d314
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-1.js
@@ -0,0 +1,241 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
+
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
+
+
+ This tests the returned value of a newly constructed
+ Date object.
+
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+ var TIME = 0;
+ var UTC_YEAR = 1;
+ var UTC_MONTH = 2;
+ var UTC_DATE = 3;
+ var UTC_DAY = 4;
+ var UTC_HOURS = 5;
+ var UTC_MINUTES = 6;
+ var UTC_SECONDS = 7;
+ var UTC_MS = 8;
+
+ var YEAR = 9;
+ var MONTH = 10;
+ var DATE = 11;
+ var DAY = 12;
+ var HOURS = 13;
+ var MINUTES = 14;
+ var SECONDS = 15;
+ var MS = 16;
+
+// for TCMS, the testcases array must be global.
+ var SECTION = "15.9.3.1";
+ var TITLE = "Date( year, month, date, hours, minutes, seconds )";
+
+ writeHeaderToLog( SECTION+" " +TITLE );
+
+ var testcases = new Array();
+ getTestCases();
+
+// all tests must call a function that returns an array of TestCase object
+ test();
+
+function getTestCases( ) {
+
+ // Dates around 1970
+
+ addNewTestCase( new Date( 1969,11,31,15,59,59),
+ "new Date( 1969,11,31,15,59,59)",
+ [-1000,1969,11,31,3,23,59,59,0,1969,11,31,3,15,59,59,0] );
+
+ addNewTestCase( new Date( 1969,11,31,16,0,0),
+ "new Date( 1969,11,31,16,0,0)",
+ [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+
+ addNewTestCase( new Date( 1969,11,31,23,59,59),
+ "new Date( 1969,11,31,23,59,59)",
+ [28799000,1970,0,1,4,7,59,59,0,1969,11,31,3,23,59,59,0] );
+
+ addNewTestCase( new Date( 1970, 0, 1, 0, 0, 0),
+ "new Date( 1970, 0, 1, 0, 0, 0)",
+ [28800000,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+ addNewTestCase( new Date( 1969,11,31,16,0,0),
+ "new Date( 1969,11,31,16,0,0)",
+ [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+/*
+ // Dates around 2000
+
+ addNewTestCase( new Date( 1999,11,31,15,59,59),
+ "new Date( 1999,11,31,15,59,59)",
+ [946684799000,1999,11,31,5,23,59,59,0,1999,11,31,5,15,59,59,0] );
+
+ addNewTestCase( new Date( 1999,11,31,16,0,0),
+ "new Date( 1999,11,31,16,0,0)",
+ [946684800000,2000,0,1,6,0,0,0,0,1999,11,31,5, 16,0,0,0] );
+
+ addNewTestCase( new Date( 2000,0,1,0,0,0),
+ "new Date( 2000,0,1,0,0,0)",
+ [946713600000,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+
+ // Dates around 1900
+
+ addNewTestCase( new Date(1899,11,31,16,0,0),
+ "new Date(1899,11,31,16,0,0)",
+ [-2208988800000,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date(1899,11,31,15,59,59),
+ "new Date(1899,11,31,15,59,59)",
+ [-2208988801000,1899,11,31,0,23,59,59,0,1899,11,31,0,15,59,59,0] );
+
+ addNewTestCase( new Date(1900,0,1,0,0,0),
+ "new Date(1900,0,1,0,0,0)",
+ [-2208960000000,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+ addNewTestCase( new Date(1900,0,1,0,0,1),
+ "new Date(1900,0,1,0,0,1)",
+ [-2208959999000,1900,0,1,1,8,0,1,0,1900,0,1,1,0,0,1,0] );
+
+ var UTC_FEB_29_2000 = TIME_2000 + msPerDay*31 + msPerDay*28;
+ var PST_FEB_29_2000 = UTC_FEB_29_2000 + 8*msPerHour;
+
+ // Dates around Feb 29, 2000
+ addNewTestCase( new Date(2000,1,28,16,0,0,0),
+ "new Date(2000,1,28,16,0,0,0)",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0,0] );
+
+ addNewTestCase( new Date(2000,1,29,0,0,0,0),
+ "new Date(2000,1,29,0,0,0,0)",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+ addNewTestCase( new Date(2000,1,29,24,0,0,0),
+ "new Date(2000,1,29,24,0,0,0)",
+ [PST_FEB_29_2000+msPerDay,2000,2,1,3,8,0,0,0,2000,2,1,3,0,0,0,0] );
+
+ // Dates around Jan 1, 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+ TimeInYear(2002)+ TimeInYear(2003) + TimeInYear(2004);
+ var PST_JAN_1_2005 = UTC_JAN_1_2005 + 8*msPerHour;
+
+ addNewTestCase( new Date(2005,0,1,0,0,0,0),
+ "new Date(2005,0,1,0,0,0,0)",
+ [PST_JAN_1_2005,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date(2004,11,31,16,0,0,0),
+ "new Date(2004,11,31,16,0,0,0)",
+ [UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
+*/
+/*
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
+
+ // Daylight Savings Time
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ addNewTestCase( new Date(1998,3,5,1,59,59,999),
+ "new Date(1998,3,5,1,59,59,999)",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+
+ addNewTestCase( new Date(1998,3,5,2,0,0,0),
+ "new Date(1998,3,5,2,0,0,0)",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addNewTestCase ( new Date(1998,9,25,1,59,59,999),
+ "new Date(1998,9,25,1,59,59,999)",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+
+ addNewTestCase ( new Date(1998,9,25,2,0,0,0),
+ "new Date(1998,9,25,2,0,0,0)",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+*/
+}
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
+
+ item = testcases.length;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+
+}
+
+function test() {
+ for( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = " +
+ testcases[tc].actual );
+ }
+ stopTest();
+ return testcases;
+}
+
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-2.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-2.js
new file mode 100644
index 0000000..b110f52
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-2.js
@@ -0,0 +1,219 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
+
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
+
+
+ This tests the returned value of a newly constructed
+ Date object.
+
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+ var TIME = 0;
+ var UTC_YEAR = 1;
+ var UTC_MONTH = 2;
+ var UTC_DATE = 3;
+ var UTC_DAY = 4;
+ var UTC_HOURS = 5;
+ var UTC_MINUTES = 6;
+ var UTC_SECONDS = 7;
+ var UTC_MS = 8;
+
+ var YEAR = 9;
+ var MONTH = 10;
+ var DATE = 11;
+ var DAY = 12;
+ var HOURS = 13;
+ var MINUTES = 14;
+ var SECONDS = 15;
+ var MS = 16;
+
+// for TCMS, the testcases array must be global.
+ var SECTION = "15.9.3.1";
+ var TITLE = "Date( year, month, date, hours, minutes, seconds )";
+
+ writeHeaderToLog( SECTION+" " +TITLE );
+
+ var testcases = new Array();
+ getTestCases();
+
+// all tests must call a function that returns an array of TestCase object
+ test();
+
+function getTestCases( ) {
+
+ // Dates around 2000
+
+ addNewTestCase( new Date( 1999,11,31,15,59,59),
+ "new Date( 1999,11,31,15,59,59)",
+ [946684799000,1999,11,31,5,23,59,59,0,1999,11,31,5,15,59,59,0] );
+
+ addNewTestCase( new Date( 1999,11,31,16,0,0),
+ "new Date( 1999,11,31,16,0,0)",
+ [946684800000,2000,0,1,6,0,0,0,0,1999,11,31,5, 16,0,0,0] );
+
+ addNewTestCase( new Date( 2000,0,1,0,0,0),
+ "new Date( 2000,0,1,0,0,0)",
+ [946713600000,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+/*
+ // Dates around 1900
+
+ addNewTestCase( new Date(1899,11,31,16,0,0),
+ "new Date(1899,11,31,16,0,0)",
+ [-2208988800000,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date(1899,11,31,15,59,59),
+ "new Date(1899,11,31,15,59,59)",
+ [-2208988801000,1899,11,31,0,23,59,59,0,1899,11,31,0,15,59,59,0] );
+
+ addNewTestCase( new Date(1900,0,1,0,0,0),
+ "new Date(1900,0,1,0,0,0)",
+ [-2208960000000,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+ addNewTestCase( new Date(1900,0,1,0,0,1),
+ "new Date(1900,0,1,0,0,1)",
+ [-2208959999000,1900,0,1,1,8,0,1,0,1900,0,1,1,0,0,1,0] );
+
+ var UTC_FEB_29_2000 = TIME_2000 + msPerDay*31 + msPerDay*28;
+ var PST_FEB_29_2000 = UTC_FEB_29_2000 + 8*msPerHour;
+
+ // Dates around Feb 29, 2000
+ addNewTestCase( new Date(2000,1,28,16,0,0,0),
+ "new Date(2000,1,28,16,0,0,0)",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0,0] );
+
+ addNewTestCase( new Date(2000,1,29,0,0,0,0),
+ "new Date(2000,1,29,0,0,0,0)",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+ addNewTestCase( new Date(2000,1,29,24,0,0,0),
+ "new Date(2000,1,29,24,0,0,0)",
+ [PST_FEB_29_2000+msPerDay,2000,2,1,3,8,0,0,0,2000,2,1,3,0,0,0,0] );
+
+ // Dates around Jan 1, 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+ TimeInYear(2002)+ TimeInYear(2003) + TimeInYear(2004);
+ var PST_JAN_1_2005 = UTC_JAN_1_2005 + 8*msPerHour;
+
+ addNewTestCase( new Date(2005,0,1,0,0,0,0),
+ "new Date(2005,0,1,0,0,0,0)",
+ [PST_JAN_1_2005,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date(2004,11,31,16,0,0,0),
+ "new Date(2004,11,31,16,0,0,0)",
+ [UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
+*/
+/*
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
+
+ // Daylight Savings Time
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ addNewTestCase( new Date(1998,3,5,1,59,59,999),
+ "new Date(1998,3,5,1,59,59,999)",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+
+ addNewTestCase( new Date(1998,3,5,2,0,0,0),
+ "new Date(1998,3,5,2,0,0,0)",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addNewTestCase ( new Date(1998,9,25,1,59,59,999),
+ "new Date(1998,9,25,1,59,59,999)",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+
+ addNewTestCase ( new Date(1998,9,25,2,0,0,0),
+ "new Date(1998,9,25,2,0,0,0)",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+*/
+}
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
+
+ item = testcases.length;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+
+}
+
+function test() {
+ for( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = " +
+ testcases[tc].actual );
+ }
+ stopTest();
+ return testcases;
+}
+
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-3.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-3.js
new file mode 100644
index 0000000..9e57730
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-3.js
@@ -0,0 +1,205 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
+
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
+
+
+ This tests the returned value of a newly constructed
+ Date object.
+
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+ var TIME = 0;
+ var UTC_YEAR = 1;
+ var UTC_MONTH = 2;
+ var UTC_DATE = 3;
+ var UTC_DAY = 4;
+ var UTC_HOURS = 5;
+ var UTC_MINUTES = 6;
+ var UTC_SECONDS = 7;
+ var UTC_MS = 8;
+
+ var YEAR = 9;
+ var MONTH = 10;
+ var DATE = 11;
+ var DAY = 12;
+ var HOURS = 13;
+ var MINUTES = 14;
+ var SECONDS = 15;
+ var MS = 16;
+
+// for TCMS, the testcases array must be global.
+ var SECTION = "15.9.3.1";
+ var TITLE = "Date( year, month, date, hours, minutes, seconds )";
+
+ writeHeaderToLog( SECTION+" " +TITLE );
+
+ var testcases = new Array();
+ getTestCases();
+
+// all tests must call a function that returns an array of TestCase object
+ test();
+
+function getTestCases( ) {
+
+ // Dates around 1900
+
+ addNewTestCase( new Date(1899,11,31,16,0,0),
+ "new Date(1899,11,31,16,0,0)",
+ [-2208988800000,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date(1899,11,31,15,59,59),
+ "new Date(1899,11,31,15,59,59)",
+ [-2208988801000,1899,11,31,0,23,59,59,0,1899,11,31,0,15,59,59,0] );
+
+ addNewTestCase( new Date(1900,0,1,0,0,0),
+ "new Date(1900,0,1,0,0,0)",
+ [-2208960000000,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+ addNewTestCase( new Date(1900,0,1,0,0,1),
+ "new Date(1900,0,1,0,0,1)",
+ [-2208959999000,1900,0,1,1,8,0,1,0,1900,0,1,1,0,0,1,0] );
+/*
+ var UTC_FEB_29_2000 = TIME_2000 + msPerDay*31 + msPerDay*28;
+ var PST_FEB_29_2000 = UTC_FEB_29_2000 + 8*msPerHour;
+
+ // Dates around Feb 29, 2000
+ addNewTestCase( new Date(2000,1,28,16,0,0,0),
+ "new Date(2000,1,28,16,0,0,0)",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0,0] );
+
+ addNewTestCase( new Date(2000,1,29,0,0,0,0),
+ "new Date(2000,1,29,0,0,0,0)",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+ addNewTestCase( new Date(2000,1,29,24,0,0,0),
+ "new Date(2000,1,29,24,0,0,0)",
+ [PST_FEB_29_2000+msPerDay,2000,2,1,3,8,0,0,0,2000,2,1,3,0,0,0,0] );
+
+ // Dates around Jan 1, 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+ TimeInYear(2002)+ TimeInYear(2003) + TimeInYear(2004);
+ var PST_JAN_1_2005 = UTC_JAN_1_2005 + 8*msPerHour;
+
+ addNewTestCase( new Date(2005,0,1,0,0,0,0),
+ "new Date(2005,0,1,0,0,0,0)",
+ [PST_JAN_1_2005,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date(2004,11,31,16,0,0,0),
+ "new Date(2004,11,31,16,0,0,0)",
+ [UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
+*/
+/*
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
+
+ // Daylight Savings Time
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ addNewTestCase( new Date(1998,3,5,1,59,59,999),
+ "new Date(1998,3,5,1,59,59,999)",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+
+ addNewTestCase( new Date(1998,3,5,2,0,0,0),
+ "new Date(1998,3,5,2,0,0,0)",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addNewTestCase ( new Date(1998,9,25,1,59,59,999),
+ "new Date(1998,9,25,1,59,59,999)",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+
+ addNewTestCase ( new Date(1998,9,25,2,0,0,0),
+ "new Date(1998,9,25,2,0,0,0)",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+*/
+}
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
+
+ item = testcases.length;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+
+}
+
+function test() {
+ for( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = " +
+ testcases[tc].actual );
+ }
+ stopTest();
+ return testcases;
+}
+
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-4.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-4.js
new file mode 100644
index 0000000..6b6b0c4
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-4.js
@@ -0,0 +1,188 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
+
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
+
+
+ This tests the returned value of a newly constructed
+ Date object.
+
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+ var TIME = 0;
+ var UTC_YEAR = 1;
+ var UTC_MONTH = 2;
+ var UTC_DATE = 3;
+ var UTC_DAY = 4;
+ var UTC_HOURS = 5;
+ var UTC_MINUTES = 6;
+ var UTC_SECONDS = 7;
+ var UTC_MS = 8;
+
+ var YEAR = 9;
+ var MONTH = 10;
+ var DATE = 11;
+ var DAY = 12;
+ var HOURS = 13;
+ var MINUTES = 14;
+ var SECONDS = 15;
+ var MS = 16;
+
+// for TCMS, the testcases array must be global.
+ var SECTION = "15.9.3.1";
+ var TITLE = "Date( year, month, date, hours, minutes, seconds )";
+
+ writeHeaderToLog( SECTION+" " +TITLE );
+
+ var testcases = new Array();
+ getTestCases();
+
+// all tests must call a function that returns an array of TestCase object
+ test();
+
+function getTestCases( ) {
+
+
+ var UTC_FEB_29_2000 = TIME_2000 + msPerDay*31 + msPerDay*28;
+ var PST_FEB_29_2000 = UTC_FEB_29_2000 + 8*msPerHour;
+
+ // Dates around Feb 29, 2000
+ addNewTestCase( new Date(2000,1,28,16,0,0,0),
+ "new Date(2000,1,28,16,0,0,0)",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0,0] );
+
+ addNewTestCase( new Date(2000,1,29,0,0,0,0),
+ "new Date(2000,1,29,0,0,0,0)",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+ addNewTestCase( new Date(2000,1,29,24,0,0,0),
+ "new Date(2000,1,29,24,0,0,0)",
+ [PST_FEB_29_2000+msPerDay,2000,2,1,3,8,0,0,0,2000,2,1,3,0,0,0,0] );
+/*
+ // Dates around Jan 1, 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+ TimeInYear(2002)+ TimeInYear(2003) + TimeInYear(2004);
+ var PST_JAN_1_2005 = UTC_JAN_1_2005 + 8*msPerHour;
+
+ addNewTestCase( new Date(2005,0,1,0,0,0,0),
+ "new Date(2005,0,1,0,0,0,0)",
+ [PST_JAN_1_2005,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date(2004,11,31,16,0,0,0),
+ "new Date(2004,11,31,16,0,0,0)",
+ [UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
+*/
+/*
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
+
+ // Daylight Savings Time
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ addNewTestCase( new Date(1998,3,5,1,59,59,999),
+ "new Date(1998,3,5,1,59,59,999)",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+
+ addNewTestCase( new Date(1998,3,5,2,0,0,0),
+ "new Date(1998,3,5,2,0,0,0)",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addNewTestCase ( new Date(1998,9,25,1,59,59,999),
+ "new Date(1998,9,25,1,59,59,999)",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+
+ addNewTestCase ( new Date(1998,9,25,2,0,0,0),
+ "new Date(1998,9,25,2,0,0,0)",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+*/
+}
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
+
+ item = testcases.length;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+
+}
+
+function test() {
+ for( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = " +
+ testcases[tc].actual );
+ }
+ stopTest();
+ return testcases;
+}
+
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-5.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-5.js
new file mode 100644
index 0000000..798320b
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.2-5.js
@@ -0,0 +1,170 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
+
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
+
+
+ This tests the returned value of a newly constructed
+ Date object.
+
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+ var TIME = 0;
+ var UTC_YEAR = 1;
+ var UTC_MONTH = 2;
+ var UTC_DATE = 3;
+ var UTC_DAY = 4;
+ var UTC_HOURS = 5;
+ var UTC_MINUTES = 6;
+ var UTC_SECONDS = 7;
+ var UTC_MS = 8;
+
+ var YEAR = 9;
+ var MONTH = 10;
+ var DATE = 11;
+ var DAY = 12;
+ var HOURS = 13;
+ var MINUTES = 14;
+ var SECONDS = 15;
+ var MS = 16;
+
+// for TCMS, the testcases array must be global.
+ var SECTION = "15.9.3.1";
+ var TITLE = "Date( year, month, date, hours, minutes, seconds )";
+
+ writeHeaderToLog( SECTION+" " +TITLE );
+
+ var testcases = new Array();
+ getTestCases();
+
+// all tests must call a function that returns an array of TestCase object
+ test();
+
+function getTestCases( ) {
+
+ // Dates around Jan 1, 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+ TimeInYear(2002)+ TimeInYear(2003) + TimeInYear(2004);
+ var PST_JAN_1_2005 = UTC_JAN_1_2005 + 8*msPerHour;
+
+ addNewTestCase( new Date(2005,0,1,0,0,0,0),
+ "new Date(2005,0,1,0,0,0,0)",
+ [PST_JAN_1_2005,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date(2004,11,31,16,0,0,0),
+ "new Date(2004,11,31,16,0,0,0)",
+ [UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
+/*
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
+
+ // Daylight Savings Time
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ addNewTestCase( new Date(1998,3,5,1,59,59,999),
+ "new Date(1998,3,5,1,59,59,999)",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+
+ addNewTestCase( new Date(1998,3,5,2,0,0,0),
+ "new Date(1998,3,5,2,0,0,0)",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addNewTestCase ( new Date(1998,9,25,1,59,59,999),
+ "new Date(1998,9,25,1,59,59,999)",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+
+ addNewTestCase ( new Date(1998,9,25,2,0,0,0),
+ "new Date(1998,9,25,2,0,0,0)",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+*/
+}
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
+
+ item = testcases.length;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+
+}
+
+function test() {
+ for( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = " +
+ testcases[tc].actual );
+ }
+ stopTest();
+ return testcases;
+}
+
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-1.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-1.js
new file mode 100644
index 0000000..644f37c
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-1.js
@@ -0,0 +1,300 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.3.8.js
+ ECMA Section: 15.9.3.8 The Date Constructor
+ new Date( value )
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial valiue of Date.prototype.
+
+ The [[Class]] property of the newly constructed object is
+ set to "Date".
+
+ The [[Value]] property of the newly constructed object is
+ set as follows:
+
+ 1. Call ToPrimitive(value)
+ 2. If Type( Result(1) ) is String, then go to step 5.
+ 3. Let V be ToNumber( Result(1) ).
+ 4. Set the [[Value]] property of the newly constructed
+ object to TimeClip(V) and return.
+ 5. Parse Result(1) as a date, in exactly the same manner
+ as for the parse method. Let V be the time value for
+ this date.
+ 6. Go to step 4.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
+
+*/
+
+ var VERSION = "ECMA_1";
+ startTest();
+ var SECTION = "15.9.3.8";
+ var TYPEOF = "object";
+
+ var TIME = 0;
+ var UTC_YEAR = 1;
+ var UTC_MONTH = 2;
+ var UTC_DATE = 3;
+ var UTC_DAY = 4;
+ var UTC_HOURS = 5;
+ var UTC_MINUTES = 6;
+ var UTC_SECONDS = 7;
+ var UTC_MS = 8;
+
+ var YEAR = 9;
+ var MONTH = 10;
+ var DATE = 11;
+ var DAY = 12;
+ var HOURS = 13;
+ var MINUTES = 14;
+ var SECONDS = 15;
+ var MS = 16;
+
+
+// for TCMS, the testcases array must be global.
+ var tc= 0;
+ var TITLE = "Date constructor: new Date( value )";
+ var SECTION = "15.9.3.8";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION +" " + TITLE );
+
+ testcases = new Array();
+ getTestCases();
+
+// all tests must call a function that returns a boolean value
+ test();
+
+function getTestCases( ) {
+ // all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
+ var TZ_ADJUST = -TZ_PST * msPerHour;
+
+
+ // Dates around 1970
+ addNewTestCase( new Date(0),
+ "new Date(0)",
+ [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+
+ addNewTestCase( new Date(1),
+ "new Date(1)",
+ [1,1970,0,1,4,0,0,0,1,1969,11,31,3,16,0,0,1] );
+
+ addNewTestCase( new Date(true),
+ "new Date(true)",
+ [1,1970,0,1,4,0,0,0,1,1969,11,31,3,16,0,0,1] );
+
+ addNewTestCase( new Date(false),
+ "new Date(false)",
+ [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(0)).toString() ),
+ "new Date(\""+ (new Date(0)).toString()+"\" )",
+ [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+/*
+// addNewTestCase( "new Date(\""+ (new Date(0)).toLocaleString()+"\")", [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+
+ addNewTestCase( new Date((new Date(0)).toUTCString()),
+ "new Date(\""+ (new Date(0)).toUTCString()+"\" )",
+ [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+
+ addNewTestCase( new Date((new Date(1)).toString()),
+ "new Date(\""+ (new Date(1)).toString()+"\" )",
+ [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+
+ addNewTestCase( new Date( TZ_ADJUST ),
+ "new Date(" + TZ_ADJUST+")",
+ [TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+ addNewTestCase( new Date((new Date(TZ_ADJUST)).toString()),
+ "new Date(\""+ (new Date(TZ_ADJUST)).toString()+"\")",
+ [TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+// addNewTestCase( "new Date(\""+ (new Date(TZ_ADJUST)).toLocaleString()+"\")",[TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(TZ_ADJUST)).toUTCString() ),
+ "new Date(\""+ (new Date(TZ_ADJUST)).toUTCString()+"\")",
+ [TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+ // Dates around 2000
+
+ addNewTestCase( new Date(TIME_2000+TZ_ADJUST),
+ "new Date(" +(TIME_2000+TZ_ADJUST)+")",
+ [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date(TIME_2000),
+ "new Date(" +TIME_2000+")",
+ [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(TIME_2000+TZ_ADJUST)).toString()),
+ "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toString()+"\")",
+ [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date((new Date(TIME_2000)).toString()),
+ "new Date(\"" +(new Date(TIME_2000)).toString()+"\")",
+ [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
+
+// addNewTestCase( "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toLocaleString()+"\")", [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+// addNewTestCase( "new Date(\"" +(new Date(TIME_2000)).toLocaleString()+"\")", [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(TIME_2000+TZ_ADJUST)).toUTCString()),
+ "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toUTCString()+"\")",
+ [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(TIME_2000)).toUTCString()),
+ "new Date(\"" +(new Date(TIME_2000)).toUTCString()+"\")",
+ [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
+
+ // Dates around Feb 29, 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
+ var PST_FEB_29_2000 = UTC_FEB_29_2000 + TZ_ADJUST;
+
+ addNewTestCase( new Date(UTC_FEB_29_2000),
+ "new Date("+UTC_FEB_29_2000+")",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+
+ addNewTestCase( new Date(PST_FEB_29_2000),
+ "new Date("+PST_FEB_29_2000+")",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toString() ),
+ "new Date(\""+(new Date(UTC_FEB_29_2000)).toString()+"\")",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toString() ),
+ "new Date(\""+(new Date(PST_FEB_29_2000)).toString()+"\")",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+// Parsing toLocaleString() is not guaranteed by ECMA.
+// addNewTestCase( "new Date(\""+(new Date(UTC_FEB_29_2000)).toLocaleString()+"\")", [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+// addNewTestCase( "new Date(\""+(new Date(PST_FEB_29_2000)).toLocaleString()+"\")", [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toGMTString() ),
+ "new Date(\""+(new Date(UTC_FEB_29_2000)).toGMTString()+"\")",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toGMTString() ),
+ "new Date(\""+(new Date(PST_FEB_29_2000)).toGMTString()+"\")",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+ // Dates around 1900
+
+ var PST_1900 = TIME_1900 + 8*msPerHour;
+
+ addNewTestCase( new Date( TIME_1900 ),
+ "new Date("+TIME_1900+")",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date(PST_1900),
+ "new Date("+PST_1900+")",
+ [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(TIME_1900)).toString() ),
+ "new Date(\""+(new Date(TIME_1900)).toString()+"\")",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(PST_1900)).toString() ),
+ "new Date(\""+(new Date(PST_1900 )).toString()+"\")",
+ [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(TIME_1900)).toUTCString() ),
+ "new Date(\""+(new Date(TIME_1900)).toUTCString()+"\")",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(PST_1900)).toUTCString() ),
+ "new Date(\""+(new Date(PST_1900 )).toUTCString()+"\")",
+ [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+// addNewTestCase( "new Date(\""+(new Date(TIME_1900)).toLocaleString()+"\")", [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+// addNewTestCase( "new Date(\""+(new Date(PST_1900 )).toLocaleString()+"\")", [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+*/
+/*
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ addNewTestCase( new Date(DST_START_1998-1),
+ "new Date("+(DST_START_1998-1)+")",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+
+ addNewTestCase( new Date(DST_START_1998),
+ "new Date("+DST_START_1998+")",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addNewTestCase ( new Date(DST_END_1998-1),
+ "new Date("+(DST_END_1998-1)+")",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+
+ addNewTestCase ( new Date(DST_END_1998),
+ "new Date("+DST_END_1998+")",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+*/
+}
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray, 'msMode');
+
+ item = testcases.length;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+}
+
+function test() {
+ for( tc = 0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = " +
+ testcases[tc].actual );
+ }
+ stopTest();
+
+ // all tests must return a boolean value
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-2.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-2.js
new file mode 100644
index 0000000..4cfcb04
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-2.js
@@ -0,0 +1,275 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.3.8.js
+ ECMA Section: 15.9.3.8 The Date Constructor
+ new Date( value )
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial valiue of Date.prototype.
+
+ The [[Class]] property of the newly constructed object is
+ set to "Date".
+
+ The [[Value]] property of the newly constructed object is
+ set as follows:
+
+ 1. Call ToPrimitive(value)
+ 2. If Type( Result(1) ) is String, then go to step 5.
+ 3. Let V be ToNumber( Result(1) ).
+ 4. Set the [[Value]] property of the newly constructed
+ object to TimeClip(V) and return.
+ 5. Parse Result(1) as a date, in exactly the same manner
+ as for the parse method. Let V be the time value for
+ this date.
+ 6. Go to step 4.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
+
+*/
+
+ var VERSION = "ECMA_1";
+ startTest();
+ var SECTION = "15.9.3.8";
+ var TYPEOF = "object";
+
+ var TIME = 0;
+ var UTC_YEAR = 1;
+ var UTC_MONTH = 2;
+ var UTC_DATE = 3;
+ var UTC_DAY = 4;
+ var UTC_HOURS = 5;
+ var UTC_MINUTES = 6;
+ var UTC_SECONDS = 7;
+ var UTC_MS = 8;
+
+ var YEAR = 9;
+ var MONTH = 10;
+ var DATE = 11;
+ var DAY = 12;
+ var HOURS = 13;
+ var MINUTES = 14;
+ var SECONDS = 15;
+ var MS = 16;
+
+
+// for TCMS, the testcases array must be global.
+ var tc= 0;
+ var TITLE = "Date constructor: new Date( value )";
+ var SECTION = "15.9.3.8";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION +" " + TITLE );
+
+ testcases = new Array();
+ getTestCases();
+
+// all tests must call a function that returns a boolean value
+ test();
+
+function getTestCases( ) {
+ // all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
+ var TZ_ADJUST = -TZ_PST * msPerHour;
+
+ addNewTestCase( new Date((new Date(0)).toUTCString()),
+ "new Date(\""+ (new Date(0)).toUTCString()+"\" )",
+ [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+
+ addNewTestCase( new Date((new Date(1)).toString()),
+ "new Date(\""+ (new Date(1)).toString()+"\" )",
+ [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+
+ addNewTestCase( new Date( TZ_ADJUST ),
+ "new Date(" + TZ_ADJUST+")",
+ [TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+ addNewTestCase( new Date((new Date(TZ_ADJUST)).toString()),
+ "new Date(\""+ (new Date(TZ_ADJUST)).toString()+"\")",
+ [TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+
+ addNewTestCase( new Date( (new Date(TZ_ADJUST)).toUTCString() ),
+ "new Date(\""+ (new Date(TZ_ADJUST)).toUTCString()+"\")",
+ [TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+/*
+ // Dates around 2000
+
+ addNewTestCase( new Date(TIME_2000+TZ_ADJUST),
+ "new Date(" +(TIME_2000+TZ_ADJUST)+")",
+ [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date(TIME_2000),
+ "new Date(" +TIME_2000+")",
+ [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(TIME_2000+TZ_ADJUST)).toString()),
+ "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toString()+"\")",
+ [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date((new Date(TIME_2000)).toString()),
+ "new Date(\"" +(new Date(TIME_2000)).toString()+"\")",
+ [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
+
+// addNewTestCase( "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toLocaleString()+"\")", [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+// addNewTestCase( "new Date(\"" +(new Date(TIME_2000)).toLocaleString()+"\")", [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(TIME_2000+TZ_ADJUST)).toUTCString()),
+ "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toUTCString()+"\")",
+ [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(TIME_2000)).toUTCString()),
+ "new Date(\"" +(new Date(TIME_2000)).toUTCString()+"\")",
+ [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
+
+ // Dates around Feb 29, 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
+ var PST_FEB_29_2000 = UTC_FEB_29_2000 + TZ_ADJUST;
+
+ addNewTestCase( new Date(UTC_FEB_29_2000),
+ "new Date("+UTC_FEB_29_2000+")",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+
+ addNewTestCase( new Date(PST_FEB_29_2000),
+ "new Date("+PST_FEB_29_2000+")",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toString() ),
+ "new Date(\""+(new Date(UTC_FEB_29_2000)).toString()+"\")",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toString() ),
+ "new Date(\""+(new Date(PST_FEB_29_2000)).toString()+"\")",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+// Parsing toLocaleString() is not guaranteed by ECMA.
+// addNewTestCase( "new Date(\""+(new Date(UTC_FEB_29_2000)).toLocaleString()+"\")", [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+// addNewTestCase( "new Date(\""+(new Date(PST_FEB_29_2000)).toLocaleString()+"\")", [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toGMTString() ),
+ "new Date(\""+(new Date(UTC_FEB_29_2000)).toGMTString()+"\")",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toGMTString() ),
+ "new Date(\""+(new Date(PST_FEB_29_2000)).toGMTString()+"\")",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+ // Dates around 1900
+
+ var PST_1900 = TIME_1900 + 8*msPerHour;
+
+ addNewTestCase( new Date( TIME_1900 ),
+ "new Date("+TIME_1900+")",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date(PST_1900),
+ "new Date("+PST_1900+")",
+ [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(TIME_1900)).toString() ),
+ "new Date(\""+(new Date(TIME_1900)).toString()+"\")",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(PST_1900)).toString() ),
+ "new Date(\""+(new Date(PST_1900 )).toString()+"\")",
+ [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(TIME_1900)).toUTCString() ),
+ "new Date(\""+(new Date(TIME_1900)).toUTCString()+"\")",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(PST_1900)).toUTCString() ),
+ "new Date(\""+(new Date(PST_1900 )).toUTCString()+"\")",
+ [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+// addNewTestCase( "new Date(\""+(new Date(TIME_1900)).toLocaleString()+"\")", [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+// addNewTestCase( "new Date(\""+(new Date(PST_1900 )).toLocaleString()+"\")", [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+*/
+/*
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ addNewTestCase( new Date(DST_START_1998-1),
+ "new Date("+(DST_START_1998-1)+")",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+
+ addNewTestCase( new Date(DST_START_1998),
+ "new Date("+DST_START_1998+")",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addNewTestCase ( new Date(DST_END_1998-1),
+ "new Date("+(DST_END_1998-1)+")",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+
+ addNewTestCase ( new Date(DST_END_1998),
+ "new Date("+DST_END_1998+")",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+*/
+}
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray, 'msMode');
+
+ item = testcases.length;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+}
+
+function test() {
+ for( tc = 0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = " +
+ testcases[tc].actual );
+ }
+ stopTest();
+
+ // all tests must return a boolean value
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-3.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-3.js
new file mode 100644
index 0000000..aaf430d
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-3.js
@@ -0,0 +1,253 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.3.8.js
+ ECMA Section: 15.9.3.8 The Date Constructor
+ new Date( value )
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial valiue of Date.prototype.
+
+ The [[Class]] property of the newly constructed object is
+ set to "Date".
+
+ The [[Value]] property of the newly constructed object is
+ set as follows:
+
+ 1. Call ToPrimitive(value)
+ 2. If Type( Result(1) ) is String, then go to step 5.
+ 3. Let V be ToNumber( Result(1) ).
+ 4. Set the [[Value]] property of the newly constructed
+ object to TimeClip(V) and return.
+ 5. Parse Result(1) as a date, in exactly the same manner
+ as for the parse method. Let V be the time value for
+ this date.
+ 6. Go to step 4.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
+
+*/
+
+ var VERSION = "ECMA_1";
+ startTest();
+ var SECTION = "15.9.3.8";
+ var TYPEOF = "object";
+
+ var TIME = 0;
+ var UTC_YEAR = 1;
+ var UTC_MONTH = 2;
+ var UTC_DATE = 3;
+ var UTC_DAY = 4;
+ var UTC_HOURS = 5;
+ var UTC_MINUTES = 6;
+ var UTC_SECONDS = 7;
+ var UTC_MS = 8;
+
+ var YEAR = 9;
+ var MONTH = 10;
+ var DATE = 11;
+ var DAY = 12;
+ var HOURS = 13;
+ var MINUTES = 14;
+ var SECONDS = 15;
+ var MS = 16;
+
+
+// for TCMS, the testcases array must be global.
+ var tc= 0;
+ var TITLE = "Date constructor: new Date( value )";
+ var SECTION = "15.9.3.8";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION +" " + TITLE );
+
+ testcases = new Array();
+ getTestCases();
+
+// all tests must call a function that returns a boolean value
+ test();
+
+function getTestCases( ) {
+ // all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
+ var TZ_ADJUST = -TZ_PST * msPerHour;
+
+
+ // Dates around 2000
+
+ addNewTestCase( new Date(TIME_2000+TZ_ADJUST),
+ "new Date(" +(TIME_2000+TZ_ADJUST)+")",
+ [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date(TIME_2000),
+ "new Date(" +TIME_2000+")",
+ [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(TIME_2000+TZ_ADJUST)).toString()),
+ "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toString()+"\")",
+ [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date((new Date(TIME_2000)).toString()),
+ "new Date(\"" +(new Date(TIME_2000)).toString()+"\")",
+ [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
+
+
+ addNewTestCase( new Date( (new Date(TIME_2000+TZ_ADJUST)).toUTCString()),
+ "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toUTCString()+"\")",
+ [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(TIME_2000)).toUTCString()),
+ "new Date(\"" +(new Date(TIME_2000)).toUTCString()+"\")",
+ [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
+/*
+ // Dates around Feb 29, 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
+ var PST_FEB_29_2000 = UTC_FEB_29_2000 + TZ_ADJUST;
+
+ addNewTestCase( new Date(UTC_FEB_29_2000),
+ "new Date("+UTC_FEB_29_2000+")",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+
+ addNewTestCase( new Date(PST_FEB_29_2000),
+ "new Date("+PST_FEB_29_2000+")",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toString() ),
+ "new Date(\""+(new Date(UTC_FEB_29_2000)).toString()+"\")",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toString() ),
+ "new Date(\""+(new Date(PST_FEB_29_2000)).toString()+"\")",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+// Parsing toLocaleString() is not guaranteed by ECMA.
+// addNewTestCase( "new Date(\""+(new Date(UTC_FEB_29_2000)).toLocaleString()+"\")", [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+// addNewTestCase( "new Date(\""+(new Date(PST_FEB_29_2000)).toLocaleString()+"\")", [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toGMTString() ),
+ "new Date(\""+(new Date(UTC_FEB_29_2000)).toGMTString()+"\")",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toGMTString() ),
+ "new Date(\""+(new Date(PST_FEB_29_2000)).toGMTString()+"\")",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+ // Dates around 1900
+
+ var PST_1900 = TIME_1900 + 8*msPerHour;
+
+ addNewTestCase( new Date( TIME_1900 ),
+ "new Date("+TIME_1900+")",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date(PST_1900),
+ "new Date("+PST_1900+")",
+ [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(TIME_1900)).toString() ),
+ "new Date(\""+(new Date(TIME_1900)).toString()+"\")",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(PST_1900)).toString() ),
+ "new Date(\""+(new Date(PST_1900 )).toString()+"\")",
+ [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(TIME_1900)).toUTCString() ),
+ "new Date(\""+(new Date(TIME_1900)).toUTCString()+"\")",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(PST_1900)).toUTCString() ),
+ "new Date(\""+(new Date(PST_1900 )).toUTCString()+"\")",
+ [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+// addNewTestCase( "new Date(\""+(new Date(TIME_1900)).toLocaleString()+"\")", [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+// addNewTestCase( "new Date(\""+(new Date(PST_1900 )).toLocaleString()+"\")", [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+*/
+/*
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ addNewTestCase( new Date(DST_START_1998-1),
+ "new Date("+(DST_START_1998-1)+")",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+
+ addNewTestCase( new Date(DST_START_1998),
+ "new Date("+DST_START_1998+")",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addNewTestCase ( new Date(DST_END_1998-1),
+ "new Date("+(DST_END_1998-1)+")",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+
+ addNewTestCase ( new Date(DST_END_1998),
+ "new Date("+DST_END_1998+")",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+*/
+}
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray, 'msMode');
+
+ item = testcases.length;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+}
+
+function test() {
+ for( tc = 0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = " +
+ testcases[tc].actual );
+ }
+ stopTest();
+
+ // all tests must return a boolean value
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-4.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-4.js
new file mode 100644
index 0000000..c25bda8
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-4.js
@@ -0,0 +1,222 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.3.8.js
+ ECMA Section: 15.9.3.8 The Date Constructor
+ new Date( value )
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial valiue of Date.prototype.
+
+ The [[Class]] property of the newly constructed object is
+ set to "Date".
+
+ The [[Value]] property of the newly constructed object is
+ set as follows:
+
+ 1. Call ToPrimitive(value)
+ 2. If Type( Result(1) ) is String, then go to step 5.
+ 3. Let V be ToNumber( Result(1) ).
+ 4. Set the [[Value]] property of the newly constructed
+ object to TimeClip(V) and return.
+ 5. Parse Result(1) as a date, in exactly the same manner
+ as for the parse method. Let V be the time value for
+ this date.
+ 6. Go to step 4.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
+
+*/
+
+ var VERSION = "ECMA_1";
+ startTest();
+ var SECTION = "15.9.3.8";
+ var TYPEOF = "object";
+
+ var TIME = 0;
+ var UTC_YEAR = 1;
+ var UTC_MONTH = 2;
+ var UTC_DATE = 3;
+ var UTC_DAY = 4;
+ var UTC_HOURS = 5;
+ var UTC_MINUTES = 6;
+ var UTC_SECONDS = 7;
+ var UTC_MS = 8;
+
+ var YEAR = 9;
+ var MONTH = 10;
+ var DATE = 11;
+ var DAY = 12;
+ var HOURS = 13;
+ var MINUTES = 14;
+ var SECONDS = 15;
+ var MS = 16;
+
+
+// for TCMS, the testcases array must be global.
+ var tc= 0;
+ var TITLE = "Date constructor: new Date( value )";
+ var SECTION = "15.9.3.8";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION +" " + TITLE );
+
+ testcases = new Array();
+ getTestCases();
+
+// all tests must call a function that returns a boolean value
+ test();
+
+function getTestCases( ) {
+ // all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
+ var TZ_ADJUST = -TZ_PST * msPerHour;
+
+ // Dates around Feb 29, 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
+ var PST_FEB_29_2000 = UTC_FEB_29_2000 + TZ_ADJUST;
+
+ addNewTestCase( new Date(UTC_FEB_29_2000),
+ "new Date("+UTC_FEB_29_2000+")",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+
+ addNewTestCase( new Date(PST_FEB_29_2000),
+ "new Date("+PST_FEB_29_2000+")",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toString() ),
+ "new Date(\""+(new Date(UTC_FEB_29_2000)).toString()+"\")",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toString() ),
+ "new Date(\""+(new Date(PST_FEB_29_2000)).toString()+"\")",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+
+ addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toGMTString() ),
+ "new Date(\""+(new Date(UTC_FEB_29_2000)).toGMTString()+"\")",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toGMTString() ),
+ "new Date(\""+(new Date(PST_FEB_29_2000)).toGMTString()+"\")",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+/*
+ // Dates around 1900
+
+ var PST_1900 = TIME_1900 + 8*msPerHour;
+
+ addNewTestCase( new Date( TIME_1900 ),
+ "new Date("+TIME_1900+")",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date(PST_1900),
+ "new Date("+PST_1900+")",
+ [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(TIME_1900)).toString() ),
+ "new Date(\""+(new Date(TIME_1900)).toString()+"\")",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(PST_1900)).toString() ),
+ "new Date(\""+(new Date(PST_1900 )).toString()+"\")",
+ [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(TIME_1900)).toUTCString() ),
+ "new Date(\""+(new Date(TIME_1900)).toUTCString()+"\")",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(PST_1900)).toUTCString() ),
+ "new Date(\""+(new Date(PST_1900 )).toUTCString()+"\")",
+ [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+// addNewTestCase( "new Date(\""+(new Date(TIME_1900)).toLocaleString()+"\")", [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+// addNewTestCase( "new Date(\""+(new Date(PST_1900 )).toLocaleString()+"\")", [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+*/
+/*
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ addNewTestCase( new Date(DST_START_1998-1),
+ "new Date("+(DST_START_1998-1)+")",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+
+ addNewTestCase( new Date(DST_START_1998),
+ "new Date("+DST_START_1998+")",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addNewTestCase ( new Date(DST_END_1998-1),
+ "new Date("+(DST_END_1998-1)+")",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+
+ addNewTestCase ( new Date(DST_END_1998),
+ "new Date("+DST_END_1998+")",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+*/
+}
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray, 'msMode');
+
+ item = testcases.length;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+}
+
+function test() {
+ for( tc = 0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = " +
+ testcases[tc].actual );
+ }
+ stopTest();
+
+ // all tests must return a boolean value
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-5.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-5.js
new file mode 100644
index 0000000..00b3b47
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.3.8-5.js
@@ -0,0 +1,190 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.3.8.js
+ ECMA Section: 15.9.3.8 The Date Constructor
+ new Date( value )
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial valiue of Date.prototype.
+
+ The [[Class]] property of the newly constructed object is
+ set to "Date".
+
+ The [[Value]] property of the newly constructed object is
+ set as follows:
+
+ 1. Call ToPrimitive(value)
+ 2. If Type( Result(1) ) is String, then go to step 5.
+ 3. Let V be ToNumber( Result(1) ).
+ 4. Set the [[Value]] property of the newly constructed
+ object to TimeClip(V) and return.
+ 5. Parse Result(1) as a date, in exactly the same manner
+ as for the parse method. Let V be the time value for
+ this date.
+ 6. Go to step 4.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
+
+*/
+
+ var VERSION = "ECMA_1";
+ startTest();
+ var SECTION = "15.9.3.8";
+ var TYPEOF = "object";
+
+ var TIME = 0;
+ var UTC_YEAR = 1;
+ var UTC_MONTH = 2;
+ var UTC_DATE = 3;
+ var UTC_DAY = 4;
+ var UTC_HOURS = 5;
+ var UTC_MINUTES = 6;
+ var UTC_SECONDS = 7;
+ var UTC_MS = 8;
+
+ var YEAR = 9;
+ var MONTH = 10;
+ var DATE = 11;
+ var DAY = 12;
+ var HOURS = 13;
+ var MINUTES = 14;
+ var SECONDS = 15;
+ var MS = 16;
+
+
+// for TCMS, the testcases array must be global.
+ var tc= 0;
+ var TITLE = "Date constructor: new Date( value )";
+ var SECTION = "15.9.3.8";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION +" " + TITLE );
+
+ testcases = new Array();
+ getTestCases();
+
+// all tests must call a function that returns a boolean value
+ test();
+
+function getTestCases( ) {
+ // all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
+ var TZ_ADJUST = -TZ_PST * msPerHour;
+
+
+ // Dates around 1900
+
+ var PST_1900 = TIME_1900 + 8*msPerHour;
+
+ addNewTestCase( new Date( TIME_1900 ),
+ "new Date("+TIME_1900+")",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date(PST_1900),
+ "new Date("+PST_1900+")",
+ [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(TIME_1900)).toString() ),
+ "new Date(\""+(new Date(TIME_1900)).toString()+"\")",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(PST_1900)).toString() ),
+ "new Date(\""+(new Date(PST_1900 )).toString()+"\")",
+ [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(TIME_1900)).toUTCString() ),
+ "new Date(\""+(new Date(TIME_1900)).toUTCString()+"\")",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date( (new Date(PST_1900)).toUTCString() ),
+ "new Date(\""+(new Date(PST_1900 )).toUTCString()+"\")",
+ [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+/*
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ addNewTestCase( new Date(DST_START_1998-1),
+ "new Date("+(DST_START_1998-1)+")",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+
+ addNewTestCase( new Date(DST_START_1998),
+ "new Date("+DST_START_1998+")",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addNewTestCase ( new Date(DST_END_1998-1),
+ "new Date("+(DST_END_1998-1)+")",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+
+ addNewTestCase ( new Date(DST_END_1998),
+ "new Date("+DST_END_1998+")",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+*/
+}
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray, 'msMode');
+
+ item = testcases.length;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+}
+
+function test() {
+ for( tc = 0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = " +
+ testcases[tc].actual );
+ }
+ stopTest();
+
+ // all tests must return a boolean value
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.4.2-1.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.4.2-1.js
new file mode 100644
index 0000000..2fa4cbf
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.4.2-1.js
@@ -0,0 +1,63 @@
+/*
+* The contents of this file are subject to the Netscape Public
+* License Version 1.1 (the "License"); you may not use this file
+* except in compliance with the License. You may obtain a copy of
+* the License at http://www.mozilla.org/NPL/
+*
+* Software distributed under the License is distributed on an "AS
+* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* rights and limitations under the License.
+*
+* The Original Code is mozilla.org code.
+*
+* The Initial Developer of the Original Code is Netscape
+* Communications Corporation. Portions created by Netscape are
+* Copyright (C) 1998 Netscape Communications Corporation. All
+* Rights Reserved.
+*
+* Contributor(s):
+*/
+
+/**
+ * File Name:
+ * Reference: http://bugzilla.mozilla.org/show_bug.cgi?id=4088
+ * Description: Date parsing gets 12:30 AM wrong.
+ * New behavior:
+ * js> d = new Date('1/1/1999 13:30 AM')
+ * Invalid Date
+ * js> d = new Date('1/1/1999 13:30 PM')
+ * Invalid Date
+ * js> d = new Date('1/1/1999 12:30 AM')
+ * Fri Jan 01 00:30:00 GMT-0800 (PST) 1999
+ * js> d = new Date('1/1/1999 12:30 PM')
+ * Fri Jan 01 12:30:00 GMT-0800 (PST) 1999
+ * Author: christine@netscape.com
+ */
+
+ var SECTION = "15.9.4.2-1"; // provide a document reference (ie, ECMA section)
+ var VERSION = "ECMA"; // Version of JavaScript or ECMA
+ var TITLE = "Regression Test for Date.parse"; // Provide ECMA section title or a description
+ var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=4088"; // Provide URL to bugsplat or bugzilla report
+
+ startTest(); // leave this alone
+
+ AddTestCase( "new Date('1/1/1999 12:30 AM').toString()",
+ new Date(1999,0,1,0,30).toString(),
+ new Date('1/1/1999 12:30 AM').toString() );
+
+ AddTestCase( "new Date('1/1/1999 12:30 PM').toString()",
+ new Date( 1999,0,1,12,30 ).toString(),
+ new Date('1/1/1999 12:30 PM').toString() );
+
+ AddTestCase( "new Date('1/1/1999 13:30 AM')",
+ "Invalid Date",
+ new Date('1/1/1999 13:30 AM').toString() );
+
+
+ AddTestCase( "new Date('1/1/1999 13:30 PM')",
+ "Invalid Date",
+ new Date('1/1/1999 13:30 PM').toString() );
+
+ test(); // leave this alone. this executes the test cases and
+ // displays results.
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.4.2.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.4.2.js
new file mode 100644
index 0000000..5fd15ba
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.4.2.js
@@ -0,0 +1,213 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.4.2.js
+ ECMA Section: 15.9.4.2 Date.parse()
+ Description: The parse() function applies the to ToString() operator
+ to its argument and interprets the resulting string as
+ a date. It returns a number, the UTC time value
+ corresponding to the date.
+
+ The string may be interpreted as a local time, a UTC
+ time, or a time in some other time zone, depending on
+ the contents of the string.
+
+ (need to test strings containing stuff with the time
+ zone specified, and verify that parse() returns the
+ correct GMT time)
+
+ so for any Date object x, all of these things should
+ be equal:
+
+ value tested in function:
+ x.valueOf() test_value()
+ Date.parse(x.toString()) test_tostring()
+ Date.parse(x.toGMTString()) test_togmt()
+
+ Date.parse(x.toLocaleString()) is not required to
+ produce the same number value as the preceeding three
+ expressions. in general the value produced by
+ Date.parse is implementation dependent when given any
+ string value that could not be produced in that
+ implementation by the toString or toGMTString method.
+
+ value tested in function:
+ Date.parse( x.toLocaleString()) test_tolocale()
+
+ Author: christine@netscape.com
+ Date: 10 july 1997
+
+*/
+
+ var VERSION = "ECMA_1";
+ startTest();
+ var SECTION = "15.9.4.2";
+ var TITLE = "Date.parse()";
+
+ var TIME = 0;
+ var UTC_YEAR = 1;
+ var UTC_MONTH = 2;
+ var UTC_DATE = 3;
+ var UTC_DAY = 4;
+ var UTC_HOURS = 5;
+ var UTC_MINUTES = 6;
+ var UTC_SECONDS = 7;
+ var UTC_MS = 8;
+
+ var YEAR = 9;
+ var MONTH = 10;
+ var DATE = 11;
+ var DAY = 12;
+ var HOURS = 13;
+ var MINUTES = 14;
+ var SECONDS = 15;
+ var MS = 16;
+ var TYPEOF = "object";
+
+// for TCMS, the testcases array must be global.
+ writeHeaderToLog("15.9.4.2 Date.parse()" );
+ var tc= 0;
+ testcases = new Array();
+ getTestCases();
+
+// all tests must call a function that returns an array of TestCase objects.
+ test();
+
+function getTestCases() {
+
+ // Dates around 1970
+
+ addNewTestCase( new Date(0),
+ "new Date(0)",
+ [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+
+ addNewTestCase( new Date(-1),
+ "new Date(-1)",
+ [-1,1969,11,31,3,23,59,59,999,1969,11,31,3,15,59,59,999] );
+ addNewTestCase( new Date(28799999),
+ "new Date(28799999)",
+ [28799999,1970,0,1,4,7,59,59,999,1969,11,31,3,23,59,59,999] );
+ addNewTestCase( new Date(28800000),
+ "new Date(28800000)",
+ [28800000,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+ // Dates around 2000
+
+ addNewTestCase( new Date(946684799999),
+ "new Date(946684799999)",
+ [946684799999,1999,11,31,5,23,59,59,999,1999,11,31,5,15,59,59,999] );
+ addNewTestCase( new Date(946713599999),
+ "new Date(946713599999)",
+ [946713599999,2000,0,1,6,7,59,59,999,1999,11,31,5,23,59,59,999] );
+ addNewTestCase( new Date(946684800000),
+ "new Date(946684800000)",
+ [946684800000,2000,0,1,6,0,0,0,0,1999,11,31,5, 16,0,0,0] );
+ addNewTestCase( new Date(946713600000),
+ "new Date(946713600000)",
+ [946713600000,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+
+ // Dates around 1900
+
+ addNewTestCase( new Date(-2208988800000),
+ "new Date(-2208988800000)",
+ [-2208988800000,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+ addNewTestCase( new Date(-2208988800001),
+ "new Date(-2208988800001)",
+ [-2208988800001,1899,11,31,0,23,59,59,999,1899,11,31,0,15,59,59,999] );
+
+ addNewTestCase( new Date(-2208960000001),
+ "new Date(-2208960000001)",
+ [-2208960000001,1900,0,1,1,7,59,59,0,1899,11,31,0,23,59,59,999] );
+ addNewTestCase( new Date(-2208960000000),
+ "new Date(-2208960000000)",
+ [-2208960000000,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+ addNewTestCase( new Date(-2208959999999),
+ "new Date(-2208959999999)",
+ [-2208959999999,1900,0,1,1,8,0,0,1,1900,0,1,1,0,0,0,1] );
+
+ // Dates around Feb 29, 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
+ var PST_FEB_29_2000 = UTC_FEB_29_2000 + 8*msPerHour;
+ addNewTestCase( new Date(UTC_FEB_29_2000),
+ "new Date(" + UTC_FEB_29_2000 +")",
+ [UTC_FEB_29_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
+ addNewTestCase( new Date(PST_FEB_29_2000),
+ "new Date(" + PST_FEB_29_2000 +")",
+ [PST_FEB_29_2000,2000,0,1,6,8.0,0,0,2000,0,1,6,0,0,0,0]);
+
+ // Dates around Jan 1 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+ TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004);
+ var PST_JAN_1_2005 = UTC_JAN_1_2005 + 8*msPerHour;
+
+ addNewTestCase( new Date(UTC_JAN_1_2005),
+ "new Date("+ UTC_JAN_1_2005 +")",
+ [UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
+ addNewTestCase( new Date(PST_JAN_1_2005),
+ "new Date("+ PST_JAN_1_2005 +")",
+ [PST_JAN_1_2005,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
+
+}
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ DateCase = DateCase;
+
+ item = testcases.length;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+ testcases[item++] = new TestCase( SECTION, "Date.parse(" + DateCase.toString() +")", Math.floor(ResultArray[TIME]/1000)*1000, Date.parse(DateCase.toString()) );
+ testcases[item++] = new TestCase( SECTION, "Date.parse(" + DateCase.toGMTString() +")", Math.floor(ResultArray[TIME]/1000)*1000, Date.parse(DateCase.toGMTString()) );
+/*
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() z inutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+*/
+}
+function test() {
+ for( tc = 0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = " +
+ testcases[tc].actual );
+ }
+ stopTest();
+
+ // all tests must return an array of TestCase objects
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.4.3.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.4.3.js
new file mode 100644
index 0000000..e56f971
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.4.3.js
@@ -0,0 +1,209 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+
+
+ var testcases = new Array();
+ var SECTION = "15.9.4.3";
+ var TITLE = "Date.UTC( year, month, date, hours, minutes, seconds, ms )";
+
+ getTestCases();
+ test();
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+
+function utc( year, month, date, hours, minutes, seconds, ms ) {
+ d = new MyDate();
+ d.year = Number(year);
+
+ if (month)
+ d.month = Number(month);
+ if (date)
+ d.date = Number(date);
+ if (hours)
+ d.hours = Number(hours);
+ if (minutes)
+ d.minutes = Number(minutes);
+ if (seconds)
+ d.seconds = Number(seconds);
+ if (ms)
+ d.ms = Number(ms);
+
+ if ( isNaN(d.year) && 0 <= ToInteger(d.year) && d.year <= 99 ) {
+ d.year = 1900 + ToInteger(d.year);
+ }
+
+ if (isNaN(month) || isNaN(year) || isNaN(date) || isNaN(hours) ||
+ isNaN(minutes) || isNaN(seconds) || isNaN(ms) ) {
+ d.year = Number.NaN;
+ d.month = Number.NaN;
+ d.date = Number.NaN;
+ d.hours = Number.NaN;
+ d.minutes = Number.NaN;
+ d.seconds = Number.NaN;
+ d.ms = Number.NaN;
+ d.value = Number.NaN;
+ d.time = Number.NaN;
+ d.day =Number.NaN;
+ return d;
+ }
+
+ d.day = MakeDay( d.year, d.month, d.date );
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = (TimeClip( MakeDate(d.day,d.time)));
+
+ return d;
+}
+
+function UTCTime( t ) {
+ sign = ( t < 0 ) ? -1 : 1;
+ return ( (t +(TZ_DIFF*msPerHour)) );
+}
+
+function getTestCases() {
+
+ // Dates around 1970
+
+ addNewTestCase( Date.UTC( 1970,0,1,0,0,0,0),
+ "Date.UTC( 1970,0,1,0,0,0,0)",
+ utc(1970,0,1,0,0,0,0) );
+
+ addNewTestCase( Date.UTC( 1969,11,31,23,59,59,999),
+ "Date.UTC( 1969,11,31,23,59,59,999)",
+ utc(1969,11,31,23,59,59,999) );
+ addNewTestCase( Date.UTC( 1972,1,29,23,59,59,999),
+ "Date.UTC( 1972,1,29,23,59,59,999)",
+ utc(1972,1,29,23,59,59,999) );
+ addNewTestCase( Date.UTC( 1972,2,1,23,59,59,999),
+ "Date.UTC( 1972,2,1,23,59,59,999)",
+ utc(1972,2,1,23,59,59,999) );
+ addNewTestCase( Date.UTC( 1968,1,29,23,59,59,999),
+ "Date.UTC( 1968,1,29,23,59,59,999)",
+ utc(1968,1,29,23,59,59,999) );
+ addNewTestCase( Date.UTC( 1968,2,1,23,59,59,999),
+ "Date.UTC( 1968,2,1,23,59,59,999)",
+ utc(1968,2,1,23,59,59,999) );
+ addNewTestCase( Date.UTC( 1969,0,1,0,0,0,0),
+ "Date.UTC( 1969,0,1,0,0,0,0)",
+ utc(1969,0,1,0,0,0,0) );
+ addNewTestCase( Date.UTC( 1969,11,31,23,59,59,1000),
+ "Date.UTC( 1969,11,31,23,59,59,1000)",
+ utc(1970,0,1,0,0,0,0) );
+ addNewTestCase( Date.UTC( 1969,Number.NaN,31,23,59,59,999),
+ "Date.UTC( 1969,Number.NaN,31,23,59,59,999)",
+ utc(1969,Number.NaN,31,23,59,59,999) );
+
+ // Dates around 2000
+
+ addNewTestCase( Date.UTC( 1999,11,31,23,59,59,999),
+ "Date.UTC( 1999,11,31,23,59,59,999)",
+ utc(1999,11,31,23,59,59,999) );
+ addNewTestCase( Date.UTC( 2000,0,1,0,0,0,0),
+ "Date.UTC( 2000,0,1,0,0,0,0)",
+ utc(2000,0,1,0,0,0,0) );
+
+ // Dates around 1900
+ addNewTestCase( Date.UTC( 1899,11,31,23,59,59,999),
+ "Date.UTC( 1899,11,31,23,59,59,999)",
+ utc(1899,11,31,23,59,59,999) );
+ addNewTestCase( Date.UTC( 1900,0,1,0,0,0,0),
+ "Date.UTC( 1900,0,1,0,0,0,0)",
+ utc(1900,0,1,0,0,0,0) );
+ addNewTestCase( Date.UTC( 1973,0,1,0,0,0,0),
+ "Date.UTC( 1973,0,1,0,0,0,0)",
+ utc(1973,0,1,0,0,0,0) );
+ addNewTestCase( Date.UTC( 1776,6,4,12,36,13,111),
+ "Date.UTC( 1776,6,4,12,36,13,111)",
+ utc(1776,6,4,12,36,13,111) );
+ addNewTestCase( Date.UTC( 2525,9,18,15,30,1,123),
+ "Date.UTC( 2525,9,18,15,30,1,123)",
+ utc(2525,9,18,15,30,1,123) );
+
+ // Dates around 29 Feb 2000
+
+ addNewTestCase( Date.UTC( 2000,1,29,0,0,0,0 ),
+ "Date.UTC( 2000,1,29,0,0,0,0 )",
+ utc(2000,1,29,0,0,0,0) );
+ addNewTestCase( Date.UTC( 2000,1,29,8,0,0,0 ),
+ "Date.UTC( 2000,1,29,8,0,0,0 )",
+ utc(2000,1,29,8,0,0,0) );
+
+ // Dates around 1 Jan 2005
+
+ addNewTestCase( Date.UTC( 2005,0,1,0,0,0,0 ),
+ "Date.UTC( 2005,0,1,0,0,0,0 )",
+ utc(2005,0,1,0,0,0,0) );
+ addNewTestCase( Date.UTC( 2004,11,31,16,0,0,0 ),
+ "Date.UTC( 2004,11,31,16,0,0,0 )",
+ utc(2004,11,31,16,0,0,0) );
+}
+
+function addNewTestCase( DateCase, DateString, ExpectDate) {
+ DateCase = DateCase;
+
+ item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString, ExpectDate.value, DateCase );
+ testcases[item++] = new TestCase( SECTION, DateString, ExpectDate.value, DateCase );
+/*
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ExpectDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ExpectDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ExpectDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ExpectDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ExpectDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ExpectDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ExpectDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ExpectDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ExpectDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ExpectDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ExpectDate.date, DateCase.getDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ExpectDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ExpectDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ExpectDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ExpectDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ExpectDate.ms, DateCase.getMilliseconds() );
+*/
+}
+function test() {
+ for( tc=0; tc < testcases.length; tc++ ) {
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = " +
+ testcases[tc].actual );
+ }
+
+ stopTest();
+ return testcases;
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.1.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.1.js
new file mode 100644
index 0000000..d605896
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.1.js
@@ -0,0 +1,59 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.1.js
+ ECMA Section: 15.9.5.1 Date.prototype.constructor
+ Description:
+ The initial value of Date.prototype.constructor is the built-in Date
+ constructor.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.constructor";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.constructor == Date",
+ true,
+ Date.prototype.constructor == Date );
+ test();
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-1.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-1.js
new file mode 100644
index 0000000..f887725
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-1.js
@@ -0,0 +1,111 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.10";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ // some daylight savings time cases
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addTestCase( now );
+/*
+ addTestCase( TIME_YEAR_0 );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+ addTestCase( DST_START_1998 );
+ addTestCase( DST_START_1998-1 );
+ addTestCase( DST_START_1998+1 );
+ addTestCase( DST_END_1998 );
+ addTestCase( DST_END_1998-1 );
+ addTestCase( DST_END_1998+1 );
+*/
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+ test();
+function addTestCase( t ) {
+ for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDate()",
+ DateFromTime(LocalTime(t)),
+ (new Date(t)).getDate() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-10.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-10.js
new file mode 100644
index 0000000..1d8060d
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-10.js
@@ -0,0 +1,102 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.10";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ // some daylight savings time cases
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addTestCase( DST_START_1998+1 );
+/*
+ addTestCase( DST_END_1998 );
+ addTestCase( DST_END_1998-1 );
+ addTestCase( DST_END_1998+1 );
+*/
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+ test();
+function addTestCase( t ) {
+ for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDate()",
+ DateFromTime(LocalTime(t)),
+ (new Date(t)).getDate() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-11.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-11.js
new file mode 100644
index 0000000..752b114
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-11.js
@@ -0,0 +1,101 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.10";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ // some daylight savings time cases
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addTestCase( DST_END_1998 );
+/*
+ addTestCase( DST_END_1998-1 );
+ addTestCase( DST_END_1998+1 );
+*/
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+ test();
+function addTestCase( t ) {
+ for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDate()",
+ DateFromTime(LocalTime(t)),
+ (new Date(t)).getDate() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-12.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-12.js
new file mode 100644
index 0000000..587b023
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-12.js
@@ -0,0 +1,100 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.10";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ // some daylight savings time cases
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addTestCase( DST_END_1998-1 );
+/*
+ addTestCase( DST_END_1998+1 );
+*/
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+ test();
+function addTestCase( t ) {
+ for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDate()",
+ DateFromTime(LocalTime(t)),
+ (new Date(t)).getDate() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-13.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-13.js
new file mode 100644
index 0000000..bf9027a
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-13.js
@@ -0,0 +1,97 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.10";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ // some daylight savings time cases
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addTestCase( DST_END_1998+1 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+ test();
+function addTestCase( t ) {
+ for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDate()",
+ DateFromTime(LocalTime(t)),
+ (new Date(t)).getDate() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-2.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-2.js
new file mode 100644
index 0000000..a775643
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-2.js
@@ -0,0 +1,110 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.10";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ // some daylight savings time cases
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addTestCase( TIME_YEAR_0 );
+/*
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+ addTestCase( DST_START_1998 );
+ addTestCase( DST_START_1998-1 );
+ addTestCase( DST_START_1998+1 );
+ addTestCase( DST_END_1998 );
+ addTestCase( DST_END_1998-1 );
+ addTestCase( DST_END_1998+1 );
+*/
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+ test();
+function addTestCase( t ) {
+ for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDate()",
+ DateFromTime(LocalTime(t)),
+ (new Date(t)).getDate() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-3.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-3.js
new file mode 100644
index 0000000..56fee4b
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-3.js
@@ -0,0 +1,109 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.10";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ // some daylight savings time cases
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addTestCase( TIME_1970 );
+/*
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+ addTestCase( DST_START_1998 );
+ addTestCase( DST_START_1998-1 );
+ addTestCase( DST_START_1998+1 );
+ addTestCase( DST_END_1998 );
+ addTestCase( DST_END_1998-1 );
+ addTestCase( DST_END_1998+1 );
+*/
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+ test();
+function addTestCase( t ) {
+ for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDate()",
+ DateFromTime(LocalTime(t)),
+ (new Date(t)).getDate() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-4.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-4.js
new file mode 100644
index 0000000..1f22d11
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-4.js
@@ -0,0 +1,107 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.10";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ // some daylight savings time cases
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addTestCase( TIME_1900 );
+/*
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+ addTestCase( DST_START_1998 );
+ addTestCase( DST_START_1998-1 );
+ addTestCase( DST_START_1998+1 );
+ addTestCase( DST_END_1998 );
+ addTestCase( DST_END_1998-1 );
+ addTestCase( DST_END_1998+1 );
+*/
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+ test();
+function addTestCase( t ) {
+ for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDate()",
+ DateFromTime(LocalTime(t)),
+ (new Date(t)).getDate() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-5.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-5.js
new file mode 100644
index 0000000..4e7c80a
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-5.js
@@ -0,0 +1,107 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.10";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ // some daylight savings time cases
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addTestCase( TIME_2000 );
+/*
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+ addTestCase( DST_START_1998 );
+ addTestCase( DST_START_1998-1 );
+ addTestCase( DST_START_1998+1 );
+ addTestCase( DST_END_1998 );
+ addTestCase( DST_END_1998-1 );
+ addTestCase( DST_END_1998+1 );
+*/
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+ test();
+function addTestCase( t ) {
+ for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDate()",
+ DateFromTime(LocalTime(t)),
+ (new Date(t)).getDate() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-6.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-6.js
new file mode 100644
index 0000000..6408622
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-6.js
@@ -0,0 +1,106 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.10";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ // some daylight savings time cases
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addTestCase( UTC_FEB_29_2000 );
+/*
+ addTestCase( UTC_JAN_1_2005 );
+ addTestCase( DST_START_1998 );
+ addTestCase( DST_START_1998-1 );
+ addTestCase( DST_START_1998+1 );
+ addTestCase( DST_END_1998 );
+ addTestCase( DST_END_1998-1 );
+ addTestCase( DST_END_1998+1 );
+*/
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+ test();
+function addTestCase( t ) {
+ for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDate()",
+ DateFromTime(LocalTime(t)),
+ (new Date(t)).getDate() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-7.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-7.js
new file mode 100644
index 0000000..d1741e3
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-7.js
@@ -0,0 +1,105 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.10";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ // some daylight savings time cases
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addTestCase( UTC_JAN_1_2005 );
+/*
+ addTestCase( DST_START_1998 );
+ addTestCase( DST_START_1998-1 );
+ addTestCase( DST_START_1998+1 );
+ addTestCase( DST_END_1998 );
+ addTestCase( DST_END_1998-1 );
+ addTestCase( DST_END_1998+1 );
+*/
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+ test();
+function addTestCase( t ) {
+ for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDate()",
+ DateFromTime(LocalTime(t)),
+ (new Date(t)).getDate() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-8.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-8.js
new file mode 100644
index 0000000..3ef0398
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-8.js
@@ -0,0 +1,104 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.10";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ // some daylight savings time cases
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addTestCase( DST_START_1998 );
+/*
+ addTestCase( DST_START_1998-1 );
+ addTestCase( DST_START_1998+1 );
+ addTestCase( DST_END_1998 );
+ addTestCase( DST_END_1998-1 );
+ addTestCase( DST_END_1998+1 );
+*/
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+ test();
+function addTestCase( t ) {
+ for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDate()",
+ DateFromTime(LocalTime(t)),
+ (new Date(t)).getDate() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-9.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-9.js
new file mode 100644
index 0000000..1d8325c
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.10-9.js
@@ -0,0 +1,103 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.10";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ // some daylight savings time cases
+
+ var DST_START_1998 = UTC( GetSecondSundayInMarch(TimeFromYear(1998)) + 2*msPerHour )
+
+ var DST_END_1998 = UTC( GetFirstSundayInNovember(TimeFromYear(1998)) + 2*msPerHour );
+
+ addTestCase( DST_START_1998-1 );
+/*
+ addTestCase( DST_START_1998+1 );
+ addTestCase( DST_END_1998 );
+ addTestCase( DST_END_1998-1 );
+ addTestCase( DST_END_1998+1 );
+*/
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+ test();
+function addTestCase( t ) {
+ for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDate()",
+ DateFromTime(LocalTime(t)),
+ (new Date(t)).getDate() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-1.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-1.js
new file mode 100644
index 0000000..9b425e8
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-1.js
@@ -0,0 +1,99 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.11.js
+ ECMA Section: 15.9.5.11
+ Description: Date.prototype.getUTCDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 1.Return DateFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.11";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ addTestCase( now );
+
+ test()
+
+function addTestCase( t ) {
+ for ( var m = 0; m < 11; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( var d = 0; d < TimeInMonth( m ); d += 7*msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDate()",
+ DateFromTime((t)),
+ (new Date(t)).getUTCDate() );
+/*
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getUTCDate()",
+ DateFromTime((t+1)),
+ (new Date(t+1)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getUTCDate()",
+ DateFromTime((t-1)),
+ (new Date(t-1)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t-TZ_ADJUST)),
+ (new Date(t-TZ_ADJUST)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t+TZ_ADJUST)),
+ (new Date(t+TZ_ADJUST)).getUTCDate() );
+*/
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-2.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-2.js
new file mode 100644
index 0000000..ed946ea
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-2.js
@@ -0,0 +1,96 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.11
+ ECMA Section: 15.9.5.11
+ Description: Date.prototype.getUTCDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 1.Return DateFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.11";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+
+ addTestCase( TIME_YEAR_0 );
+
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 11; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( var d = 0; d < TimeInMonth( m ); d += 7*msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDate()",
+ DateFromTime((t)),
+ (new Date(t)).getUTCDate() );
+/*
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getUTCDate()",
+ DateFromTime((t+1)),
+ (new Date(t+1)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getUTCDate()",
+ DateFromTime((t-1)),
+ (new Date(t-1)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t-TZ_ADJUST)),
+ (new Date(t-TZ_ADJUST)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t+TZ_ADJUST)),
+ (new Date(t+TZ_ADJUST)).getUTCDate() );
+*/
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-3.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-3.js
new file mode 100644
index 0000000..f596a83
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-3.js
@@ -0,0 +1,95 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.11.js
+ ECMA Section: 15.9.5.11
+ Description: Date.prototype.getUTCDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 1.Return DateFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.11";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ addTestCase( TIME_1970 );
+
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 11; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( var d = 0; d < TimeInMonth( m ); d += 7*msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDate()",
+ DateFromTime((t)),
+ (new Date(t)).getUTCDate() );
+/*
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getUTCDate()",
+ DateFromTime((t+1)),
+ (new Date(t+1)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getUTCDate()",
+ DateFromTime((t-1)),
+ (new Date(t-1)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t-TZ_ADJUST)),
+ (new Date(t-TZ_ADJUST)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t+TZ_ADJUST)),
+ (new Date(t+TZ_ADJUST)).getUTCDate() );
+*/
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-4.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-4.js
new file mode 100644
index 0000000..3b9d480
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-4.js
@@ -0,0 +1,95 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.11.js
+ ECMA Section: 15.9.5.11
+ Description: Date.prototype.getUTCDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 1.Return DateFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.11";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ addTestCase( TIME_1900 );
+
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 11; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( var d = 0; d < TimeInMonth( m ); d += 7* msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDate()",
+ DateFromTime((t)),
+ (new Date(t)).getUTCDate() );
+/*
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getUTCDate()",
+ DateFromTime((t+1)),
+ (new Date(t+1)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getUTCDate()",
+ DateFromTime((t-1)),
+ (new Date(t-1)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t-TZ_ADJUST)),
+ (new Date(t-TZ_ADJUST)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t+TZ_ADJUST)),
+ (new Date(t+TZ_ADJUST)).getUTCDate() );
+*/
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-5.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-5.js
new file mode 100644
index 0000000..d76f392
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-5.js
@@ -0,0 +1,95 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.11.js
+ ECMA Section: 15.9.5.11
+ Description: Date.prototype.getUTCDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 1.Return DateFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.11";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ addTestCase( TIME_2000 );
+
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 11; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( var d = 0; d < TimeInMonth( m ); d += 7*msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDate()",
+ DateFromTime((t)),
+ (new Date(t)).getUTCDate() );
+/*
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getUTCDate()",
+ DateFromTime((t+1)),
+ (new Date(t+1)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getUTCDate()",
+ DateFromTime((t-1)),
+ (new Date(t-1)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t-TZ_ADJUST)),
+ (new Date(t-TZ_ADJUST)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t+TZ_ADJUST)),
+ (new Date(t+TZ_ADJUST)).getUTCDate() );
+*/
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-6.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-6.js
new file mode 100644
index 0000000..7cb0509
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-6.js
@@ -0,0 +1,96 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.11.js
+ ECMA Section: 15.9.5.11
+ Description: Date.prototype.getUTCDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 1.Return DateFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.11";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ var UTC_FEB_29_2000 = TIME_2000 + ( 30 * msPerDay ) + ( 29 * msPerDay );
+
+ addTestCase( UTC_FEB_29_2000 );
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 11; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( var d = 0; d < TimeInMonth( m ); d += 7*msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDate()",
+ DateFromTime((t)),
+ (new Date(t)).getUTCDate() );
+/*
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getUTCDate()",
+ DateFromTime((t+1)),
+ (new Date(t+1)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getUTCDate()",
+ DateFromTime((t-1)),
+ (new Date(t-1)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t-TZ_ADJUST)),
+ (new Date(t-TZ_ADJUST)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t+TZ_ADJUST)),
+ (new Date(t+TZ_ADJUST)).getUTCDate() );
+*/
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-7.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-7.js
new file mode 100644
index 0000000..08eb7f6
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.11-7.js
@@ -0,0 +1,98 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.11.js
+ ECMA Section: 15.9.5.11
+ Description: Date.prototype.getUTCDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 1.Return DateFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.11";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCDate()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( UTC_JAN_1_2005 );
+
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 11; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( var d = 0; d < TimeInMonth( m ); d += 7*msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDate()",
+ DateFromTime((t)),
+ (new Date(t)).getUTCDate() );
+/*
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getUTCDate()",
+ DateFromTime((t+1)),
+ (new Date(t+1)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getUTCDate()",
+ DateFromTime((t-1)),
+ (new Date(t-1)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t-TZ_ADJUST)),
+ (new Date(t-TZ_ADJUST)).getUTCDate() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t+TZ_ADJUST)),
+ (new Date(t+TZ_ADJUST)).getUTCDate() );
+*/
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-1.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-1.js
new file mode 100644
index 0000000..437a809
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-1.js
@@ -0,0 +1,105 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.12.js
+ ECMA Section: 15.9.5.12
+ Description: Date.prototype.getDay
+
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return WeekDay(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.12";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDay()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( now );
+/*
+ addTestCase( TIME_YEAR_0 );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDay()",
+ NaN,
+ (new Date(NaN)).getDay() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDay.length",
+ 0,
+ Date.prototype.getDay.length );
+*/
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) {
+ t += d;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDay()",
+ WeekDay(LocalTime(t)),
+ (new Date(t)).getDay() );
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-2.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-2.js
new file mode 100644
index 0000000..dd58cb0
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-2.js
@@ -0,0 +1,104 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.12.js
+ ECMA Section: 15.9.5.12
+ Description: Date.prototype.getDay
+
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return WeekDay(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.12";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDay()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( TIME_YEAR_0 );
+/*
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDay()",
+ NaN,
+ (new Date(NaN)).getDay() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDay.length",
+ 0,
+ Date.prototype.getDay.length );
+*/
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) {
+ t += d;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDay()",
+ WeekDay(LocalTime(t)),
+ (new Date(t)).getDay() );
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-3.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-3.js
new file mode 100644
index 0000000..6212458
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-3.js
@@ -0,0 +1,103 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.12.js
+ ECMA Section: 15.9.5.12
+ Description: Date.prototype.getDay
+
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return WeekDay(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.12";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDay()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( TIME_1970 );
+/*
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDay()",
+ NaN,
+ (new Date(NaN)).getDay() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDay.length",
+ 0,
+ Date.prototype.getDay.length );
+*/
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) {
+ t += d;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDay()",
+ WeekDay(LocalTime(t)),
+ (new Date(t)).getDay() );
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-4.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-4.js
new file mode 100644
index 0000000..e7bde15
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-4.js
@@ -0,0 +1,102 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.12.js
+ ECMA Section: 15.9.5.12
+ Description: Date.prototype.getDay
+
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return WeekDay(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.12";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDay()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( TIME_1900 );
+/*
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDay()",
+ NaN,
+ (new Date(NaN)).getDay() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDay.length",
+ 0,
+ Date.prototype.getDay.length );
+*/
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) {
+ t += d;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDay()",
+ WeekDay(LocalTime(t)),
+ (new Date(t)).getDay() );
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-5.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-5.js
new file mode 100644
index 0000000..796187a
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-5.js
@@ -0,0 +1,101 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.12.js
+ ECMA Section: 15.9.5.12
+ Description: Date.prototype.getDay
+
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return WeekDay(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.12";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDay()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( TIME_2000 );
+/*
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDay()",
+ NaN,
+ (new Date(NaN)).getDay() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDay.length",
+ 0,
+ Date.prototype.getDay.length );
+*/
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) {
+ t += d;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDay()",
+ WeekDay(LocalTime(t)),
+ (new Date(t)).getDay() );
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-6.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-6.js
new file mode 100644
index 0000000..1aa0a1d
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-6.js
@@ -0,0 +1,100 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.12.js
+ ECMA Section: 15.9.5.12
+ Description: Date.prototype.getDay
+
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return WeekDay(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.12";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDay()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( UTC_FEB_29_2000 );
+/*
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDay()",
+ NaN,
+ (new Date(NaN)).getDay() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDay.length",
+ 0,
+ Date.prototype.getDay.length );
+*/
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) {
+ t += d;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDay()",
+ WeekDay(LocalTime(t)),
+ (new Date(t)).getDay() );
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-7.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-7.js
new file mode 100644
index 0000000..c638614
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-7.js
@@ -0,0 +1,98 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.12.js
+ ECMA Section: 15.9.5.12
+ Description: Date.prototype.getDay
+
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return WeekDay(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.12";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDay()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( UTC_JAN_1_2005 );
+/*
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDay()",
+ NaN,
+ (new Date(NaN)).getDay() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDay.length",
+ 0,
+ Date.prototype.getDay.length );
+*/
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) {
+ t += d;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDay()",
+ WeekDay(LocalTime(t)),
+ (new Date(t)).getDay() );
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-8.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-8.js
new file mode 100644
index 0000000..54260ca
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.12-8.js
@@ -0,0 +1,95 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.12
+ ECMA Section: 15.9.5.12
+ Description: Date.prototype.getDay
+
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return WeekDay(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.12";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getDay()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getDay()",
+ NaN,
+ (new Date(NaN)).getDay() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDay.length",
+ 0,
+ Date.prototype.getDay.length );
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) {
+ t += d;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDay()",
+ WeekDay(LocalTime(t)),
+ (new Date(t)).getDay() );
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-1.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-1.js
new file mode 100644
index 0000000..06bd92e
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-1.js
@@ -0,0 +1,78 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.13.js
+ ECMA Section: 15.9.5.13
+ Description: Date.prototype.getUTCDay
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return WeekDay(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.13";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCDay()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ addTestCase( now );
+
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*14 ) {
+ t += d;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDay()",
+ WeekDay((t)),
+ (new Date(t)).getUTCDay() );
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-2.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-2.js
new file mode 100644
index 0000000..bec562c
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-2.js
@@ -0,0 +1,75 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.13
+ ECMA Section: 15.9.5.13
+ Description: Date.prototype.getUTCDay
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return WeekDay(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.13";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCDay()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+
+ addTestCase( TIME_YEAR_0 );
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*14 ) {
+ t += d;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDay()",
+ WeekDay((t)),
+ (new Date(t)).getUTCDay() );
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-3.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-3.js
new file mode 100644
index 0000000..6124d86
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-3.js
@@ -0,0 +1,75 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.13.js
+ ECMA Section: 15.9.5.13
+ Description: Date.prototype.getUTCDay
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return WeekDay(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.13";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCDay()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ addTestCase( TIME_1970 );
+
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*14 ) {
+ t += d;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDay()",
+ WeekDay((t)),
+ (new Date(t)).getUTCDay() );
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-4.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-4.js
new file mode 100644
index 0000000..37fd989
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-4.js
@@ -0,0 +1,75 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.13.js
+ ECMA Section: 15.9.5.13
+ Description: Date.prototype.getUTCDay
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return WeekDay(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.13";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCDay()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ addTestCase( TIME_1900 );
+
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*14 ) {
+ t += d;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDay()",
+ WeekDay((t)),
+ (new Date(t)).getUTCDay() );
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-5.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-5.js
new file mode 100644
index 0000000..2af2e9e
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-5.js
@@ -0,0 +1,75 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.13.js
+ ECMA Section: 15.9.5.13
+ Description: Date.prototype.getUTCDay
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return WeekDay(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.13";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCDay()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ addTestCase( TIME_2000 );
+
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*14 ) {
+ t += d;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDay()",
+ WeekDay((t)),
+ (new Date(t)).getUTCDay() );
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-6.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-6.js
new file mode 100644
index 0000000..ce5e335
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-6.js
@@ -0,0 +1,78 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.13.js
+ ECMA Section: 15.9.5.13
+ Description: Date.prototype.getUTCDay
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return WeekDay(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.13";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCDay()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ addTestCase( UTC_FEB_29_2000 );
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*7 ) {
+ t += d;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDay()",
+ WeekDay((t)),
+ (new Date(t)).getUTCDay() );
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-7.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-7.js
new file mode 100644
index 0000000..2870bc5
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-7.js
@@ -0,0 +1,80 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.13.js
+ ECMA Section: 15.9.5.13
+ Description: Date.prototype.getUTCDay
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return WeekDay(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.13";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCDay()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( UTC_JAN_1_2005 );
+
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*7 ) {
+ t += d;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDay()",
+ WeekDay((t)),
+ (new Date(t)).getUTCDay() );
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-8.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-8.js
new file mode 100644
index 0000000..703483e
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.13-8.js
@@ -0,0 +1,95 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.13.js
+ ECMA Section: 15.9.5.13
+ Description: Date.prototype.getUTCDay
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return WeekDay(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.13";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCDay()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getUTCDay()",
+ NaN,
+ (new Date(NaN)).getUTCDay() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getUTCDay.length",
+ 0,
+ Date.prototype.getUTCDay.length );
+
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
+
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*7 ) {
+ t += d;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDay()",
+ WeekDay((t)),
+ (new Date(t)).getUTCDay() );
+ }
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.14.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.14.js
new file mode 100644
index 0000000..4d95ada
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.14.js
@@ -0,0 +1,96 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.14.js
+ ECMA Section: 15.9.5.14
+ Description: Date.prototype.getHours
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return HourFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.14";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getHours()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( now );
+ addTestCase( TIME_YEAR_0 );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getHours()",
+ NaN,
+ (new Date(NaN)).getHours() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getHours.length",
+ 0,
+ Date.prototype.getHours.length );
+ test();
+function addTestCase( t ) {
+ for ( h = 0; h < 24; h+=4 ) {
+ t += msPerHour;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getHours()",
+ HourFromTime((LocalTime(t))),
+ (new Date(t)).getHours() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.15.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.15.js
new file mode 100644
index 0000000..de4a132
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.15.js
@@ -0,0 +1,97 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.15.js
+ ECMA Section: 15.9.5.15
+ Description: Date.prototype.getUTCHours
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return HourFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.15";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCHours()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( now );
+ addTestCase( TIME_YEAR_0 );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getUTCHours()",
+ NaN,
+ (new Date(NaN)).getUTCHours() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getUTCHours.length",
+ 0,
+ Date.prototype.getUTCHours.length );
+ test();
+function addTestCase( t ) {
+ for ( h = 0; h < 24; h+=3 ) {
+ t += msPerHour;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCHours()",
+ HourFromTime((t)),
+ (new Date(t)).getUTCHours() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.16.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.16.js
new file mode 100644
index 0000000..2a02370
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.16.js
@@ -0,0 +1,96 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.16.js
+ ECMA Section: 15.9.5.16
+ Description: Date.prototype.getMinutes
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return MinFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.16";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getMinutes()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( now );
+ addTestCase( TIME_YEAR_0 );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getMinutes()",
+ NaN,
+ (new Date(NaN)).getMinutes() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getMinutes.length",
+ 0,
+ Date.prototype.getMinutes.length );
+ test();
+function addTestCase( t ) {
+ for ( m = 0; m <= 60; m+=10 ) {
+ t += msPerMinute;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getMinutes()",
+ MinFromTime((LocalTime(t))),
+ (new Date(t)).getMinutes() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.17.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.17.js
new file mode 100644
index 0000000..0afaa7b
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.17.js
@@ -0,0 +1,97 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.17.js
+ ECMA Section: 15.9.5.17
+ Description: Date.prototype.getUTCMinutes
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return MinFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.17";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCMinutes()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( now );
+ addTestCase( TIME_YEAR_0 );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getUTCMinutes()",
+ NaN,
+ (new Date(NaN)).getUTCMinutes() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getUTCMinutes.length",
+ 0,
+ Date.prototype.getUTCMinutes.length );
+ test();
+function addTestCase( t ) {
+ for ( m = 0; m <= 60; m+=10 ) {
+ t += msPerMinute;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCMinutes()",
+ MinFromTime(t),
+ (new Date(t)).getUTCMinutes() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.18.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.18.js
new file mode 100644
index 0000000..1537683
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.18.js
@@ -0,0 +1,97 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.18.js
+ ECMA Section: 15.9.5.18
+ Description: Date.prototype.getSeconds
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return SecFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.18";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getSeconds()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( now );
+ addTestCase( TIME_YEAR_0 );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getSeconds()",
+ NaN,
+ (new Date(NaN)).getSeconds() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getSeconds.length",
+ 0,
+ Date.prototype.getSeconds.length );
+ test();
+function addTestCase( t ) {
+ for ( m = 0; m <= 60; m+=10 ) {
+ t += 1000;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getSeconds()",
+ SecFromTime(LocalTime(t)),
+ (new Date(t)).getSeconds() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.19.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.19.js
new file mode 100644
index 0000000..91f2a0a
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.19.js
@@ -0,0 +1,97 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.19.js
+ ECMA Section: 15.9.5.19
+ Description: Date.prototype.getUTCSeconds
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return SecFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.19";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCSeconds()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( now );
+ addTestCase( TIME_YEAR_0 );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getUTCSeconds()",
+ NaN,
+ (new Date(NaN)).getUTCSeconds() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getUTCSeconds.length",
+ 0,
+ Date.prototype.getUTCSeconds.length );
+ test();
+function addTestCase( t ) {
+ for ( m = 0; m <= 60; m+=10 ) {
+ t += 1000;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCSeconds()",
+ SecFromTime(t),
+ (new Date(t)).getUTCSeconds() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.2-1.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.2-1.js
new file mode 100644
index 0000000..bb0fb02
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.2-1.js
@@ -0,0 +1,152 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.2.js
+ ECMA Section: 15.9.5.2 Date.prototype.toString
+ Description:
+ This function returns a string value. The contents of the string are
+ implementation dependent, but are intended to represent the Date in a
+ convenient, human-readable form in the current time zone.
+
+ The toString function is not generic; it generates a runtime error if its
+ this value is not a Date object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.toString";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.toString.length",
+ 0,
+ Date.prototype.toString.length );
+
+ var now = new Date();
+
+ // can't test the content of the string, but can verify that the string is
+ // parsable by Date.parse
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Math.abs(Date.parse(now.toString()) - now.valueOf()) < 1000",
+ true,
+ Math.abs(Date.parse(now.toString()) - now.valueOf()) < 1000 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "typeof now.toString()",
+ "string",
+ typeof now.toString() );
+ // 1970
+
+ TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date(0)).toString() )",
+ 0,
+ Date.parse( (new Date(0)).toString() ) )
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+TZ_ADJUST+")).toString() )",
+ TZ_ADJUST,
+ Date.parse( (new Date(TZ_ADJUST)).toString() ) )
+
+ // 1900
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+TIME_1900+")).toString() )",
+ TIME_1900,
+ Date.parse( (new Date(TIME_1900)).toString() ) )
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+TIME_1900 -TZ_ADJUST+")).toString() )",
+ TIME_1900 -TZ_ADJUST,
+ Date.parse( (new Date(TIME_1900 -TZ_ADJUST)).toString() ) )
+
+ // 2000
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+TIME_2000+")).toString() )",
+ TIME_2000,
+ Date.parse( (new Date(TIME_2000)).toString() ) )
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+TIME_2000 -TZ_ADJUST+")).toString() )",
+ TIME_2000 -TZ_ADJUST,
+ Date.parse( (new Date(TIME_2000 -TZ_ADJUST)).toString() ) )
+
+ // 29 Feb 2000
+
+ var UTC_29_FEB_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+UTC_29_FEB_2000+")).toString() )",
+ UTC_29_FEB_2000,
+ Date.parse( (new Date(UTC_29_FEB_2000)).toString() ) )
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+(UTC_29_FEB_2000-1000)+")).toString() )",
+ UTC_29_FEB_2000-1000,
+ Date.parse( (new Date(UTC_29_FEB_2000-1000)).toString() ) )
+
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+(UTC_29_FEB_2000-TZ_ADJUST)+")).toString() )",
+ UTC_29_FEB_2000-TZ_ADJUST,
+ Date.parse( (new Date(UTC_29_FEB_2000-TZ_ADJUST)).toString() ) )
+ // 2O05
+
+ var UTC_1_JAN_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+ TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004);
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+UTC_1_JAN_2005+")).toString() )",
+ UTC_1_JAN_2005,
+ Date.parse( (new Date(UTC_1_JAN_2005)).toString() ) )
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+(UTC_1_JAN_2005-1000)+")).toString() )",
+ UTC_1_JAN_2005-1000,
+ Date.parse( (new Date(UTC_1_JAN_2005-1000)).toString() ) )
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+(UTC_1_JAN_2005-TZ_ADJUST)+")).toString() )",
+ UTC_1_JAN_2005-TZ_ADJUST,
+ Date.parse( (new Date(UTC_1_JAN_2005-TZ_ADJUST)).toString() ) )
+
+ test();
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.2-2-n.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.2-2-n.js
new file mode 100644
index 0000000..8044dd8
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.2-2-n.js
@@ -0,0 +1,77 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.2-2.js
+ ECMA Section: 15.9.5.2 Date.prototype.toString
+ Description:
+ This function returns a string value. The contents of the string are
+ implementation dependent, but are intended to represent the Date in a
+ convenient, human-readable form in the current time zone.
+
+ The toString function is not generic; it generates a runtime error if its
+ this value is not a Date object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
+
+
+ This verifies that calling toString on an object that is not a string
+ generates a runtime error.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.2-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.toString";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var OBJ = new MyObject( new Date(0) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var OBJ = new MyObject( new Date(0) ); OBJ.toString()",
+ "error",
+ OBJ.toString() );
+ test();
+
+function MyObject( value ) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+ this.toString = Date.prototype.toString;
+ return this;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.2.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.2.js
new file mode 100644
index 0000000..bb0fb02
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.2.js
@@ -0,0 +1,152 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.2.js
+ ECMA Section: 15.9.5.2 Date.prototype.toString
+ Description:
+ This function returns a string value. The contents of the string are
+ implementation dependent, but are intended to represent the Date in a
+ convenient, human-readable form in the current time zone.
+
+ The toString function is not generic; it generates a runtime error if its
+ this value is not a Date object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.toString";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.toString.length",
+ 0,
+ Date.prototype.toString.length );
+
+ var now = new Date();
+
+ // can't test the content of the string, but can verify that the string is
+ // parsable by Date.parse
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Math.abs(Date.parse(now.toString()) - now.valueOf()) < 1000",
+ true,
+ Math.abs(Date.parse(now.toString()) - now.valueOf()) < 1000 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "typeof now.toString()",
+ "string",
+ typeof now.toString() );
+ // 1970
+
+ TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date(0)).toString() )",
+ 0,
+ Date.parse( (new Date(0)).toString() ) )
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+TZ_ADJUST+")).toString() )",
+ TZ_ADJUST,
+ Date.parse( (new Date(TZ_ADJUST)).toString() ) )
+
+ // 1900
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+TIME_1900+")).toString() )",
+ TIME_1900,
+ Date.parse( (new Date(TIME_1900)).toString() ) )
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+TIME_1900 -TZ_ADJUST+")).toString() )",
+ TIME_1900 -TZ_ADJUST,
+ Date.parse( (new Date(TIME_1900 -TZ_ADJUST)).toString() ) )
+
+ // 2000
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+TIME_2000+")).toString() )",
+ TIME_2000,
+ Date.parse( (new Date(TIME_2000)).toString() ) )
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+TIME_2000 -TZ_ADJUST+")).toString() )",
+ TIME_2000 -TZ_ADJUST,
+ Date.parse( (new Date(TIME_2000 -TZ_ADJUST)).toString() ) )
+
+ // 29 Feb 2000
+
+ var UTC_29_FEB_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+UTC_29_FEB_2000+")).toString() )",
+ UTC_29_FEB_2000,
+ Date.parse( (new Date(UTC_29_FEB_2000)).toString() ) )
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+(UTC_29_FEB_2000-1000)+")).toString() )",
+ UTC_29_FEB_2000-1000,
+ Date.parse( (new Date(UTC_29_FEB_2000-1000)).toString() ) )
+
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+(UTC_29_FEB_2000-TZ_ADJUST)+")).toString() )",
+ UTC_29_FEB_2000-TZ_ADJUST,
+ Date.parse( (new Date(UTC_29_FEB_2000-TZ_ADJUST)).toString() ) )
+ // 2O05
+
+ var UTC_1_JAN_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+ TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004);
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+UTC_1_JAN_2005+")).toString() )",
+ UTC_1_JAN_2005,
+ Date.parse( (new Date(UTC_1_JAN_2005)).toString() ) )
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+(UTC_1_JAN_2005-1000)+")).toString() )",
+ UTC_1_JAN_2005-1000,
+ Date.parse( (new Date(UTC_1_JAN_2005-1000)).toString() ) )
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.parse( (new Date("+(UTC_1_JAN_2005-TZ_ADJUST)+")).toString() )",
+ UTC_1_JAN_2005-TZ_ADJUST,
+ Date.parse( (new Date(UTC_1_JAN_2005-TZ_ADJUST)).toString() ) )
+
+ test();
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.20.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.20.js
new file mode 100644
index 0000000..3ef81f2
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.20.js
@@ -0,0 +1,97 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.20.js
+ ECMA Section: 15.9.5.20
+ Description: Date.prototype.getMilliseconds
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return msFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.20";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getMilliseconds()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( now );
+ addTestCase( TIME_YEAR_0 );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getMilliseconds()",
+ NaN,
+ (new Date(NaN)).getMilliseconds() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getMilliseconds.length",
+ 0,
+ Date.prototype.getMilliseconds.length );
+ test();
+function addTestCase( t ) {
+ for ( m = 0; m <= 1000; m+=100 ) {
+ t++;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getMilliseconds()",
+ msFromTime(LocalTime(t)),
+ (new Date(t)).getMilliseconds() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-1.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-1.js
new file mode 100644
index 0000000..eb89ba4
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-1.js
@@ -0,0 +1,97 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.21.js
+ ECMA Section: 15.9.5.21
+ Description: Date.prototype.getUTCMilliseconds
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return msFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.21";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCMilliseconds()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( now );
+/*
+ addTestCase( TIME_YEAR_0 );
+
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getUTCMilliseconds()",
+ NaN,
+ (new Date(NaN)).getUTCMilliseconds() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getUTCMilliseconds.length",
+ 0,
+ Date.prototype.getUTCMilliseconds.length );
+*/
+ test();
+function addTestCase( t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCMilliseconds()",
+ msFromTime(t),
+ (new Date(t)).getUTCMilliseconds() );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-2.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-2.js
new file mode 100644
index 0000000..5a70d47
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-2.js
@@ -0,0 +1,95 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.21.js
+ ECMA Section: 15.9.5.21
+ Description: Date.prototype.getUTCMilliseconds
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return msFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.21";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCMilliseconds()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( TIME_YEAR_0 );
+/*
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getUTCMilliseconds()",
+ NaN,
+ (new Date(NaN)).getUTCMilliseconds() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getUTCMilliseconds.length",
+ 0,
+ Date.prototype.getUTCMilliseconds.length );
+*/
+ test();
+function addTestCase( t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCMilliseconds()",
+ msFromTime(t),
+ (new Date(t)).getUTCMilliseconds() );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-3.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-3.js
new file mode 100644
index 0000000..bfd80c8
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-3.js
@@ -0,0 +1,78 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.21.js
+ ECMA Section: 15.9.5.21
+ Description: Date.prototype.getUTCMilliseconds
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return msFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.21";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCMilliseconds()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( TIME_1970 );
+ test();
+function addTestCase( t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCMilliseconds()",
+ msFromTime(t),
+ (new Date(t)).getUTCMilliseconds() );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-4.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-4.js
new file mode 100644
index 0000000..3f0e4e8
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-4.js
@@ -0,0 +1,78 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.21.js
+ ECMA Section: 15.9.5.21
+ Description: Date.prototype.getUTCMilliseconds
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return msFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.21";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCMilliseconds()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( TIME_1900 );
+ test();
+function addTestCase( t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCMilliseconds()",
+ msFromTime(t),
+ (new Date(t)).getUTCMilliseconds() );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-5.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-5.js
new file mode 100644
index 0000000..2ef6e21
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-5.js
@@ -0,0 +1,78 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.21.js
+ ECMA Section: 15.9.5.21
+ Description: Date.prototype.getUTCMilliseconds
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return msFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.21";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCMilliseconds()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( TIME_2000 );
+ test();
+function addTestCase( t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCMilliseconds()",
+ msFromTime(t),
+ (new Date(t)).getUTCMilliseconds() );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-6.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-6.js
new file mode 100644
index 0000000..3973472
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-6.js
@@ -0,0 +1,79 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.21.js
+ ECMA Section: 15.9.5.21
+ Description: Date.prototype.getUTCMilliseconds
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return msFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.21";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCMilliseconds()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( UTC_FEB_29_2000 );
+
+ test();
+function addTestCase( t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCMilliseconds()",
+ msFromTime(t),
+ (new Date(t)).getUTCMilliseconds() );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-7.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-7.js
new file mode 100644
index 0000000..e50aa04
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-7.js
@@ -0,0 +1,78 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.21.js
+ ECMA Section: 15.9.5.21
+ Description: Date.prototype.getUTCMilliseconds
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return msFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.21";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCMilliseconds()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( UTC_JAN_1_2005 );
+ test();
+function addTestCase( t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCMilliseconds()",
+ msFromTime(t),
+ (new Date(t)).getUTCMilliseconds() );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-8.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-8.js
new file mode 100644
index 0000000..b23dfc3
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.21-8.js
@@ -0,0 +1,86 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.21.js
+ ECMA Section: 15.9.5.21
+ Description: Date.prototype.getUTCMilliseconds
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return msFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.21";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCMilliseconds()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getUTCMilliseconds()",
+ NaN,
+ (new Date(NaN)).getUTCMilliseconds() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getUTCMilliseconds.length",
+ 0,
+ Date.prototype.getUTCMilliseconds.length );
+ test();
+function addTestCase( t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCMilliseconds()",
+ msFromTime(t),
+ (new Date(t)).getUTCMilliseconds() );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-1.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-1.js
new file mode 100644
index 0000000..cd84a9b
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-1.js
@@ -0,0 +1,100 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.22.js
+ ECMA Section: 15.9.5.22
+ Description: Date.prototype.getTimezoneOffset
+
+ Returns the difference between local time and UTC time in minutes.
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return (t - LocalTime(t)) / msPerMinute.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.22";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getTimezoneOffset()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+// addTestCase( now );
+
+ addTestCase( TIME_YEAR_0 );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getTimezoneOffset()",
+ NaN,
+ (new Date(NaN)).getTimezoneOffset() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getTimezoneOffset.length",
+ 0,
+ Date.prototype.getTimezoneOffset.length );
+
+ test();
+function addTestCase( t ) {
+ for ( m = 0; m <= 1000; m+=100 ) {
+ t++;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getTimezoneOffset()",
+ (t - LocalTime(t)) / msPerMinute,
+ (new Date(t)).getTimezoneOffset() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-2.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-2.js
new file mode 100644
index 0000000..e516135
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-2.js
@@ -0,0 +1,99 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.22.js
+ ECMA Section: 15.9.5.22
+ Description: Date.prototype.getTimezoneOffset
+
+ Returns the difference between local time and UTC time in minutes.
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return (t - LocalTime(t)) / msPerMinute.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.22";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getTimezoneOffset()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( TIME_YEAR_0 );
+/*
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getTimezoneOffset()",
+ NaN,
+ (new Date(NaN)).getTimezoneOffset() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getTimezoneOffset.length",
+ 0,
+ Date.prototype.getTimezoneOffset.length );
+*/
+ test();
+function addTestCase( t ) {
+ for ( m = 0; m <= 1000; m+=100 ) {
+ t++;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getTimezoneOffset()",
+ (t - LocalTime(t)) / msPerMinute,
+ (new Date(t)).getTimezoneOffset() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-3.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-3.js
new file mode 100644
index 0000000..371cbc2
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-3.js
@@ -0,0 +1,98 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.22.js
+ ECMA Section: 15.9.5.22
+ Description: Date.prototype.getTimezoneOffset
+
+ Returns the difference between local time and UTC time in minutes.
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return (t - LocalTime(t)) / msPerMinute.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.22";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getTimezoneOffset()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( TIME_1970 );
+/*
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getTimezoneOffset()",
+ NaN,
+ (new Date(NaN)).getTimezoneOffset() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getTimezoneOffset.length",
+ 0,
+ Date.prototype.getTimezoneOffset.length );
+*/
+ test();
+function addTestCase( t ) {
+ for ( m = 0; m <= 1000; m+=100 ) {
+ t++;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getTimezoneOffset()",
+ (t - LocalTime(t)) / msPerMinute,
+ (new Date(t)).getTimezoneOffset() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-4.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-4.js
new file mode 100644
index 0000000..1c63441
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-4.js
@@ -0,0 +1,97 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.22.js
+ ECMA Section: 15.9.5.22
+ Description: Date.prototype.getTimezoneOffset
+
+ Returns the difference between local time and UTC time in minutes.
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return (t - LocalTime(t)) / msPerMinute.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.22";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getTimezoneOffset()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( TIME_1900 );
+/*
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getTimezoneOffset()",
+ NaN,
+ (new Date(NaN)).getTimezoneOffset() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getTimezoneOffset.length",
+ 0,
+ Date.prototype.getTimezoneOffset.length );
+*/
+ test();
+function addTestCase( t ) {
+ for ( m = 0; m <= 1000; m+=100 ) {
+ t++;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getTimezoneOffset()",
+ (t - LocalTime(t)) / msPerMinute,
+ (new Date(t)).getTimezoneOffset() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-5.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-5.js
new file mode 100644
index 0000000..3f20ea4
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-5.js
@@ -0,0 +1,96 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.22.js
+ ECMA Section: 15.9.5.22
+ Description: Date.prototype.getTimezoneOffset
+
+ Returns the difference between local time and UTC time in minutes.
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return (t - LocalTime(t)) / msPerMinute.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.22";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getTimezoneOffset()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( TIME_2000 );
+/*
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getTimezoneOffset()",
+ NaN,
+ (new Date(NaN)).getTimezoneOffset() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getTimezoneOffset.length",
+ 0,
+ Date.prototype.getTimezoneOffset.length );
+*/
+ test();
+function addTestCase( t ) {
+ for ( m = 0; m <= 1000; m+=100 ) {
+ t++;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getTimezoneOffset()",
+ (t - LocalTime(t)) / msPerMinute,
+ (new Date(t)).getTimezoneOffset() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-6.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-6.js
new file mode 100644
index 0000000..0aee4a0
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-6.js
@@ -0,0 +1,95 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.22.js
+ ECMA Section: 15.9.5.22
+ Description: Date.prototype.getTimezoneOffset
+
+ Returns the difference between local time and UTC time in minutes.
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return (t - LocalTime(t)) / msPerMinute.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.22";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getTimezoneOffset()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( UTC_FEB_29_2000 );
+/*
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getTimezoneOffset()",
+ NaN,
+ (new Date(NaN)).getTimezoneOffset() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getTimezoneOffset.length",
+ 0,
+ Date.prototype.getTimezoneOffset.length );
+*/
+ test();
+function addTestCase( t ) {
+ for ( m = 0; m <= 1000; m+=100 ) {
+ t++;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getTimezoneOffset()",
+ (t - LocalTime(t)) / msPerMinute,
+ (new Date(t)).getTimezoneOffset() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-7.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-7.js
new file mode 100644
index 0000000..2d6ecfc
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-7.js
@@ -0,0 +1,93 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.22.js
+ ECMA Section: 15.9.5.22
+ Description: Date.prototype.getTimezoneOffset
+
+ Returns the difference between local time and UTC time in minutes.
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return (t - LocalTime(t)) / msPerMinute.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.22";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getTimezoneOffset()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( UTC_JAN_1_2005 );
+/*
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getTimezoneOffset()",
+ NaN,
+ (new Date(NaN)).getTimezoneOffset() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getTimezoneOffset.length",
+ 0,
+ Date.prototype.getTimezoneOffset.length );
+*/
+ test();
+function addTestCase( t ) {
+ for ( m = 0; m <= 1000; m+=100 ) {
+ t++;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getTimezoneOffset()",
+ (t - LocalTime(t)) / msPerMinute,
+ (new Date(t)).getTimezoneOffset() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-8.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-8.js
new file mode 100644
index 0000000..f7d6520
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.22-8.js
@@ -0,0 +1,90 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.22.js
+ ECMA Section: 15.9.5.22
+ Description: Date.prototype.getTimezoneOffset
+
+ Returns the difference between local time and UTC time in minutes.
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return (t - LocalTime(t)) / msPerMinute.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.22";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getTimezoneOffset()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getTimezoneOffset()",
+ NaN,
+ (new Date(NaN)).getTimezoneOffset() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getTimezoneOffset.length",
+ 0,
+ Date.prototype.getTimezoneOffset.length );
+ test();
+function addTestCase( t ) {
+ for ( m = 0; m <= 1000; m+=100 ) {
+ t++;
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getTimezoneOffset()",
+ (t - LocalTime(t)) / msPerMinute,
+ (new Date(t)).getTimezoneOffset() );
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-1.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-1.js
new file mode 100644
index 0000000..3a74450
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-1.js
@@ -0,0 +1,157 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "15.9.5.23-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.setTime()";
+
+
+ var testcases = new Array();
+ writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
+
+ getTestCases();
+ test();
+
+function getTestCases() {
+ var now = "now";
+ addTestCase( 0, 0 );
+/*
+ addTestCase( now, -2208988800000 );
+ addTestCase( now, -86400000 );
+ addTestCase( now, 946684800000 );
+
+ // this daylight savings case fails -- need to fix date test functions
+// addTestCase( now, -69609600000 );
+ addTestCase( now, -2208988800000 );
+ addTestCase( now, 946684800000 );
+
+ // this daylight savings case fails -- need to fix date test functions
+// addTestCase( now, -69609600000 );
+ addTestCase( now, 0 );
+ addTestCase( now, String( TIME_1900 ) );
+ addTestCase( now, String( TZ_DIFF* msPerHour ) );
+ addTestCase( now, String( TIME_2000 ) );
+*/
+}
+
+function addTestCase( startTime, setTime ) {
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
+
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-10.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-10.js
new file mode 100644
index 0000000..406123b
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-10.js
@@ -0,0 +1,156 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "15.9.5.23-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.setTime()";
+
+
+ var testcases = new Array();
+
+ getTestCases();
+ writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
+ test();
+
+function getTestCases() {
+ var now = "now";
+ addTestCase( now, -2208988800000 );
+/*
+ addTestCase( now, -86400000 );
+ addTestCase( now, 946684800000 );
+
+ // this daylight savings case fails -- need to fix date test functions
+// addTestCase( now, -69609600000 );
+ addTestCase( now, -2208988800000 );
+ addTestCase( now, 946684800000 );
+
+ // this daylight savings case fails -- need to fix date test functions
+// addTestCase( now, -69609600000 );
+ addTestCase( now, 0 );
+ addTestCase( now, String( TIME_1900 ) );
+ addTestCase( now, String( TZ_DIFF* msPerHour ) );
+ addTestCase( now, String( TIME_2000 ) );
+*/
+}
+
+function addTestCase( startTime, setTime ) {
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
+
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-11.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-11.js
new file mode 100644
index 0000000..377edd5
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-11.js
@@ -0,0 +1,155 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "15.9.5.23-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.setTime()";
+
+ writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
+
+ var testcases = new Array();
+ getTestCases();
+
+ test();
+
+function getTestCases() {
+ var now = "now";
+ addTestCase( now, -86400000 );
+/*
+ addTestCase( now, 946684800000 );
+
+ // this daylight savings case fails -- need to fix date test functions
+// addTestCase( now, -69609600000 );
+ addTestCase( now, -2208988800000 );
+ addTestCase( now, 946684800000 );
+
+ // this daylight savings case fails -- need to fix date test functions
+// addTestCase( now, -69609600000 );
+ addTestCase( now, 0 );
+ addTestCase( now, String( TIME_1900 ) );
+ addTestCase( now, String( TZ_DIFF* msPerHour ) );
+ addTestCase( now, String( TIME_2000 ) );
+*/
+}
+
+function addTestCase( startTime, setTime ) {
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
+
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-12.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-12.js
new file mode 100644
index 0000000..b0820c0
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-12.js
@@ -0,0 +1,153 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "15.9.5.23-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.setTime()";
+
+
+ var testcases = new Array();
+ getTestCases();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
+ test();
+
+function getTestCases() {
+ var now = "now";
+ addTestCase( now, 946684800000 );
+/*
+ // this daylight savings case fails -- need to fix date test functions
+// addTestCase( now, -69609600000 );
+ addTestCase( now, -2208988800000 );
+ addTestCase( now, 946684800000 );
+
+ // this daylight savings case fails -- need to fix date test functions
+// addTestCase( now, -69609600000 );
+ addTestCase( now, 0 );
+ addTestCase( now, String( TIME_1900 ) );
+ addTestCase( now, String( TZ_DIFF* msPerHour ) );
+ addTestCase( now, String( TIME_2000 ) );
+*/
+}
+
+function addTestCase( startTime, setTime ) {
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
+
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-13.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-13.js
new file mode 100644
index 0000000..058a7c7
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-13.js
@@ -0,0 +1,150 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "15.9.5.23-13";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.setTime()";
+
+
+ writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
+
+ var testcases = new Array();
+ getTestCases();
+ test();
+
+function getTestCases() {
+ var now = "now";
+ addTestCase( now, -2208988800000 );
+/*
+ addTestCase( now, 946684800000 );
+
+ // this daylight savings case fails -- need to fix date test functions
+// addTestCase( now, -69609600000 );
+ addTestCase( now, 0 );
+ addTestCase( now, String( TIME_1900 ) );
+ addTestCase( now, String( TZ_DIFF* msPerHour ) );
+ addTestCase( now, String( TIME_2000 ) );
+*/
+}
+
+function addTestCase( startTime, setTime ) {
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
+
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-14.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-14.js
new file mode 100644
index 0000000..135e808
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-14.js
@@ -0,0 +1,148 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "15.9.5.23-14";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.setTime()";
+
+
+ writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
+
+ var testcases = new Array();
+ getTestCases();
+ test();
+
+function getTestCases() {
+ var now = "now";
+ addTestCase( now, 946684800000 );
+/*
+ // this daylight savings case fails -- need to fix date test functions
+// addTestCase( now, -69609600000 );
+ addTestCase( now, 0 );
+ addTestCase( now, String( TIME_1900 ) );
+ addTestCase( now, String( TZ_DIFF* msPerHour ) );
+ addTestCase( now, String( TIME_2000 ) );
+*/
+}
+
+function addTestCase( startTime, setTime ) {
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
+
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-15.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-15.js
new file mode 100644
index 0000000..0f4e587
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-15.js
@@ -0,0 +1,144 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "15.9.5.23-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.setTime()";
+
+ writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
+
+ var testcases = new Array();
+ getTestCases();
+ test();
+
+function getTestCases() {
+ var now = "now";
+ addTestCase( now, 0 );
+/*
+ addTestCase( now, String( TIME_1900 ) );
+ addTestCase( now, String( TZ_DIFF* msPerHour ) );
+ addTestCase( now, String( TIME_2000 ) );
+*/
+}
+
+function addTestCase( startTime, setTime ) {
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
+
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-16.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-16.js
new file mode 100644
index 0000000..7390eb5
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-16.js
@@ -0,0 +1,143 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "15.9.5.23-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.setTime()";
+
+ writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
+
+ var testcases = new Array();
+ getTestCases();
+ test();
+
+function getTestCases() {
+ var now = "now";
+ addTestCase( now, String( TIME_1900 ) );
+/*
+ addTestCase( now, String( TZ_DIFF* msPerHour ) );
+ addTestCase( now, String( TIME_2000 ) );
+*/
+}
+
+function addTestCase( startTime, setTime ) {
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
+
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-17.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-17.js
new file mode 100644
index 0000000..0ac866e
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-17.js
@@ -0,0 +1,142 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "15.9.5.23-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.setTime()";
+
+ writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
+
+ var testcases = new Array();
+ getTestCases();
+ test();
+
+function getTestCases() {
+ var now = "now";
+ addTestCase( now, String( TZ_DIFF* msPerHour ) );
+/*
+ addTestCase( now, String( TIME_2000 ) );
+*/
+}
+
+function addTestCase( startTime, setTime ) {
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
+
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-18.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-18.js
new file mode 100644
index 0000000..902f411
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-18.js
@@ -0,0 +1,139 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var SECTION = "15.9.5.23-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.setTime()";
+
+ writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
+
+ var testcases = new Array();
+ getTestCases();
+ test();
+
+function getTestCases() {
+ var now = "now";
+ addTestCase( now, String( TIME_2000 ) );
+}
+
+function addTestCase( startTime, setTime ) {
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
+
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-2.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-2.js
new file mode 100644
index 0000000..e471514
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-2.js
@@ -0,0 +1,111 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.23-2.js
+ ECMA Section: 15.9.5.23
+ Description: Date.prototype.setTime
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "15.9.5.23-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.setTime()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ test_times = new Array( now, TIME_1970, TIME_1900, TIME_2000 );
+
+
+ for ( var j = 0; j < test_times.length; j++ ) {
+ addTestCase( new Date(now), test_times[j] );
+ }
+
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).setTime()",
+ NaN,
+ (new Date(NaN)).setTime() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.setTime.length",
+ 1,
+ Date.prototype.setTime.length );
+ test();
+function addTestCase( d, t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+t+")",
+ t,
+ d.setTime(t) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1.1)+")",
+ TimeClip(t+1.1),
+ d.setTime(t+1.1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1)+")",
+ t+1,
+ d.setTime(t+1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-1)+")",
+ t-1,
+ d.setTime(t-1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-TZ_ADJUST)+")",
+ t-TZ_ADJUST,
+ d.setTime(t-TZ_ADJUST) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+TZ_ADJUST)+")",
+ t+TZ_ADJUST,
+ d.setTime(t+TZ_ADJUST) );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-3-n.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-3-n.js
new file mode 100644
index 0000000..44fffdf
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-3-n.js
@@ -0,0 +1,70 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.23-3-n.js
+ ECMA Section: 15.9.5.23
+ Description: Date.prototype.setTime
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.23-3-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.setTime()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var MYDATE = new MyDate(TIME_1970);
+
+ testcases[tc++] = new TestCase( SECTION,
+ "MYDATE.setTime(TIME_2000)",
+ "error",
+ MYDATE.setTime(TIME_2000) );
+
+function MyDate(value) {
+ this.value = value;
+ this.setTime = Date.prototype.setTime;
+ return this;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-4.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-4.js
new file mode 100644
index 0000000..633bbf6
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-4.js
@@ -0,0 +1,122 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.23-2.js
+ ECMA Section: 15.9.5.23
+ Description: Date.prototype.setTime
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.23-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.setTime()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ test_times = new Array( now, TIME_YEAR_0, TIME_1970, TIME_1900, TIME_2000,
+ UTC_FEB_29_2000, UTC_JAN_1_2005 );
+
+
+ for ( var j = 0; j < test_times.length; j++ ) {
+ addTestCase( new Date(TIME_YEAR_0), test_times[j] );
+ }
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).setTime()",
+ NaN,
+ (new Date(NaN)).setTime() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.setTime.length",
+ 1,
+ Date.prototype.setTime.length );
+ test();
+
+function addTestCase( d, t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+t+")",
+ t,
+ d.setTime(t) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1.1)+")",
+ TimeClip(t+1.1),
+ d.setTime(t+1.1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1)+")",
+ t+1,
+ d.setTime(t+1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-1)+")",
+ t-1,
+ d.setTime(t-1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-TZ_ADJUST)+")",
+ t-TZ_ADJUST,
+ d.setTime(t-TZ_ADJUST) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+TZ_ADJUST)+")",
+ t+TZ_ADJUST,
+ d.setTime(t+TZ_ADJUST) );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-5.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-5.js
new file mode 100644
index 0000000..ab8d9a7
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-5.js
@@ -0,0 +1,122 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.23-2.js
+ ECMA Section: 15.9.5.23
+ Description: Date.prototype.setTime
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.23-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.setTime()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ test_times = new Array( now, TIME_YEAR_0, TIME_1970, TIME_1900, TIME_2000,
+ UTC_FEB_29_2000, UTC_JAN_1_2005 );
+
+
+ for ( var j = 0; j < test_times.length; j++ ) {
+ addTestCase( new Date(TIME_1970), test_times[j] );
+ }
+
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).setTime()",
+ NaN,
+ (new Date(NaN)).setTime() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.setTime.length",
+ 1,
+ Date.prototype.setTime.length );
+ test();
+function addTestCase( d, t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+t+")",
+ t,
+ d.setTime(t) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1.1)+")",
+ TimeClip(t+1.1),
+ d.setTime(t+1.1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1)+")",
+ t+1,
+ d.setTime(t+1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-1)+")",
+ t-1,
+ d.setTime(t-1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-TZ_ADJUST)+")",
+ t-TZ_ADJUST,
+ d.setTime(t-TZ_ADJUST) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+TZ_ADJUST)+")",
+ t+TZ_ADJUST,
+ d.setTime(t+TZ_ADJUST) );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-6.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-6.js
new file mode 100644
index 0000000..3f0c3f7
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-6.js
@@ -0,0 +1,122 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.23-2.js
+ ECMA Section: 15.9.5.23
+ Description: Date.prototype.setTime
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.23-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.setTime()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ test_times = new Array( now, TIME_YEAR_0, TIME_1970, TIME_1900, TIME_2000,
+ UTC_FEB_29_2000, UTC_JAN_1_2005 );
+
+
+ for ( var j = 0; j < test_times.length; j++ ) {
+ addTestCase( new Date(TIME_1900), test_times[j] );
+ }
+
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).setTime()",
+ NaN,
+ (new Date(NaN)).setTime() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.setTime.length",
+ 1,
+ Date.prototype.setTime.length );
+ test();
+function addTestCase( d, t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+t+")",
+ t,
+ d.setTime(t) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1.1)+")",
+ TimeClip(t+1.1),
+ d.setTime(t+1.1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1)+")",
+ t+1,
+ d.setTime(t+1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-1)+")",
+ t-1,
+ d.setTime(t-1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-TZ_ADJUST)+")",
+ t-TZ_ADJUST,
+ d.setTime(t-TZ_ADJUST) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+TZ_ADJUST)+")",
+ t+TZ_ADJUST,
+ d.setTime(t+TZ_ADJUST) );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-7.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-7.js
new file mode 100644
index 0000000..328642f
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-7.js
@@ -0,0 +1,122 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.23-2.js
+ ECMA Section: 15.9.5.23
+ Description: Date.prototype.setTime
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.23-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.setTime()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ test_times = new Array( now, TIME_YEAR_0, TIME_1970, TIME_1900, TIME_2000,
+ UTC_FEB_29_2000, UTC_JAN_1_2005 );
+
+
+ for ( var j = 0; j < test_times.length; j++ ) {
+ addTestCase( new Date(TIME_2000), test_times[j] );
+ }
+
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).setTime()",
+ NaN,
+ (new Date(NaN)).setTime() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.setTime.length",
+ 1,
+ Date.prototype.setTime.length );
+ test();
+function addTestCase( d, t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+t+")",
+ t,
+ d.setTime(t) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1.1)+")",
+ TimeClip(t+1.1),
+ d.setTime(t+1.1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1)+")",
+ t+1,
+ d.setTime(t+1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-1)+")",
+ t-1,
+ d.setTime(t-1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-TZ_ADJUST)+")",
+ t-TZ_ADJUST,
+ d.setTime(t-TZ_ADJUST) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+TZ_ADJUST)+")",
+ t+TZ_ADJUST,
+ d.setTime(t+TZ_ADJUST) );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-8.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-8.js
new file mode 100644
index 0000000..4b9fbb3
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-8.js
@@ -0,0 +1,111 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.23-2.js
+ ECMA Section: 15.9.5.23
+ Description: Date.prototype.setTime
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.23-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.setTime()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+ test_times = new Array( now, TIME_YEAR_0, TIME_1970, TIME_1900, TIME_2000,
+ UTC_FEB_29_2000, UTC_JAN_1_2005 );
+
+
+ for ( var j = 0; j < test_times.length; j++ ) {
+ addTestCase( new Date(UTC_FEB_29_2000), test_times[j] );
+ }
+
+ test();
+function addTestCase( d, t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+t+")",
+ t,
+ d.setTime(t) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1.1)+")",
+ TimeClip(t+1.1),
+ d.setTime(t+1.1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1)+")",
+ t+1,
+ d.setTime(t+1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-1)+")",
+ t-1,
+ d.setTime(t-1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-TZ_ADJUST)+")",
+ t-TZ_ADJUST,
+ d.setTime(t-TZ_ADJUST) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+TZ_ADJUST)+")",
+ t+TZ_ADJUST,
+ d.setTime(t+TZ_ADJUST) );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-9.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-9.js
new file mode 100644
index 0000000..cbf8f18
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.23-9.js
@@ -0,0 +1,112 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.23-2.js
+ ECMA Section: 15.9.5.23
+ Description: Date.prototype.setTime
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.23-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.setTime()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ test_times = new Array( now, TIME_YEAR_0, TIME_1970, TIME_1900, TIME_2000,
+ UTC_FEB_29_2000, UTC_JAN_1_2005 );
+
+
+ for ( var j = 0; j < test_times.length; j++ ) {
+ addTestCase( new Date(UTC_JAN_1_2005), test_times[j] );
+ }
+
+ test();
+function addTestCase( d, t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+t+")",
+ t,
+ d.setTime(t) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1.1)+")",
+ TimeClip(t+1.1),
+ d.setTime(t+1.1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1)+")",
+ t+1,
+ d.setTime(t+1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-1)+")",
+ t-1,
+ d.setTime(t-1) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-TZ_ADJUST)+")",
+ t-TZ_ADJUST,
+ d.setTime(t-TZ_ADJUST) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+TZ_ADJUST)+")",
+ t+TZ_ADJUST,
+ d.setTime(t+TZ_ADJUST) );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-1.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-1.js
new file mode 100644
index 0000000..4e7a4fb
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-1.js
@@ -0,0 +1,151 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.24-1.js
+ ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
+ Description:
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var TITLE = "Date.prototype.setTime"
+ var SECTION = "15.9.5.24-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
+
+ var testcases = new Array();
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+
+ addTestCase( 0, 0 );
+/*
+ addTestCase( 0, -86400000 );
+ addTestCase( 0, -2208988800000 );
+ addTestCase( 0, 946684800000 );
+
+// This test case is incorrect. Need to fix the DaylightSavings functions in
+// shell.js for this to work properly.
+// addTestCase( 0, -69609600000 );
+// addTestCase( 0, "-69609600000" );
+
+ addTestCase( 0, "0" );
+ addTestCase( 0, "-2208988800000" );
+ addTestCase( 0, "-86400000" );
+ addTestCase( 0, "946684800000" );
+*/
+}
+function addTestCase( startms, newms ) {
+
+ var DateCase = new Date( startms );
+ DateCase.setMilliseconds( newms );
+ var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
+ var UTCDate = UTCDateFromTime( Number(newms) );
+ var LocalDate = LocalDateFromTime( Number(newms) );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-2.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-2.js
new file mode 100644
index 0000000..8995cf2
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-2.js
@@ -0,0 +1,150 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.24-1.js
+ ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
+ Description:
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var TITLE = "Date.prototype.setTime"
+ var SECTION = "15.9.5.24-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
+
+ var testcases = new Array();
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+
+ addTestCase( 0, -86400000 );
+/*
+ addTestCase( 0, -2208988800000 );
+ addTestCase( 0, 946684800000 );
+
+// This test case is incorrect. Need to fix the DaylightSavings functions in
+// shell.js for this to work properly.
+// addTestCase( 0, -69609600000 );
+// addTestCase( 0, "-69609600000" );
+
+ addTestCase( 0, "0" );
+ addTestCase( 0, "-2208988800000" );
+ addTestCase( 0, "-86400000" );
+ addTestCase( 0, "946684800000" );
+*/
+}
+function addTestCase( startms, newms ) {
+
+ var DateCase = new Date( startms );
+ DateCase.setMilliseconds( newms );
+ var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
+ var UTCDate = UTCDateFromTime( Number(newms) );
+ var LocalDate = LocalDateFromTime( Number(newms) );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-3.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-3.js
new file mode 100644
index 0000000..788fc80
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-3.js
@@ -0,0 +1,149 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.24-1.js
+ ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
+ Description:
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var TITLE = "Date.prototype.setTime"
+ var SECTION = "15.9.5.24-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
+
+ var testcases = new Array();
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+
+ addTestCase( 0, -2208988800000 );
+/*
+ addTestCase( 0, 946684800000 );
+
+// This test case is incorrect. Need to fix the DaylightSavings functions in
+// shell.js for this to work properly.
+// addTestCase( 0, -69609600000 );
+// addTestCase( 0, "-69609600000" );
+
+ addTestCase( 0, "0" );
+ addTestCase( 0, "-2208988800000" );
+ addTestCase( 0, "-86400000" );
+ addTestCase( 0, "946684800000" );
+*/
+}
+function addTestCase( startms, newms ) {
+
+ var DateCase = new Date( startms );
+ DateCase.setMilliseconds( newms );
+ var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
+ var UTCDate = UTCDateFromTime( Number(newms) );
+ var LocalDate = LocalDateFromTime( Number(newms) );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-4.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-4.js
new file mode 100644
index 0000000..b003de4
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-4.js
@@ -0,0 +1,148 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.24-1.js
+ ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
+ Description:
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var TITLE = "Date.prototype.setTime"
+ var SECTION = "15.9.5.24-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
+
+ var testcases = new Array();
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+
+ addTestCase( 0, 946684800000 );
+/*
+
+// This test case is incorrect. Need to fix the DaylightSavings functions in
+// shell.js for this to work properly.
+// addTestCase( 0, -69609600000 );
+// addTestCase( 0, "-69609600000" );
+
+ addTestCase( 0, "0" );
+ addTestCase( 0, "-2208988800000" );
+ addTestCase( 0, "-86400000" );
+ addTestCase( 0, "946684800000" );
+*/
+}
+function addTestCase( startms, newms ) {
+
+ var DateCase = new Date( startms );
+ DateCase.setMilliseconds( newms );
+ var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
+ var UTCDate = UTCDateFromTime( Number(newms) );
+ var LocalDate = LocalDateFromTime( Number(newms) );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-5.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-5.js
new file mode 100644
index 0000000..ccfadc0
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-5.js
@@ -0,0 +1,141 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.24-1.js
+ ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
+ Description:
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var TITLE = "Date.prototype.setTime"
+ var SECTION = "15.9.5.24-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
+
+ var testcases = new Array();
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+
+ addTestCase( 0, "0" );
+/*
+ addTestCase( 0, "-2208988800000" );
+ addTestCase( 0, "-86400000" );
+ addTestCase( 0, "946684800000" );
+*/
+}
+function addTestCase( startms, newms ) {
+
+ var DateCase = new Date( startms );
+ DateCase.setMilliseconds( newms );
+ var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
+ var UTCDate = UTCDateFromTime( Number(newms) );
+ var LocalDate = LocalDateFromTime( Number(newms) );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-6.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-6.js
new file mode 100644
index 0000000..cd2d9d1
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-6.js
@@ -0,0 +1,140 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.24-1.js
+ ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
+ Description:
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var TITLE = "Date.prototype.setTime"
+ var SECTION = "15.9.5.24-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
+
+ var testcases = new Array();
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+
+ addTestCase( 0, "-2208988800000" );
+/*
+ addTestCase( 0, "-86400000" );
+ addTestCase( 0, "946684800000" );
+*/
+}
+function addTestCase( startms, newms ) {
+
+ var DateCase = new Date( startms );
+ DateCase.setMilliseconds( newms );
+ var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
+ var UTCDate = UTCDateFromTime( Number(newms) );
+ var LocalDate = LocalDateFromTime( Number(newms) );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-7.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-7.js
new file mode 100644
index 0000000..8e5846e
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-7.js
@@ -0,0 +1,139 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.24-1.js
+ ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
+ Description:
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var TITLE = "Date.prototype.setTime"
+ var SECTION = "15.9.5.24-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
+
+ var testcases = new Array();
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+
+ addTestCase( 0, "-86400000" );
+/*
+ addTestCase( 0, "946684800000" );
+*/
+}
+function addTestCase( startms, newms ) {
+
+ var DateCase = new Date( startms );
+ DateCase.setMilliseconds( newms );
+ var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
+ var UTCDate = UTCDateFromTime( Number(newms) );
+ var LocalDate = LocalDateFromTime( Number(newms) );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-8.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-8.js
new file mode 100644
index 0000000..956bc9d
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.24-8.js
@@ -0,0 +1,135 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.24-1.js
+ ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
+ Description:
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+ var TITLE = "Date.prototype.setTime"
+ var SECTION = "15.9.5.24-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
+
+ var testcases = new Array();
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+ addTestCase( 0, "946684800000" );
+}
+function addTestCase( startms, newms ) {
+
+ var DateCase = new Date( startms );
+ DateCase.setMilliseconds( newms );
+ var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
+ var UTCDate = UTCDateFromTime( Number(newms) );
+ var LocalDate = LocalDateFromTime( Number(newms) );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.25-1.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.25-1.js
new file mode 100644
index 0000000..65cecdc
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.25-1.js
@@ -0,0 +1,190 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.25-1.js
+ ECMA Section: 15.9.5.25 Date.prototype.setUTCMilliseconds(ms)
+ Description:
+ 1. Let t be this time value.
+ 2. Call ToNumber(ms).
+ 3. Compute MakeTime(HourFromTime(t), MinFromTime(t), SecFromTime(t), Result(2)).
+ 4. Compute MakeDate(Day(t), Result(3)).
+ 5. Set the [[Value]] property of the this value to TimeClip(Result(4)).
+ 6. Return the value of the [[Value]] property of the this value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "15.9.5.25-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setUTCMilliseconds(ms)");
+
+ var testcases = new Array();
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+ addNewTestCase( 0, 0, "TDATE = new Date(0);(TDATE).setUTCMilliseconds(0);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(0,0)),
+ LocalDateFromTime(SetUTCMilliseconds(0,0)) );
+ addNewTestCase( 28800000,999,
+ "TDATE = new Date(28800000);(TDATE).setUTCMilliseconds(999);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(28800000,999)),
+ LocalDateFromTime(SetUTCMilliseconds(28800000,999)) );
+ addNewTestCase( 28800000,-28800000,
+ "TDATE = new Date(28800000);(TDATE).setUTCMilliseconds(-28800000);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(28800000,-28800000)),
+ LocalDateFromTime(SetUTCMilliseconds(28800000,-28800000)) );
+ addNewTestCase( 946684800000,1234567,
+ "TDATE = new Date(946684800000);(TDATE).setUTCMilliseconds(1234567);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(946684800000,1234567)),
+ LocalDateFromTime(SetUTCMilliseconds(946684800000,1234567)) );
+ addNewTestCase( 946684800000, 123456789,
+ "TDATE = new Date(946684800000);(TDATE).setUTCMilliseconds(123456789);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(946684800000,123456789)),
+ LocalDateFromTime(SetUTCMilliseconds(946684800000,123456789)) );
+
+ addNewTestCase( -2208988800000,123456789,
+ "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456789);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)) );
+
+ addNewTestCase( -2208988800000,123456,
+ "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456)) );
+
+ addNewTestCase( -2208988800000,-123456,
+ "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(-123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)) );
+
+ addNewTestCase( 0,-999,
+ "TDATE = new Date(0);(TDATE).setUTCMilliseconds(-999);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(0,-999)),
+ LocalDateFromTime(SetUTCMilliseconds(0,-999)) );
+/*
+ addNewTestCase( "TEST_DATE = new Date(0);(TEST_DATE).setMilliseconds(0);TEST_DATE", UTCDateFromTime(0), LocalDateFromTime(0) );
+// addNewTestCase( "TEST_DATE = new Date(0);(TEST_DATE).setMilliseconds(-2208988800000);TEST_DATE", UTCDateFromTime(-2208988800000), LocalDateFromTime(-2208988800000) );
+ addNewTestCase( "TEST_DATE = new Date(0);(TEST_DATE).setMilliseconds(-86400000);TEST_DATE", UTCDateFromTime(-86400000), LocalDateFromTime(-86400000) );
+ addNewTestCase( "TEST_DATE = new Date(0);(TEST_DATE).setMilliseconds(946684800000);TEST_DATE", UTCDateFromTime(946684800000), LocalDateFromTime(946684800000) );
+ addNewTestCase( "TEST_DATE = new Date(0);(TEST_DATE).setMilliseconds(-69609600000);TEST_DATE", UTCDateFromTime(-69609600000), LocalDateFromTime(-69609600000) );
+
+
+ addNewTestCase( "TEST_DATE = new Date(0);(TEST_DATE).setMilliseconds('0');TEST_DATE", UTCDateFromTime(0), LocalDateFromTime(0) );
+// addNewTestCase( "TEST_DATE = new Date(0);(TEST_DATE).setMilliseconds('-2208988800000');TEST_DATE", UTCDateFromTime(-2208988800000), LocalDateFromTime(-2208988800000) );
+ addNewTestCase( "TEST_DATE = new Date(0);(TEST_DATE).setMilliseconds('-86400000');TEST_DATE", UTCDateFromTime(-86400000), LocalDateFromTime(-86400000) );
+ addNewTestCase( "TEST_DATE = new Date(0);(TEST_DATE).setMilliseconds('946684800000');TEST_DATE", UTCDateFromTime(946684800000), LocalDateFromTime(946684800000) );
+ addNewTestCase( "TEST_DATE = new Date(0);(TEST_DATE).setMilliseconds('-69609600000');TEST_DATE", UTCDateFromTime(-69609600000), LocalDateFromTime(-69609600000) );
+*/
+}
+function addNewTestCase( initialTime, ms, DateString, UTCDate, LocalDate) {
+ DateCase = new Date(initialTime);
+ DateCase.setUTCMilliseconds(ms);
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+
+function SetUTCMilliseconds( T, MS ) {
+ T = Number( T );
+ TIME = MakeTime( HourFromTime(T),
+ MinFromTime(T),
+ SecFromTime(T),
+ MS );
+ return( MakeDate( Day(T), TIME ));
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.26-1.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.26-1.js
new file mode 100644
index 0000000..58f70ff
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.26-1.js
@@ -0,0 +1,203 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/** File Name: 15.9.5.26-1.js
+ ECMA Section: 15.9.5.26 Date.prototype.setSeconds(sec [,ms])
+ Description:
+
+ If ms is not specified, this behaves as if ms were specified with the
+ value getMilliseconds( ).
+
+ 1. Let t be the result of LocalTime(this time value).
+ 2. Call ToNumber(sec).
+ 3. If ms is not specified, compute msFromTime(t); otherwise, call
+ ToNumber(ms).
+ 4. Compute MakeTime(HourFromTime(t), MinFromTime(t), Result(2),
+ Result(3)).
+ 5. Compute UTC(MakeDate(Day(t), Result(4))).
+ 6. Set the [[Value]] property of the this value to TimeClip(Result(5)).
+ 7. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "15.9.5.26-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setSeconds(sec [,ms] )");
+
+ var testcases = new Array();
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+ addNewTestCase( 0, 0, 0,
+ "TDATE = new Date(0);(TDATE).setSeconds(0,0);TDATE",
+ UTCDateFromTime(SetSeconds(0,0,0)),
+ LocalDateFromTime(SetSeconds(0,0,0)) );
+
+ addNewTestCase( 28800000,59,999,
+ "TDATE = new Date(28800000);(TDATE).setSeconds(59,999);TDATE",
+ UTCDateFromTime(SetSeconds(28800000,59,999)),
+ LocalDateFromTime(SetSeconds(28800000,59,999)) );
+
+ addNewTestCase( 28800000,999,999,
+ "TDATE = new Date(28800000);(TDATE).setSeconds(999,999);TDATE",
+ UTCDateFromTime(SetSeconds(28800000,999,999)),
+ LocalDateFromTime(SetSeconds(28800000,999,999)) );
+
+ addNewTestCase( 28800000,999, void 0,
+ "TDATE = new Date(28800000);(TDATE).setSeconds(999);TDATE",
+ UTCDateFromTime(SetSeconds(28800000,999,0)),
+ LocalDateFromTime(SetSeconds(28800000,999,0)) );
+
+ addNewTestCase( 28800000,-28800, void 0,
+ "TDATE = new Date(28800000);(TDATE).setSeconds(-28800);TDATE",
+ UTCDateFromTime(SetSeconds(28800000,-28800)),
+ LocalDateFromTime(SetSeconds(28800000,-28800)) );
+
+ addNewTestCase( 946684800000,1234567,void 0,
+ "TDATE = new Date(946684800000);(TDATE).setSeconds(1234567);TDATE",
+ UTCDateFromTime(SetSeconds(946684800000,1234567)),
+ LocalDateFromTime(SetSeconds(946684800000,1234567)) );
+
+ addNewTestCase( -2208988800000,59,999,
+ "TDATE = new Date(-2208988800000);(TDATE).setSeconds(59,999);TDATE",
+ UTCDateFromTime(SetSeconds(-2208988800000,59,999)),
+ LocalDateFromTime(SetSeconds(-2208988800000,59,999)) );
+
+/*
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456789);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)) );
+
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456)) );
+
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(-123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMilliseconds(-999);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(0,-999)),
+ LocalDateFromTime(SetUTCMilliseconds(0,-999)) );
+*/
+}
+function addNewTestCase( startTime, sec, ms, DateString,UTCDate, LocalDate) {
+ DateCase = new Date( startTime );
+ if ( ms != void 0 ) {
+ DateCase.setSeconds( sec, ms );
+ } else {
+ DateCase.setSeconds( sec );
+ }
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetSeconds( t, s, m ) {
+ var MS = ( m == void 0 ) ? msFromTime(t) : Number( m );
+ var TIME = LocalTime( t );
+ var SEC = Number(s);
+ var RESULT4 = MakeTime( HourFromTime( TIME ),
+ MinFromTime( TIME ),
+ SEC,
+ MS );
+ var UTC_TIME = UTC(MakeDate(Day(TIME), RESULT4));
+ return ( TimeClip(UTC_TIME) );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.27-1.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.27-1.js
new file mode 100644
index 0000000..38cd843
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.27-1.js
@@ -0,0 +1,202 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.27-1.js
+ ECMA Section: 15.9.5.27 Date.prototype.setUTCSeconds(sec [,ms])
+ Description:
+
+ If ms is not specified, this behaves as if ms were specified with the
+ value getUTCMilliseconds( ).
+
+ 1. Let t be this time value.
+ 2. Call ToNumber(sec).
+ 3. If ms is not specified, compute msFromTime(t); otherwise, call
+ ToNumber(ms)
+ 4. Compute MakeTime(HourFromTime(t), MinFromTime(t), Result(2), Result(3))
+ 5. Compute MakeDate(Day(t), Result(4)).
+ 6. Set the [[Value]] property of the this value to TimeClip(Result(5)).
+ 7. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "15.9.5.27-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setUTCSeconds(sec [,ms] )");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+ addNewTestCase( 0, 0, 0, "TDATE = new Date(0);(TDATE).setUTCSeconds(0,0);TDATE",
+ UTCDateFromTime(SetUTCSeconds(0,0,0)),
+ LocalDateFromTime(SetUTCSeconds(0,0,0)) );
+
+ addNewTestCase( 28800000,59,999,
+ "TDATE = new Date(28800000);(TDATE).setUTCSeconds(59,999);TDATE",
+ UTCDateFromTime(SetUTCSeconds(28800000,59,999)),
+ LocalDateFromTime(SetUTCSeconds(28800000,59,999)) );
+
+ addNewTestCase( 28800000,999,999,
+ "TDATE = new Date(28800000);(TDATE).setUTCSeconds(999,999);TDATE",
+ UTCDateFromTime(SetUTCSeconds(28800000,999,999)),
+ LocalDateFromTime(SetUTCSeconds(28800000,999,999)) );
+
+ addNewTestCase( 28800000, 999, void 0,
+ "TDATE = new Date(28800000);(TDATE).setUTCSeconds(999);TDATE",
+ UTCDateFromTime(SetUTCSeconds(28800000,999,0)),
+ LocalDateFromTime(SetUTCSeconds(28800000,999,0)) );
+
+ addNewTestCase( 28800000, -28800, void 0,
+ "TDATE = new Date(28800000);(TDATE).setUTCSeconds(-28800);TDATE",
+ UTCDateFromTime(SetUTCSeconds(28800000,-28800)),
+ LocalDateFromTime(SetUTCSeconds(28800000,-28800)) );
+
+ addNewTestCase( 946684800000, 1234567, void 0,
+ "TDATE = new Date(946684800000);(TDATE).setUTCSeconds(1234567);TDATE",
+ UTCDateFromTime(SetUTCSeconds(946684800000,1234567)),
+ LocalDateFromTime(SetUTCSeconds(946684800000,1234567)) );
+
+ addNewTestCase( -2208988800000,59,999,
+ "TDATE = new Date(-2208988800000);(TDATE).setUTCSeconds(59,999);TDATE",
+ UTCDateFromTime(SetUTCSeconds(-2208988800000,59,999)),
+ LocalDateFromTime(SetUTCSeconds(-2208988800000,59,999)) );
+/*
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456789);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)) );
+
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456)) );
+
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(-123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMilliseconds(-999);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(0,-999)),
+ LocalDateFromTime(SetUTCMilliseconds(0,-999)) );
+*/
+}
+function addNewTestCase( startTime, sec, ms, DateString, UTCDate, LocalDate) {
+ DateCase = new Date( startTime );
+ if ( ms == void 0) {
+ DateCase.setSeconds( sec );
+ } else {
+ DateCase.setSeconds( sec, ms );
+ }
+
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+
+function SetUTCSeconds( t, s, m ) {
+ var TIME = t;
+ var SEC = Number(s);
+ var MS = ( m == void 0 ) ? msFromTime(TIME) : Number( m );
+ var RESULT4 = MakeTime( HourFromTime( TIME ),
+ MinFromTime( TIME ),
+ SEC,
+ MS );
+ return ( TimeClip(MakeDate(Day(TIME), RESULT4)) );
+}
+
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.28-1.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.28-1.js
new file mode 100644
index 0000000..8fd97d1
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.28-1.js
@@ -0,0 +1,216 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.28-1.js
+ ECMA Section: 15.9.5.28 Date.prototype.setMinutes(min [, sec [, ms ]] )
+ Description:
+ If sec is not specified, this behaves as if sec were specified with the
+ value getSeconds ( ).
+
+ If ms is not specified, this behaves as if ms were specified with the
+ value getMilliseconds( ).
+
+ 1. Let t be the result of LocalTime(this time value).
+ 2. Call ToNumber(min).
+ 3. If sec is not specified, compute SecFromTime(t); otherwise, call ToNumber(sec).
+ 4. If ms is not specified, compute msFromTime(t); otherwise, call ToNumber(ms).
+ 5. Compute MakeTime(HourFromTime(t), Result(2), Result(3), Result(4)).
+ 6. Compute UTC(MakeDate(Day(t), Result(5))).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "15.9.5.28-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setMinutes(sec [,ms] )");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+ addNewTestCase( 0, 0, void 0, void 0,
+ "TDATE = new Date(0);(TDATE).setMinutes(0);TDATE",
+ UTCDateFromTime(SetMinutes(0,0,0,0)),
+ LocalDateFromTime(SetMinutes(0,0,0,0)) );
+
+ addNewTestCase( 28800000, 59, 59, void 0,
+ "TDATE = new Date(28800000);(TDATE).setMinutes(59,59);TDATE",
+ UTCDateFromTime(SetMinutes(28800000,59,59)),
+ LocalDateFromTime(SetMinutes(28800000,59,59)) );
+
+ addNewTestCase( 28800000, 59, 59, 999,
+ "TDATE = new Date(28800000);(TDATE).setMinutes(59,59,999);TDATE",
+ UTCDateFromTime(SetMinutes(28800000,59,59,999)),
+ LocalDateFromTime(SetMinutes(28800000,59,59,999)) );
+
+ addNewTestCase( 28800000, 59, void 0, void 0,
+ "TDATE = new Date(28800000);(TDATE).setMinutes(59);TDATE",
+ UTCDateFromTime(SetMinutes(28800000,59,0)),
+ LocalDateFromTime(SetMinutes(28800000,59,0)) );
+
+ addNewTestCase( 28800000, -480, void 0, void 0,
+ "TDATE = new Date(28800000);(TDATE).setMinutes(-480);TDATE",
+ UTCDateFromTime(SetMinutes(28800000,-480)),
+ LocalDateFromTime(SetMinutes(28800000,-480)) );
+
+ addNewTestCase( 946684800000, 1234567, void 0, void 0,
+ "TDATE = new Date(946684800000);(TDATE).setMinutes(1234567);TDATE",
+ UTCDateFromTime(SetMinutes(946684800000,1234567)),
+ LocalDateFromTime(SetMinutes(946684800000,1234567)) );
+
+ addNewTestCase( -2208988800000,59, 59, void 0,
+ "TDATE = new Date(-2208988800000);(TDATE).setMinutes(59,59);TDATE",
+ UTCDateFromTime(SetMinutes(-2208988800000,59,59)),
+ LocalDateFromTime(SetMinutes(-2208988800000,59,59)) );
+
+ addNewTestCase( -2208988800000, 59, 59, 999,
+ "TDATE = new Date(-2208988800000);(TDATE).setMinutes(59,59,999);TDATE",
+ UTCDateFromTime(SetMinutes(-2208988800000,59,59,999)),
+ LocalDateFromTime(SetMinutes(-2208988800000,59,59,999)) );
+/*
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456789);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)) );
+
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456)) );
+
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(-123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMilliseconds(-999);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(0,-999)),
+ LocalDateFromTime(SetUTCMilliseconds(0,-999)) );
+*/
+
+}
+function addNewTestCase( time, min, sec, ms, DateString, UTCDate, LocalDate) {
+ DateCase = new Date( time );
+
+ if ( sec == void 0 ) {
+ DateCase.setMinutes( min );
+ } else {
+ if ( ms == void 0 ) {
+ DateCase.setMinutes( min, sec );
+ } else {
+ DateCase.setMinutes( min, sec, ms );
+ }
+ }
+
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+
+function SetMinutes( t, min, sec, ms ) {
+ var TIME = LocalTime(t);
+ var MIN = Number(min);
+ var SEC = ( sec == void 0) ? SecFromTime(TIME) : Number(sec);
+ var MS = ( ms == void 0 ) ? msFromTime(TIME) : Number(ms);
+ var RESULT5 = MakeTime( HourFromTime( TIME ),
+ MIN,
+ SEC,
+ MS );
+ return ( TimeClip(UTC( MakeDate(Day(TIME),RESULT5))) );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.29-1.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.29-1.js
new file mode 100644
index 0000000..0640a74
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.29-1.js
@@ -0,0 +1,210 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.29-1.js
+ ECMA Section: 15.9.5.29 Date.prototype.setUTCMinutes(min [, sec [, ms ]] )
+ Description:
+ If sec is not specified, this behaves as if sec were specified with the
+ value getUTCSeconds ( ).
+
+ If ms is not specified, this behaves as if ms were specified with the value
+ getUTCMilliseconds( ).
+
+ 1. Let t be this time value.
+ 2. Call ToNumber(min).
+ 3. If sec is not specified, compute SecFromTime(t); otherwise, call
+ ToNumber(sec).
+ 4. If ms is not specified, compute msFromTime(t); otherwise, call
+ ToNumber(ms).
+ 5. Compute MakeTime(HourFromTime(t), Result(2), Result(3), Result(4)).
+ 6. Compute MakeDate(Day(t), Result(5)).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "15.9.5.29-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setUTCMinutes( min [, sec, ms] )");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+ addNewTestCase( 0, 0, void 0, void 0,
+ "TDATE = new Date(0);(TDATE).setUTCMinutes(0);TDATE",
+ UTCDateFromTime(SetUTCMinutes(0,0,0,0)),
+ LocalDateFromTime(SetUTCMinutes(0,0,0,0)) );
+
+ addNewTestCase( 28800000, 59, 59, void 0,
+ "TDATE = new Date(28800000);(TDATE).setUTCMinutes(59,59);TDATE",
+ UTCDateFromTime(SetUTCMinutes(28800000,59,59)),
+ LocalDateFromTime(SetUTCMinutes(28800000,59,59)) );
+
+ addNewTestCase( 28800000, 59, 59, 999,
+ "TDATE = new Date(28800000);(TDATE).setUTCMinutes(59,59,999);TDATE",
+ UTCDateFromTime(SetUTCMinutes(28800000,59,59,999)),
+ LocalDateFromTime(SetUTCMinutes(28800000,59,59,999)) );
+
+ addNewTestCase( 28800000, 59, void 0, void 0,
+ "TDATE = new Date(28800000);(TDATE).setUTCMinutes(59);TDATE",
+ UTCDateFromTime(SetUTCMinutes(28800000,59)),
+ LocalDateFromTime(SetUTCMinutes(28800000,59)) );
+
+ addNewTestCase( 28800000, -480, 0, 0,
+ "TDATE = new Date(28800000);(TDATE).setUTCMinutes(-480);TDATE",
+ UTCDateFromTime(SetUTCMinutes(28800000,-480)),
+ LocalDateFromTime(SetUTCMinutes(28800000,-480)) );
+
+ addNewTestCase( 946684800000, 1234567, void 0, void 0,
+ "TDATE = new Date(946684800000);(TDATE).setUTCMinutes(1234567);TDATE",
+ UTCDateFromTime(SetUTCMinutes(946684800000,1234567)),
+ LocalDateFromTime(SetUTCMinutes(946684800000,1234567)) );
+
+ addNewTestCase( -2208988800000, 59, 999, void 0,
+ "TDATE = new Date(-2208988800000);(TDATE).setUTCMinutes(59,999);TDATE",
+ UTCDateFromTime(SetUTCMinutes(-2208988800000,59,999)),
+ LocalDateFromTime(SetUTCMinutes(-2208988800000,59,999)) );
+/*
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456789);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)) );
+
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456)) );
+
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(-123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMilliseconds(-999);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(0,-999)),
+ LocalDateFromTime(SetUTCMilliseconds(0,-999)) );
+*/
+
+}
+function addNewTestCase( time, min, sec, ms, DateString, UTCDate, LocalDate) {
+ var DateCase = new Date( time );
+
+ if ( sec == void 0 ) {
+ DateCase.setUTCMinutes( min );
+ } else {
+ if ( ms == void 0 ) {
+ DateCase.setUTCMinutes( min, sec );
+ } else {
+ DateCase.setUTCMinutes( min, sec, ms );
+ }
+ }
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetUTCMinutes( t, min, sec, ms ) {
+ var TIME = t;
+ var MIN = Number(min);
+ var SEC = ( sec == void 0) ? SecFromTime(TIME) : Number(sec);
+ var MS = ( ms == void 0 ) ? msFromTime(TIME) : Number(ms);
+ var RESULT5 = MakeTime( HourFromTime( TIME ),
+ MIN,
+ SEC,
+ MS );
+ return ( TimeClip(MakeDate(Day(TIME),RESULT5)) );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.3-1-n.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.3-1-n.js
new file mode 100644
index 0000000..109fc26
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.3-1-n.js
@@ -0,0 +1,73 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.3-1.js
+ ECMA Section: 15.9.5.3-1 Date.prototype.valueOf
+ Description:
+
+ The valueOf function returns a number, which is this time value.
+
+ The valueOf function is not generic; it generates a runtime error if
+ its this value is not a Date object. Therefore it cannot be transferred
+ to other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.3-1-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.valueOf";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var OBJ = new MyObject( new Date(0) );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "var OBJ = new MyObject( new Date(0) ); OBJ.valueOf()",
+ "error",
+ OBJ.valueOf() );
+ test();
+
+function MyObject( value ) {
+ this.value = value;
+ this.valueOf = Date.prototype.valueOf;
+// The following line causes an infinte loop
+// this.toString = new Function( "return this+\"\";");
+ return this;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.3-2.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.3-2.js
new file mode 100644
index 0000000..7698ac1
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.3-2.js
@@ -0,0 +1,107 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.3-2.js
+ ECMA Section: 15.9.5.3-2 Date.prototype.valueOf
+ Description:
+
+ The valueOf function returns a number, which is this time value.
+
+ The valueOf function is not generic; it generates a runtime error if
+ its this value is not a Date object. Therefore it cannot be transferred
+ to other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.3-2";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.valueOf";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+ var now = (new Date()).valueOf();
+ var UTC_29_FEB_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
+ var UTC_1_JAN_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( now );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_29_FEB_2000 );
+ addTestCase( UTC_1_JAN_2005 );
+
+ test();
+
+function addTestCase( t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+").valueOf()",
+ t,
+ (new Date(t)).valueOf() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+1)+").valueOf()",
+ t+1,
+ (new Date(t+1)).valueOf() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-1)+").valueOf()",
+ t-1,
+ (new Date(t-1)).valueOf() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+").valueOf()",
+ t-TZ_ADJUST,
+ (new Date(t-TZ_ADJUST)).valueOf() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+").valueOf()",
+ t+TZ_ADJUST,
+ (new Date(t+TZ_ADJUST)).valueOf() );
+}
+
+function MyObject( value ) {
+ this.value = value;
+ this.valueOf = Date.prototype.valueOf;
+ this.toString = new Function( "return this+\"\";");
+ return this;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.30-1.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.30-1.js
new file mode 100644
index 0000000..6e6715f
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.30-1.js
@@ -0,0 +1,215 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.30-1.js
+ ECMA Section: 15.9.5.30 Date.prototype.setHours(hour [, min [, sec [, ms ]]] )
+ Description:
+ If min is not specified, this behaves as if min were specified with the
+ value getMinutes( ). If sec is not specified, this behaves as if sec were
+ specified with the value getSeconds ( ). If ms is not specified, this
+ behaves as if ms were specified with the value getMilliseconds( ).
+
+ 1. Let t be the result of LocalTime(this time value).
+ 2. Call ToNumber(hour).
+ 3. If min is not specified, compute MinFromTime(t); otherwise, call
+ ToNumber(min).
+ 4. If sec is not specified, compute SecFromTime(t); otherwise, call
+ ToNumber(sec).
+ 5. If ms is not specified, compute msFromTime(t); otherwise, call
+ ToNumber(ms).
+ 6. Compute MakeTime(Result(2), Result(3), Result(4), Result(5)).
+ 7. Compute UTC(MakeDate(Day(t), Result(6))).
+ 8. Set the [[Value]] property of the this value to TimeClip(Result(7)).
+ 9. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "15.9.5.30-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setHours( hour [, min, sec, ms] )");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+ addNewTestCase( 0,0,0,0,void 0,
+ "TDATE = new Date(0);(TDATE).setHours(0);TDATE" );
+
+ addNewTestCase( 28800000, 23, 59, 999,void 0,
+ "TDATE = new Date(28800000);(TDATE).setHours(23,59,999);TDATE" );
+
+ addNewTestCase( 28800000, 999, 999, void 0, void 0,
+ "TDATE = new Date(28800000);(TDATE).setHours(999,999);TDATE" );
+
+ addNewTestCase( 28800000,999,0, void 0, void 0,
+ "TDATE = new Date(28800000);(TDATE).setHours(999);TDATE" );
+
+ addNewTestCase( 28800000,-8, void 0, void 0, void 0,
+ "TDATE = new Date(28800000);(TDATE).setHours(-8);TDATE" );
+
+ addNewTestCase( 946684800000,8760, void 0, void 0, void 0,
+ "TDATE = new Date(946684800000);(TDATE).setHours(8760);TDATE" );
+
+ addNewTestCase( TIME_2000 - msPerDay, 23, 59, 59, 999,
+ "d = new Date( " + (TIME_2000-msPerDay) +"); d.setHours(23,59,59,999)" );
+
+ addNewTestCase( TIME_2000 - msPerDay, 23, 59, 59, 1000,
+ "d = new Date( " + (TIME_2000-msPerDay) +"); d.setHours(23,59,59,1000)" );
+
+
+/*
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setHours(59,999);TDATE",
+ UTCDateFromTime(SetHours(-2208988800000,59,999)),
+ LocalDateFromTime(SetHours(-2208988800000,59,999)) );
+
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456789);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)) );
+
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456)) );
+
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(-123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMilliseconds(-999);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(0,-999)),
+ LocalDateFromTime(SetUTCMilliseconds(0,-999)) );
+*/
+
+}
+function addNewTestCase( time, hours, min, sec, ms, DateString) {
+ var UTCDate = UTCDateFromTime( SetHours( time, hours, min, sec, ms ));
+ var LocalDate = LocalDateFromTime( SetHours( time, hours, min, sec, ms ));
+
+ var DateCase = new Date( time );
+
+ if ( min == void 0 ) {
+ DateCase.setHours( hours );
+ } else {
+ if ( sec == void 0 ) {
+ DateCase.setHours( hours, min );
+ } else {
+ if ( ms == void 0 ) {
+ DateCase.setHours( hours, min, sec );
+ } else {
+ DateCase.setHours( hours, min, sec, ms );
+ }
+ }
+ }
+
+
+ var item = testcases.length;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.day = WeekDay( t );
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+
+ return (d);
+}
+function SetHours( t, hour, min, sec, ms ) {
+ var TIME = LocalTime(t);
+ var HOUR = Number(hour);
+ var MIN = ( min == void 0) ? MinFromTime(TIME) : Number(min);
+ var SEC = ( sec == void 0) ? SecFromTime(TIME) : Number(sec);
+ var MS = ( ms == void 0 ) ? msFromTime(TIME) : Number(ms);
+ var RESULT6 = MakeTime( HOUR,
+ MIN,
+ SEC,
+ MS );
+ var UTC_TIME = UTC( MakeDate(Day(TIME), RESULT6) );
+ return ( TimeClip(UTC_TIME) );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.31-1.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.31-1.js
new file mode 100644
index 0000000..b6a2fee
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.31-1.js
@@ -0,0 +1,212 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.31-1.js
+ ECMA Section: 15.9.5.31 Date.prototype.setUTCHours(hour [, min [, sec [, ms ]]] )
+ Description:
+ If min is not specified, this behaves as if min were specified with the value getUTCMinutes( ).
+ If sec is not specified, this behaves as if sec were specified with the value getUTCSeconds ( ).
+ If ms is not specified, this behaves as if ms were specified with the value getUTCMilliseconds( ).
+
+ 1.Let t be this time value.
+ 2.Call ToNumber(hour).
+ 3.If min is not specified, compute MinFromTime(t); otherwise, call ToNumber(min).
+ 4.If sec is not specified, compute SecFromTime(t); otherwise, call ToNumber(sec).
+ 5.If ms is not specified, compute msFromTime(t); otherwise, call ToNumber(ms).
+ 6.Compute MakeTime(Result(2), Result(3), Result(4), Result(5)).
+ 7.Compute MakeDate(Day(t), Result(6)).
+ 8.Set the [[Value]] property of the this value to TimeClip(Result(7)).
+
+ 1.Return the value of the [[Value]] property of the this value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "15.9.5.31-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setUTCHours(hour [, min [, sec [, ms ]]] )");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+ addNewTestCase( 0, 0, void 0, void 0, void 0,
+ "TDATE = new Date(0);(TDATE).setUTCHours(0);TDATE",
+ UTCDateFromTime(SetUTCHours(0,0,0,0)),
+ LocalDateFromTime(SetUTCHours(0,0,0,0)) );
+
+ addNewTestCase( 28800000, 23, 59, 999, void 0,
+ "TDATE = new Date(28800000);(TDATE).setUTCHours(23,59,999);TDATE",
+ UTCDateFromTime(SetUTCHours(28800000,23,59,999)),
+ LocalDateFromTime(SetUTCHours(28800000,23,59,999)) );
+
+ addNewTestCase( 28800000,999,999, void 0, void 0,
+ "TDATE = new Date(28800000);(TDATE).setUTCHours(999,999);TDATE",
+ UTCDateFromTime(SetUTCHours(28800000,999,999)),
+ LocalDateFromTime(SetUTCHours(28800000,999,999)) );
+
+ addNewTestCase( 28800000, 999, void 0, void 0, void 0,
+ "TDATE = new Date(28800000);(TDATE).setUTCHours(999);TDATE",
+ UTCDateFromTime(SetUTCHours(28800000,999,0)),
+ LocalDateFromTime(SetUTCHours(28800000,999,0)) );
+
+ addNewTestCase( 28800000, -8670, void 0, void 0, void 0,
+ "TDATE = new Date(28800000);(TDATE).setUTCHours(-8670);TDATE",
+ UTCDateFromTime(SetUTCHours(28800000,-8670)),
+ LocalDateFromTime(SetUTCHours(28800000,-8670)) );
+
+ addNewTestCase( 946684800000, 1234567, void 0, void 0, void 0,
+ "TDATE = new Date(946684800000);(TDATE).setUTCHours(1234567);TDATE",
+ UTCDateFromTime(SetUTCHours(946684800000,1234567)),
+ LocalDateFromTime(SetUTCHours(946684800000,1234567)) );
+
+ addNewTestCase( -2208988800000, 59, 999, void 0, void 0,
+ "TDATE = new Date(-2208988800000);(TDATE).setUTCHours(59,999);TDATE",
+ UTCDateFromTime(SetUTCHours(-2208988800000,59,999)),
+ LocalDateFromTime(SetUTCHours(-2208988800000,59,999)) );
+/*
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456789);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)) );
+
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456)) );
+
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(-123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMilliseconds(-999);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(0,-999)),
+ LocalDateFromTime(SetUTCMilliseconds(0,-999)) );
+*/
+
+}
+function addNewTestCase( time, hours, min, sec, ms, DateString, UTCDate, LocalDate) {
+
+ DateCase = new Date(time);
+ if ( min == void 0 ) {
+ DateCase.setUTCHours( hours );
+ } else {
+ if ( sec == void 0 ) {
+ DateCase.setUTCHours( hours, min );
+ } else {
+ if ( ms == void 0 ) {
+ DateCase.setUTCHours( hours, min, sec );
+ } else {
+ DateCase.setUTCHours( hours, min, sec, ms );
+ }
+ }
+ }
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetUTCHours( t, hour, min, sec, ms ) {
+ var TIME = t;
+ var HOUR = Number(hour);
+ var MIN = ( min == void 0) ? MinFromTime(TIME) : Number(min);
+ var SEC = ( sec == void 0) ? SecFromTime(TIME) : Number(sec);
+ var MS = ( ms == void 0 ) ? msFromTime(TIME) : Number(ms);
+ var RESULT6 = MakeTime( HOUR,
+ MIN,
+ SEC,
+ MS );
+ return ( TimeClip(MakeDate(Day(TIME), RESULT6)) );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.32-1.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.32-1.js
new file mode 100644
index 0000000..eded146
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.32-1.js
@@ -0,0 +1,157 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+ /**
+ File Name: 15.9.5.32-1.js
+ ECMA Section: 15.9.5.32 Date.prototype.setDate(date)
+ Description:
+ 1. Let t be the result of LocalTime(this time value).
+ 2. Call ToNumber(date).
+ 3. Compute MakeDay(YearFromTime(t), MonthFromTime(t), Result(2)).
+ 4. Compute UTC(MakeDate(Result(3), TimeWithinDay(t))).
+ 5. Set the [[Value]] property of the this value to TimeClip(Result(4)).
+ 6. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "15.9.5.32-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setDate(date) ");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+ addNewTestCase( 0, 1,
+ "TDATE = new Date(0);(TDATE).setDate(1);TDATE" );
+
+/*
+ addNewTestCase( "TDATE = new Date(86400000);(TDATE).setDate(1);TDATE",
+ UTCDateFromTime(SetDate(86400000,1)),
+ LocalDateFromTime(SetDate(86400000,1)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1972);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1972)),
+ LocalDateFromTime(SetUTCFullYear(0,1972)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1968);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1968)),
+ LocalDateFromTime(SetUTCFullYear(0,1968)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1969);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1969)),
+ LocalDateFromTime(SetUTCFullYear(0,1969)) );
+*/
+}
+function addNewTestCase( t, d, DateString ) {
+ var DateCase = new Date( t );
+ DateCase.setDate( d );
+
+ var UTCDate = UTCDateFromTime(SetDate(t, d));
+ var LocalDate=LocalDateFromTime(SetDate(t,d));
+
+ var item = testcases.length;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+
+function SetDate( t, date ) {
+ var T = LocalTime( t );
+ var DATE = Number( date );
+ var RESULT3 = MakeDay(YearFromTime(T), MonthFromTime(T), DATE );
+ var UTC_DATE = UTC( MakeDate(RESULT3, TimeWithinDay(T)) );
+ return ( TimeClip(UTC_DATE) );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.33-1.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.33-1.js
new file mode 100644
index 0000000..017d43e
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.33-1.js
@@ -0,0 +1,156 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+ /**
+ File Name: 15.9.5.33-1.js
+ ECMA Section: 15.9.5.33 Date.prototype.setUTCDate(date)
+ Description:
+ 1. Let t be this time value.
+ 2. Call ToNumber(date).
+ 3. Compute MakeDay(YearFromTime(t), MonthFromTime(t), Result(2)).
+ 4. Compute MakeDate(Result(3), TimeWithinDay(t)).
+ 5. Set the [[Value]] property of the this value to TimeClip(Result(4)).
+ 6. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "15.9.5.33-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setUTCDate(date) ");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCDate(31);TDATE",
+ UTCDateFromTime(SetUTCDate(0,31)),
+ LocalDateFromTime(SetUTCDate(0,31)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCDate(1);TDATE",
+ UTCDateFromTime(SetUTCDate(0,1)),
+ LocalDateFromTime(SetUTCDate(0,1)) );
+
+ addNewTestCase( "TDATE = new Date(86400000);(TDATE).setUTCDate(1);TDATE",
+ UTCDateFromTime(SetUTCDate(86400000,1)),
+ LocalDateFromTime(SetUTCDate(86400000,1)) );
+/*
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1972);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1972)),
+ LocalDateFromTime(SetUTCFullYear(0,1972)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1968);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1968)),
+ LocalDateFromTime(SetUTCFullYear(0,1968)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1969);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1969)),
+ LocalDateFromTime(SetUTCFullYear(0,1969)) );
+*/
+}
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ var item = testcases.length;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetUTCDate( t, date ) {
+ var T = t;
+ var DATE = Number( date );
+ var RESULT3 = MakeDay(YearFromTime(T), MonthFromTime(T), DATE );
+ return ( TimeClip(MakeDate(RESULT3, TimeWithinDay(t))) );
+}
+
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.34-1.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.34-1.js
new file mode 100644
index 0000000..e042ab9
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.34-1.js
@@ -0,0 +1,220 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.34-1.js
+ ECMA Section: 15.9.5.34 Date.prototype.setMonth(mon [, date ] )
+ Description:
+ If date is not specified, this behaves as if date were specified with the
+ value getDate( ).
+
+ 1. Let t be the result of LocalTime(this time value).
+ 2. Call ToNumber(date).
+ 3. If date is not specified, compute DateFromTime(t); otherwise, call ToNumber(date).
+ 4. Compute MakeDay(YearFromTime(t), Result(2), Result(3)).
+ 5. Compute UTC(MakeDate(Result(4), TimeWithinDay(t))).
+ 6. Set the [[Value]] property of the this value to TimeClip(Result(5)).
+ 7. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "15.9.5.34-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setMonth(mon [, date ] )");
+
+ var now = (new Date()).valueOf();
+
+ getFunctionCases();
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getFunctionCases() {
+ // some tests for all functions
+ testcases[testcases.length] = new TestCase(
+ SECTION,
+ "Date.prototype.setMonth.length",
+ 2,
+ Date.prototype.setMonth.length );
+
+ testcases[testcases.length] = new TestCase(
+ SECTION,
+ "typeof Date.prototype.setMonth",
+ "function",
+ typeof Date.prototype.setMonth );
+
+
+/*
+
+ testcases[testcases.length] = new TestCase(
+ SECTION,
+ "delete Date.prototype.setMonth",
+ false,
+ delete Date.prototype.setMonth );
+*/
+
+}
+
+
+function getTestCases() {
+ // regression test for http://scopus.mcom.com/bugsplat/show_bug.cgi?id=112404
+ d = new Date(0);
+ d.setMonth(1,1,1,1,1,1);
+
+ addNewTestCase(
+ "TDATE = new Date(0); TDATE.setMonth(1,1,1,1,1,1); TDATE",
+ UTCDateFromTime(SetMonth(0,1,1)),
+ LocalDateFromTime(SetMonth(0,1,1)) );
+
+
+ // whatever today is
+
+ addNewTestCase( "TDATE = new Date(now); (TDATE).setMonth(11,31); TDATE",
+ UTCDateFromTime(SetMonth(now,11,31)),
+ LocalDateFromTime(SetMonth(now,11,31)) );
+
+ // 1970
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setMonth(0,1);TDATE",
+ UTCDateFromTime(SetMonth(0,0,1)),
+ LocalDateFromTime(SetMonth(0,0,1)) );
+
+ addNewTestCase( "TDATE = new Date("+TIME_1900+"); "+
+ "(TDATE).setMonth(11,31); TDATE",
+ UTCDateFromTime( SetMonth(TIME_1900,11,31) ),
+ LocalDateFromTime( SetMonth(TIME_1900,11,31) ) );
+
+
+
+
+/*
+ addNewTestCase( "TDATE = new Date(28800000);(TDATE).setMonth(11,23,59,999);TDATE",
+ UTCDateFromTime(SetMonth(28800000,11,23,59,999)),
+ LocalDateFromTime(SetMonth(28800000,11,23,59,999)) );
+
+ addNewTestCase( "TDATE = new Date(28800000);(TDATE).setMonth(99,99);TDATE",
+ UTCDateFromTime(SetMonth(28800000,99,99)),
+ LocalDateFromTime(SetMonth(28800000,99,99)) );
+
+ addNewTestCase( "TDATE = new Date(28800000);(TDATE).setMonth(11);TDATE",
+ UTCDateFromTime(SetMonth(28800000,11,0)),
+ LocalDateFromTime(SetMonth(28800000,11,0)) );
+
+ addNewTestCase( "TDATE = new Date(28800000);(TDATE).setMonth(-11);TDATE",
+ UTCDateFromTime(SetMonth(28800000,-11)),
+ LocalDateFromTime(SetMonth(28800000,-11)) );
+
+ // 1900
+
+// addNewTestCase( "TDATE = new Date(); (TDATE).setMonth(11,31); TDATE;"
+*/
+
+}
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetMonth( t, mon, date ) {
+ var TIME = LocalTime(t);
+ var MONTH = Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(TIME) : Number( date );
+ var DAY = MakeDay( YearFromTime(TIME), MONTH, DATE );
+ return ( TimeClip (UTC(MakeDate( DAY, TimeWithinDay(TIME) ))) );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.35-1.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.35-1.js
new file mode 100644
index 0000000..242c0d8
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.35-1.js
@@ -0,0 +1,143 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+ /**
+ File Name: 15.9.5.35-1.js
+ ECMA Section: 15.9.5.35 Date.prototype.setUTCMonth(mon [,date])
+ Description:
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "15.9.5.35-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setUTCMonth(mon [,date] ) ");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMonth(0);TDATE",
+ UTCDateFromTime(SetUTCMonth(0,0)),
+ LocalDateFromTime(SetUTCMonth(0,0)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMonth(11);TDATE",
+ UTCDateFromTime(SetUTCMonth(0,11)),
+ LocalDateFromTime(SetUTCMonth(0,11)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMonth(3,4);TDATE",
+ UTCDateFromTime(SetUTCMonth(0,3,4)),
+ LocalDateFromTime(SetUTCMonth(0,3,4)) );
+
+}
+
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetUTCMonth( t, month, date ) {
+ var T = t;
+ var MONTH = Number( month );
+ var DATE = ( date == void 0) ? DateFromTime(T) : Number( date );
+
+ var RESULT4 = MakeDay(YearFromTime(T), MONTH, DATE );
+ var RESULT5 = MakeDate( RESULT4, TimeWithinDay(T));
+
+ return ( TimeClip(RESULT5) );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-1.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-1.js
new file mode 100644
index 0000000..f046829
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-1.js
@@ -0,0 +1,245 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.36-1.js
+ ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getMonth( ). If date is not specified, this behaves as if date were
+ specified with the value getDate( ).
+
+ 1. Let t be the result of LocalTime(this time value); but if this time
+ value is NaN, let t be +0.
+ 2. Call ToNumber(year).
+ 3. If mon is not specified, compute MonthFromTime(t); otherwise, call
+ ToNumber(mon).
+ 4. If date is not specified, compute DateFromTime(t); otherwise, call
+ ToNumber(date).
+ 5. Compute MakeDay(Result(2), Result(3), Result(4)).
+ 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+ Added test cases for Year 2000 Compatilibity Testing.
+
+*/
+ var SECTION = "15.9.5.36-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+
+ // 1969
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1969);TDATE",
+ UTCDateFromTime(SetFullYear(0,1969)),
+ LocalDateFromTime(SetFullYear(0,1969)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1969,11);TDATE",
+ UTCDateFromTime(SetFullYear(0,1969,11)),
+ LocalDateFromTime(SetFullYear(0,1969,11)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1969,11,31);TDATE",
+ UTCDateFromTime(SetFullYear(0,1969,11,31)),
+ LocalDateFromTime(SetFullYear(0,1969,11,31)) );
+/*
+ // 1970
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1970);TDATE",
+ UTCDateFromTime(SetFullYear(0,1970)),
+ LocalDateFromTime(SetFullYear(0,1970)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1970,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,1970,0)),
+ LocalDateFromTime(SetFullYear(0,1970,0)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1970,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,1970,0,1)),
+ LocalDateFromTime(SetFullYear(0,1970,0,1)) );
+ // 1971
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971);TDATE",
+ UTCDateFromTime(SetFullYear(0,1971)),
+ LocalDateFromTime(SetFullYear(0,1971)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,1971,0)),
+ LocalDateFromTime(SetFullYear(0,1971,0)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,1971,0,1)),
+ LocalDateFromTime(SetFullYear(0,1971,0,1)) );
+
+ // 1999
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999);TDATE",
+ UTCDateFromTime(SetFullYear(0,1999)),
+ LocalDateFromTime(SetFullYear(0,1999)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11);TDATE",
+ UTCDateFromTime(SetFullYear(0,1999,11)),
+ LocalDateFromTime(SetFullYear(0,1999,11)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11,31);TDATE",
+ UTCDateFromTime(SetFullYear(0,1999,11,31)),
+ LocalDateFromTime(SetFullYear(0,1999,11,31)) );
+
+ // 2000
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000)),
+ LocalDateFromTime(SetFullYear(0,2000)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,0)),
+ LocalDateFromTime(SetFullYear(0,2000,0)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,0,1)),
+ LocalDateFromTime(SetFullYear(0,2000,0,1)) );
+
+ // feb 29, 2000
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000)),
+ LocalDateFromTime(SetFullYear(0,2000)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,1)),
+ LocalDateFromTime(SetFullYear(0,2000,1)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1,29);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,1,29)),
+ LocalDateFromTime(SetFullYear(0,2000,1,29)) );
+
+ // Jan 1, 2005
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005)),
+ LocalDateFromTime(SetFullYear(0,2005)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005,0)),
+ LocalDateFromTime(SetFullYear(0,2005,0)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005,0,1)),
+ LocalDateFromTime(SetFullYear(0,2005,0,1)) );
+
+*/
+}
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetFullYear( t, year, mon, date ) {
+ var T = ( isNaN(t) ) ? 0 : LocalTime(t) ;
+ var YEAR = Number( year );
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+ var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T)));
+
+ return ( TimeClip(UTC_DATE) );
+} \ No newline at end of file
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-2.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-2.js
new file mode 100644
index 0000000..1e207ed
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-2.js
@@ -0,0 +1,231 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.36-1.js
+ ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getMonth( ). If date is not specified, this behaves as if date were
+ specified with the value getDate( ).
+
+ 1. Let t be the result of LocalTime(this time value); but if this time
+ value is NaN, let t be +0.
+ 2. Call ToNumber(year).
+ 3. If mon is not specified, compute MonthFromTime(t); otherwise, call
+ ToNumber(mon).
+ 4. If date is not specified, compute DateFromTime(t); otherwise, call
+ ToNumber(date).
+ 5. Compute MakeDay(Result(2), Result(3), Result(4)).
+ 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+ Added test cases for Year 2000 Compatilibity Testing.
+
+*/
+ var SECTION = "15.9.5.36-2";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ // 1970
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1970);TDATE",
+ UTCDateFromTime(SetFullYear(0,1970)),
+ LocalDateFromTime(SetFullYear(0,1970)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1970,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,1970,0)),
+ LocalDateFromTime(SetFullYear(0,1970,0)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1970,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,1970,0,1)),
+ LocalDateFromTime(SetFullYear(0,1970,0,1)) );
+/*
+ // 1971
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971);TDATE",
+ UTCDateFromTime(SetFullYear(0,1971)),
+ LocalDateFromTime(SetFullYear(0,1971)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,1971,0)),
+ LocalDateFromTime(SetFullYear(0,1971,0)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,1971,0,1)),
+ LocalDateFromTime(SetFullYear(0,1971,0,1)) );
+
+ // 1999
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999);TDATE",
+ UTCDateFromTime(SetFullYear(0,1999)),
+ LocalDateFromTime(SetFullYear(0,1999)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11);TDATE",
+ UTCDateFromTime(SetFullYear(0,1999,11)),
+ LocalDateFromTime(SetFullYear(0,1999,11)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11,31);TDATE",
+ UTCDateFromTime(SetFullYear(0,1999,11,31)),
+ LocalDateFromTime(SetFullYear(0,1999,11,31)) );
+
+ // 2000
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000)),
+ LocalDateFromTime(SetFullYear(0,2000)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,0)),
+ LocalDateFromTime(SetFullYear(0,2000,0)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,0,1)),
+ LocalDateFromTime(SetFullYear(0,2000,0,1)) );
+
+ // feb 29, 2000
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000)),
+ LocalDateFromTime(SetFullYear(0,2000)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,1)),
+ LocalDateFromTime(SetFullYear(0,2000,1)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1,29);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,1,29)),
+ LocalDateFromTime(SetFullYear(0,2000,1,29)) );
+
+ // Jan 1, 2005
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005)),
+ LocalDateFromTime(SetFullYear(0,2005)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005,0)),
+ LocalDateFromTime(SetFullYear(0,2005,0)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005,0,1)),
+ LocalDateFromTime(SetFullYear(0,2005,0,1)) );
+
+*/
+}
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetFullYear( t, year, mon, date ) {
+ var T = ( isNaN(t) ) ? 0 : LocalTime(t) ;
+ var YEAR = Number( year );
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+ var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T)));
+
+ return ( TimeClip(UTC_DATE) );
+} \ No newline at end of file
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-3.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-3.js
new file mode 100644
index 0000000..c1e9c81
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-3.js
@@ -0,0 +1,218 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.36-1.js
+ ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getMonth( ). If date is not specified, this behaves as if date were
+ specified with the value getDate( ).
+
+ 1. Let t be the result of LocalTime(this time value); but if this time
+ value is NaN, let t be +0.
+ 2. Call ToNumber(year).
+ 3. If mon is not specified, compute MonthFromTime(t); otherwise, call
+ ToNumber(mon).
+ 4. If date is not specified, compute DateFromTime(t); otherwise, call
+ ToNumber(date).
+ 5. Compute MakeDay(Result(2), Result(3), Result(4)).
+ 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+ Added test cases for Year 2000 Compatilibity Testing.
+
+*/
+ var SECTION = "15.9.5.36-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ // 1971
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971);TDATE",
+ UTCDateFromTime(SetFullYear(0,1971)),
+ LocalDateFromTime(SetFullYear(0,1971)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,1971,0)),
+ LocalDateFromTime(SetFullYear(0,1971,0)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,1971,0,1)),
+ LocalDateFromTime(SetFullYear(0,1971,0,1)) );
+
+/*
+ // 1999
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999);TDATE",
+ UTCDateFromTime(SetFullYear(0,1999)),
+ LocalDateFromTime(SetFullYear(0,1999)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11);TDATE",
+ UTCDateFromTime(SetFullYear(0,1999,11)),
+ LocalDateFromTime(SetFullYear(0,1999,11)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11,31);TDATE",
+ UTCDateFromTime(SetFullYear(0,1999,11,31)),
+ LocalDateFromTime(SetFullYear(0,1999,11,31)) );
+
+ // 2000
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000)),
+ LocalDateFromTime(SetFullYear(0,2000)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,0)),
+ LocalDateFromTime(SetFullYear(0,2000,0)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,0,1)),
+ LocalDateFromTime(SetFullYear(0,2000,0,1)) );
+
+ // feb 29, 2000
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000)),
+ LocalDateFromTime(SetFullYear(0,2000)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,1)),
+ LocalDateFromTime(SetFullYear(0,2000,1)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1,29);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,1,29)),
+ LocalDateFromTime(SetFullYear(0,2000,1,29)) );
+
+ // Jan 1, 2005
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005)),
+ LocalDateFromTime(SetFullYear(0,2005)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005,0)),
+ LocalDateFromTime(SetFullYear(0,2005,0)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005,0,1)),
+ LocalDateFromTime(SetFullYear(0,2005,0,1)) );
+
+*/
+}
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetFullYear( t, year, mon, date ) {
+ var T = ( isNaN(t) ) ? 0 : LocalTime(t) ;
+ var YEAR = Number( year );
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+ var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T)));
+
+ return ( TimeClip(UTC_DATE) );
+} \ No newline at end of file
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-4.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-4.js
new file mode 100644
index 0000000..4d7f08b0
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-4.js
@@ -0,0 +1,205 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.36-1.js
+ ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getMonth( ). If date is not specified, this behaves as if date were
+ specified with the value getDate( ).
+
+ 1. Let t be the result of LocalTime(this time value); but if this time
+ value is NaN, let t be +0.
+ 2. Call ToNumber(year).
+ 3. If mon is not specified, compute MonthFromTime(t); otherwise, call
+ ToNumber(mon).
+ 4. If date is not specified, compute DateFromTime(t); otherwise, call
+ ToNumber(date).
+ 5. Compute MakeDay(Result(2), Result(3), Result(4)).
+ 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+ Added test cases for Year 2000 Compatilibity Testing.
+
+*/
+ var SECTION = "15.9.5.36-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ // 1999
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999);TDATE",
+ UTCDateFromTime(SetFullYear(0,1999)),
+ LocalDateFromTime(SetFullYear(0,1999)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11);TDATE",
+ UTCDateFromTime(SetFullYear(0,1999,11)),
+ LocalDateFromTime(SetFullYear(0,1999,11)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11,31);TDATE",
+ UTCDateFromTime(SetFullYear(0,1999,11,31)),
+ LocalDateFromTime(SetFullYear(0,1999,11,31)) );
+
+/*
+ // 2000
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000)),
+ LocalDateFromTime(SetFullYear(0,2000)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,0)),
+ LocalDateFromTime(SetFullYear(0,2000,0)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,0,1)),
+ LocalDateFromTime(SetFullYear(0,2000,0,1)) );
+
+ // feb 29, 2000
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000)),
+ LocalDateFromTime(SetFullYear(0,2000)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,1)),
+ LocalDateFromTime(SetFullYear(0,2000,1)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1,29);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,1,29)),
+ LocalDateFromTime(SetFullYear(0,2000,1,29)) );
+
+ // Jan 1, 2005
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005)),
+ LocalDateFromTime(SetFullYear(0,2005)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005,0)),
+ LocalDateFromTime(SetFullYear(0,2005,0)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005,0,1)),
+ LocalDateFromTime(SetFullYear(0,2005,0,1)) );
+
+*/
+}
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetFullYear( t, year, mon, date ) {
+ var T = ( isNaN(t) ) ? 0 : LocalTime(t) ;
+ var YEAR = Number( year );
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+ var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T)));
+
+ return ( TimeClip(UTC_DATE) );
+} \ No newline at end of file
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-5.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-5.js
new file mode 100644
index 0000000..41dc143
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-5.js
@@ -0,0 +1,192 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.36-1.js
+ ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getMonth( ). If date is not specified, this behaves as if date were
+ specified with the value getDate( ).
+
+ 1. Let t be the result of LocalTime(this time value); but if this time
+ value is NaN, let t be +0.
+ 2. Call ToNumber(year).
+ 3. If mon is not specified, compute MonthFromTime(t); otherwise, call
+ ToNumber(mon).
+ 4. If date is not specified, compute DateFromTime(t); otherwise, call
+ ToNumber(date).
+ 5. Compute MakeDay(Result(2), Result(3), Result(4)).
+ 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+ Added test cases for Year 2000 Compatilibity Testing.
+
+*/
+ var SECTION = "15.9.5.36-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ // 2000
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000)),
+ LocalDateFromTime(SetFullYear(0,2000)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,0)),
+ LocalDateFromTime(SetFullYear(0,2000,0)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,0,1)),
+ LocalDateFromTime(SetFullYear(0,2000,0,1)) );
+
+/*
+ // feb 29, 2000
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000)),
+ LocalDateFromTime(SetFullYear(0,2000)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,1)),
+ LocalDateFromTime(SetFullYear(0,2000,1)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1,29);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,1,29)),
+ LocalDateFromTime(SetFullYear(0,2000,1,29)) );
+
+ // Jan 1, 2005
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005)),
+ LocalDateFromTime(SetFullYear(0,2005)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005,0)),
+ LocalDateFromTime(SetFullYear(0,2005,0)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005,0,1)),
+ LocalDateFromTime(SetFullYear(0,2005,0,1)) );
+
+*/
+}
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetFullYear( t, year, mon, date ) {
+ var T = ( isNaN(t) ) ? 0 : LocalTime(t) ;
+ var YEAR = Number( year );
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+ var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T)));
+
+ return ( TimeClip(UTC_DATE) );
+} \ No newline at end of file
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-6.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-6.js
new file mode 100644
index 0000000..8bed8d2
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-6.js
@@ -0,0 +1,179 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.36-1.js
+ ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getMonth( ). If date is not specified, this behaves as if date were
+ specified with the value getDate( ).
+
+ 1. Let t be the result of LocalTime(this time value); but if this time
+ value is NaN, let t be +0.
+ 2. Call ToNumber(year).
+ 3. If mon is not specified, compute MonthFromTime(t); otherwise, call
+ ToNumber(mon).
+ 4. If date is not specified, compute DateFromTime(t); otherwise, call
+ ToNumber(date).
+ 5. Compute MakeDay(Result(2), Result(3), Result(4)).
+ 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+ Added test cases for Year 2000 Compatilibity Testing.
+
+*/
+ var SECTION = "15.9.5.36-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ // feb 29, 2000
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000)),
+ LocalDateFromTime(SetFullYear(0,2000)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,1)),
+ LocalDateFromTime(SetFullYear(0,2000,1)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1,29);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,1,29)),
+ LocalDateFromTime(SetFullYear(0,2000,1,29)) );
+
+/*
+ // Jan 1, 2005
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005)),
+ LocalDateFromTime(SetFullYear(0,2005)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005,0)),
+ LocalDateFromTime(SetFullYear(0,2005,0)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005,0,1)),
+ LocalDateFromTime(SetFullYear(0,2005,0,1)) );
+
+*/
+}
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetFullYear( t, year, mon, date ) {
+ var T = ( isNaN(t) ) ? 0 : LocalTime(t) ;
+ var YEAR = Number( year );
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+ var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T)));
+
+ return ( TimeClip(UTC_DATE) );
+} \ No newline at end of file
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-7.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-7.js
new file mode 100644
index 0000000..8520844
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.36-7.js
@@ -0,0 +1,164 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.36-1.js
+ ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getMonth( ). If date is not specified, this behaves as if date were
+ specified with the value getDate( ).
+
+ 1. Let t be the result of LocalTime(this time value); but if this time
+ value is NaN, let t be +0.
+ 2. Call ToNumber(year).
+ 3. If mon is not specified, compute MonthFromTime(t); otherwise, call
+ ToNumber(mon).
+ 4. If date is not specified, compute DateFromTime(t); otherwise, call
+ ToNumber(date).
+ 5. Compute MakeDay(Result(2), Result(3), Result(4)).
+ 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+ Added test cases for Year 2000 Compatilibity Testing.
+
+*/
+ var SECTION = "15.9.5.36-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+function getTestCases() {
+ // Jan 1, 2005
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005)),
+ LocalDateFromTime(SetFullYear(0,2005)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005,0)),
+ LocalDateFromTime(SetFullYear(0,2005,0)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005,0,1)),
+ LocalDateFromTime(SetFullYear(0,2005,0,1)) );
+
+}
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetFullYear( t, year, mon, date ) {
+ var T = ( isNaN(t) ) ? 0 : LocalTime(t) ;
+ var YEAR = Number( year );
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+ var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T)));
+
+ return ( TimeClip(UTC_DATE) );
+} \ No newline at end of file
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-1.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-1.js
new file mode 100644
index 0000000..9eaf49d
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-1.js
@@ -0,0 +1,235 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+ /**
+ File Name: 15.9.5.37-1.js
+ ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getUTCMonth( ). If date is not specified, this behaves as if date
+ were specified with the value getUTCDate( ).
+
+ 1. Let t be this time value; but if this time value is NaN, let t be +0.
+ 2. Call ToNumber(year).
+ 3. If mon is not specified, compute MonthFromTime(t); otherwise, call
+ ToNumber(mon).
+ 4. If date is not specified, compute DateFromTime(t); otherwise, call
+ ToNumber(date).
+ 5. Compute MakeDay(Result(2), Result(3), Result(4)).
+ 6. Compute MakeDate(Result(5), TimeWithinDay(t)).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+ Added some Year 2000 test cases.
+*/
+ var SECTION = "15.9.5.37-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+
+ // Dates around 1970
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1970);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1970)),
+ LocalDateFromTime(SetUTCFullYear(0,1970)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1971);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1971)),
+ LocalDateFromTime(SetUTCFullYear(0,1971)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1972);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1972)),
+ LocalDateFromTime(SetUTCFullYear(0,1972)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1968);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1968)),
+ LocalDateFromTime(SetUTCFullYear(0,1968)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1969);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1969)),
+ LocalDateFromTime(SetUTCFullYear(0,1969)) );
+
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1969);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1969)),
+ LocalDateFromTime(SetUTCFullYear(0,1969)) );
+/*
+ // Dates around 2000
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2000);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2000)),
+ LocalDateFromTime(SetUTCFullYear(0,2000)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2001);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2001)),
+ LocalDateFromTime(SetUTCFullYear(0,2001)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1999);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1999)),
+ LocalDateFromTime(SetUTCFullYear(0,1999)) );
+
+ // Dates around 29 February 2000
+
+ var UTC_FEB_29_1972 = TIME_1970 + TimeInYear(1970) + TimeInYear(1971) +
+ 31*msPerDay + 28*msPerDay;
+
+ var PST_FEB_29_1972 = UTC_FEB_29_1972 - TZ_DIFF * msPerHour;
+
+ addNewTestCase( "TDATE = new Date("+UTC_FEB_29_1972+"); "+
+ "TDATE.setUTCFullYear(2000);TDATE",
+ UTCDateFromTime(SetUTCFullYear(UTC_FEB_29_1972,2000)),
+ LocalDateFromTime(SetUTCFullYear(UTC_FEB_29_1972,2000)) );
+
+ addNewTestCase( "TDATE = new Date("+PST_FEB_29_1972+"); "+
+ "TDATE.setUTCFullYear(2000);TDATE",
+ UTCDateFromTime(SetUTCFullYear(PST_FEB_29_1972,2000)),
+ LocalDateFromTime(SetUTCFullYear(PST_FEB_29_1972,2000)) );
+
+ // Dates around 2005
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2005);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2005)),
+ LocalDateFromTime(SetUTCFullYear(0,2005)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2004);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2004)),
+ LocalDateFromTime(SetUTCFullYear(0,2004)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2006);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2006)),
+ LocalDateFromTime(SetUTCFullYear(0,2006)) );
+
+
+ // Dates around 1900
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1900);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1900)),
+ LocalDateFromTime(SetUTCFullYear(0,1900)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1899);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1899)),
+ LocalDateFromTime(SetUTCFullYear(0,1899)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1901);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1901)),
+ LocalDateFromTime(SetUTCFullYear(0,1901)) );
+
+*/
+}
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetUTCFullYear( t, year, mon, date ) {
+ var T = ( t != t ) ? 0 : t;
+ var YEAR = Number(year);
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+
+ return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-2.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-2.js
new file mode 100644
index 0000000..ffb8fda
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-2.js
@@ -0,0 +1,209 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+ /**
+ File Name: 15.9.5.37-1.js
+ ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getUTCMonth( ). If date is not specified, this behaves as if date
+ were specified with the value getUTCDate( ).
+
+ 1. Let t be this time value; but if this time value is NaN, let t be +0.
+ 2. Call ToNumber(year).
+ 3. If mon is not specified, compute MonthFromTime(t); otherwise, call
+ ToNumber(mon).
+ 4. If date is not specified, compute DateFromTime(t); otherwise, call
+ ToNumber(date).
+ 5. Compute MakeDay(Result(2), Result(3), Result(4)).
+ 6. Compute MakeDate(Result(5), TimeWithinDay(t)).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+ Added some Year 2000 test cases.
+*/
+ var SECTION = "15.9.5.37-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+
+ // Dates around 2000
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2000);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2000)),
+ LocalDateFromTime(SetUTCFullYear(0,2000)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2001);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2001)),
+ LocalDateFromTime(SetUTCFullYear(0,2001)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1999);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1999)),
+ LocalDateFromTime(SetUTCFullYear(0,1999)) );
+/*
+ // Dates around 29 February 2000
+
+ var UTC_FEB_29_1972 = TIME_1970 + TimeInYear(1970) + TimeInYear(1971) +
+ 31*msPerDay + 28*msPerDay;
+
+ var PST_FEB_29_1972 = UTC_FEB_29_1972 - TZ_DIFF * msPerHour;
+
+ addNewTestCase( "TDATE = new Date("+UTC_FEB_29_1972+"); "+
+ "TDATE.setUTCFullYear(2000);TDATE",
+ UTCDateFromTime(SetUTCFullYear(UTC_FEB_29_1972,2000)),
+ LocalDateFromTime(SetUTCFullYear(UTC_FEB_29_1972,2000)) );
+
+ addNewTestCase( "TDATE = new Date("+PST_FEB_29_1972+"); "+
+ "TDATE.setUTCFullYear(2000);TDATE",
+ UTCDateFromTime(SetUTCFullYear(PST_FEB_29_1972,2000)),
+ LocalDateFromTime(SetUTCFullYear(PST_FEB_29_1972,2000)) );
+
+ // Dates around 2005
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2005);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2005)),
+ LocalDateFromTime(SetUTCFullYear(0,2005)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2004);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2004)),
+ LocalDateFromTime(SetUTCFullYear(0,2004)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2006);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2006)),
+ LocalDateFromTime(SetUTCFullYear(0,2006)) );
+
+
+ // Dates around 1900
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1900);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1900)),
+ LocalDateFromTime(SetUTCFullYear(0,1900)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1899);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1899)),
+ LocalDateFromTime(SetUTCFullYear(0,1899)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1901);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1901)),
+ LocalDateFromTime(SetUTCFullYear(0,1901)) );
+
+*/
+}
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetUTCFullYear( t, year, mon, date ) {
+ var T = ( t != t ) ? 0 : t;
+ var YEAR = Number(year);
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+
+ return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-3.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-3.js
new file mode 100644
index 0000000..136ec89
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-3.js
@@ -0,0 +1,195 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+ /**
+ File Name: 15.9.5.37-1.js
+ ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getUTCMonth( ). If date is not specified, this behaves as if date
+ were specified with the value getUTCDate( ).
+
+ 1. Let t be this time value; but if this time value is NaN, let t be +0.
+ 2. Call ToNumber(year).
+ 3. If mon is not specified, compute MonthFromTime(t); otherwise, call
+ ToNumber(mon).
+ 4. If date is not specified, compute DateFromTime(t); otherwise, call
+ ToNumber(date).
+ 5. Compute MakeDay(Result(2), Result(3), Result(4)).
+ 6. Compute MakeDate(Result(5), TimeWithinDay(t)).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+ Added some Year 2000 test cases.
+*/
+ var SECTION = "15.9.5.37-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+
+ // Dates around 29 February 2000
+
+ var UTC_FEB_29_1972 = TIME_1970 + TimeInYear(1970) + TimeInYear(1971) +
+ 31*msPerDay + 28*msPerDay;
+
+ var PST_FEB_29_1972 = UTC_FEB_29_1972 - TZ_DIFF * msPerHour;
+
+ addNewTestCase( "TDATE = new Date("+UTC_FEB_29_1972+"); "+
+ "TDATE.setUTCFullYear(2000);TDATE",
+ UTCDateFromTime(SetUTCFullYear(UTC_FEB_29_1972,2000)),
+ LocalDateFromTime(SetUTCFullYear(UTC_FEB_29_1972,2000)) );
+
+ addNewTestCase( "TDATE = new Date("+PST_FEB_29_1972+"); "+
+ "TDATE.setUTCFullYear(2000);TDATE",
+ UTCDateFromTime(SetUTCFullYear(PST_FEB_29_1972,2000)),
+ LocalDateFromTime(SetUTCFullYear(PST_FEB_29_1972,2000)) );
+/*
+ // Dates around 2005
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2005);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2005)),
+ LocalDateFromTime(SetUTCFullYear(0,2005)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2004);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2004)),
+ LocalDateFromTime(SetUTCFullYear(0,2004)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2006);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2006)),
+ LocalDateFromTime(SetUTCFullYear(0,2006)) );
+
+
+ // Dates around 1900
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1900);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1900)),
+ LocalDateFromTime(SetUTCFullYear(0,1900)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1899);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1899)),
+ LocalDateFromTime(SetUTCFullYear(0,1899)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1901);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1901)),
+ LocalDateFromTime(SetUTCFullYear(0,1901)) );
+
+*/
+}
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetUTCFullYear( t, year, mon, date ) {
+ var T = ( t != t ) ? 0 : t;
+ var YEAR = Number(year);
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+
+ return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-4.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-4.js
new file mode 100644
index 0000000..c7876d1
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-4.js
@@ -0,0 +1,177 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+ /**
+ File Name: 15.9.5.37-1.js
+ ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getUTCMonth( ). If date is not specified, this behaves as if date
+ were specified with the value getUTCDate( ).
+
+ 1. Let t be this time value; but if this time value is NaN, let t be +0.
+ 2. Call ToNumber(year).
+ 3. If mon is not specified, compute MonthFromTime(t); otherwise, call
+ ToNumber(mon).
+ 4. If date is not specified, compute DateFromTime(t); otherwise, call
+ ToNumber(date).
+ 5. Compute MakeDay(Result(2), Result(3), Result(4)).
+ 6. Compute MakeDate(Result(5), TimeWithinDay(t)).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+ Added some Year 2000 test cases.
+*/
+ var SECTION = "15.9.5.37-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+ // Dates around 2005
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2005);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2005)),
+ LocalDateFromTime(SetUTCFullYear(0,2005)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2004);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2004)),
+ LocalDateFromTime(SetUTCFullYear(0,2004)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2006);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2006)),
+ LocalDateFromTime(SetUTCFullYear(0,2006)) );
+
+/*
+ // Dates around 1900
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1900);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1900)),
+ LocalDateFromTime(SetUTCFullYear(0,1900)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1899);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1899)),
+ LocalDateFromTime(SetUTCFullYear(0,1899)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1901);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1901)),
+ LocalDateFromTime(SetUTCFullYear(0,1901)) );
+
+*/
+}
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetUTCFullYear( t, year, mon, date ) {
+ var T = ( t != t ) ? 0 : t;
+ var YEAR = Number(year);
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+
+ return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-5.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-5.js
new file mode 100644
index 0000000..cee31ed
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.37-5.js
@@ -0,0 +1,160 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+ /**
+ File Name: 15.9.5.37-1.js
+ ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getUTCMonth( ). If date is not specified, this behaves as if date
+ were specified with the value getUTCDate( ).
+
+ 1. Let t be this time value; but if this time value is NaN, let t be +0.
+ 2. Call ToNumber(year).
+ 3. If mon is not specified, compute MonthFromTime(t); otherwise, call
+ ToNumber(mon).
+ 4. If date is not specified, compute DateFromTime(t); otherwise, call
+ ToNumber(date).
+ 5. Compute MakeDay(Result(2), Result(3), Result(4)).
+ 6. Compute MakeDate(Result(5), TimeWithinDay(t)).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+ Added some Year 2000 test cases.
+*/
+ var SECTION = "15.9.5.37-1";
+ var VERSION = "ECMA_1";
+ startTest();
+
+ writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )");
+
+ getTestCases();
+ test();
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function getTestCases() {
+ // Dates around 1900
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1900);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1900)),
+ LocalDateFromTime(SetUTCFullYear(0,1900)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1899);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1899)),
+ LocalDateFromTime(SetUTCFullYear(0,1899)) );
+
+ addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1901);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1901)),
+ LocalDateFromTime(SetUTCFullYear(0,1901)) );
+}
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ var item = testcases.length;
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ testcases[item++] = new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetUTCFullYear( t, year, mon, date ) {
+ var T = ( t != t ) ? 0 : t;
+ var YEAR = Number(year);
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+
+ return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.4-1.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.4-1.js
new file mode 100644
index 0000000..81c3740
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.4-1.js
@@ -0,0 +1,96 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.4-1.js
+ ECMA Section: 15.9.5.4-1 Date.prototype.getTime
+ Description:
+
+ 1. If the this value is not an object whose [[Class]] property is "Date",
+ generate a runtime error.
+ 2. Return this time value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+ var SECTION = "15.9.5.4-1";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getTime";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+ var now = (new Date()).valueOf();
+ var UTC_29_FEB_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
+ var UTC_1_JAN_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( now );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_29_FEB_2000 );
+ addTestCase( UTC_1_JAN_2005 );
+
+ test();
+
+function addTestCase( t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+").getTime()",
+ t,
+ (new Date(t)).getTime() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+1)+").getTime()",
+ t+1,
+ (new Date(t+1)).getTime() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-1)+").getTime()",
+ t-1,
+ (new Date(t-1)).getTime() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+").getTime()",
+ t-TZ_ADJUST,
+ (new Date(t-TZ_ADJUST)).getTime() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+").getTime()",
+ t+TZ_ADJUST,
+ (new Date(t+TZ_ADJUST)).getTime() );
+}
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.4-2-n.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.4-2-n.js
new file mode 100644
index 0000000..c90559a
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.4-2-n.js
@@ -0,0 +1,67 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.4-2-n.js
+ ECMA Section: 15.9.5.4-1 Date.prototype.getTime
+ Description:
+
+ 1. If the this value is not an object whose [[Class]] property is "Date",
+ generate a runtime error.
+ 2. Return this time value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+
+ var SECTION = "15.9.5.4-2-n";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getTime";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var MYDATE = new MyDate( TIME_2000 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "MYDATE.getTime()",
+ "error",
+ MYDATE.getTime() );
+
+function MyDate( value ) {
+ this.value = value;
+ this.getTime = Date.prototype.getTime;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.5.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.5.js
new file mode 100644
index 0000000..5660c4c
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.5.js
@@ -0,0 +1,123 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.5.js
+ ECMA Section: 15.9.5.5
+ Description: Date.prototype.getYear
+
+ This function is specified here for backwards compatibility only. The
+ function getFullYear is much to be preferred for nearly all purposes,
+ because it avoids the "year 2000 problem."
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return YearFromTime(LocalTime(t)) 1900.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.5";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getYear()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ addTestCase( now );
+ addTestCase( TIME_YEAR_0 );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getYear()",
+ NaN,
+ (new Date(NaN)).getYear() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getYear.length",
+ 0,
+ Date.prototype.getYear.length );
+
+ test();
+function addTestCase( t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getYear()",
+ GetYear(YearFromTime(LocalTime(t))),
+ (new Date(t)).getYear() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getYear()",
+ GetYear(YearFromTime(LocalTime(t+1))),
+ (new Date(t+1)).getYear() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getYear()",
+ GetYear(YearFromTime(LocalTime(t-1))),
+ (new Date(t-1)).getYear() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getYear()",
+ GetYear(YearFromTime(LocalTime(t-TZ_ADJUST))),
+ (new Date(t-TZ_ADJUST)).getYear() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getYear()",
+ GetYear(YearFromTime(LocalTime(t+TZ_ADJUST))),
+ (new Date(t+TZ_ADJUST)).getYear() );
+}
+function GetYear( year ) {
+/*
+ if ( year >= 1900 && year < 2000 ) {
+ return year - 1900;
+ } else {
+ return year;
+ }
+*/
+ return year - 1900;
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.6.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.6.js
new file mode 100644
index 0000000..5a9cf38
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.6.js
@@ -0,0 +1,114 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.6.js
+ ECMA Section: 15.9.5.6
+ Description: Date.prototype.getFullYear
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return YearFromTime(LocalTime(t)).
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.6";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getFullYear()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( now );
+ addTestCase( TIME_YEAR_0 );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getFullYear()",
+ NaN,
+ (new Date(NaN)).getFullYear() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getFullYear.length",
+ 0,
+ Date.prototype.getFullYear.length );
+
+ test();
+function addTestCase( t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getFullYear()",
+ YearFromTime(LocalTime(t)),
+ (new Date(t)).getFullYear() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getFullYear()",
+ YearFromTime(LocalTime(t+1)),
+ (new Date(t+1)).getFullYear() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getFullYear()",
+ YearFromTime(LocalTime(t-1)),
+ (new Date(t-1)).getFullYear() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getFullYear()",
+ YearFromTime(LocalTime(t-TZ_ADJUST)),
+ (new Date(t-TZ_ADJUST)).getFullYear() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getFullYear()",
+ YearFromTime(LocalTime(t+TZ_ADJUST)),
+ (new Date(t+TZ_ADJUST)).getFullYear() );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.7.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.7.js
new file mode 100644
index 0000000..8a7f5c0
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.7.js
@@ -0,0 +1,114 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.7.js
+ ECMA Section: 15.9.5.7
+ Description: Date.prototype.getUTCFullYear
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return YearFromTime(t).
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.7";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCFullYear()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( now );
+ addTestCase( TIME_YEAR_0 );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getUTCFullYear()",
+ NaN,
+ (new Date(NaN)).getUTCFullYear() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getUTCFullYear.length",
+ 0,
+ Date.prototype.getUTCFullYear.length );
+
+ test();
+function addTestCase( t ) {
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCFullYear()",
+ YearFromTime(t),
+ (new Date(t)).getUTCFullYear() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getUTCFullYear()",
+ YearFromTime(t+1),
+ (new Date(t+1)).getUTCFullYear() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getUTCFullYear()",
+ YearFromTime(t-1),
+ (new Date(t-1)).getUTCFullYear() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getUTCFullYear()",
+ YearFromTime(t-TZ_ADJUST),
+ (new Date(t-TZ_ADJUST)).getUTCFullYear() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getUTCFullYear()",
+ YearFromTime(t+TZ_ADJUST),
+ (new Date(t+TZ_ADJUST)).getUTCFullYear() );
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.8.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.8.js
new file mode 100644
index 0000000..038eda9
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.8.js
@@ -0,0 +1,120 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.8.js
+ ECMA Section: 15.9.5.8
+ Description: Date.prototype.getMonth
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return MonthFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.8";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getMonth()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( now );
+ addTestCase( TIME_YEAR_0 );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getMonth()",
+ NaN,
+ (new Date(NaN)).getMonth() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getMonth.length",
+ 0,
+ Date.prototype.getMonth.length );
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 12; m++ ) {
+
+ t += TimeInMonth(m);
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getMonth()",
+ MonthFromTime(LocalTime(t)),
+ (new Date(t)).getMonth() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getMonth()",
+ MonthFromTime(LocalTime(t+1)),
+ (new Date(t+1)).getMonth() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getMonth()",
+ MonthFromTime(LocalTime(t-1)),
+ (new Date(t-1)).getMonth() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getMonth()",
+ MonthFromTime(LocalTime(t-TZ_ADJUST)),
+ (new Date(t-TZ_ADJUST)).getMonth() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getMonth()",
+ MonthFromTime(LocalTime(t+TZ_ADJUST)),
+ (new Date(t+TZ_ADJUST)).getMonth() );
+
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.9.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.9.js
new file mode 100644
index 0000000..9fda4ea
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.9.js
@@ -0,0 +1,120 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.9.js
+ ECMA Section: 15.9.5.9
+ Description: Date.prototype.getUTCMonth
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return MonthFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5.8";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Date.prototype.getUTCMonth()";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ var TZ_ADJUST = TZ_DIFF * msPerHour;
+
+ // get the current time
+ var now = (new Date()).valueOf();
+
+ // get time for 29 feb 2000
+
+ var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+
+ // get time for 1 jan 2005
+
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+ TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+
+ addTestCase( now );
+ addTestCase( TIME_YEAR_0 );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date(NaN)).getUTCMonth()",
+ NaN,
+ (new Date(NaN)).getUTCMonth() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getUTCMonth.length",
+ 0,
+ Date.prototype.getUTCMonth.length );
+ test();
+function addTestCase( t ) {
+ for ( var m = 0; m < 12; m++ ) {
+
+ t += TimeInMonth(m);
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getUTCMonth()",
+ MonthFromTime(t),
+ (new Date(t)).getUTCMonth() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getUTCMonth()",
+ MonthFromTime(t+1),
+ (new Date(t+1)).getUTCMonth() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getUTCMonth()",
+ MonthFromTime(t-1),
+ (new Date(t-1)).getUTCMonth() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getUTCMonth()",
+ MonthFromTime(t-TZ_ADJUST),
+ (new Date(t-TZ_ADJUST)).getUTCMonth() );
+
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getUTCMonth()",
+ MonthFromTime(t+TZ_ADJUST),
+ (new Date(t+TZ_ADJUST)).getUTCMonth() );
+
+ }
+}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
diff --git a/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.js b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.js
new file mode 100644
index 0000000..d7bd303
--- /dev/null
+++ b/JavaScriptCore/tests/mozilla/ecma/Date/15.9.5.js
@@ -0,0 +1,81 @@
+/* The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March
+ * 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape Communications
+ * Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ */
+/**
+ File Name: 15.9.5.js
+ ECMA Section: 15.9.5 Properties of the Date prototype object
+ Description:
+
+ The Date prototype object is itself a Date object (its [[Class]] is
+ "Date") whose value is NaN.
+
+ The value of the internal [[Prototype]] property of the Date prototype
+ object is the Object prototype object (15.2.3.1).
+
+ In following descriptions of functions that are properties of the Date
+ prototype object, the phrase "this Date object" refers to the object that
+ is the this value for the invocation of the function; it is an error if
+ this does not refer to an object for which the value of the internal
+ [[Class]] property is "Date". Also, the phrase "this time value" refers
+ to the number value for the time represented by this Date object, that is,
+ the value of the internal [[Value]] property of this Date object.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+ var SECTION = "15.9.5";
+ var VERSION = "ECMA_1";
+ startTest();
+ var TITLE = "Properties of the Date Prototype Object";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var testcases = new Array();
+
+ Date.prototype.getClass = Object.prototype.toString;
+
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getClass",
+ "[object Date]",
+ Date.prototype.getClass() );
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.valueOf()",
+ NaN,
+ Date.prototype.valueOf() );
+ testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.__proto__ == Object.prototype",
+ true,
+ Date.prototype.__proto__ == Object.prototype );
+ test();
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}