diff options
Diffstat (limited to 'Source/JavaScriptCore/tests/mozilla/ecma_3')
126 files changed, 40537 insertions, 0 deletions
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/15.4.4.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/15.4.4.3-1.js new file mode 100644 index 0000000..7b5fdbd --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/15.4.4.3-1.js @@ -0,0 +1,66 @@ +/* +* 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): pschwartau@netscape.com +* Date: 12 Mar 2001 +* +* +* SUMMARY: Testing Array.prototype.toLocaleString() +* See http://bugzilla.mozilla.org/show_bug.cgi?id=56883 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=58031 +* +* By ECMA3 15.4.4.3, myArray.toLocaleString() means that toLocaleString() +* should be applied to each element of the array, and the results should be +* concatenated with an implementation-specific delimiter. For example: +* +* myArray[0].toLocaleString() + ',' + myArray[1].toLocaleString() + etc. +* +* In this testcase toLocaleString is a user-defined property of each array element; +* therefore it is the function that should be invoked. This function increments a +* global variable. Therefore the end value of this variable should be myArray.length. +*/ +//------------------------------------------------------------------------------------------------- +var bug = 56883; +var summary = 'Testing Array.prototype.toLocaleString() -'; +var actual = ''; +var expect = ''; +var n = 0; +var obj = {toLocaleString: function() {n++}}; +var myArray = [obj, obj, obj]; + + +myArray.toLocaleString(); +actual = n; +expect = 3; // (see explanation above) + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/15.4.4.4-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/15.4.4.4-001.js new file mode 100644 index 0000000..6d99159 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/15.4.4.4-001.js @@ -0,0 +1,148 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): george@vanous.com, igor@icesoft.no, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 19 September 2002 +* SUMMARY: Testing Array.prototype.concat() +* See http://bugzilla.mozilla.org/show_bug.cgi?id=169795 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 169795; +var summary = 'Testing Array.prototype.concat()'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var x; + + +status = inSection(1); +x = "Hello"; +actual = [].concat(x).toString(); +expect = x.toString(); +addThis(); + +status = inSection(2); +x = 999; +actual = [].concat(x).toString(); +expect = x.toString(); +addThis(); + +status = inSection(3); +x = /Hello/g; +actual = [].concat(x).toString(); +expect = x.toString(); +addThis(); + +status = inSection(4); +x = new Error("Hello"); +actual = [].concat(x).toString(); +expect = x.toString(); +addThis(); + +status = inSection(5); +x = function() {return "Hello";}; +actual = [].concat(x).toString(); +expect = x.toString(); +addThis(); + +status = inSection(6); +x = [function() {return "Hello";}]; +actual = [].concat(x).toString(); +expect = x.toString(); +addThis(); + +status = inSection(7); +x = [1,2,3].concat([4,5,6]); +actual = [].concat(x).toString(); +expect = x.toString(); +addThis(); + +status = inSection(8); +x = eval('this'); +actual = [].concat(x).toString(); +expect = x.toString(); +addThis(); + +/* + * The next two sections are by igor@icesoft.no; see + * http://bugzilla.mozilla.org/show_bug.cgi?id=169795#c3 + */ +status = inSection(9); +x={length:0}; +actual = [].concat(x).toString(); +expect = x.toString(); +addThis(); + +status = inSection(10); +x={length:2, 0:0, 1:1}; +actual = [].concat(x).toString(); +expect = x.toString(); +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/regress-101488.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/regress-101488.js new file mode 100644 index 0000000..73c22c9 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/regress-101488.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.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): igor@icesoft.no, pschwartau@netscape.com +* Date: 24 September 2001 +* +* SUMMARY: Try assigning arr.length = new Number(n) +* From correspondence with Igor Bukanov <igor@icesoft.no> +* See http://bugzilla.mozilla.org/show_bug.cgi?id=101488 +* +* Without the "new" keyword, assigning arr.length = Number(n) worked. +* But with it, Rhino was giving an error "Inappropriate array length" +* and SpiderMonkey was exiting without giving any error or return value - +* +* Comments on the Rhino code by igor@icesoft.no: +* +* jsSet_length requires that the new length value should be an instance +* of Number. But according to Ecma 15.4.5.1, item 12-13, an error should +* be thrown only if ToUint32(length_value) != ToNumber(length_value) +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 101488; +var summary = 'Try assigning arr.length = new Number(n)'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var arr = []; + + +status = inSection(1); +arr = Array(); +tryThis('arr.length = new Number(1);'); +actual = arr.length; +expect = 1; +addThis(); + +status = inSection(2); +arr = Array(5); +tryThis('arr.length = new Number(1);'); +actual = arr.length; +expect = 1; +addThis(); + +status = inSection(3); +arr = Array(); +tryThis('arr.length = new Number(17);'); +actual = arr.length; +expect = 17; +addThis(); + +status = inSection(4); +arr = Array(5); +tryThis('arr.length = new Number(17);'); +actual = arr.length; +expect = 17; +addThis(); + + +/* + * Also try the above with the "new" keyword before Array(). + * Array() and new Array() should be equivalent, by ECMA 15.4.1.1 + */ +status = inSection(5); +arr = new Array(); +tryThis('arr.length = new Number(1);'); +actual = arr.length; +expect = 1; +addThis(); + +status = inSection(6); +arr = new Array(5); +tryThis('arr.length = new Number(1);'); +actual = arr.length; +expect = 1; +addThis(); + +arr = new Array(); +tryThis('arr.length = new Number(17);'); +actual = arr.length; +expect = 17; +addThis(); + +status = inSection(7); +arr = new Array(5); +tryThis('arr.length = new Number(17);'); +actual = arr.length; +expect = 17; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function tryThis(s) +{ + try + { + eval(s); + } + catch(e) + { + // keep going + } +} + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/regress-130451.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/regress-130451.js new file mode 100644 index 0000000..7cc5051 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Array/regress-130451.js @@ -0,0 +1,214 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): brendan@mozilla.org, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 25 Mar 2002 +* SUMMARY: Array.prototype.sort() should not (re-)define .length +* See http://bugzilla.mozilla.org/show_bug.cgi?id=130451 +* +* From the ECMA-262 Edition 3 Final spec: +* +* NOTE: The sort function is intentionally generic; it does not require that +* its |this| value be an Array object. Therefore, it can be transferred to +* other kinds of objects for use as a method. Whether the sort function can +* be applied successfully to a host object is implementation-dependent. +* +* The interesting parts of this testcase are the contrasting expectations for +* Brendan's test below, when applied to Array objects vs. non-Array objects. +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 130451; +var summary = 'Array.prototype.sort() should not (re-)define .length'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var arr = []; +var cmp = new Function(); + + +/* + * First: test Array.prototype.sort() on Array objects + */ +status = inSection(1); +arr = [0,1,2,3]; +cmp = function(x,y) {return x-y;}; +actual = arr.sort(cmp).length; +expect = 4; +addThis(); + +status = inSection(2); +arr = [0,1,2,3]; +cmp = function(x,y) {return y-x;}; +actual = arr.sort(cmp).length; +expect = 4; +addThis(); + +status = inSection(3); +arr = [0,1,2,3]; +cmp = function(x,y) {return x-y;}; +arr.length = 1; +actual = arr.sort(cmp).length; +expect = 1; +addThis(); + +/* + * This test is by Brendan. Setting arr.length to + * 2 and then 4 should cause elements to be deleted. + */ +arr = [0,1,2,3]; +cmp = function(x,y) {return x-y;}; +arr.sort(cmp); + +status = inSection(4); +actual = arr.join(); +expect = '0,1,2,3'; +addThis(); + +status = inSection(5); +actual = arr.length; +expect = 4; +addThis(); + +status = inSection(6); +arr.length = 2; +actual = arr.join(); +expect = '0,1'; +addThis(); + +status = inSection(7); +arr.length = 4; +actual = arr.join(); +expect = '0,1,,'; //<---- see how 2,3 have been lost +addThis(); + + + +/* + * Now test Array.prototype.sort() on non-Array objects + */ +status = inSection(8); +var obj = new Object(); +obj.sort = Array.prototype.sort; +obj.length = 4; +obj[0] = 0; +obj[1] = 1; +obj[2] = 2; +obj[3] = 3; +cmp = function(x,y) {return x-y;}; +actual = obj.sort(cmp).length; +expect = 4; +addThis(); + + +/* + * Here again is Brendan's test. Unlike the array case + * above, the setting of obj.length to 2 and then 4 + * should NOT cause elements to be deleted + */ +obj = new Object(); +obj.sort = Array.prototype.sort; +obj.length = 4; +obj[0] = 3; +obj[1] = 2; +obj[2] = 1; +obj[3] = 0; +cmp = function(x,y) {return x-y;}; +obj.sort(cmp); //<---- this is what triggered the buggy behavior below +obj.join = Array.prototype.join; + +status = inSection(9); +actual = obj.join(); +expect = '0,1,2,3'; +addThis(); + +status = inSection(10); +actual = obj.length; +expect = 4; +addThis(); + +status = inSection(11); +obj.length = 2; +actual = obj.join(); +expect = '0,1'; +addThis(); + +/* + * Before this bug was fixed, |actual| held the value '0,1,,' + * as in the Array-object case at top. This bug only occurred + * if Array.prototype.sort() had been applied to |obj|, + * as we have done higher up. + */ +status = inSection(12); +obj.length = 4; +actual = obj.join(); +expect = '0,1,2,3'; +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.3.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.3.js new file mode 100644 index 0000000..a68cb89 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.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.3.js + ECMA Section: 15.9.5.3 Date.prototype.toDateString() + Description: + This function returns a string value. The contents of the string are + implementation dependent, but are intended to represent the "date" + portion of the Date in the current time zone in a convenient, + human-readable form. We can't test the content of the string, + but can verify that the string is parsable by Date.parse + + The toDateString 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: pschwartau@netscape.com + Date: 14 november 2000 (adapted from ecma/Date/15.9.5.2.js) +*/ + + var SECTION = "15.9.5.3"; + var VERSION = "ECMA_3"; + var TITLE = "Date.prototype.toDateString()"; + + var status = ''; + var actual = ''; + var expect = ''; + + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + +//----------------------------------------------------------------------------------------------------- + var testcases = new Array(); +//----------------------------------------------------------------------------------------------------- + + + // first, some generic tests - + + status = "typeof (now.toDateString())"; + actual = typeof (now.toDateString()); + expect = "string"; + addTestCase(); + + status = "Date.prototype.toDateString.length"; + actual = Date.prototype.toDateString.length; + expect = 0; + addTestCase(); + + /* Date.parse is accurate to the second; valueOf() to the millisecond. + Here we expect them to coincide, as we expect a time of exactly midnight - */ + status = "(Date.parse(now.toDateString()) - (midnight(now)).valueOf()) == 0"; + actual = (Date.parse(now.toDateString()) - (midnight(now)).valueOf()) == 0; + expect = true; + addTestCase(); + + + + // 1970 + addDateTestCase(0); + addDateTestCase(TZ_ADJUST); + + + // 1900 + addDateTestCase(TIME_1900); + addDateTestCase(TIME_1900 - TZ_ADJUST); + + + // 2000 + addDateTestCase(TIME_2000); + addDateTestCase(TIME_2000 - TZ_ADJUST); + + + // 29 Feb 2000 + addDateTestCase(UTC_29_FEB_2000); + addDateTestCase(UTC_29_FEB_2000 - 1000); + addDateTestCase(UTC_29_FEB_2000 - TZ_ADJUST); + + + // 2005 + addDateTestCase(UTC_1_JAN_2005); + addDateTestCase(UTC_1_JAN_2005 - 1000); + addDateTestCase(UTC_1_JAN_2005 - TZ_ADJUST); + + + +//----------------------------------------------------------------------------------------------------- + test(); +//----------------------------------------------------------------------------------------------------- + + +function addTestCase() +{ + testcases[tc++] = new TestCase( SECTION, status, expect, actual); +} + + +function addDateTestCase(date_given_in_milliseconds) +{ + var givenDate = new Date(date_given_in_milliseconds); + + status = 'Date.parse(' + givenDate + ').toDateString())'; + actual = Date.parse(givenDate.toDateString()); + expect = Date.parse(midnight(givenDate)); + addTestCase(); +} + + +function midnight(givenDate) +{ + // midnight on the given date - + return new Date(givenDate.getFullYear(), givenDate.getMonth(), givenDate.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); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.4.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.4.js new file mode 100644 index 0000000..abff98a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.4.js @@ -0,0 +1,194 @@ +/* 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.js + ECMA Section: 15.9.5.4 Date.prototype.toTimeString() + Description: + This function returns a string value. The contents of the string are + implementation dependent, but are intended to represent the "time" + portion of the Date in the current time zone in a convenient, + human-readable form. We test the content of the string by checking + that d.toDateString() + d.toTimeString() == d.toString() + + Author: pschwartau@netscape.com + Date: 14 november 2000 + Revised: 07 january 2002 because of a change in JS Date format: + + See http://bugzilla.mozilla.org/show_bug.cgi?id=118266 (SpiderMonkey) + See http://bugzilla.mozilla.org/show_bug.cgi?id=118636 (Rhino) +*/ +//----------------------------------------------------------------------------- + var SECTION = "15.9.5.4"; + var VERSION = "ECMA_3"; + var TITLE = "Date.prototype.toTimeString()"; + + var status = ''; + var actual = ''; + var expect = ''; + var givenDate; + var year = ''; + var regexp = ''; + var reducedDateString = ''; + var hopeThisIsTimeString = ''; + var cnEmptyString = ''; + var cnERR ='OOPS! FATAL ERROR: no regexp match in extractTimeString()'; + + + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + +//----------------------------------------------------------------------------------------------------- + var testcases = new Array(); +//----------------------------------------------------------------------------------------------------- + + + // first, a couple of generic tests - + + status = "typeof (now.toTimeString())"; + actual = typeof (now.toTimeString()); + expect = "string"; + addTestCase(); + + status = "Date.prototype.toTimeString.length"; + actual = Date.prototype.toTimeString.length; + expect = 0; + addTestCase(); + + + + + // 1970 + addDateTestCase(0); + addDateTestCase(TZ_ADJUST); + + + // 1900 + addDateTestCase(TIME_1900); + addDateTestCase(TIME_1900 - TZ_ADJUST); + + + // 2000 + addDateTestCase(TIME_2000); + addDateTestCase(TIME_2000 - TZ_ADJUST); + + + // 29 Feb 2000 + addDateTestCase(UTC_29_FEB_2000); + addDateTestCase(UTC_29_FEB_2000 - 1000); + addDateTestCase(UTC_29_FEB_2000 - TZ_ADJUST); + + + // Now + addDateTestCase( TIME_NOW); + addDateTestCase( TIME_NOW - TZ_ADJUST); + + + // 2005 + addDateTestCase(UTC_1_JAN_2005); + addDateTestCase(UTC_1_JAN_2005 - 1000); + addDateTestCase(UTC_1_JAN_2005 - TZ_ADJUST); + + + +//----------------------------------------------------------------------------------------------------- + test(); +//----------------------------------------------------------------------------------------------------- + + +function addTestCase() +{ + testcases[tc++] = new TestCase( SECTION, status, expect, actual); +} + + +function addDateTestCase(date_given_in_milliseconds) +{ + givenDate = new Date(date_given_in_milliseconds); + + status = '(' + givenDate + ').toTimeString()'; + actual = givenDate.toTimeString(); + expect = extractTimeString(givenDate); + addTestCase(); +} + + +/* + * As of 2002-01-07, the format for JavaScript dates changed. + * See http://bugzilla.mozilla.org/show_bug.cgi?id=118266 (SpiderMonkey) + * See http://bugzilla.mozilla.org/show_bug.cgi?id=118636 (Rhino) + * + * WAS: Mon Jan 07 13:40:34 GMT-0800 (Pacific Standard Time) 2002 + * NOW: Mon Jan 07 2002 13:40:34 GMT-0800 (Pacific Standard Time) + * + * Thus, use a regexp of the form /date.toDateString()(.*)$/ + * to capture the TimeString into the first backreference - + */ +function extractTimeString(date) +{ + regexp = new RegExp(date.toDateString() + '(.*)' + '$'); + + try + { + hopeThisIsTimeString = date.toString().match(regexp)[1]; + } + catch(e) + { + return cnERR; + } + + // trim any leading or trailing spaces - + return trimL(trimR(hopeThisIsTimeString)); + } + + +function trimL(s) +{ + if (!s) {return cnEmptyString;}; + for (var i = 0; i!=s.length; i++) {if (s[i] != ' ') {break;}} + return s.substring(i); +} + + +function trimR(s) +{ + if (!s) {return cnEmptyString;}; + for (var i = (s.length - 1); i!=-1; i--) {if (s[i] != ' ') {break;}} + return s.substring(0, i+1); +} + + +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/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.5.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.5.js new file mode 100644 index 0000000..c16002b --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.5.js @@ -0,0 +1,94 @@ +/* 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 Date.prototype.toLocaleString() + Description: + This function returns a string value. The contents of the string are + implementation dependent, but are intended to represent the "date" + portion of the Date in the current time zone in a convenient, + human-readable form. We can't test the content of the string, + but can verify that the object returned is a string. + + The toLocaleString 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: pschwartau@netscape.com + Date: 14 november 2000 +*/ + + var SECTION = "15.9.5.5"; + var VERSION = "ECMA_3"; + var TITLE = "Date.prototype.toLocaleString()"; + + var status = ''; + var actual = ''; + var expect = ''; + + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + +//----------------------------------------------------------------------------------------------------- + var testcases = new Array(); +//----------------------------------------------------------------------------------------------------- + + + // first, some generic tests - + + status = "typeof (now.toLocaleString())"; + actual = typeof (now.toLocaleString()); + expect = "string"; + addTestCase(); + + status = "Date.prototype.toLocaleString.length"; + actual = Date.prototype.toLocaleString.length; + expect = 0; + addTestCase(); + +//----------------------------------------------------------------------------------------------------- + test(); +//----------------------------------------------------------------------------------------------------- + + +function addTestCase() +{ + testcases[tc++] = new TestCase( SECTION, status, expect, actual); +} + + +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); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.6.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.6.js new file mode 100644 index 0000000..073d828 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.6.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.6.js + ECMA Section: 15.9.5.6 Date.prototype.toLocaleDateString() + Description: + This function returns a string value. The contents of the string are + implementation dependent, but are intended to represent the "date" + portion of the Date in the current time zone in a convenient, + human-readable form. We can't test the content of the string, + but can verify that the string is parsable by Date.parse + + The toLocaleDateString 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: pschwartau@netscape.com + Date: 14 november 2000 +*/ + + var SECTION = "15.9.5.6"; + var VERSION = "ECMA_3"; + var TITLE = "Date.prototype.toLocaleDateString()"; + + var status = ''; + var actual = ''; + var expect = ''; + + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + +//----------------------------------------------------------------------------------------------------- + var testcases = new Array(); +//----------------------------------------------------------------------------------------------------- + + + // first, some generic tests - + + status = "typeof (now.toLocaleDateString())"; + actual = typeof (now.toLocaleDateString()); + expect = "string"; + addTestCase(); + + status = "Date.prototype.toLocaleDateString.length"; + actual = Date.prototype.toLocaleDateString.length; + expect = 0; + addTestCase(); + + /* Date.parse is accurate to the second; valueOf() to the millisecond. + Here we expect them to coincide, as we expect a time of exactly midnight - */ + status = "(Date.parse(now.toLocaleDateString()) - (midnight(now)).valueOf()) == 0"; + actual = (Date.parse(now.toLocaleDateString()) - (midnight(now)).valueOf()) == 0; + expect = true; + addTestCase(); + + + + // 1970 + addDateTestCase(0); + addDateTestCase(TZ_ADJUST); + + + // 1900 + addDateTestCase(TIME_1900); + addDateTestCase(TIME_1900 - TZ_ADJUST); + + + // 2000 + addDateTestCase(TIME_2000); + addDateTestCase(TIME_2000 - TZ_ADJUST); + + + // 29 Feb 2000 + addDateTestCase(UTC_29_FEB_2000); + addDateTestCase(UTC_29_FEB_2000 - 1000); + addDateTestCase(UTC_29_FEB_2000 - TZ_ADJUST); + + + // 2005 + addDateTestCase(UTC_1_JAN_2005); + addDateTestCase(UTC_1_JAN_2005 - 1000); + addDateTestCase(UTC_1_JAN_2005 - TZ_ADJUST); + + + +//----------------------------------------------------------------------------------------------------- + test(); +//----------------------------------------------------------------------------------------------------- + + +function addTestCase() +{ + testcases[tc++] = new TestCase( SECTION, status, expect, actual); +} + + +function addDateTestCase(date_given_in_milliseconds) +{ + var givenDate = new Date(date_given_in_milliseconds); + + status = 'Date.parse(' + givenDate + ').toLocaleDateString())'; + actual = Date.parse(givenDate.toLocaleDateString()); + expect = Date.parse(midnight(givenDate)); + addTestCase(); +} + + +function midnight(givenDate) +{ + // midnight on the given date - + return new Date(givenDate.getFullYear(), givenDate.getMonth(), givenDate.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); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.7.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.7.js new file mode 100644 index 0000000..14b2574 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/15.9.5.7.js @@ -0,0 +1,211 @@ +/* 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 Date.prototype.toLocaleTimeString() + Description: + This function returns a string value. The contents of the string are + implementation dependent, but are intended to represent the "time" + portion of the Date in the current time zone in a convenient, + human-readable form. We test the content of the string by checking + that d.toDateString() + d.toLocaleTimeString() == d.toString() + + The only headache is that as of this writing the "GMT ..." portion of + d.toString() is NOT included in d.toLocaleTimeString() as it is in + d.toTimeString(). So we have to take that into account. + + Author: pschwartau@netscape.com + Date: 14 november 2000 + Revised: 07 january 2002 because of a change in JS Date format: + + See http://bugzilla.mozilla.org/show_bug.cgi?id=118266 (SpiderMonkey) + See http://bugzilla.mozilla.org/show_bug.cgi?id=118636 (Rhino) +*/ +//----------------------------------------------------------------------------- + var SECTION = "15.9.5.7"; + var VERSION = "ECMA_3"; + var TITLE = "Date.prototype.toLocaleTimeString()"; + + var status = ''; + var actual = ''; + var expect = ''; + var givenDate; + var year = ''; + var regexp = ''; + var TimeString = ''; + var reducedDateString = ''; + var hopeThisIsLocaleTimeString = ''; + var cnERR ='OOPS! FATAL ERROR: no regexp match in extractLocaleTimeString()'; + + + startTest(); + writeHeaderToLog( SECTION + " "+ TITLE); + + +//----------------------------------------------------------------------------------------------------- + var testcases = new Array(); +//----------------------------------------------------------------------------------------------------- + + + // first, a couple generic tests - + + status = "typeof (now.toLocaleTimeString())"; + actual = typeof (now.toLocaleTimeString()); + expect = "string"; + addTestCase(); + + status = "Date.prototype.toLocaleTimeString.length"; + actual = Date.prototype.toLocaleTimeString.length; + expect = 0; + addTestCase(); + + + + + // 1970 + addDateTestCase(0); + addDateTestCase(TZ_ADJUST); + + + // 1900 + addDateTestCase(TIME_1900); + addDateTestCase(TIME_1900 - TZ_ADJUST); + + + // 2000 + addDateTestCase(TIME_2000); + addDateTestCase(TIME_2000 - TZ_ADJUST); + + + // 29 Feb 2000 + addDateTestCase(UTC_29_FEB_2000); + addDateTestCase(UTC_29_FEB_2000 - 1000); + addDateTestCase(UTC_29_FEB_2000 - TZ_ADJUST); + + + // Now + addDateTestCase( TIME_NOW); + addDateTestCase( TIME_NOW - TZ_ADJUST); + + + // 2005 + addDateTestCase(UTC_1_JAN_2005); + addDateTestCase(UTC_1_JAN_2005 - 1000); + addDateTestCase(UTC_1_JAN_2005 - TZ_ADJUST); + + + +//----------------------------------------------------------------------------------------------------- + test(); +//----------------------------------------------------------------------------------------------------- + + +function addTestCase() +{ + testcases[tc++] = new TestCase( SECTION, status, expect, actual); +} + + +function addDateTestCase(date_given_in_milliseconds) +{ + givenDate = new Date(date_given_in_milliseconds); + + status = '(' + givenDate + ').toLocaleTimeString()'; + actual = givenDate.toLocaleTimeString(); + expect = extractLocaleTimeString(givenDate); + addTestCase(); +} + + +/* + * As of 2002-01-07, the format for JavaScript dates changed. + * See http://bugzilla.mozilla.org/show_bug.cgi?id=118266 (SpiderMonkey) + * See http://bugzilla.mozilla.org/show_bug.cgi?id=118636 (Rhino) + * + * WAS: Mon Jan 07 13:40:34 GMT-0800 (Pacific Standard Time) 2002 + * NOW: Mon Jan 07 2002 13:40:34 GMT-0800 (Pacific Standard Time) + * + * So first, use a regexp of the form /date.toDateString()(.*)$/ + * to capture the TimeString into the first backreference. + * + * Then remove the GMT string from TimeString (see introduction above) + */ +function extractLocaleTimeString(date) +{ + regexp = new RegExp(date.toDateString() + '(.*)' + '$'); + try + { + TimeString = date.toString().match(regexp)[1]; + } + catch(e) + { + return cnERR; + } + + /* + * Now remove the GMT part of the TimeString. + * Guard against dates with two "GMT"s, like: + * Jan 01 00:00:00 GMT+0000 (GMT Standard Time) + */ + regexp= /([^G]*)GMT.*/; + try + { + hopeThisIsLocaleTimeString = TimeString.match(regexp)[1]; + } + catch(e) + { + return TimeString; + } + + // trim any leading or trailing spaces - + return trimL(trimR(hopeThisIsLocaleTimeString)); +} + + +function trimL(s) +{ + if (!s) {return cnEmptyString;}; + for (var i = 0; i!=s.length; i++) {if (s[i] != ' ') {break;}} + return s.substring(i); +} + +function trimR(s) +{ + for (var i = (s.length - 1); i!=-1; i--) {if (s[i] != ' ') {break;}} + return s.substring(0, i+1); +} + + +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/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/shell.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/shell.js new file mode 100644 index 0000000..43721a7 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Date/shell.js @@ -0,0 +1,676 @@ +/* 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): + * + */ +/* + * JavaScript shared functions file for running the tests in either + * stand-alone JavaScript engine. To run a test, first load this file, + * then load the test script. + */ + +var completed = false; +var testcases; +var tc = 0; + +SECTION = ""; +VERSION = ""; +BUGNUMBER = ""; + +/* + * constant strings + */ +var GLOBAL = "[object global]"; +var PASSED = " PASSED!" +var FAILED = " FAILED! expected: "; +var DEBUG = false; + + +/* +* Wrapper for test case constructor that doesn't require the SECTION argument. + */ +function AddTestCase( description, expect, actual ) +{ + testcases[tc++] = new TestCase( SECTION, description, expect, actual ); +} + + +/* + * TestCase constructor +*/ +function TestCase( n, d, e, a ) +{ + this.name = n; + this.description = d; + this.expect = e; + this.actual = a; + this.passed = true; + this.reason = ""; + this.bugnumber = BUGNUMBER; + this.passed = getTestCaseResult( this.expect, this.actual ); + if ( DEBUG ) {writeLineToLog("added " + this.description);} +} + + +/* + * Set up test environment. +*/ +function startTest() +{ + if ( version ) + { + // JavaScript 1.3 is supposed to be compliant ECMA version 1.0 + if (VERSION == "ECMA_1" ) {version ("130");} + if (VERSION == "JS_1.3" ) {version ( "130");} + if (VERSION == "JS_1.2" ) {version ( "120");} + if (VERSION == "JS_1.1" ) {version( "110");} + + // for ECMA version 2.0, we will leave the JavaScript version + // to the default ( for now ). + } + + // print out bugnumber + if ( BUGNUMBER ) + { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + } + + testcases = new Array(); + tc = 0; +} + + +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 ); +} + + +/* + * Compare expected result to the actual result and figure out whether + * the test case passed. + */ +function getTestCaseResult(expect, actual ) +{ + //because ( NaN == NaN ) always returns false, need to do + //a special compare to see if we got the right result. + if ( actual != actual ) + { + if ( typeof actual == "object" ) {actual = "NaN object";} + else {actual = "NaN number";} + } + + if ( expect != expect ) + { + if ( typeof expect == "object" ) {expect = "NaN object";} + else {expect = "NaN number";} + } + + var passed = ( expect == actual ) ? true : false; + + // if both objects are numbers, need to replace w/ IEEE standard for rounding + if ( !passed && typeof(actual) == "number" && typeof(expect) == "number" ) + { + if ( Math.abs(actual-expect) < 0.0000001 ) {passed = true;} + } + + //verify type is the same + if ( typeof(expect) != typeof(actual) ) {passed = false;} + + return passed; +} + + +/* + * Begin printing functions. These functions use the shell's print function. +* When running tests in the browser, override these functions with functions +* that use document.write. + */ +function writeTestCaseResult( expect, actual, string ) +{ + var passed = getTestCaseResult(expect, actual ); + writeFormattedResult( expect, actual, string, passed ); + return passed; +} + + +function writeFormattedResult( expect, actual, string, passed ) +{ + var s = string ; + s += ( passed ) ? PASSED : FAILED + expect; + writeLineToLog( s); + return passed; +} + + +function writeLineToLog( string ) +{ + print( string ); +} + + +function writeHeaderToLog( string ) +{ + print( string ); +} +/* End of printing functions */ + + +/* + * When running in the shell, run the garbage collector after the test has completed. + */ +function stopTest() +{ + var gc; + if ( gc != undefined ) + { + gc(); + } +} + + +/* + * Convenience function for displaying failed test cases. + * Useful when running tests manually. +*/ +function getFailedCases() +{ + for (var i = 0; i < testcases.length; i++ ) + { + if ( !testcases[i].passed ) + { + print( testcases[i].description + " = " + testcases[i].actual + " expected: " + testcases[i].expect ); + } + } +} + + + /* + * Date constants and functions used by tests in Date suite +*/ +var msPerDay = 86400000; +var HoursPerDay = 24; +var MinutesPerHour = 60; +var SecondsPerMinute = 60; +var msPerSecond = 1000; +var msPerMinute = 60000; // msPerSecond * SecondsPerMinute +var msPerHour = 3600000; // msPerMinute * MinutesPerHour +var TZ_DIFF = getTimeZoneDiff(); +var TZ_ADJUST = TZ_DIFF * msPerHour; +var TIME_1970 = 0; +var TIME_2000 = 946684800000; +var TIME_1900 = -2208988800000; +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); +var now = new Date(); +var TIME_NOW = now.valueOf(); //valueOf() is to accurate to the millisecond + //Date.parse() is accurate only to the second + + + +/* + * Originally, the test suite used a hard-coded value TZ_DIFF = -8. + * But that was only valid for testers in the Pacific Standard Time Zone! + * We calculate the proper number dynamically for any tester. We just + * have to be careful to use a date not subject to Daylight Savings Time... +*/ +function getTimeZoneDiff() +{ + return -((new Date(2000, 1, 1)).getTimezoneOffset())/60; +} + + +function Day( t) +{ + return ( Math.floor( t/msPerDay ) ); +} + + +function DaysInYear( y ) +{ + if ( y % 4 != 0 ) {return 365;} + + if ( (y%4 == 0) && (y%100 != 0) ) {return 366;} + + if ( (y%100 == 0) && (y%400 != 0) ) {return 365;} + + if ( (y%400 == 0)){return 366;} + else {return "ERROR: DaysInYear(" + y + ") case not covered";} +} + + +function TimeInYear( y ) +{ + return ( DaysInYear(y) * msPerDay ); +} + + +function DayNumber( t ) +{ + return ( Math.floor( t / msPerDay ) ); +} + + +function TimeWithinDay( t ) +{ + if ( t < 0 ) {return ( (t%msPerDay) + msPerDay );} + else {return ( t % msPerDay );} +} + + +function YearNumber( t ) +{ +} + + +function TimeFromYear( y ) +{ + return ( msPerDay * DayFromYear(y) ); +} + + +function DayFromYear( y ) +{ + return ( 365*(y-1970) + Math.floor((y-1969)/4) - Math.floor((y-1901)/100) + + Math.floor((y-1601)/400) ); +} + + +function InLeapYear( t ) +{ + if ( DaysInYear(YearFromTime(t)) == 365 ) {return 0;} + + if ( DaysInYear(YearFromTime(t)) == 366 ) {return 1;} + else {return "ERROR: InLeapYear(" + t + ") case not covered";} +} + + +function YearFromTime( t ) +{ + t =Number( t ); + var sign = ( t < 0 ) ? -1 : 1; + var year = ( sign < 0 ) ? 1969 : 1970; + + for (var timeToTimeZero = t; ; ) + { + // subtract the current year's time from the time that's left. + timeToTimeZero -= sign * TimeInYear(year) + + // if there's less than the current year's worth of time left, then break. + if ( sign < 0 ) + { + if ( sign * timeToTimeZero <= 0 ) {break;} + else {year += sign;} + } + else + { + if ( sign * timeToTimeZero < 0 ) {break;} + else {year += sign;} + } + } + + return ( year ); +} + + +function MonthFromTime( t ) +{ + var day = DayWithinYear( t ); + var leap = InLeapYear(t); + + // I know I could use switch but I'd rather not until it's part of ECMA + if ( (0 <= day) && (day < 31) ) {return 0;} + if ( (31 <= day) && (day < (59+leap) )) {return 1;} + if ( ((59+leap) <= day) && (day < (90+leap) )) {return 2;} + if ( ((90+leap) <= day) && (day < (120+leap) )) {return 3;} + if ( ((120+leap) <= day) && (day < (151+leap) )) {return 4;} + if ( ((151+leap) <= day) && (day < (181+leap) )) {return 5;} + if ( ((181+leap) <= day) && (day < (212+leap) )) {return 6;} + if ( ((212+leap) <= day) && (day < (243+leap)) ) {return 7;} + if ( ((243+leap) <= day) && (day < (273+leap) )) {return 8;} + if ( ((273+leap) <= day) && (day < (304+leap)) ) {return 9;} + if ( ((304+leap) <= day) && (day < (334+leap)) ) {return 10;} + if ( ((334+leap) <= day) && (day < (365+leap)) ) {return 11;} + else {return "ERROR: MonthFromTime(" + t + ") not known";} +} + + +function DayWithinYear( t ) +{ + return(Day(t) - DayFromYear(YearFromTime(t)) ); +} + + +function DateFromTime( t ) +{ + var day = DayWithinYear(t); + var month = MonthFromTime(t); + + if ( month == 0) {return ( day + 1 );} + if ( month == 1) {return ( day - 30 );} + if ( month == 2) {return ( day - 58 - InLeapYear(t) );} + if ( month == 3) {return ( day - 89 - InLeapYear(t));} + if ( month == 4) {return ( day - 119 - InLeapYear(t));} + if ( month == 5) {return ( day - 150 - InLeapYear(t));} + if ( month == 6) {return ( day - 180 - InLeapYear(t));} + if ( month == 7) {return ( day - 211 - InLeapYear(t));} + if ( month == 8) {return ( day - 242 - InLeapYear(t));} + if ( month == 9) {return ( day - 272 - InLeapYear(t));} + if ( month == 10) {return ( day - 303 - InLeapYear(t));} + if ( month == 11) {return ( day - 333 - InLeapYear(t));} + return ("ERROR: DateFromTime("+t+") not known" ); +} + + +function WeekDay( t ) +{ + var weekday = (Day(t)+4)%7; + return( weekday < 0 ? 7+weekday : weekday ); +} + + +// missing daylight savings time adjustment + + +function HourFromTime( t ) +{ + var h = Math.floor( t / msPerHour )%HoursPerDay; + return ( (h<0) ? HoursPerDay + h : h ); +} + + +function MinFromTime( t ) +{ + var min = Math.floor( t / msPerMinute )%MinutesPerHour; + return( (min < 0 ) ? MinutesPerHour + min : min ); +} + + +function SecFromTime( t ) +{ + var sec = Math.floor( t / msPerSecond )%SecondsPerMinute; + return ( (sec < 0 ) ? SecondsPerMinute + sec : sec ); +} + + +function msFromTime( t ) +{ + var ms = t%msPerSecond; + return ( (ms < 0 ) ? msPerSecond + ms : ms ); +} + + +function LocalTZA() +{ + return ( TZ_DIFF * msPerHour ); +} + + +function UTC( t ) +{ + return ( t - LocalTZA() - DaylightSavingTA(t - LocalTZA()) ); +} + + +function DaylightSavingTA( t ) +{ + t = t - LocalTZA(); + + var dst_start = GetSecondSundayInMarch(t) + 2*msPerHour; + var dst_end = GetFirstSundayInNovember(t) + 2*msPerHour; + + if ( t >= dst_start && t < dst_end ) {return msPerHour;} + else {return 0;} + + // Daylight Savings Time starts on the first Sunday in April at 2:00AM in PST. + // Other time zones will need to override this function. + +print( new Date( UTC(dst_start + LocalTZA())) ); +return UTC(dst_start + LocalTZA()); +} + +function GetFirstSundayInApril( t ) { + var year = YearFromTime(t); + var leap = InLeapYear(t); + + var april = TimeFromYear(year) + TimeInMonth(0, leap) + TimeInMonth(1,leap) + + TimeInMonth(2,leap); + + for ( var first_sunday = april; WeekDay(first_sunday) > 0; + first_sunday += msPerDay ) + { + ; + } + + return first_sunday; +} +function GetLastSundayInOctober( t ) { + var year = YearFromTime(t); + var leap = InLeapYear(t); + + for ( var oct = TimeFromYear(year), m = 0; m < 9; m++ ) { + oct += TimeInMonth(m, leap); + } + for ( var last_sunday = oct + 30*msPerDay; WeekDay(last_sunday) > 0; + last_sunday -= msPerDay ) + { + ; + } + return last_sunday; +} + +// Added these two functions because DST rules changed for the US. +function GetSecondSundayInMarch( t ) { + var year = YearFromTime(t); + var leap = InLeapYear(t); + + var march = TimeFromYear(year) + TimeInMonth(0, leap) + TimeInMonth(1,leap); + + var sundayCount = 0; + var flag = true; + for ( var second_sunday = march; flag; second_sunday += msPerDay ) + { + if (WeekDay(second_sunday) == 0) { + if(++sundayCount == 2) + flag = false; + } + } + + return second_sunday; +} +function GetFirstSundayInNovember( t ) { + var year = YearFromTime(t); + var leap = InLeapYear(t); + + for ( var nov = TimeFromYear(year), m = 0; m < 10; m++ ) { + nov += TimeInMonth(m, leap); + } + for ( var first_sunday = nov; WeekDay(first_sunday) > 0; + first_sunday += msPerDay ) + { + ; + } + return first_sunday; +} + + +function LocalTime( t ) +{ + return ( t + LocalTZA() + DaylightSavingTA(t) ); +} + + +function MakeTime( hour, min, sec, ms ) +{ + if ( isNaN(hour) || isNaN(min) || isNaN(sec) || isNaN(ms) ){return Number.NaN;} + + hour = ToInteger(hour); + min = ToInteger( min); + sec = ToInteger( sec); + ms = ToInteger( ms ); + + return( (hour*msPerHour) + (min*msPerMinute) + (sec*msPerSecond) + ms ); +} + + +function MakeDay( year, month, date ) +{ + if ( isNaN(year) || isNaN(month) || isNaN(date)) {return Number.NaN;} + + year = ToInteger(year); + month = ToInteger(month); + date = ToInteger(date ); + + var sign = ( year < 1970 ) ? -1 : 1; + var t = ( year < 1970 ) ? 1 : 0; + var y = ( year < 1970 ) ? 1969 : 1970; + + var result5 = year + Math.floor( month/12 ); + var result6= month%12; + + if ( year < 1970 ) + { + for ( y = 1969; y >= year; y += sign ) + { + t += sign * TimeInYear(y); + } + } + else + { + for ( y = 1970 ; y < year; y += sign ) + { + t += sign * TimeInYear(y); + } + } + + var leap = InLeapYear( t ); + + for ( var m = 0; m < month; m++) + { + t += TimeInMonth( m, leap ); + } + + if ( YearFromTime(t) != result5 ) {return Number.NaN;} + if ( MonthFromTime(t) != result6 ) {return Number.NaN;} + if ( DateFromTime(t) != 1 ){return Number.NaN;} + + return ( (Day(t)) + date - 1 ); +} + + +function TimeInMonth( month, leap ) +{ + // Jan 0 Feb 1 Mar 2 Apr 3 May 4 June 5 Jul 6 Aug 7 Sep 8 Oct 9 Nov 10 Dec11 + + // April June September November + if ( month == 3 || month == 5 || month == 8 || month == 10 ) {return ( 30*msPerDay );} + + // all the rest + if ( month == 0 || month == 2 || month == 4 || month == 6 || + month == 7 || month == 9 || month == 11 ) {return ( 31*msPerDay );} + + // save February + return ( (leap == 0) ? 28*msPerDay : 29*msPerDay ); +} + + +function MakeDate( day, time ) +{ + if (day == Number.POSITIVE_INFINITY || + day == Number.NEGATIVE_INFINITY || + day == Number.NaN ) + { + return Number.NaN; + } + + if ( time == Number.POSITIVE_INFINITY || + time == Number.POSITIVE_INFINITY || + day == Number.NaN) + { + return Number.NaN; + } + + return ( day * msPerDay ) + time; +} + + +function TimeClip( t ) +{ + if ( isNaN( t )) {return ( Number.NaN);} + if ( Math.abs( t ) > 8.64e15 ) {return ( Number.NaN);} + + return ( ToInteger( t ) ); +} + + +function ToInteger( t ) +{ + t = Number( t ); + + if ( isNaN( t )) {return ( Number.NaN);} + + if ( t == 0 || t == -0 || + t == Number.POSITIVE_INFINITY || + t == Number.NEGATIVE_INFINITY) + { + return 0; + } + + var sign = ( t < 0 ) ? -1 : 1; + + return ( sign * Math.floor( Math.abs( t ) ) ); +} + + +function Enumerate( o ) +{ + var p; + for ( p in o ) {print( p + ": " + o[p] );} +} + + +/* these functions are useful for running tests manually in Rhino */ + +function GetContext() +{ + return Packages.com.netscape.javascript.Context.getCurrentContext(); +} + + +function OptLevel( i ) +{ + i = Number(i); + var cx = GetContext(); + cx.setOptimizationLevel(i); +} + +/* end of Rhino functions */ + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.1.1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.1.1.js new file mode 100644 index 0000000..3aab137 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.1.1.js @@ -0,0 +1,132 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): joerg.schaible@gmx.de +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 27 Nov 2002 +* SUMMARY: Ensuring normal function call of Error (ECMA-262 Ed.3 15.11.1.1). +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = ''; +var summary = 'Ensuring normal function call of Error (ECMA-262 Ed.3 15.11.1.1)'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var EMPTY_STRING = ''; +var EXPECTED_FORMAT = 0; + + +function otherScope(msg) +{ + return Error(msg); +} + + +status = inSection(1); +var err1 = Error('msg1'); +actual = examineThis(err1, 'msg1'); +expect = EXPECTED_FORMAT; +addThis(); + +status = inSection(2); +var err2 = otherScope('msg2'); +actual = examineThis(err2, 'msg2'); +expect = EXPECTED_FORMAT; +addThis(); + +status = inSection(3); +var err3 = otherScope(); +actual = examineThis(err3, EMPTY_STRING); +expect = EXPECTED_FORMAT; +addThis(); + +status = inSection(4); +var err4 = eval("Error('msg4')"); +actual = examineThis(err4, 'msg4'); +expect = EXPECTED_FORMAT; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +/* + * Searches err.toString() for err.name + ':' + err.message, + * with possible whitespace on each side of the colon sign. + * + * We allow for no colon in case err.message was not provided by the user. + * In such a case, SpiderMonkey and Rhino currently set err.message = '', + * as allowed for by ECMA 15.11.4.3. This makes |pattern| work in this case. + * + * If this is ever changed to a non-empty string, e.g. 'undefined', + * you may have to modify |pattern| to take that into account - + * + */ +function examineThis(err, msg) +{ + var pattern = err.name + '\\s*:?\\s*' + msg; + return err.toString().search(RegExp(pattern)); +} + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.4.4-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.4.4-1.js new file mode 100644 index 0000000..ca05e7e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.4.4-1.js @@ -0,0 +1,169 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2001 +* the Initial Developer. All Rights Reserved. +* +* Contributors: d-russo@ti.com, pschwartau@netscape.com, joerg.schaible@gmx.de +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 22 Jan 2002 +* SUMMARY: Testing Error.prototype.toString() +* +* Revised: 25 Nov 2002 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=181909 +* +* Note that ECMA-262 3rd Edition Final, Section 15.11.4.4 states that +* Error.prototype.toString() returns an implementation-dependent string. +* Therefore any testcase on this property is somewhat arbitrary. +* +* However, d-russo@ti.com pointed out that Rhino was returning this: +* +* js> err = new Error() +* undefined: undefined +* +* js> err = new Error("msg") +* undefined: msg +* +* +* We expect Rhino to return what SpiderMonkey currently does: +* +* js> err = new Error() +* Error +* +* js> err = new Error("msg") +* Error: msg +* +* +* i.e. we expect err.toString() === err.name if err.message is not defined; +* otherwise, we expect err.toString() === err.name + ': ' + err.message. +* +* See also ECMA 15.11.4.2, 15.11.4.3 +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = '(none)'; +var summary = 'Testing Error.prototype.toString()'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var EMPTY_STRING = ''; +var EXPECTED_FORMAT = 0; + + +status = inSection(1); +var err1 = new Error('msg1'); +actual = examineThis(err1, 'msg1'); +expect = EXPECTED_FORMAT; +addThis(); + +status = inSection(2); +var err2 = new Error(err1); +actual = examineThis(err2, err1); +expect = EXPECTED_FORMAT; +addThis(); + +status = inSection(3); +var err3 = new Error(); +actual = examineThis(err3, EMPTY_STRING); +expect = EXPECTED_FORMAT; +addThis(); + +status = inSection(4); +var err4 = new Error(EMPTY_STRING); +actual = examineThis(err4, EMPTY_STRING); +expect = EXPECTED_FORMAT; +addThis(); + +// now generate a run-time error - +status = inSection(5); +try +{ + eval('1=2'); +} +catch(err5) +{ + actual = examineThis(err5, '.*'); +} +expect = EXPECTED_FORMAT; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +/* + * Searches err.toString() for err.name + ':' + err.message, + * with possible whitespace on each side of the colon sign. + * + * We allow for no colon in case err.message was not provided by the user. + * In such a case, SpiderMonkey and Rhino currently set err.message = '', + * as allowed for by ECMA 15.11.4.3. This makes |pattern| work in this case. + * + * If this is ever changed to a non-empty string, e.g. 'undefined', + * you may have to modify |pattern| to take that into account - + * + */ +function examineThis(err, msg) +{ + var pattern = err.name + '\\s*:?\\s*' + msg; + return err.toString().search(RegExp(pattern)); +} + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-001.js new file mode 100644 index 0000000..a8097f5 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-001.js @@ -0,0 +1,125 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor@fastmail.fm, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 14 April 2003 +* SUMMARY: Prototype of predefined error objects should be DontEnum +* See http://bugzilla.mozilla.org/show_bug.cgi?id=201989 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 201989; +var summary = 'Prototype of predefined error objects should be DontEnum'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +/* + * Tests that |F.prototype| is not enumerable in |F| + */ +function testDontEnum(F) +{ + var proto = F.prototype; + + for (var prop in F) + { + if (F[prop] === proto) + return false; + } + return true; +} + + +var list = [ + "Error", + "ConversionError", + "EvalError", + "RangeError", + "ReferenceError", + "SyntaxError", + "TypeError", + "URIError" +]; + + +for (i in list) +{ + var F = this[list[i]]; + + // Test for |F|; e.g. Rhino defines |ConversionError| while SM does not. + if (F) + { + status = 'Testing DontEnum attribute of |' + list[i] + '.prototype|'; + actual = testDontEnum(F); + expect = true; + addThis(); + } +} + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-002.js new file mode 100644 index 0000000..f0fae24 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-002.js @@ -0,0 +1,120 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor@fastmail.fm, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 14 April 2003 +* SUMMARY: Prototype of predefined error objects should be DontDelete +* See http://bugzilla.mozilla.org/show_bug.cgi?id=201989 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 201989; +var summary = 'Prototype of predefined error objects should be DontDelete'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +/* + * Tests that |F.prototype| is DontDelete + */ +function testDontDelete(F) +{ + var orig = F.prototype; + delete F.prototype; + return F.prototype === orig; +} + + +var list = [ + "Error", + "ConversionError", + "EvalError", + "RangeError", + "ReferenceError", + "SyntaxError", + "TypeError", + "URIError" +]; + + +for (i in list) +{ + var F = this[list[i]]; + + // Test for |F|; e.g. Rhino defines |ConversionError| while SM does not. + if (F) + { + status = 'Testing DontDelete attribute of |' + list[i] + '.prototype|'; + actual = testDontDelete(F); + expect = true; + addThis(); + } +} + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-003.js new file mode 100644 index 0000000..5840427 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/15.11.7.6-003.js @@ -0,0 +1,120 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor@fastmail.fm, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 14 April 2003 +* SUMMARY: Prototype of predefined error objects should be ReadOnly +* See http://bugzilla.mozilla.org/show_bug.cgi?id=201989 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 201989; +var summary = 'Prototype of predefined error objects should be ReadOnly'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +/* + * Tests that |F.prototype| is ReadOnly + */ +function testReadOnly(F) +{ + var orig = F.prototype; + F.prototype = new Object(); + return F.prototype === orig; +} + + +var list = [ + "Error", + "ConversionError", + "EvalError", + "RangeError", + "ReferenceError", + "SyntaxError", + "TypeError", + "URIError" +]; + + +for (i in list) +{ + var F = this[list[i]]; + + // Test for |F|; e.g. Rhino defines |ConversionError| while SM does not. + if (F) + { + status = 'Testing ReadOnly attribute of |' + list[i] + '.prototype|'; + actual = testReadOnly(F); + expect = true; + addThis(); + } +} + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/binding-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/binding-001.js new file mode 100644 index 0000000..72ff55e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/binding-001.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 expressed +* 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): brendan@mozilla.org, pschwartau@netscape.com +* Date: 2001-08-27 +* +* SUMMARY: Testing binding of function names +* +* Brendan: +* +* "... the question is, does Rhino bind 'sum' in the global object +* for the following test? If it does, it's buggy. +* +* var f = function sum(){}; +* print(sum); // should fail with 'sum is not defined' " +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = '(none)'; +var summary = 'Testing binding of function names'; +var ERR_REF_YES = 'ReferenceError'; +var ERR_REF_NO = 'did NOT generate a ReferenceError'; +var statusitems = []; +var actualvalues = []; +var expectedvalues = []; +var status = summary; +var actual = ERR_REF_NO; +var expect= ERR_REF_YES; + + +try +{ + var f = function sum(){}; + print(sum); +} +catch (e) +{ + status = 'Section 1 of test'; + actual = e instanceof ReferenceError; + expect = true; + addThis(); + + + /* + * This test is more literal, and one day may not be valid. + * Searching for literal string "ReferenceError" in e.toString() + */ + status = 'Section 2 of test'; + var match = e.toString().search(/ReferenceError/); + actual = (match > -1); + expect = true; + addThis(); +} + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = isReferenceError(actual); + expectedvalues[UBound] = isReferenceError(expect); + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} + + +// converts a Boolean result into a textual result - +function isReferenceError(bResult) +{ + return bResult? ERR_REF_YES : ERR_REF_NO; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-181654.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-181654.js new file mode 100644 index 0000000..d65efff --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-181654.js @@ -0,0 +1,150 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): joerg.schaible@gmx.de +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 23 Nov 2002 +* SUMMARY: Calling toString for an object derived from the Error class +* results in an TypeError (Rhino only) +* See http://bugzilla.mozilla.org/show_bug.cgi?id=181654 +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = '181654'; +var summary = 'Calling toString for an object derived from the Error class should be possible.'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var EMPTY_STRING = ''; +var EXPECTED_FORMAT = 0; + + +// derive MyError from Error +function MyError( msg ) +{ + this.message = msg; +} +MyError.prototype = new Error(); +MyError.prototype.name = "MyError"; + + +status = inSection(1); +var err1 = new MyError('msg1'); +actual = examineThis(err1, 'msg1'); +expect = EXPECTED_FORMAT; +addThis(); + +status = inSection(2); +var err2 = new MyError(err1); +actual = examineThis(err2, err1); +expect = EXPECTED_FORMAT; +addThis(); + +status = inSection(3); +var err3 = new MyError(); +actual = examineThis(err3, EMPTY_STRING); +expect = EXPECTED_FORMAT; +addThis(); + +status = inSection(4); +var err4 = new MyError(EMPTY_STRING); +actual = examineThis(err4, EMPTY_STRING); +expect = EXPECTED_FORMAT; +addThis(); + +// now generate an error - +status = inSection(5); +try +{ + throw new MyError("thrown"); +} +catch(err5) +{ + actual = examineThis(err5, "thrown"); +} +expect = EXPECTED_FORMAT; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +/* + * Searches err.toString() for err.name + ':' + err.message, + * with possible whitespace on each side of the colon sign. + * + * We allow for no colon in case err.message was not provided by the user. + * In such a case, SpiderMonkey and Rhino currently set err.message = '', + * as allowed for by ECMA 15.11.4.3. This makes |pattern| work in this case. + * + * If this is ever changed to a non-empty string, e.g. 'undefined', + * you may have to modify |pattern| to take that into account - + * + */ +function examineThis(err, msg) +{ + var pattern = err.name + '\\s*:?\\s*' + msg; + return err.toString().search(RegExp(pattern)); +} + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-181914.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-181914.js new file mode 100644 index 0000000..adf0b46 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-181914.js @@ -0,0 +1,189 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): joerg.schaible@gmx.de, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 25 Nov 2002 +* SUMMARY: Calling a user-defined superconstructor +* See http://bugzilla.mozilla.org/show_bug.cgi?id=181914, esp. Comment 10. +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = '181914'; +var summary = 'Calling a user-defined superconstructor'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var EMPTY_STRING = ''; +var EXPECTED_FORMAT = 0; + + +// make a user-defined version of the Error constructor +function _Error(msg) +{ + this.message = msg; +} +_Error.prototype = new Error(); +_Error.prototype.name = '_Error'; + + +// derive MyApplyError from _Error +function MyApplyError(msg) +{ + if(this instanceof MyApplyError) + _Error.apply(this, arguments); + else + return new MyApplyError(msg); +} +MyApplyError.prototype = new _Error(); +MyApplyError.prototype.name = "MyApplyError"; + + +// derive MyCallError from _Error +function MyCallError(msg) +{ + if(this instanceof MyCallError) + _Error.call(this, msg); + else + return new MyCallError(msg); +} +MyCallError.prototype = new _Error(); +MyCallError.prototype.name = "MyCallError"; + + +function otherScope(msg) +{ + return MyApplyError(msg); +} + + +status = inSection(1); +var err1 = new MyApplyError('msg1'); +actual = examineThis(err1, 'msg1'); +expect = EXPECTED_FORMAT; +addThis(); + +status = inSection(2); +var err2 = new MyCallError('msg2'); +actual = examineThis(err2, 'msg2'); +expect = EXPECTED_FORMAT; +addThis(); + +status = inSection(3); +var err3 = MyApplyError('msg3'); +actual = examineThis(err3, 'msg3'); +expect = EXPECTED_FORMAT; +addThis(); + +status = inSection(4); +var err4 = MyCallError('msg4'); +actual = examineThis(err4, 'msg4'); +expect = EXPECTED_FORMAT; +addThis(); + +status = inSection(5); +var err5 = otherScope('msg5'); +actual = examineThis(err5, 'msg5'); +expect = EXPECTED_FORMAT; +addThis(); + +status = inSection(6); +var err6 = otherScope(); +actual = examineThis(err6, EMPTY_STRING); +expect = EXPECTED_FORMAT; +addThis(); + +status = inSection(7); +var err7 = eval("MyApplyError('msg7')"); +actual = examineThis(err7, 'msg7'); +expect = EXPECTED_FORMAT; +addThis(); + +status = inSection(8); +var err8; +try +{ + throw MyApplyError('msg8'); +} +catch(e) +{ + if(e instanceof Error) + err8 = e; +} +actual = examineThis(err8, 'msg8'); +expect = EXPECTED_FORMAT; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +// Searches |err.toString()| for |err.name + ':' + err.message| +function examineThis(err, msg) +{ + var pattern = err.name + '\\s*:?\\s*' + msg; + return err.toString().search(RegExp(pattern)); +} + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-58946.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-58946.js new file mode 100644 index 0000000..e2fc798 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-58946.js @@ -0,0 +1,56 @@ +/* +* 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): pschwartau@netscape.com +* +* +*This test arose from Bugzilla bug 58946. +*The bug was filed when we got the following error (see code below): +* +* "ReferenceError: e is not defined" +* +*There was no error if we replaced "return e" in the code below with "print(e)". +*There should be no error with "return e", either - +*/ +//------------------------------------------------------------------------------------------------- +var bug = '58946'; +var stat = 'Testing a return statement inside a catch statement inside a function'; + + +test(); + + +function test() { + enterFunc ("test"); + printBugNumber (bug); + printStatus (stat); + + + try + { + throw 'PASS'; + } + + catch(e) + { + return e; + } + + + exitFunc ("test"); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-95101.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-95101.js new file mode 100644 index 0000000..59b5209 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Exceptions/regress-95101.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.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): pschwartau@netscape.com +* Date: 13 August 2001 +* +* SUMMARY: Invoking an undefined function should produce a ReferenceError +* See http://bugzilla.mozilla.org/show_bug.cgi?id=95101 +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 95101; +var summary = 'Invoking an undefined function should produce a ReferenceError'; +var msgERR_REF_YES = 'ReferenceError'; +var msgERR_REF_NO = 'did NOT generate a ReferenceError'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +try +{ + xxxyyyzzz(); +} +catch (e) +{ + status = 'Section 1 of test'; + actual = e instanceof ReferenceError; + expect = true; + addThis(); + + + /* + * This test is more literal, and may one day be invalid. + * Searching for literal string "ReferenceError" in e.toString() + */ + status = 'Section 2 of test'; + var match = e.toString().search(/ReferenceError/); + actual = (match > -1); + expect = true; + addThis(); +} + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = isReferenceError(actual); + expectedvalues[UBound] = isReferenceError(expect); + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} + + +// converts a Boolean result into a textual result - +function isReferenceError(bResult) +{ + return bResult? msgERR_REF_YES : msgERR_REF_NO; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.3-1.js new file mode 100644 index 0000000..a29d2a4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.3-1.js @@ -0,0 +1,196 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 11 Feb 2002 +* SUMMARY: Testing functions having duplicate formal parameter names +* +* Note: given function f(x,x,x,x) {return x;}; f(1,2,3,4) should return 4. +* See ECMA-262 3rd Edition Final Section 10.1.3: Variable Instantiation +* +* Also see http://bugzilla.mozilla.org/show_bug.cgi?id=124900 +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 124900; +var summary = 'Testing functions having duplicate formal parameter names'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +function f1(x,x) +{ + return x; +} +status = inSection(1); +actual = f1(1,2); +expect = 2; +addThis(); + + +function f2(x,x,x) +{ + return x*x*x; +} +status = inSection(2); +actual = f2(1,2,3); +expect = 27; +addThis(); + + +function f3(x,x,x,x) +{ + return 'a' + x + 'b' + x + 'c' + x ; +} +status = inSection(3); +actual = f3(1,2,3,4); +expect = 'a4b4c4'; +addThis(); + + +/* + * If the value of the last duplicate parameter is not provided by + * the function caller, the value of this parameter is undefined + */ +function f4(x,a,b,x,z) +{ + return x; +} +status = inSection(4); +actual = f4(1,2); +expect = undefined; +addThis(); + + +/* + * f.toString() should preserve any duplicate formal parameter names that exist + */ +function f5(x,x,x,x) +{ +} +status = inSection(5); +actual = f5.toString().match(/\((.*)\)/)[1]; +actual = actual.replace(/\s/g, ''); // for definiteness, remove any white space +expect = 'x,x,x,x'; +addThis(); + + +function f6(x,x,x,x) +{ + var ret = []; + + for (var i=0; i<arguments.length; i++) + ret.push(arguments[i]); + + return ret.toString(); +} +status = inSection(6); +actual = f6(1,2,3,4); +expect = '1,2,3,4'; +addThis(); + + +/* + * This variation (assigning to x inside f) is from nboyd@atg.com + * See http://bugzilla.mozilla.org/show_bug.cgi?id=124900 + */ +function f7(x,x,x,x) +{ + x = 999; + var ret = []; + + for (var i=0; i<arguments.length; i++) + ret.push(arguments[i]); + + return ret.toString(); +} +status = inSection(7); +actual = f7(1,2,3,4); +expect = '1,2,3,999'; +addThis(); + + +/* + * Same as above, but with |var| keyword added - + */ +function f8(x,x,x,x) +{ + var x = 999; + var ret = []; + + for (var i=0; i<arguments.length; i++) + ret.push(arguments[i]); + + return ret.toString(); +} +status = inSection(8); +actual = f8(1,2,3,4); +expect = '1,2,3,999'; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.3-2.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.3-2.js new file mode 100644 index 0000000..f969ca0 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.3-2.js @@ -0,0 +1,157 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 11 Feb 2002 +* SUMMARY: Testing functions having duplicate formal parameter names +* +* SpiderMonkey was crashing on each case below if the parameters had +* the same name. But duplicate parameter names are permitted by ECMA; +* see ECMA-262 3rd Edition Final Section 10.1.3 +* +* NOTE: Rhino does not have toSource() and uneval(); they are non-ECMA +* extensions to the language. So we include a test for them at the beginning - +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = '(none)'; +var summary = 'Testing functions having duplicate formal parameter names'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var OBJ = new Object(); +var OBJ_TYPE = OBJ.toString(); + +/* + * Exit if the implementation doesn't support toSource() or uneval(), + * since these are non-ECMA extensions to the language - + */ +try +{ + if (!OBJ.toSource || !uneval(OBJ)) + quit(); +} +catch(e) +{ + quit(); +} + + +/* + * OK, now begin the test. Just checking that we don't crash on these - + */ +function f1(x,x,x,x) +{ + var ret = eval(arguments.toSource()); + return ret.toString(); +} +status = inSection(1); +actual = f1(1,2,3,4); +expect = OBJ_TYPE; +addThis(); + + +/* + * Same thing, but preface |arguments| with the function name + */ +function f2(x,x,x,x) +{ + var ret = eval(f2.arguments.toSource()); + return ret.toString(); +} +status = inSection(2); +actual = f2(1,2,3,4); +expect = OBJ_TYPE; +addThis(); + + +function f3(x,x,x,x) +{ + var ret = eval(uneval(arguments)); + return ret.toString(); +} +status = inSection(3); +actual = f3(1,2,3,4); +expect = OBJ_TYPE; +addThis(); + + +/* + * Same thing, but preface |arguments| with the function name + */ +function f4(x,x,x,x) +{ + var ret = eval(uneval(f4.arguments)); + return ret.toString(); +} +status = inSection(4); +actual = f4(1,2,3,4); +expect = OBJ_TYPE; +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.3.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.3.js new file mode 100644 index 0000000..468589a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.3.js @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * 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): + * Rob Ginda rginda@netscape.com + */ + +/** + ECMA Section: 10.1.3: Variable Instantiation + FunctionDeclarations are processed before VariableDeclarations, and + VariableDeclarations don't replace existing values with undefined +*/ + +test(); + +function f() +{ + var x; + + return typeof x; + + function x() + { + return 7; + } +} + +function test() +{ + enterFunc ("test"); + + printStatus ("ECMA Section: 10.1.3: Variable Instantiation."); + printBugNumber (17290); + + reportCompare ("function", f(), "Declaration precedence test"); + + exitFunc("test"); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.4-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.4-1.js new file mode 100644 index 0000000..f4b6f5d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/10.1.4-1.js @@ -0,0 +1,58 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * 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): + * Rob Ginda rginda@netscape.com + */ + +/** + ECMA Section: 10.1.4.1 Entering An Execution Context + ECMA says: + * Global Code, Function Code + Variable instantiation is performed using the global object as the + variable object and using property attributes { DontDelete }. + + * Eval Code + Variable instantiation is performed using the calling context's + variable object and using empty property attributes. +*/ + +test(); + +function test() +{ + enterFunc ("test"); + + var y; + eval("var x = 1"); + + if (delete y) + reportFailure ("Expected *NOT* to be able to delete y"); + + if (typeof x == "undefined") + reportFailure ("x did not remain defined after eval()"); + else if (x != 1) + reportFailure ("x did not retain it's value after eval()"); + + if (!delete x) + reportFailure ("Expected to be able to delete x"); + + exitFunc("test"); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/regress-23346.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/regress-23346.js new file mode 100644 index 0000000..d831720 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/ExecutionContexts/regress-23346.js @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * 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): + * Rob Ginda rginda@netscape.com + */ + +var CALL_CALLED = "PASSED"; + +test(); + +function f(x) +{ + if (x) + return call(); + + return "FAILED!"; +} + +function call() +{ + return CALL_CALLED; +} + +function test() +{ + enterFunc ("test"); + + printStatus ("ECMA Section: 10.1.3: Variable Instantiation."); + printBugNumber (23346); + + reportCompare ("PASSED", f(true), + "Unqualified reference should not see Function.prototype"); + + exitFunc("test"); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Expressions/11.6.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Expressions/11.6.1-1.js new file mode 100644 index 0000000..0963ef7 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Expressions/11.6.1-1.js @@ -0,0 +1,171 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): bzbarsky@mit.edu, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 14 Mar 2003 +* SUMMARY: Testing left-associativity of the + operator +* +* See ECMA-262 Ed.3, Section 11.6.1, "The Addition operator" +* See http://bugzilla.mozilla.org/show_bug.cgi?id=196290 +* +* The upshot: |a + b + c| should always equal |(a + b) + c| +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 196290; +var summary = 'Testing left-associativity of the + operator'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +status = inSection(1); +actual = 1 + 1 + 'px'; +expect = '2px'; +addThis(); + +status = inSection(2); +actual = 'px' + 1 + 1; +expect = 'px11'; +addThis(); + +status = inSection(3); +actual = 1 + 1 + 1 + 'px'; +expect = '3px'; +addThis(); + +status = inSection(4); +actual = 1 + 1 + 'a' + 1 + 1 + 'b'; +expect = '2a11b'; +addThis(); + +/* + * The next sections test the + operator via eval() + */ +status = inSection(5); +actual = sumThese(1, 1, 'a', 1, 1, 'b'); +expect = '2a11b'; +addThis(); + +status = inSection(6); +actual = sumThese(new Number(1), new Number(1), 'a'); +expect = '2a'; +addThis(); + +status = inSection(7); +actual = sumThese('a', new Number(1), new Number(1)); +expect = 'a11'; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + +/* + * Applies the + operator to the provided arguments via eval(). + * + * Form an eval string of the form 'arg1 + arg2 + arg3', but + * remember to add double-quotes inside the eval string around + * any argument that is of string type. For example, suppose the + * arguments were 11, 'a', 22. Then the eval string should be + * + * arg1 + quoteThis(arg2) + arg3 + * + * If we didn't put double-quotes around the string argument, + * we'd get this for an eval string: + * + * '11 + a + 22' + * + * If we eval() this, we get 'ReferenceError: a is not defined'. + * With proper quoting, we get eval('11 + "a" + 22') as desired. + */ +function sumThese() +{ + var sEval = ''; + var arg; + var i; + + var L = arguments.length; + for (i=0; i<L; i++) + { + arg = arguments[i]; + if (typeof arg === 'string') + arg = quoteThis(arg); + + if (i < L-1) + sEval += arg + ' + '; + else + sEval += arg; + } + + return eval(sEval); +} + + +function quoteThis(x) +{ + return '"' + x + '"'; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Expressions/11.9.6-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Expressions/11.9.6-1.js new file mode 100644 index 0000000..8153585 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Expressions/11.9.6-1.js @@ -0,0 +1,208 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 20 Feb 2002 +* SUMMARY: Testing the comparison |undefined === null| +* See http://bugzilla.mozilla.org/show_bug.cgi?id=126722 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 126722; +var summary = 'Testing the comparison |undefined === null|'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +status = inSection(1); +if (undefined === null) + actual = true; +else + actual = false; +expect = false; +addThis(); + + + +status = inSection(2); +switch(true) +{ + case (undefined === null) : + actual = true; + break; + + default: + actual = false; +} +expect = false; +addThis(); + + + +status = inSection(3); +function f3(x) +{ + var res = false; + + switch(true) + { + case (x === null) : + res = true; + break; + + default: + // do nothing + } + + return res; +} + +actual = f3(undefined); +expect = false; +addThis(); + + + +status = inSection(4); +function f4(arr) +{ + var elt = ''; + var res = false; + + for (i=0; i<arr.length; i++) + { + elt = arr[i]; + + switch(true) + { + case (elt === null) : + res = true; + break; + + default: + // do nothing + } + } + + return res; +} + +var arr = Array('a', undefined); +actual = f4(arr); +expect = false; +addThis(); + + + +status = inSection(5); +function f5(arr) +{ + var len = arr.length; + + for(var i=0; (arr[i]===undefined) && (i<len); i++) + ; //do nothing + + return i; +} + +/* + * An array of 5 undefined elements. Note: + * + * The return value of eval(a STATEMENT) is undefined. + * A non-existent PROPERTY is undefined, not a ReferenceError. + * No undefined element exists AFTER trailing comma at end. + * + */ +var arrUndef = [ , undefined, eval('var x = 0'), this.NOT_A_PROPERTY, , ]; +actual = f5(arrUndef); +expect = 5; +addThis(); + + + +status = inSection(6); +function f6(arr) +{ + var len = arr.length; + + for(var i=0; (arr[i]===null) && (i<len); i++) + ; //do nothing + + return i; +} + +/* + * Use same array as above. This time we're comparing to |null|, so we expect 0 + */ +actual = f6(arrUndef); +expect = 0; +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/FunExpr/fe-001-n.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/FunExpr/fe-001-n.js new file mode 100644 index 0000000..34c37e8 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/FunExpr/fe-001-n.js @@ -0,0 +1,37 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * 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): + * Rob Ginda rginda@netscape.com + */ + +test(); + +function test() +{ + enterFunc ("test"); + printStatus ("Function Expression test."); + + var x = function f(){return "inner";}(); + var y = f(); + reportFailure ("Previous statement should have thrown a ReferenceError"); + + exitFunc ("test"); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/FunExpr/fe-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/FunExpr/fe-001.js new file mode 100644 index 0000000..569a636 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/FunExpr/fe-001.js @@ -0,0 +1,39 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * 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): + * Rob Ginda rginda@netscape.com + */ + +if (1) function f() {return 1;} +if (0) function f() {return 0;} + +function test() +{ + enterFunc ("test"); + + printStatus ("Function Expression Statements basic test."); + + reportCompare (1, f(), "Both functions were defined."); + + exitFunc ("test"); +} + +test(); diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/FunExpr/fe-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/FunExpr/fe-002.js new file mode 100644 index 0000000..35a9925 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/FunExpr/fe-002.js @@ -0,0 +1,43 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * 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): + * Rob Ginda rginda@netscape.com + */ + +function f() +{ + return "outer"; +} + +function test() +{ + enterFunc ("test"); + printStatus ("Function Expression test."); + + var x = function f(){return "inner";}(); + + reportCompare ("outer", f(), + "Inner function statement should not have been called."); + + exitFunc ("test"); +} + +test(); diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/15.3.4.3-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/15.3.4.3-1.js new file mode 100644 index 0000000..123b944 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/15.3.4.3-1.js @@ -0,0 +1,205 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor3@apochta.com, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 21 May 2002 +* SUMMARY: ECMA conformance of Function.prototype.apply +* +* Function.prototype.apply(thisArg, argArray) +* +* See ECMA-262 Edition 3 Final, Section 15.3.4.3 +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 145791; +var summary = 'Testing ECMA conformance of Function.prototype.apply'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +function F0(a) +{ + return "" + this + arguments.length; +} + +function F1(a) +{ + return "" + this + a; +} + +function F2() +{ + return "" + this; +} + + + +/* + * Function.prototype.apply.length should return 2 + */ +status = inSection(1); +actual = Function.prototype.apply.length; +expect = 2; +addThis(); + + +/* + * When |thisArg| is not provided to the apply() method, the + * called function must be passed the global object as |this| + */ +status = inSection(2); +actual = F0.apply(); +expect = "" + this + 0; +addThis(); + + +/* + * If |argArray| is not provided to the apply() method, the + * called function should be invoked with an empty argument list + */ +status = inSection(3); +actual = F0.apply(""); +expect = "" + "" + 0; +addThis(); + +status = inSection(4); +actual = F0.apply(true); +expect = "" + true + 0; +addThis(); + + +/* + * Function.prototype.apply(x) and + * Function.prototype.apply(x, undefined) should return the same result + */ +status = inSection(5); +actual = F1.apply(0, undefined); +expect = F1.apply(0); +addThis(); + +status = inSection(6); +actual = F1.apply("", undefined); +expect = F1.apply(""); +addThis(); + +status = inSection(7); +actual = F1.apply(null, undefined); +expect = F1.apply(null); +addThis(); + +status = inSection(8); +actual = F1.apply(undefined, undefined); +expect = F1.apply(undefined); +addThis(); + + +/* + * Function.prototype.apply(x) and + * Function.prototype.apply(x, null) should return the same result + */ +status = inSection(9); +actual = F1.apply(0, null); +expect = F1.apply(0); +addThis(); + +status = inSection(10); +actual = F1.apply("", null); +expect = F1.apply(""); +addThis(); + +status = inSection(11); +actual = F1.apply(null, null); +expect = F1.apply(null); +addThis(); + +status = inSection(12); +actual = F1.apply(undefined, null); +expect = F1.apply(undefined); +addThis(); + + +/* + * Function.prototype.apply() and + * Function.prototype.apply(undefined) should return the same result + */ +status = inSection(13); +actual = F2.apply(undefined); +expect = F2.apply(); +addThis(); + + +/* + * Function.prototype.apply() and + * Function.prototype.apply(null) should return the same result + */ +status = inSection(14); +actual = F2.apply(null); +expect = F2.apply(); +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/15.3.4.4-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/15.3.4.4-1.js new file mode 100644 index 0000000..e9e2b64 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/15.3.4.4-1.js @@ -0,0 +1,180 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor3@apochta.com, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 21 May 2002 +* SUMMARY: ECMA conformance of Function.prototype.call +* +* Function.prototype.call(thisArg [,arg1 [,arg2, ...]]) +* +* See ECMA-262 Edition 3 Final, Section 15.3.4.4 +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 145791; +var summary = 'Testing ECMA conformance of Function.prototype.call'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +function F0(a) +{ + return "" + this + arguments.length; +} + +function F1(a) +{ + return "" + this + a; +} + +function F2() +{ + return "" + this; +} + + + +/* + * Function.prototype.call.length should return 1 + */ +status = inSection(1); +actual = Function.prototype.call.length; +expect = 1; +addThis(); + + +/* + * When |thisArg| is not provided to the call() method, the + * called function must be passed the global object as |this| + */ +status = inSection(2); +actual = F0.call(); +expect = "" + this + 0; +addThis(); + + +/* + * If [,arg1 [,arg2, ...]] are not provided to the call() method, + * the called function should be invoked with an empty argument list + */ +status = inSection(3); +actual = F0.call(""); +expect = "" + "" + 0; +addThis(); + +status = inSection(4); +actual = F0.call(true); +expect = "" + true + 0; +addThis(); + + +/* + * Function.prototype.call(x) and + * Function.prototype.call(x, undefined) should return the same result + */ +status = inSection(5); +actual = F1.call(0, undefined); +expect = F1.call(0); +addThis(); + +status = inSection(6); +actual = F1.call("", undefined); +expect = F1.call(""); +addThis(); + +status = inSection(7); +actual = F1.call(null, undefined); +expect = F1.call(null); +addThis(); + +status = inSection(8); +actual = F1.call(undefined, undefined); +expect = F1.call(undefined); +addThis(); + + +/* + * Function.prototype.call() and + * Function.prototype.call(undefined) should return the same result + */ +status = inSection(9); +actual = F2.call(undefined); +expect = F2.call(); +addThis(); + + +/* + * Function.prototype.call() and + * Function.prototype.call(null) should return the same result + */ +status = inSection(10); +actual = F2.call(null); +expect = F2.call(); +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/arguments-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/arguments-001.js new file mode 100644 index 0000000..98aca18 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/arguments-001.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.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): brendan@mozilla.org, pschwartau@netscape.com +* Date: 07 May 2001 +* +* SUMMARY: Testing the arguments object +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=72884 +*/ +//------------------------------------------------------------------------------------------------- +var UBound = 0; +var bug = 72884; +var summary = 'Testing the arguments object'; +var status = ''; +var statusitems = [ ]; +var actual = ''; +var actualvalues = [ ]; +var expect= ''; +var expectedvalues = [ ]; +var a = ''; + + +status = inSection(1); +function f() +{ + delete arguments.length; + return arguments; +} + +a = f(); +actual = a instanceof Object; +expect = true; +addThis(); + +actual = a instanceof Array; +expect = false; +addThis(); + +actual = a.length; +expect = undefined; +addThis(); + + + +status = inSection(2); +a = f(1,2,3); +actual = a instanceof Object; +expect = true; +addThis(); + +actual = a instanceof Array; +expect = false; +addThis(); + +actual = a.length; +expect = undefined; +addThis(); + +actual = a[0]; +expect = 1; +addThis(); + +actual = a[1]; +expect = 2; +addThis(); + +actual = a[2]; +expect = 3; +addThis(); + + + +status = inSection(3); +/* + * Brendan: + * + * Note that only callee and length can be overridden, so deleting an indexed + * property and asking for it again causes it to be recreated by args_resolve: + * + * function g(){delete arguments[0]; return arguments[0]} + * g(42) // should this print 42? + * + * I'm not positive this violates ECMA, which allows in chapter 16 for extensions + * including properties (does it allow for magically reappearing properties?). The + * delete operator successfully deletes arguments[0] and results in true, but that + * is not distinguishable from the case where arguments[0] was delegated to + * Arguments.prototype[0], which was how the bad old code worked. + * + * I'll ponder this last detail... + * + * UPDATE: Per ECMA-262, delete on an arguments[i] should succeed + * and remove that property from the arguments object, leaving any get + * of it after the delete to evaluate to undefined. + */ +function g() +{ + delete arguments[0]; + return arguments[0]; +} +actual = g(42); +expect = undefined; // not 42... +addThis(); + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/call-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/call-001.js new file mode 100644 index 0000000..f9bdf62 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/call-001.js @@ -0,0 +1,131 @@ +/* +* 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 expressed +* 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): pschwartau@netscape.com +* Date: 2001-07-13 +* +* SUMMARY: Applying Function.prototype.call to the Function object itself +* +* +* ECMA-262 15.3.4.4 Function.prototype.call (thisArg [,arg1 [,arg2,…] ] ) +* +* When applied to the Function object itself, thisArg should be ignored. +* As explained by Waldemar (waldemar@netscape.com): +* +* Function.call(obj, "print(this)") is equivalent to invoking +* Function("print(this)") with this set to obj. Now, Function("print(this)") +* is equivalent to new Function("print(this)") (see 15.3.1.1), and the latter +* ignores the this value that you passed it and constructs a function +* (which we'll call F) which will print the value of the this that will be +* passed in when F will be invoked. +* +* With the last set of () you're invoking F(), which means you're calling it +* with no this value. When you don't provide a this value, it defaults to the +* global object. +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = '(none)'; +var summary = 'Applying Function.prototype.call to the Function object itself'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var self = this; // capture a reference to the global object +var cnOBJECT_GLOBAL = self.toString(); +var cnOBJECT_OBJECT = (new Object).toString(); +var cnHello = 'Hello'; +var cnRed = 'red'; +var objTEST = {color:cnRed}; +var f = new Function(); +var g = new Function(); + + +f = Function.call(self, 'return cnHello'); +g = Function.call(objTEST, 'return cnHello'); + +status = 'Section A of test'; +actual = f(); +expect = cnHello; +captureThis(); + +status = 'Section B of test'; +actual = g(); +expect = cnHello; +captureThis(); + + +f = Function.call(self, 'return this.toString()'); +g = Function.call(objTEST, 'return this.toString()'); + +status = 'Section C of test'; +actual = f(); +expect = cnOBJECT_GLOBAL; +captureThis(); + +status = 'Section D of test'; +actual = g(); +expect = cnOBJECT_GLOBAL; +captureThis(); + + +f = Function.call(self, 'return this.color'); +g = Function.call(objTEST, 'return this.color'); + +status = 'Section E of test'; +actual = f(); +expect = undefined; +captureThis(); + +status = 'Section F of test'; +actual = g(); +expect = undefined; +captureThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + +function captureThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-104584.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-104584.js new file mode 100644 index 0000000..db984a2 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-104584.js @@ -0,0 +1,56 @@ +/* +* 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): jband@netscape.com, pschwartau@netscape.com +* Date: 14 October 2001 +* +* SUMMARY: Regression test for Bugzilla bug 104584 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=104584 +* +* Testing that we don't crash on this code. The idea is to +* call F,G WITHOUT providing an argument. This caused a crash +* on the second call to obj.toString() or print(obj) below - +*/ +//----------------------------------------------------------------------------- +var bug = 104584; +var summary = "Testing that we don't crash on this code -"; + +printBugNumber (bug); +printStatus (summary); + +F(); +G(); + +function F(obj) +{ + if(!obj) + obj = {}; + obj.toString(); + gc(); + obj.toString(); +} + + +function G(obj) +{ + if(!obj) + obj = {}; + print(obj); + gc(); + print(obj); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-131964.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-131964.js new file mode 100644 index 0000000..d90aa17 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-131964.js @@ -0,0 +1,191 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 19 Mar 2002 +* SUMMARY: Function declarations in global or function scope are {DontDelete}. +* Function declarations in eval scope are not {DontDelete}. +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=131964 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 131964; +var summary = 'Functions defined in global or function scope are {DontDelete}'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +status = inSection(1); +function f() +{ + return 'f lives!'; +} +delete f; + +try +{ + actual = f(); +} +catch(e) +{ + actual = 'f was deleted'; +} + +expect = 'f lives!'; +addThis(); + + + +/* + * Try the same test in function scope - + */ +status = inSection(2); +function g() +{ + function f() + { + return 'f lives!'; + } + delete f; + + try + { + actual = f(); + } + catch(e) + { + actual = 'f was deleted'; + } + + expect = 'f lives!'; + addThis(); +} +g(); + + + +/* + * Try the same test in eval scope - here we EXPECT the function to be deleted (?) + */ +status = inSection(3); +var s = ''; +s += 'function h()'; +s += '{ '; +s += ' return "h lives!";'; +s += '}'; +s += 'delete h;'; + +s += 'try'; +s += '{'; +s += ' actual = h();'; +s += '}'; +s += 'catch(e)'; +s += '{'; +s += ' actual = "h was deleted";'; +s += '}'; + +s += 'expect = "h was deleted";'; +s += 'addThis();'; +eval(s); + + +/* + * Define the function in eval scope, but delete it in global scope - + */ +status = inSection(4); +s = ''; +s += 'function k()'; +s += '{ '; +s += ' return "k lives!";'; +s += '}'; +eval(s); + +delete k; + +try +{ + actual = k(); +} +catch(e) +{ + actual = 'k was deleted'; +} + +expect = 'k was deleted'; +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function wasDeleted(functionName) +{ + return functionName + ' was deleted...'; +} + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-137181.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-137181.js new file mode 100644 index 0000000..1417601 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-137181.js @@ -0,0 +1,108 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): ibukanov8@yahoo.com, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 12 Apr 2002 +* SUMMARY: delete arguments[i] should break connection to local reference +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=137181 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 137181; +var summary = 'delete arguments[i] should break connection to local reference'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +status = inSection(1); +function f1(x) +{ + x = 1; + delete arguments[0]; + return x; +} +actual = f1(0); // (bug: Rhino was returning |undefined|) +expect = 1; +addThis(); + + +status = inSection(2); +function f2(x) +{ + x = 1; + delete arguments[0]; + arguments[0] = -1; + return x; +} +actual = f2(0); // (bug: Rhino was returning -1) +expect = 1; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-193555.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-193555.js new file mode 100644 index 0000000..cc3c1eb --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-193555.js @@ -0,0 +1,131 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor@icesoft.no, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 17 February 2003 +* SUMMARY: Testing access to function name from inside function +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=193555 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 193555; +var summary = 'Testing access to function name from inside function'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +// test via function statement +status = inSection(1); +function f() {return f.toString();}; +actual = f(); +expect = f.toString(); +addThis(); + +// test via function expression +status = inSection(2); +var x = function g() {return g.toString();}; +actual = x(); +expect = x.toString(); +addThis(); + +// test via eval() outside function +status = inSection(3); +eval ('function a() {return a.toString();}'); +actual = a(); +expect = a.toString(); +addThis(); + +status = inSection(4); +eval ('var y = function b() {return b.toString();}'); +actual = y(); +expect = y.toString(); +addThis(); + +// test via eval() inside function +status = inSection(5); +function c() {return eval('c').toString();}; +actual = c(); +expect = c.toString(); +addThis(); + +status = inSection(6); +var z = function d() {return eval('d').toString();}; +actual = z(); +expect = z.toString(); +addThis(); + +// test via two evals! +status = inSection(7); +eval('var w = function e() {return eval("e").toString();}'); +actual = w(); +expect = w.toString(); +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-49286.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-49286.js new file mode 100644 index 0000000..5f7093a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-49286.js @@ -0,0 +1,116 @@ +/* +* 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 expressed +* 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. +* +* Contributors: jlaprise@delanotech.com,pschwartau@netscape.com +* Date: 2001-07-10 +* +* SUMMARY: Invoking try...catch through Function.call +* See http://bugzilla.mozilla.org/show_bug.cgi?id=49286 +* +* 1) Define a function with a try...catch block in it +* 2) Invoke the function via the call method of Function +* 3) Pass bad syntax to the try...catch block +* 4) We should catch the error! +*/ +//------------------------------------------------------------------------------------------------- +var UBound = 0; +var bug = 49286; +var summary = 'Invoking try...catch through Function.call'; +var cnErrorCaught = 'Error caught'; +var cnErrorNotCaught = 'Error NOT caught'; +var cnGoodSyntax = '1==2'; +var cnBadSyntax = '1=2'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +var obj = new testObject(); + +status = 'Section A of test: direct call of f'; +actual = f.call(obj); +expect = cnErrorCaught; +addThis(); + +status = 'Section B of test: indirect call of f'; +actual = g.call(obj); +expect = cnErrorCaught; +addThis(); + + + +//----------------------------------------- +test(); +//----------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} + + +// An object storing bad syntax as a property - +function testObject() +{ + this.badSyntax = cnBadSyntax; + this.goodSyntax = cnGoodSyntax; +} + + +// A function wrapping a try...catch block +function f() +{ + try + { + eval(this.badSyntax); + } + catch(e) + { + return cnErrorCaught; + } + return cnErrorNotCaught; +} + + +// A function wrapping a call to f - +function g() +{ + return f.call(this); +} + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-58274.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-58274.js new file mode 100644 index 0000000..8a5c2e6 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-58274.js @@ -0,0 +1,221 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): rogerl@netscape.com, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 15 July 2002 +* SUMMARY: Testing functions with double-byte names +* See http://bugzilla.mozilla.org/show_bug.cgi?id=58274 +* +* Here is a sample of the problem: +* +* js> function f\u02B1 () {} +* +* js> f\u02B1.toSource(); +* function f¦() {} +* +* js> f\u02B1.toSource().toSource(); +* (new String("function f\xB1() {}")) +* +* +* See how the high-byte information (the 02) has been lost? +* The same thing was happening with the toString() method: +* +* js> f\u02B1.toString(); +* +* function f¦() { +* } +* +* js> f\u02B1.toString().toSource(); +* (new String("\nfunction f\xB1() {\n}\n")) +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 58274; +var summary = 'Testing functions with double-byte names'; +var ERR = 'UNEXPECTED ERROR! \n'; +var ERR_MALFORMED_NAME = ERR + 'Could not find function name in: \n\n'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var sEval; +var sName; + + +sEval = "function f\u02B2() {return 42;}"; +eval(sEval); +sName = getFunctionName(f\u02B2); + +// Test function call - +status = inSection(1); +actual = f\u02B2(); +expect = 42; +addThis(); + +// Test both characters of function name - +status = inSection(2); +actual = sName[0]; +expect = sEval[9]; +addThis(); + +status = inSection(3); +actual = sName[1]; +expect = sEval[10]; +addThis(); + + + +sEval = "function f\u02B2\u0AAA () {return 84;}"; +eval(sEval); +sName = getFunctionName(f\u02B2\u0AAA); + +// Test function call - +status = inSection(4); +actual = f\u02B2\u0AAA(); +expect = 84; +addThis(); + +// Test all three characters of function name - +status = inSection(5); +actual = sName[0]; +expect = sEval[9]; +addThis(); + +status = inSection(6); +actual = sName[1]; +expect = sEval[10]; +addThis(); + +status = inSection(7); +actual = sName[2]; +expect = sEval[11]; +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +/* + * Goal: test that f.toString() contains the proper function name. + * + * Note, however, f.toString() is implementation-independent. For example, + * it may begin with '\nfunction' instead of 'function'. Therefore we use + * a regexp to make sure we extract the name properly. + * + * Here we assume that f has been defined by means of a function statement, + * and not a function expression (where it wouldn't have to have a name). + * + * Rhino uses a Unicode representation for f.toString(); whereas + * SpiderMonkey uses an ASCII representation, putting escape sequences + * for non-ASCII characters. For example, if a function is called f\u02B1, + * then in Rhino the toString() method will present a 2-character Unicode + * string for its name, whereas SpiderMonkey will present a 7-character + * ASCII string for its name: the string literal 'f\u02B1'. + * + * So we force the lexer to condense the string before using it. + * This will give uniform results in Rhino and SpiderMonkey. + */ +function getFunctionName(f) +{ + var s = condenseStr(f.toString()); + var re = /\s*function\s+(\S+)\s*\(/; + var arr = s.match(re); + + if (!(arr && arr[1])) + return ERR_MALFORMED_NAME + s; + return arr[1]; +} + + +/* + * This function is the opposite of functions like escape(), which take + * Unicode characters and return escape sequences for them. Here, we force + * the lexer to turn escape sequences back into single characters. + * + * Note we can't simply do |eval(str)|, since in practice |str| will be an + * identifier somewhere in the program (e.g. a function name); thus |eval(str)| + * would return the object that the identifier represents: not what we want. + * + * So we surround |str| lexicographically with quotes to force the lexer to + * evaluate it as a string. Have to strip out any linefeeds first, however - + */ +function condenseStr(str) +{ + /* + * You won't be able to do the next step if |str| has + * any carriage returns or linefeeds in it. For example: + * + * js> eval("'" + '\nHello' + "'"); + * 1: SyntaxError: unterminated string literal: + * 1: ' + * 1: ^ + * + * So replace them with the empty string - + */ + str = str.replace(/[\r\n]/g, '') + return eval("'" + str + "'"); +} + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-85880.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-85880.js new file mode 100644 index 0000000..fea243e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-85880.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.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): pschwartau@netscape.com +* Date: 2001-06-14 +* +* SUMMARY: Regression test for Bugzilla bug 85880 +* +* Rhino interpreted mode was nulling out the arguments object of a +* function if it happened to call another function inside its body. +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=85880 +* +*/ +//------------------------------------------------------------------------------------------------- +var UBound = 0; +var bug = 85880; +var summary = 'Arguments object of g(){f()} should not be null'; +var cnNonNull = 'Arguments != null'; +var cnNull = 'Arguments == null'; +var cnRecurse = true; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +function f1(x) +{ +} + + +function f2() +{ + return f2.arguments; +} +status = 'Section A of test'; +actual = (f2() == null); +expect = false; +addThis(); + +status = 'Section B of test'; +actual = (f2(0) == null); +expect = false; +addThis(); + + +function f3() +{ + f1(); + return f3.arguments; +} +status = 'Section C of test'; +actual = (f3() == null); +expect = false; +addThis(); + +status = 'Section D of test'; +actual = (f3(0) == null); +expect = false; +addThis(); + + +function f4() +{ + f1(); + f2(); + f3(); + return f4.arguments; +} +status = 'Section E of test'; +actual = (f4() == null); +expect = false; +addThis(); + +status = 'Section F of test'; +actual = (f4(0) == null); +expect = false; +addThis(); + + +function f5() +{ + if (cnRecurse) + { + cnRecurse = false; + f5(); + } + return f5.arguments; +} +status = 'Section G of test'; +actual = (f5() == null); +expect = false; +addThis(); + +status = 'Section H of test'; +actual = (f5(0) == null); +expect = false; +addThis(); + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = isThisNull(actual); + expectedvalues[UBound] = isThisNull(expect); + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} + + +function isThisNull(bool) +{ + return bool? cnNull : cnNonNull +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-94506.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-94506.js new file mode 100644 index 0000000..de4a3a3 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-94506.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.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): deneen@alum.bucknell.edu, shaver@mozilla.org +* Date: 08 August 2001 +* +* SUMMARY: When we invoke a function, the arguments object should take +* a back seat to any local identifier named "arguments". +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=94506 +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 94506; +var summary = 'Testing functions employing identifiers named "arguments"'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var TYPE_OBJECT = typeof new Object(); +var arguments = 5555; + + +// use a parameter named "arguments" +function F1(arguments) +{ + return arguments; +} + + +// use a local variable named "arguments" +function F2() +{ + var arguments = 55; + return arguments; +} + + +// same thing in a different order. CHANGES THE RESULT! +function F3() +{ + return arguments; + var arguments = 555; +} + + +// use the global variable above named "arguments" +function F4() +{ + return arguments; +} + + + +/* + * In Sections 1 and 2, expect the local identifier, not the arguments object. + * In Sections 3 and 4, expect the arguments object, not the the identifier. + */ + +status = 'Section 1 of test'; +actual = F1(5); +expect = 5; +addThis(); + + +status = 'Section 2 of test'; +actual = F2(); +expect = 55; +addThis(); + + +status = 'Section 3 of test'; +actual = typeof F3(); +expect = TYPE_OBJECT; +addThis(); + + +status = 'Section 4 of test'; +actual = typeof F4(); +expect = TYPE_OBJECT; +addThis(); + + +// Let's try calling F1 without providing a parameter - +status = 'Section 5 of test'; +actual = F1(); +expect = undefined; +addThis(); + + +// Let's try calling F1 with too many parameters - +status = 'Section 6 of test'; +actual = F1(3,33,333); +expect = 3; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-97921.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-97921.js new file mode 100644 index 0000000..c982673 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/regress-97921.js @@ -0,0 +1,131 @@ +/* +* 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): georg@bioshop.de, pschwartau@netscape.com +* Date: 10 September 2001 +* +* SUMMARY: Testing with() statement with nested functions +* See http://bugzilla.mozilla.org/show_bug.cgi?id=97921 +* +* Brendan: "The bug is peculiar to functions that have formal parameters, +* but that are called with fewer actual arguments than the declared number +* of formal parameters." +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 97921; +var summary = 'Testing with() statement with nested functions'; +var cnYES = 'Inner value === outer value'; +var cnNO = "Inner value !== outer value!"; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var outerValue = ''; +var innerValue = ''; +var useWith = ''; + + +function F(i) +{ + i = 0; + if(useWith) with(1){i;} + i++; + + outerValue = i; // capture value of i in outer function + F1 = function() {innerValue = i;}; // capture value of i in inner function + F1(); +} + + +status = inSection(1); +useWith=false; +F(); // call F without supplying the argument +actual = innerValue === outerValue; +expect = true; +addThis(); + +status = inSection(2); +useWith=true; +F(); // call F without supplying the argument +actual = innerValue === outerValue; +expect = true; +addThis(); + + +function G(i) +{ + i = 0; + with (new Object()) {i=100}; + i++; + + outerValue = i; // capture value of i in outer function + G1 = function() {innerValue = i;}; // capture value of i in inner function + G1(); +} + + +status = inSection(3); +G(); // call G without supplying the argument +actual = innerValue === 101; +expect = true; +addThis(); + +status = inSection(4); +G(); // call G without supplying the argument +actual = innerValue === outerValue; +expect = true; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = areTheseEqual(actual); + expectedvalues[UBound] = areTheseEqual(expect); + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} + + +function areTheseEqual(yes) +{ + return yes? cnYES : cnNO +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/scope-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/scope-001.js new file mode 100644 index 0000000..9c4e8fa --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/scope-001.js @@ -0,0 +1,249 @@ +/* +* 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): pschwartau@netscape.com, rogerl@netscape.com +* Date: 28 May 2001 +* +* SUMMARY: Functions are scoped statically, not dynamically +* +* See ECMA Section 10.1.4 Scope Chain and Identifier Resolution +* (This section defines the scope chain of an execution context) +* +* See ECMA Section 12.10 The with Statement +* +* See ECMA Section 13 Function Definition +* (This section defines the scope chain of a function object as that +* of the running execution context when the function was declared) +*/ +//------------------------------------------------------------------------------------------------- +var UBound = 0; +var bug = '(none)'; +var summary = 'Testing that functions are scoped statically, not dynamically'; +var self = this; // capture a reference to the global object +var status = ''; +var statusitems = [ ]; +var actual = ''; +var actualvalues = [ ]; +var expect= ''; +var expectedvalues = [ ]; + +/* + * In this section the expected value is 1, not 2. + * + * Why? f captures its scope chain from when it's declared, and imposes that chain + * when it's executed. In other words, f's scope chain is from when it was compiled. + * Since f is a top-level function, this is the global object only. Hence 'a' resolves to 1. + */ +status = 'Section A of test'; +var a = 1; +function f() +{ + return a; +} +var obj = {a:2}; +with (obj) +{ + actual = f(); +} +expect = 1; +addThis(); + + +/* + * In this section the expected value is 2, not 1. That is because here + * f's associated scope chain now includes 'obj' before the global object. + */ +status = 'Section B of test'; +var a = 1; +var obj = {a:2}; +with (obj) +{ + function f() + { + return a; + } + actual = f(); +} +// Mozilla result, which contradicts IE and the ECMA spec: expect = 2; +expect = 1; +addThis(); + + +/* + * Like Section B , except that we call f outside the with block. + * By the principles explained above, we still expect 2 - + */ +status = 'Section C of test'; +var a = 1; +var obj = {a:2}; +with (obj) +{ + function f() + { + return a; + } +} +actual = f(); +// Mozilla result, which contradicts IE and the ECMA spec: expect = 2; +expect = 1; +addThis(); + + +/* + * Like Section C, but with one more level of indirection - + */ +status = 'Section D of test'; +var a = 1; +var obj = {a:2, obj:{a:3}}; +with (obj) +{ + with (obj) + { + function f() + { + return a; + } + } +} +actual = f(); +// Mozilla result, which contradicts IE and the ECMA spec: expect = 3; +expect = 1; +addThis(); + + +/* + * Like Section C, but here we actually delete obj before calling f. + * We still expect 2 - + */ +status = 'Section E of test'; +var a = 1; +var obj = {a:2}; +with (obj) +{ + function f() + { + return a; + } +} +delete obj; +actual = f(); +// Mozilla result, which contradicts IE and the ECMA spec: expect = 2; +expect = 1; +addThis(); + + +/* + * Like Section E. Here we redefine obj and call f under with (obj) - + * We still expect 2 - + */ +status = 'Section F of test'; +var a = 1; +var obj = {a:2}; +with (obj) +{ + function f() + { + return a; + } +} +delete obj; +var obj = {a:3}; +with (obj) +{ + actual = f(); +} +// Mozilla result, which contradicts IE and the ECMA spec: expect = 2; // NOT 3 !!! +expect = 1; +addThis(); + + +/* + * Explicitly verify that f exists at global level, even though + * it was defined under the with(obj) block - + */ +status = 'Section G of test'; +var a = 1; +var obj = {a:2}; +with (obj) +{ + function f() + { + return a; + } +} +actual = String([obj.hasOwnProperty('f'), self.hasOwnProperty('f')]); +expect = String([false, true]); +addThis(); + + +/* + * Explicitly verify that f exists at global level, even though + * it was defined under the with(obj) block - + */ +status = 'Section H of test'; +var a = 1; +var obj = {a:2}; +with (obj) +{ + function f() + { + return a; + } +} +actual = String(['f' in obj, 'f' in self]); +expect = String([false, true]); +addThis(); + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; + resetTestVars(); +} + + +function resetTestVars() +{ + delete a; + delete obj; + delete f; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/scope-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/scope-002.js new file mode 100644 index 0000000..8e4626e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Function/scope-002.js @@ -0,0 +1,224 @@ +/* +* 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): pschwartau@netscape.com, rogerl@netscape.com +* Date: 28 May 2001 +* +* SUMMARY: Functions are scoped statically, not dynamically +* +* See ECMA Section 10.1.4 Scope Chain and Identifier Resolution +* (This section defines the scope chain of an execution context) +* +* See ECMA Section 12.10 The with Statement +* +* See ECMA Section 13 Function Definition +* (This section defines the scope chain of a function object as that +* of the running execution context when the function was declared) +* +* Like scope-001.js, but using assignment var f = function expression +* instead of a function declaration: function f() {} etc. +*/ +//------------------------------------------------------------------------------------------------- +var UBound = 0; +var bug = '(none)'; +var summary = 'Testing that functions are scoped statically, not dynamically'; +var self = this; // capture a reference to the global object +var status = ''; +var statusitems = [ ]; +var actual = ''; +var actualvalues = [ ]; +var expect= ''; +var expectedvalues = [ ]; + + +/* + * In this section the expected value is 1, not 2. + * + * Why? f captures its scope chain from when it's declared, and imposes that chain + * when it's executed. In other words, f's scope chain is from when it was compiled. + * Since f is a top-level function, this is the global object only. Hence 'a' resolves to 1. + */ +status = 'Section A of test'; +var a = 1; +var f = function () {return a;}; +var obj = {a:2}; +with (obj) +{ + actual = f(); +} +expect = 1; +addThis(); + + +/* + * In this section the expected value is 2, not 1. That is because here + * f's associated scope chain now includes 'obj' before the global object. + */ +status = 'Section B of test'; +var a = 1; +var obj = {a:2}; +with (obj) +{ + var f = function () {return a;}; + actual = f(); +} +expect = 2; +addThis(); + + +/* + * Like Section B , except that we call f outside the with block. + * By the principles explained above, we still expect 2 - + */ +status = 'Section C of test'; +var a = 1; +var obj = {a:2}; +with (obj) +{ + var f = function () {return a;}; +} +actual = f(); +expect = 2; +addThis(); + + +/* + * Like Section C, but with one more level of indirection - + */ +status = 'Section D of test'; +var a = 1; +var obj = {a:2, obj:{a:3}}; +with (obj) +{ + with (obj) + { + var f = function () {return a;}; + } +} +actual = f(); +expect = 3; +addThis(); + + +/* + * Like Section C, but here we actually delete obj before calling f. + * We still expect 2 - + */ +status = 'Section E of test'; +var a = 1; +var obj = {a:2}; +with (obj) +{ + var f = function () {return a;}; +} +delete obj; +actual = f(); +expect = 2; +addThis(); + + +/* + * Like Section E. Here we redefine obj and call f under with (obj) - + * We still expect 2 - + */ +status = 'Section F of test'; +var a = 1; +var obj = {a:2}; +with (obj) +{ + var f = function () {return a;}; +} +delete obj; +var obj = {a:3}; +with (obj) +{ + actual = f(); +} +expect = 2; // NOT 3 !!! +addThis(); + + +/* + * Explicitly verify that f exists at global level, even though + * it was defined under the with(obj) block - + */ +status = 'Section G of test'; +var a = 1; +var obj = {a:2}; +with (obj) +{ + var f = function () {return a;}; +} +actual = String([obj.hasOwnProperty('f'), self.hasOwnProperty('f')]); +expect = String([false, true]); +addThis(); + + +/* + * Explicitly verify that f exists at global level, even though + * it was defined under the with(obj) block - + */ +status = 'Section H of test'; +var a = 1; +var obj = {a:2}; +with (obj) +{ + var f = function () {return a;}; +} +actual = String(['f' in obj, 'f' in self]); +expect = String([false, true]); +addThis(); + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; + resetTestVars(); +} + + +function resetTestVars() +{ + delete a; + delete obj; + delete f; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Number/15.7.4.5-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Number/15.7.4.5-1.js new file mode 100644 index 0000000..767ee6e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Number/15.7.4.5-1.js @@ -0,0 +1,124 @@ +/* +* 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 expressed +* 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): pschwartau@netscape.com +* Date: 2001-07-15 +* +* SUMMARY: Testing Number.prototype.toFixed(fractionDigits) +* See EMCA 262 Edition 3 Section 15.7.4.5 +* +* Also see http://bugzilla.mozilla.org/show_bug.cgi?id=90551 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = '(none)'; +var summary = 'Testing Number.prototype.toFixed(fractionDigits)'; +var cnIsRangeError = 'instanceof RangeError'; +var cnNotRangeError = 'NOT instanceof RangeError'; +var cnNoErrorCaught = 'NO ERROR CAUGHT...'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var testNum = 234.2040506; + + +status = 'Section A of test: no error intended!'; +actual = testNum.toFixed(4); +expect = '234.2041'; +captureThis(); + + +/////////////////////////// OOPS.... /////////////////////////////// +/************************************************************************* + * 15.7.4.5 Number.prototype.toFixed(fractionDigits) + * + * An implementation is permitted to extend the behaviour of toFixed + * for values of fractionDigits less than 0 or greater than 20. In this + * case toFixed would not necessarily throw RangeError for such values. + +status = 'Section B of test: expect RangeError because fractionDigits < 0'; +actual = catchError('testNum.toFixed(-4)'); +expect = cnIsRangeError; +captureThis(); + +status = 'Section C of test: expect RangeError because fractionDigits > 20 '; +actual = catchError('testNum.toFixed(21)'); +expect = cnIsRangeError; +captureThis(); +*************************************************************************/ + + +status = 'Section D of test: no error intended!'; +actual = 0.00001.toFixed(2); +expect = '0.00'; +captureThis(); + +status = 'Section E of test: no error intended!'; +actual = 0.000000000000000000001.toFixed(20); +expect = '0.00000000000000000000'; +captureThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + +function captureThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} + + +function catchError(sEval) +{ + try {eval(sEval);} + catch(e) {return isRangeError(e);} + return cnNoErrorCaught; +} + + +function isRangeError(obj) +{ + if (obj instanceof RangeError) + return cnIsRangeError; + return cnNotRangeError; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Number/15.7.4.6-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Number/15.7.4.6-1.js new file mode 100644 index 0000000..9a06f46 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Number/15.7.4.6-1.js @@ -0,0 +1,113 @@ +/* +* 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 expressed +* 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): pschwartau@netscape.com +* Date: 2001-07-15 +* +* SUMMARY: Testing Number.prototype.toExponential(fractionDigits) +* See EMCA 262 Edition 3 Section 15.7.4.6 +* +* Also see http://bugzilla.mozilla.org/show_bug.cgi?id=90551 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = '(none)'; +var summary = 'Testing Number.prototype.toExponential(fractionDigits)'; +var cnIsRangeError = 'instanceof RangeError'; +var cnNotRangeError = 'NOT instanceof RangeError'; +var cnNoErrorCaught = 'NO ERROR CAUGHT...'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var testNum = 77.1234; + + +status = 'Section A of test: no error intended!'; +actual = testNum.toExponential(4); +expect = '7.7123e+1'; +captureThis(); + + +/////////////////////////// OOPS.... /////////////////////////////// +/************************************************************************* + * 15.7.4.6 Number.prototype.toExponential(fractionDigits) + * + * An implementation is permitted to extend the behaviour of toExponential + * for values of fractionDigits less than 0 or greater than 20. In this + * case toExponential would not necessarily throw RangeError for such values. + +status = 'Section B of test: expect RangeError because fractionDigits < 0'; +actual = catchError('testNum.toExponential(-4)'); +expect = cnIsRangeError; +captureThis(); + +status = 'Section C of test: expect RangeError because fractionDigits > 20 '; +actual = catchError('testNum.toExponential(21)'); +expect = cnIsRangeError; +captureThis(); +*************************************************************************/ + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + +function captureThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} + + +function catchError(sEval) +{ + try {eval(sEval);} + catch(e) {return isRangeError(e);} + return cnNoErrorCaught; +} + + +function isRangeError(obj) +{ + if (obj instanceof RangeError) + return cnIsRangeError; + return cnNotRangeError; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Number/15.7.4.7-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Number/15.7.4.7-1.js new file mode 100644 index 0000000..c29c0af --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Number/15.7.4.7-1.js @@ -0,0 +1,118 @@ +/* +* 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 expressed +* 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): pschwartau@netscape.com +* Date: 2001-07-15 +* +* SUMMARY: Testing Number.prototype.toPrecision(precision) +* See EMCA 262 Edition 3 Section 15.7.4.7 +* +* Also see http://bugzilla.mozilla.org/show_bug.cgi?id=90551 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = '(none)'; +var summary = 'Testing Number.prototype.toPrecision(precision)'; +var cnIsRangeError = 'instanceof RangeError'; +var cnNotRangeError = 'NOT instanceof RangeError'; +var cnNoErrorCaught = 'NO ERROR CAUGHT...'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var testNum = 5.123456; + + +status = 'Section A of test: no error intended!'; +actual = testNum.toPrecision(4); +expect = '5.123'; +captureThis(); + + +/////////////////////////// OOPS.... /////////////////////////////// +/************************************************************************* + * 15.7.4.7 Number.prototype.toPrecision(precision) + * + * An implementation is permitted to extend the behaviour of toPrecision + * for values of precision less than 1 or greater than 21. In this + * case toPrecision would not necessarily throw RangeError for such values. + +status = 'Section B of test: expect RangeError because precision < 1'; +actual = catchError('testNum.toPrecision(0)'); +expect = cnIsRangeError; +captureThis(); + +status = 'Section C of test: expect RangeError because precision < 1'; +actual = catchError('testNum.toPrecision(-4)'); +expect = cnIsRangeError; +captureThis(); + +status = 'Section D of test: expect RangeError because precision > 21 '; +actual = catchError('testNum.toPrecision(22)'); +expect = cnIsRangeError; +captureThis(); +*************************************************************************/ + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + +function captureThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} + + +function catchError(sEval) +{ + try {eval(sEval);} + catch(e) {return isRangeError(e);} + return cnNoErrorCaught; +} + + +function isRangeError(obj) +{ + if (obj instanceof RangeError) + return cnIsRangeError; + return cnNotRangeError; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/NumberFormatting/tostring-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/NumberFormatting/tostring-001.js new file mode 100644 index 0000000..e99912d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/NumberFormatting/tostring-001.js @@ -0,0 +1,42 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * 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): + * Rob Ginda rginda@netscape.com + */ + +test(); + +function test() +{ + var n0 = 1e23; + var n1 = 5e22; + var n2 = 1.6e24; + + printStatus ("Number formatting test."); + printBugNumber ("11178"); + + reportCompare ("1e+23", n0.toString(), "1e23 toString()"); + reportCompare ("5e+22", n1.toString(), "5e22 toString()"); + reportCompare ("1.6e+24", n2.toString(), "1.6e24 toString()"); + +} + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/8.6.2.6-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/8.6.2.6-001.js new file mode 100644 index 0000000..1c7ef47 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/8.6.2.6-001.js @@ -0,0 +1,108 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 09 September 2002 +* SUMMARY: Test for TypeError on invalid default string value of object +* See ECMA reference at http://bugzilla.mozilla.org/show_bug.cgi?id=167325 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 167325; +var summary = "Test for TypeError on invalid default string value of object"; +var TEST_PASSED = 'TypeError'; +var TEST_FAILED = 'Generated an error, but NOT a TypeError!'; +var TEST_FAILED_BADLY = 'Did not generate ANY error!!!'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +status = inSection(1); +expect = TEST_PASSED; +actual = TEST_FAILED_BADLY; +/* + * This should generate a TypeError. See ECMA reference + * at http://bugzilla.mozilla.org/show_bug.cgi?id=167325 + */ +try +{ + var obj = {toString: function() {return new Object();}} + obj == 'abc'; +} +catch(e) +{ + if (e instanceof TypeError) + actual = TEST_PASSED; + else + actual = TEST_FAILED; +} +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-001.js new file mode 100644 index 0000000..6572995 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-001.js @@ -0,0 +1,128 @@ +/* +* 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 expressed +* 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): pschwartau@netscape.com +* Date: 14 Mar 2001 +* +* SUMMARY: Testing the internal [[Class]] property of objects +* See ECMA-262 Edition 3 13-Oct-1999, Section 8.6.2 +* +* The getJSClass() function we use is in a utility file, e.g. "shell.js". +*/ +//------------------------------------------------------------------------------------------------- +var i = 0; +var UBound = 0; +var bug = '(none)'; +var summary = 'Testing the internal [[Class]] property of objects'; +var statprefix = 'Current object is: '; +var status = ''; var statusList = [ ]; +var actual = ''; var actualvalue = [ ]; +var expect= ''; var expectedvalue = [ ]; + + +status = 'the global object'; +actual = getJSClass(this); +expect = 'global'; +addThis(); + +status = 'new Object()'; +actual = getJSClass(new Object()); +expect = 'Object'; +addThis(); + +status = 'new Function()'; +actual = getJSClass(new Function()); +expect = 'Function'; +addThis(); + +status = 'new Array()'; +actual = getJSClass(new Array()); +expect = 'Array'; +addThis(); + +status = 'new String()'; +actual = getJSClass(new String()); +expect = 'String'; +addThis(); + +status = 'new Boolean()'; +actual = getJSClass(new Boolean()); +expect = 'Boolean'; +addThis(); + +status = 'new Number()'; +actual = getJSClass(new Number()); +expect = 'Number'; +addThis(); + +status = 'Math'; +actual = getJSClass(Math); // can't use 'new' with the Math object (EMCA3, 15.8) +expect = 'Math'; +addThis(); + +status = 'new Date()'; +actual = getJSClass(new Date()); +expect = 'Date'; +addThis(); + +status = 'new RegExp()'; +actual = getJSClass(new RegExp()); +expect = 'RegExp'; +addThis(); + +status = 'new Error()'; +actual = getJSClass(new Error()); +expect = 'Error'; +addThis(); + + + +//--------------------------------------------------------------------------------- +test(); +//--------------------------------------------------------------------------------- + + + +function addThis() +{ + statusList[UBound] = status; + actualvalue[UBound] = actual; + expectedvalue[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (i = 0; i < UBound; i++) + { + reportCompare(expectedvalue[i], actualvalue[i], getStatus(i)); + } + + exitFunc ('test'); +} + + +function getStatus(i) +{ + return statprefix + statusList[i]; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-002.js new file mode 100644 index 0000000..bc5a7de --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-002.js @@ -0,0 +1,124 @@ +/* +* 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 expressed +* 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): pschwartau@netscape.com +* Date: 14 Mar 2001 +* +* SUMMARY: Testing the [[Class]] property of native constructors. +* See ECMA-262 Edition 3 13-Oct-1999, Section 8.6.2 re [[Class]] property. +* +* Same as class-001.js - but testing the constructors here, not object instances. +* Therefore we expect the [[Class]] property to equal 'Function' in each case. +* +* The getJSClass() function we use is in a utility file, e.g. "shell.js" +*/ +//------------------------------------------------------------------------------------------------- +var i = 0; +var UBound = 0; +var bug = '(none)'; +var summary = 'Testing the internal [[Class]] property of native constructors'; +var statprefix = 'Current constructor is: '; +var status = ''; var statusList = [ ]; +var actual = ''; var actualvalue = [ ]; +var expect= ''; var expectedvalue = [ ]; + +/* + * We set the expect variable each time only for readability. + * We expect 'Function' every time; see discussion above - + */ +status = 'Object'; +actual = getJSClass(Object); +expect = 'Function'; +addThis(); + +status = 'Function'; +actual = getJSClass(Function); +expect = 'Function'; +addThis(); + +status = 'Array'; +actual = getJSClass(Array); +expect = 'Function'; +addThis(); + +status = 'String'; +actual = getJSClass(String); +expect = 'Function'; +addThis(); + +status = 'Boolean'; +actual = getJSClass(Boolean); +expect = 'Function'; +addThis(); + +status = 'Number'; +actual = getJSClass(Number); +expect = 'Function'; +addThis(); + +status = 'Date'; +actual = getJSClass(Date); +expect = 'Function'; +addThis(); + +status = 'RegExp'; +actual = getJSClass(RegExp); +expect = 'Function'; +addThis(); + +status = 'Error'; +actual = getJSClass(Error); +expect = 'Function'; +addThis(); + + + +//--------------------------------------------------------------------------------- +test(); +//--------------------------------------------------------------------------------- + + + +function addThis() +{ + statusList[UBound] = status; + actualvalue[UBound] = actual; + expectedvalue[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (i = 0; i < UBound; i++) + { + reportCompare(expectedvalue[i], actualvalue[i], getStatus(i)); + } + + exitFunc ('test'); +} + + +function getStatus(i) +{ + return statprefix + statusList[i]; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-003.js new file mode 100644 index 0000000..012a179 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-003.js @@ -0,0 +1,118 @@ +/* +* 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 expressed +* 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): pschwartau@netscape.com +* Date: 14 Mar 2001 +* +* SUMMARY: Testing the [[Class]] property of native error types. +* See ECMA-262 Edition 3, Section 8.6.2 for the [[Class]] property. +* +* Same as class-001.js - but testing only the native error types here. +* See ECMA-262 Edition 3, Section 15.11.6 for a list of these types. +* +* ECMA expects the [[Class]] property to equal 'Error' in each case. +* See ECMA-262 Edition 3, Sections 15.11.1.1 and 15.11.7.2 for this. +* See http://bugzilla.mozilla.org/show_bug.cgi?id=56868 +* +* The getJSClass() function we use is in a utility file, e.g. "shell.js" +*/ +//------------------------------------------------------------------------------------------------- +var i = 0; +var UBound = 0; +var bug = 56868; +var summary = 'Testing the internal [[Class]] property of native error types'; +var statprefix = 'Current object is: '; +var status = ''; var statusList = [ ]; +var actual = ''; var actualvalue = [ ]; +var expect= ''; var expectedvalue = [ ]; + +/* + * We set the expect variable each time only for readability. + * We expect 'Error' every time; see discussion above - + */ +status = 'new Error()'; +actual = getJSClass(new Error()); +expect = 'Error'; +addThis(); + +status = 'new EvalError()'; +actual = getJSClass(new EvalError()); +expect = 'Error'; +addThis(); + +status = 'new RangeError()'; +actual = getJSClass(new RangeError()); +expect = 'Error'; +addThis(); + +status = 'new ReferenceError()'; +actual = getJSClass(new ReferenceError()); +expect = 'Error'; +addThis(); + +status = 'new SyntaxError()'; +actual = getJSClass(new SyntaxError()); +expect = 'Error'; +addThis(); + +status = 'new TypeError()'; +actual = getJSClass(new TypeError()); +expect = 'Error'; +addThis(); + +status = 'new URIError()'; +actual = getJSClass(new URIError()); +expect = 'Error'; +addThis(); + + + +//--------------------------------------------------------------------------------- +test(); +//--------------------------------------------------------------------------------- + + + +function addThis() +{ + statusList[UBound] = status; + actualvalue[UBound] = actual; + expectedvalue[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (i = 0; i < UBound; i++) + { + reportCompare(expectedvalue[i], actualvalue[i], getStatus(i)); + } + + exitFunc ('test'); +} + + +function getStatus(i) +{ + return statprefix + statusList[i]; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-004.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-004.js new file mode 100644 index 0000000..6c248cb --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-004.js @@ -0,0 +1,117 @@ +/* +* 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 expressed +* 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): pschwartau@netscape.com +* Date: 14 Mar 2001 +* +* SUMMARY: Testing [[Class]] property of native error constructors. +* See ECMA-262 Edition 3, Section 8.6.2 for the [[Class]] property. +* +* See ECMA-262 Edition 3, Section 15.11.6 for the native error types. +* See http://bugzilla.mozilla.org/show_bug.cgi?id=56868 +* +* Same as class-003.js - but testing the constructors here, not object instances. +* Therefore we expect the [[Class]] property to equal 'Function' in each case. +* +* The getJSClass() function we use is in a utility file, e.g. "shell.js" +*/ +//------------------------------------------------------------------------------------------------- +var i = 0; +var UBound = 0; +var bug = 56868; +var summary = 'Testing the internal [[Class]] property of native error constructors'; +var statprefix = 'Current constructor is: '; +var status = ''; var statusList = [ ]; +var actual = ''; var actualvalue = [ ]; +var expect= ''; var expectedvalue = [ ]; + +/* + * We set the expect variable each time only for readability. + * We expect 'Function' every time; see discussion above - + */ +status = 'Error'; +actual = getJSClass(Error); +expect = 'Function'; +addThis(); + +status = 'EvalError'; +actual = getJSClass(EvalError); +expect = 'Function'; +addThis(); + +status = 'RangeError'; +actual = getJSClass(RangeError); +expect = 'Function'; +addThis(); + +status = 'ReferenceError'; +actual = getJSClass(ReferenceError); +expect = 'Function'; +addThis(); + +status = 'SyntaxError'; +actual = getJSClass(SyntaxError); +expect = 'Function'; +addThis(); + +status = 'TypeError'; +actual = getJSClass(TypeError); +expect = 'Function'; +addThis(); + +status = 'URIError'; +actual = getJSClass(URIError); +expect = 'Function'; +addThis(); + + + +//--------------------------------------------------------------------------------- +test(); +//--------------------------------------------------------------------------------- + + + +function addThis() +{ + statusList[UBound] = status; + actualvalue[UBound] = actual; + expectedvalue[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (i = 0; i < UBound; i++) + { + reportCompare(expectedvalue[i], actualvalue[i], getStatus(i)); + } + + exitFunc ('test'); +} + + +function getStatus(i) +{ + return statprefix + statusList[i]; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-005.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-005.js new file mode 100644 index 0000000..dd238f9 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/class-005.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 expressed +* 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): pschwartau@netscape.com +* Date: 14 Mar 2001 +* +* SUMMARY: Testing the internal [[Class]] property of user-defined types. +* See ECMA-262 Edition 3 13-Oct-1999, Section 8.6.2 re [[Class]] property. +* +* Same as class-001.js - but testing user-defined types here, not native types. +* Therefore we expect the [[Class]] property to equal 'Object' in each case - +* +* The getJSClass() function we use is in a utility file, e.g. "shell.js" +*/ +//------------------------------------------------------------------------------------------------- +var i = 0; +var UBound = 0; +var bug = '(none)'; +var summary = 'Testing the internal [[Class]] property of user-defined types'; +var statprefix = 'Current user-defined type is: '; +var status = ''; var statusList = [ ]; +var actual = ''; var actualvalue = [ ]; +var expect= ''; var expectedvalue = [ ]; + + +Calf.prototype= new Cow(); + +/* + * We set the expect variable each time only for readability. + * We expect 'Object' every time; see discussion above - + */ +status = 'new Cow()'; +actual = getJSClass(new Cow()); +expect = 'Object'; +addThis(); + +status = 'new Calf()'; +actual = getJSClass(new Calf()); +expect = 'Object'; +addThis(); + + +//--------------------------------------------------------------------------------- +test(); +//--------------------------------------------------------------------------------- + + +function addThis() +{ + statusList[UBound] = status; + actualvalue[UBound] = actual; + expectedvalue[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (i = 0; i < UBound; i++) + { + reportCompare(expectedvalue[i], actualvalue[i], getStatus(i)); + } + + exitFunc ('test'); +} + + +function getStatus(i) +{ + return statprefix + statusList[i]; +} + + +function Cow(name) +{ + this.name=name; +} + + +function Calf(name) +{ + this.name=name; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/regress-72773.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/regress-72773.js new file mode 100644 index 0000000..de3f2fc --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/regress-72773.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 expressed +* 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): pschwartau@netscape.com +* Date: 09 May 2001 +* +* SUMMARY: Regression test: we shouldn't crash on this code +* See http://bugzilla.mozilla.org/show_bug.cgi?id=72773 +* +* See ECMA-262 Edition 3 13-Oct-1999, Section 8.6.2 re [[Class]] property. +* +* Same as class-001.js - but testing user-defined types here, not native types. +* Therefore we expect the [[Class]] property to equal 'Object' in each case - +* +* The getJSClass() function we use is in a utility file, e.g. "shell.js" +*/ +//------------------------------------------------------------------------------------------------- +var bug = 72773; +var summary = "Regression test: we shouldn't crash on this code"; +var status = ''; +var actual = ''; +var expect = ''; +var sToEval = ''; + +/* + * This code should produce an error, but not a crash. + * 'TypeError: Function.prototype.toString called on incompatible object' + */ +sToEval += 'function Cow(name){this.name = name;}' +sToEval += 'function Calf(str){this.name = str;}' +sToEval += 'Calf.prototype = Cow;' +sToEval += 'new Calf().toString();' + +status = 'Trying to catch an expected error'; +try +{ + eval(sToEval); +} +catch(e) +{ + actual = getJSClass(e); + expect = 'Error'; +} + + +//---------------------------------------------------------------------------------------------- +test(); +//---------------------------------------------------------------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + reportCompare(expect, actual, status); + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/regress-79129-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/regress-79129-001.js new file mode 100644 index 0000000..a5ff87c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/regress-79129-001.js @@ -0,0 +1,58 @@ +/* +* 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 expressed +* 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): pschwartau@netscape.com +* Date: 06 May 2001 +* +* SUMMARY: Regression test: we shouldn't crash on this code +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=79129 +*/ +//------------------------------------------------------------------------------------------------- +var bug = 79129; +var summary = "Regression test: we shouldn't crash on this code"; + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + tryThis(); + exitFunc ('test'); +} + + +function tryThis() +{ + obj={}; + obj.a = obj.b = obj.c = 1; + delete obj.a; + delete obj.b; + delete obj.c; + obj.d = obj.e = 1; + obj.a=1; + obj.b=1; + obj.c=1; + obj.d=1; + obj.e=1; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/shell.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/shell.js new file mode 100644 index 0000000..b92ffd2 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Object/shell.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.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): pschwartau@netscape.com +* Date: 14 Mar 2001 +* +* SUMMARY: Utility functions for testing objects - +* +* Suppose obj is an instance of a native type, e.g. Number. +* Then obj.toString() invokes Number.prototype.toString(). +* We would also like to access Object.prototype.toString(). +* +* The difference is this: suppose obj = new Number(7). +* Invoking Number.prototype.toString() on this just returns 7. +* Object.prototype.toString() on this returns '[object Number]'. +* +* The getJSType() function below will return '[object Number]' for us. +* The getJSClass() function returns 'Number', the [[Class]] property of obj. +* See ECMA-262 Edition 3, 13-Oct-1999, Section 8.6.2 +*/ +//------------------------------------------------------------------------------------------------- +var cnNoObject = 'Unexpected Error!!! Parameter to this function must be an object'; +var cnNoClass = 'Unexpected Error!!! Cannot find Class property'; +var cnObjectToString = Object.prototype.toString; + + +// checks that it's safe to call findType() +function getJSType(obj) +{ + if (isObject(obj)) + return findType(obj); + return cnNoObject; +} + + +// checks that it's safe to call findType() +function getJSClass(obj) +{ + if (isObject(obj)) + return findClass(findType(obj)); + return cnNoObject; +} + + +function findType(obj) +{ + return cnObjectToString.apply(obj); +} + + +// given '[object Number]', return 'Number' +function findClass(sType) +{ + var re = /^\[.*\s+(\w+)\s*\]$/; + var a = sType.match(re); + + if (a && a[1]) + return a[1]; + return cnNoClass; +} + + +function isObject(obj) +{ + return obj instanceof Object; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Operators/11.13.1-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Operators/11.13.1-001.js new file mode 100644 index 0000000..89b0c05 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Operators/11.13.1-001.js @@ -0,0 +1,147 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): brendan@mozilla.org, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 08 May 2003 +* SUMMARY: JS should evaluate RHS before binding LHS implicit variable +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=204919 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 204919; +var summary = 'JS should evaluate RHS before binding LHS implicit variable'; +var TEST_PASSED = 'ReferenceError'; +var TEST_FAILED = 'Generated an error, but NOT a ReferenceError!'; +var TEST_FAILED_BADLY = 'Did not generate ANY error!!!'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +/* + * global scope - + */ +status = inSection(1); +try +{ + x = x; + actual = TEST_FAILED_BADLY; +} +catch(e) +{ + if (e instanceof ReferenceError) + actual = TEST_PASSED; + else + actual = TEST_FAILED; +} +expect = TEST_PASSED; +addThis(); + + +/* + * function scope - + */ +status = inSection(2); +try +{ + (function() {y = y;})(); + actual = TEST_FAILED_BADLY; +} +catch(e) +{ + if (e instanceof ReferenceError) + actual = TEST_PASSED; + else + actual = TEST_FAILED; +} +expect = TEST_PASSED; +addThis(); + + +/* + * eval scope - + */ +status = inSection(3); +try +{ + eval('z = z'); + actual = TEST_FAILED_BADLY; +} +catch(e) +{ + if (e instanceof ReferenceError) + actual = TEST_PASSED; + else + actual = TEST_FAILED; +} +expect = TEST_PASSED; +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Operators/11.4.1-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Operators/11.4.1-001.js new file mode 100644 index 0000000..7edffd2 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Operators/11.4.1-001.js @@ -0,0 +1,115 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor@fastmail.fm, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 14 April 2003 +* SUMMARY: |delete x.y| should return |true| if |x| has no property |y| +* See http://bugzilla.mozilla.org/show_bug.cgi?id=201987 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 201987; +var summary = '|delete x.y| should return |true| if |x| has no property |y|'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +status = inSection(1); +var x = {}; +actual = delete x.y; +expect = true; +addThis(); + +status = inSection(2); +actual = delete {}.y; +expect = true; +addThis(); + +status = inSection(3); +actual = delete "".y; +expect = true; +addThis(); + +status = inSection(4); +actual = delete /abc/.y; +expect = true; +addThis(); + +status = inSection(5); +actual = delete (new Date()).y; +expect = true; +addThis(); + +status = inSection(6); +var x = 99; +actual = delete x.y; +expect = true; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.2-1.js new file mode 100644 index 0000000..f35c487 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.2-1.js @@ -0,0 +1,176 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): rogerl@netscape.com, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 09 July 2002 +* SUMMARY: RegExp conformance test +* +* These testcases are derived from the examples in the ECMA-262 Ed.3 spec +* scattered through section 15.10.2. +* +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = '(none)'; +var summary = 'RegExp conformance test'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +status = inSection(1); +pattern = /a|ab/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(2); +pattern = /((a)|(ab))((c)|(bc))/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc', 'a', 'a', undefined, 'bc', undefined, 'bc'); +addThis(); + +status = inSection(3); +pattern = /a[a-z]{2,4}/; +string = 'abcdefghi'; +actualmatch = string.match(pattern); +expectedmatch = Array('abcde'); +addThis(); + +status = inSection(4); +pattern = /a[a-z]{2,4}?/; +string = 'abcdefghi'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(5); +pattern = /(aa|aabaac|ba|b|c)*/; +string = 'aabaac'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaba', 'ba'); +addThis(); + +status = inSection(6); +pattern = /^(a+)\1*,\1+$/; +string = 'aaaaaaaaaa,aaaaaaaaaaaaaaa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaaaaaaaaa,aaaaaaaaaaaaaaa', 'aaaaa'); +addThis(); + +status = inSection(7); +pattern = /(z)((a+)?(b+)?(c))*/; +string = 'zaacbbbcac'; +actualmatch = string.match(pattern); +expectedmatch = Array('zaacbbbcac', 'z', 'ac', 'a', undefined, 'c'); +addThis(); + +status = inSection(8); +pattern = /(a*)*/; +string = 'b'; +actualmatch = string.match(pattern); +expectedmatch = Array('', undefined); +addThis(); + +status = inSection(9); +pattern = /(a*)b\1+/; +string = 'baaaac'; +actualmatch = string.match(pattern); +expectedmatch = Array('b', ''); +addThis(); + +status = inSection(10); +pattern = /(?=(a+))/; +string = 'baaabac'; +actualmatch = string.match(pattern); +expectedmatch = Array('', 'aaa'); +addThis(); + +status = inSection(11); +pattern = /(?=(a+))a*b\1/; +string = 'baaabac'; +actualmatch = string.match(pattern); +expectedmatch = Array('aba', 'a'); +addThis(); + +status = inSection(12); +pattern = /(.*?)a(?!(a+)b\2c)\2(.*)/; +string = 'baaabaac'; +actualmatch = string.match(pattern); +expectedmatch = Array('baaabaac', 'ba', undefined, 'abaac'); +addThis(); + +status = inSection(13); +pattern = /(?=(a+))/; +string = 'baaabac'; +actualmatch = string.match(pattern); +expectedmatch = Array('', 'aaa'); +addThis(); + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.3.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.3.1-1.js new file mode 100644 index 0000000..b12a14c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.3.1-1.js @@ -0,0 +1,115 @@ +/* +* 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): pschwartau@netscape.com +* Date: 26 November 2000 +* +* +* SUMMARY: Passing (RegExp object, flag) to RegExp() function. +* This test arose from Bugzilla bug 61266. The ECMA3 section is: +* +* 15.10.3 The RegExp Constructor Called as a Function +* +* 15.10.3.1 RegExp(pattern, flags) +* +* If pattern is an object R whose [[Class]] property is "RegExp" +* and flags is undefined, then return R unchanged. Otherwise +* call the RegExp constructor (section 15.10.4.1), passing it the +* pattern and flags arguments and return the object constructed +* by that constructor. +* +* +* The current test will check the first scenario outlined above: +* +* "pattern" is itself a RegExp object R +* "flags" is undefined +* +* The flags parameter will be undefined in the sense of not being +* provided. We check that RegExp(R) returns R - +*/ +//------------------------------------------------------------------------------------------------- +var bug = '61266'; +var summary = 'Passing (RegExp object,flag) to RegExp() function'; +var statprefix = 'RegExp(new RegExp('; +var comma = ', '; var singlequote = "'"; var closeparens = '))'; +var cnSUCCESS = 'RegExp() returned the supplied RegExp object'; +var cnFAILURE = 'RegExp() did NOT return the supplied RegExp object'; +var i = -1; var j = -1; var s = ''; var f = ''; +var obj = {}; +var status = ''; var actual = ''; var expect = ''; +var patterns = new Array(); +var flags = new Array(); + + +// various regular expressions to try - +patterns[0] = ''; +patterns[1] = 'abc'; +patterns[2] = '(.*)(3-1)\s\w'; +patterns[3] = '(.*)(...)\\s\\w'; +patterns[4] = '[^A-Za-z0-9_]'; +patterns[5] = '[^\f\n\r\t\v](123.5)([4 - 8]$)'; + +// various flags to try - +flags[0] = 'i'; +flags[1] = 'g'; +flags[2] = 'm'; +flags[3] = undefined; + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (i in patterns) + { + s = patterns[i]; + + for (j in flags) + { + f = flags[j]; + status = getStatus(s, f); + obj = new RegExp(s, f); + + actual = (obj == RegExp(obj))? cnSUCCESS : cnFAILURE; + expect = cnSUCCESS; + reportCompare (expect, actual, status); + } + } + + exitFunc ('test'); +} + + +function getStatus(regexp, flag) +{ + return (statprefix + quote(regexp) + comma + flag + closeparens); +} + + +function quote(text) +{ + return (singlequote + text + singlequote); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.3.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.3.1-2.js new file mode 100644 index 0000000..ed309b0 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.3.1-2.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.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): pschwartau@netscape.com +* Date: 26 November 2000 +* +* +* SUMMARY: Passing (RegExp object, flag) to RegExp() function. +* This test arose from Bugzilla bug 61266. The ECMA3 section is: +* +* 15.10.3 The RegExp Constructor Called as a Function +* +* 15.10.3.1 RegExp(pattern, flags) +* +* If pattern is an object R whose [[Class]] property is "RegExp" +* and flags is undefined, then return R unchanged. Otherwise +* call the RegExp constructor (section 15.10.4.1), passing it the +* pattern and flags arguments and return the object constructed +* by that constructor. +* +* +* The current test will check the first scenario outlined above: +* +* "pattern" is itself a RegExp object R +* "flags" is undefined +* +* This test is identical to test 15.10.3.1-1.js, except here we do: +* +* RegExp(R, undefined); +* +* instead of: +* +* RegExp(R); +* +* +* We check that RegExp(R, undefined) returns R - +*/ +//------------------------------------------------------------------------------------------------- +var bug = '61266'; +var summary = 'Passing (RegExp object,flag) to RegExp() function'; +var statprefix = 'RegExp(new RegExp('; +var comma = ', '; var singlequote = "'"; var closeparens = '))'; +var cnSUCCESS = 'RegExp() returned the supplied RegExp object'; +var cnFAILURE = 'RegExp() did NOT return the supplied RegExp object'; +var i = -1; var j = -1; var s = ''; var f = ''; +var obj = {}; +var status = ''; var actual = ''; var expect = ''; +var patterns = new Array(); +var flags = new Array(); + + +// various regular expressions to try - +patterns[0] = ''; +patterns[1] = 'abc'; +patterns[2] = '(.*)(3-1)\s\w'; +patterns[3] = '(.*)(...)\\s\\w'; +patterns[4] = '[^A-Za-z0-9_]'; +patterns[5] = '[^\f\n\r\t\v](123.5)([4 - 8]$)'; + +// various flags to try - +flags[0] = 'i'; +flags[1] = 'g'; +flags[2] = 'm'; +flags[3] = undefined; + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (i in patterns) + { + s = patterns[i]; + + for (j in flags) + { + f = flags[j]; + status = getStatus(s, f); + obj = new RegExp(s, f); + + actual = (obj == RegExp(obj, undefined))? cnSUCCESS : cnFAILURE ; + expect = cnSUCCESS; + reportCompare (expect, actual, status); + } + } + + exitFunc ('test'); +} + + +function getStatus(regexp, flag) +{ + return (statprefix + quote(regexp) + comma + flag + closeparens); +} + + +function quote(text) +{ + return (singlequote + text + singlequote); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-1.js new file mode 100644 index 0000000..c122abb --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-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.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): pschwartau@netscape.com +* Date: 26 November 2000 +* +* +*SUMMARY: Passing a RegExp object to a RegExp() constructor. +*This test arose from Bugzilla bug 61266. The ECMA3 section is: +* +* 15.10.4.1 new RegExp(pattern, flags) +* +* If pattern is an object R whose [[Class]] property is "RegExp" and +* flags is undefined, then let P be the pattern used to construct R +* and let F be the flags used to construct R. If pattern is an object R +* whose [[Class]] property is "RegExp" and flags is not undefined, +* then throw a TypeError exception. Otherwise, let P be the empty string +* if pattern is undefined and ToString(pattern) otherwise, and let F be +* the empty string if flags is undefined and ToString(flags) otherwise. +* +* +*The current test will check the first scenario outlined above: +* +* "pattern" is itself a RegExp object R +* "flags" is undefined +* +* We check that a new RegExp object obj2 defined from these parameters +* is morally the same as the original RegExp object obj1. Of course, they +* can't be equal as objects - so we check their enumerable properties... +* +* In this test, the initial RegExp object obj1 will not include a flag. The flags +* parameter for obj2 will be undefined in the sense of not being provided. +*/ +//------------------------------------------------------------------------------------------------- +var bug = '61266'; +var summary = 'Passing a RegExp object to a RegExp() constructor'; +var statprefix = 'Applying RegExp() twice to pattern '; +var statsuffix = '; testing property '; +var singlequote = "'"; +var i = -1; var s = ''; +var obj1 = {}; var obj2 = {}; +var status = ''; var actual = ''; var expect = ''; var msg = ''; +var patterns = new Array(); + + +// various regular expressions to try - +patterns[0] = ''; +patterns[1] = 'abc'; +patterns[2] = '(.*)(3-1)\s\w'; +patterns[3] = '(.*)(...)\\s\\w'; +patterns[4] = '[^A-Za-z0-9_]'; +patterns[5] = '[^\f\n\r\t\v](123.5)([4 - 8]$)'; + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (i in patterns) + { + s = patterns[i]; + status =getStatus(s); + obj1 = new RegExp(s); + obj2 = new RegExp(obj1); + + for (prop in obj2) + { + msg = status + quote(prop); + actual = obj2[prop]; + expect = obj1[prop]; + reportCompare (expect, actual, msg); + } + } + + exitFunc ('test'); +} + + +function getStatus(regexp) +{ + return (statprefix + quote(regexp) + statsuffix); +} + + +function quote(text) +{ + return (singlequote + text + singlequote); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-2.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-2.js new file mode 100644 index 0000000..e8613a4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-2.js @@ -0,0 +1,117 @@ +/* +* 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): pschwartau@netscape.com +* Date: 26 November 2000 +* +* +*SUMMARY: Passing a RegExp object to a RegExp() constructor. +*This test arose from Bugzilla bug 61266. The ECMA3 section is: +* +* 15.10.4.1 new RegExp(pattern, flags) +* +* If pattern is an object R whose [[Class]] property is "RegExp" and +* flags is undefined, then let P be the pattern used to construct R +* and let F be the flags used to construct R. If pattern is an object R +* whose [[Class]] property is "RegExp" and flags is not undefined, +* then throw a TypeError exception. Otherwise, let P be the empty string +* if pattern is undefined and ToString(pattern) otherwise, and let F be +* the empty string if flags is undefined and ToString(flags) otherwise. +* +* +*The current test will check the first scenario outlined above: +* +* "pattern" is itself a RegExp object R +* "flags" is undefined +* +* We check that a new RegExp object obj2 defined from these parameters +* is morally the same as the original RegExp object obj1. Of course, they +* can't be equal as objects - so we check their enumerable properties... +* +* In this test, the initial RegExp object obj1 will not include a flag. This test is +* identical to test 15.10.4.1-1.js, except that here we use this syntax: +* +* obj2 = new RegExp(obj1, undefined); +* +* instead of: +* +* obj2 = new RegExp(obj1); +*/ +//------------------------------------------------------------------------------------------------- +var bug = '61266'; +var summary = 'Passing a RegExp object to a RegExp() constructor'; +var statprefix = 'Applying RegExp() twice to pattern '; +var statsuffix = '; testing property '; +var singlequote = "'"; +var i = -1; var s = ''; +var obj1 = {}; var obj2 = {}; +var status = ''; var actual = ''; var expect = ''; var msg = ''; +var patterns = new Array(); + + +// various regular expressions to try - +patterns[0] = ''; +patterns[1] = 'abc'; +patterns[2] = '(.*)(3-1)\s\w'; +patterns[3] = '(.*)(...)\\s\\w'; +patterns[4] = '[^A-Za-z0-9_]'; +patterns[5] = '[^\f\n\r\t\v](123.5)([4 - 8]$)'; + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (i in patterns) + { + s = patterns[i]; + status =getStatus(s); + obj1 = new RegExp(s); + obj2 = new RegExp(obj1, undefined); // see introduction to bug + + for (prop in obj2) + { + msg = status + quote(prop); + actual = obj2[prop]; + expect = obj1[prop]; + reportCompare (expect, actual, msg); + } + } + + exitFunc ('test'); +} + + +function getStatus(regexp) +{ + return (statprefix + quote(regexp) + statsuffix); +} + + +function quote(text) +{ + return (singlequote + text + singlequote); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-3.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-3.js new file mode 100644 index 0000000..03c4498 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-3.js @@ -0,0 +1,124 @@ +/* +* 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): pschwartau@netscape.com +* Date: 26 November 2000 +* +* +*SUMMARY: Passing a RegExp object to a RegExp() constructor. +*This test arose from Bugzilla bug 61266. The ECMA3 section is: +* +* 15.10.4.1 new RegExp(pattern, flags) +* +* If pattern is an object R whose [[Class]] property is "RegExp" and +* flags is undefined, then let P be the pattern used to construct R +* and let F be the flags used to construct R. If pattern is an object R +* whose [[Class]] property is "RegExp" and flags is not undefined, +* then throw a TypeError exception. Otherwise, let P be the empty string +* if pattern is undefined and ToString(pattern) otherwise, and let F be +* the empty string if flags is undefined and ToString(flags) otherwise. +* +* +*The current test will check the first scenario outlined above: +* +* "pattern" is itself a RegExp object R +* "flags" is undefined +* +* We check that a new RegExp object obj2 defined from these parameters +* is morally the same as the original RegExp object obj1. Of course, they +* can't be equal as objects - so we check their enumerable properties... +* +* In this test, the initial RegExp obj1 will include a flag. The flags +* parameter for obj2 will be undefined in the sense of not being provided. +*/ +//------------------------------------------------------------------------------------------------- +var bug = '61266'; +var summary = 'Passing a RegExp object to a RegExp() constructor'; +var statprefix = 'Applying RegExp() twice to pattern '; +var statmiddle = ' and flag '; +var statsuffix = '; testing property '; +var singlequote = "'"; +var i = -1; var j = -1; var s = ''; +var obj1 = {}; var obj2 = {}; +var status = ''; var actual = ''; var expect = ''; var msg = ''; +var patterns = new Array(); +var flags = new Array(); + + +// various regular expressions to try - +patterns[0] = ''; +patterns[1] = 'abc'; +patterns[2] = '(.*)(3-1)\s\w'; +patterns[3] = '(.*)(...)\\s\\w'; +patterns[4] = '[^A-Za-z0-9_]'; +patterns[5] = '[^\f\n\r\t\v](123.5)([4 - 8]$)'; + +// various flags to try - +flags[0] = 'i'; +flags[1] = 'g'; +flags[2] = 'm'; +flags[3] = undefined; + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (i in patterns) + { + s = patterns[i]; + + for (j in flags) + { + f = flags[j]; + status = getStatus(s, f); + obj1 = new RegExp(s, f); + obj2 = new RegExp(obj1); + + for (prop in obj2) + { + msg = status + quote(prop); + actual = obj2[prop]; + expect = obj1[prop]; + reportCompare (expect, actual, msg); + } + } + } + + exitFunc ('test'); +} + + +function getStatus(regexp, flag) +{ + return (statprefix + quote(regexp) + statmiddle + flag + statsuffix); +} + + +function quote(text) +{ + return (singlequote + text + singlequote); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-4.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-4.js new file mode 100644 index 0000000..e767a69 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-4.js @@ -0,0 +1,130 @@ +/* +* 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): pschwartau@netscape.com +* Date: 26 November 2000 +* +* +*SUMMARY: Passing a RegExp object to a RegExp() constructor. +*This test arose from Bugzilla bug 61266. The ECMA3 section is: +* +* 15.10.4.1 new RegExp(pattern, flags) +* +* If pattern is an object R whose [[Class]] property is "RegExp" and +* flags is undefined, then let P be the pattern used to construct R +* and let F be the flags used to construct R. If pattern is an object R +* whose [[Class]] property is "RegExp" and flags is not undefined, +* then throw a TypeError exception. Otherwise, let P be the empty string +* if pattern is undefined and ToString(pattern) otherwise, and let F be +* the empty string if flags is undefined and ToString(flags) otherwise. +* +* +*The current test will check the first scenario outlined above: +* +* "pattern" is itself a RegExp object R +* "flags" is undefined +* +* We check that a new RegExp object obj2 defined from these parameters +* is morally the same as the original RegExp object obj1. Of course, they +* can't be equal as objects - so we check their enumerable properties... +* +* In this test, the initial RegExp object obj1 will include a flag. This test is +* identical to test 15.10.4.1-3.js, except that here we use this syntax: +* +* obj2 = new RegExp(obj1, undefined); +* +* instead of: +* +* obj2 = new RegExp(obj1); +*/ +//------------------------------------------------------------------------------------------------- +var bug = '61266'; +var summary = 'Passing a RegExp object to a RegExp() constructor'; +var statprefix = 'Applying RegExp() twice to pattern '; +var statmiddle = ' and flag '; +var statsuffix = '; testing property '; +var singlequote = "'"; +var i = -1; var j = -1; var s = ''; +var obj1 = {}; var obj2 = {}; +var status = ''; var actual = ''; var expect = ''; var msg = ''; +var patterns = new Array(); +var flags = new Array(); + + +// various regular expressions to try - +patterns[0] = ''; +patterns[1] = 'abc'; +patterns[2] = '(.*)(3-1)\s\w'; +patterns[3] = '(.*)(...)\\s\\w'; +patterns[4] = '[^A-Za-z0-9_]'; +patterns[5] = '[^\f\n\r\t\v](123.5)([4 - 8]$)'; + +// various flags to try - +flags[0] = 'i'; +flags[1] = 'g'; +flags[2] = 'm'; +flags[3] = undefined; + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (i in patterns) + { + s = patterns[i]; + + for (j in flags) + { + f = flags[j]; + status = getStatus(s, f); + obj1 = new RegExp(s, f); + obj2 = new RegExp(obj1, undefined); // see introduction to bug + + for (prop in obj2) + { + msg = status + quote(prop); + actual = obj2[prop]; + expect = obj1[prop]; + reportCompare (expect, actual, msg); + } + } + } + + exitFunc ('test'); +} + + +function getStatus(regexp, flag) +{ + return (statprefix + quote(regexp) + statmiddle + flag + statsuffix); +} + + +function quote(text) +{ + return (singlequote + text + singlequote); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-5-n.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-5-n.js new file mode 100644 index 0000000..5868e77 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.4.1-5-n.js @@ -0,0 +1,113 @@ +/* +* 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): pschwartau@netscape.com +* Date: 26 November 2000 +* +* +*SUMMARY: Passing a RegExp object to a RegExp() constructor. +*This test arose from Bugzilla bug 61266. The ECMA3 section is: +* +* 15.10.4.1 new RegExp(pattern, flags) +* +* If pattern is an object R whose [[Class]] property is "RegExp" and +* flags is undefined, then let P be the pattern used to construct R +* and let F be the flags used to construct R. If pattern is an object R +* whose [[Class]] property is "RegExp" and flags is not undefined, +* then throw a TypeError exception. Otherwise, let P be the empty string +* if pattern is undefined and ToString(pattern) otherwise, and let F be +* the empty string if flags is undefined and ToString(flags) otherwise. +* +* +*The current test will check the second scenario outlined above: +* +* "pattern" is itself a RegExp object R +* "flags" is NOT undefined +* +* This should throw an exception ... we test for this. +* +*/ +//------------------------------------------------------------------------------------------------- +var bug = '61266'; +var summary = 'Negative test: Passing (RegExp object, flag) to RegExp() constructor'; +var statprefix = 'Passing RegExp object on pattern '; +var statsuffix = '; passing flag '; +var cnFAILURE = 'Expected an exception to be thrown, but none was -'; +var singlequote = "'"; +var i = -1; var j = -1; var s = ''; var f = ''; +var obj1 = {}; var obj2 = {}; +var patterns = new Array(); +var flags = new Array(); + + +// various regular expressions to try - +patterns[0] = ''; +patterns[1] = 'abc'; +patterns[2] = '(.*)(3-1)\s\w'; +patterns[3] = '(.*)(...)\\s\\w'; +patterns[4] = '[^A-Za-z0-9_]'; +patterns[5] = '[^\f\n\r\t\v](123.5)([4 - 8]$)'; + +// various flags to try - +flags[0] = 'i'; +flags[1] = 'g'; +flags[2] = 'm'; + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (i in patterns) + { + s = patterns[i]; + + for (j in flags) + { + f = flags[j]; + printStatus(getStatus(s, f)); + obj1 = new RegExp(s, f); + obj2 = new RegExp(obj1, f); // this should cause an exception + + // WE SHOULD NEVER REACH THIS POINT - + reportFailure(cnFAILURE); + } + } + + exitFunc ('test'); +} + + +function getStatus(regexp, flag) +{ + return (statprefix + quote(regexp) + statsuffix + flag); +} + + +function quote(text) +{ + return (singlequote + text + singlequote); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.6.2-1.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.6.2-1.js new file mode 100644 index 0000000..365e32d --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.6.2-1.js @@ -0,0 +1,119 @@ +/* +* 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 expressed +* 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): pschwartau@netscape.com +* Date: 23 October 2001 +* +* SUMMARY: Testing regexps with the global flag set. +* NOT every substring fitting the given pattern will be matched. +* The parent string is CONSUMED as successive matches are found. +* +* From the ECMA-262 Final spec: +* +* 15.10.6.2 RegExp.prototype.exec(string) +* Performs a regular expression match of string against the regular +* expression and returns an Array object containing the results of +* the match, or null if the string did not match. +* +* The string ToString(string) is searched for an occurrence of the +* regular expression pattern as follows: +* +* 1. Let S be the value of ToString(string). +* 2. Let length be the length of S. +* 3. Let lastIndex be the value of the lastIndex property. +* 4. Let i be the value of ToInteger(lastIndex). +* 5. If the global property is false, let i = 0. +* 6. If i < 0 or i > length then set lastIndex to 0 and return null. +* 7. Call [[Match]], giving it the arguments S and i. +* If [[Match]] returned failure, go to step 8; +* otherwise let r be its State result and go to step 10. +* 8. Let i = i+1. +* 9. Go to step 6. +* 10. Let e be r's endIndex value. +* 11. If the global property is true, set lastIndex to e. +* +* etc. +* +* +* So when the global flag is set, |lastIndex| is incremented every time +* there is a match; not from i to i+1, but from i to "endIndex" e: +* +* e = (index of last input character matched so far by the pattern) + 1 +* +* Thus in the example below, the first endIndex e occurs after the +* first match 'a b'. The next match will begin AFTER this, and so +* will NOT be 'b c', but rather 'c d'. Similarly, 'd e' won't be matched. +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = '(none)'; +var summary = 'Testing regexps with the global flag set'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +status = inSection(1); +string = 'a b c d e'; +pattern = /\w\s\w/g; +actualmatch = string.match(pattern); +expectedmatch = ['a b','c d']; // see above explanation - +addThis(); + + +status = inSection(2); +string = '12345678'; +pattern = /\d\d\d/g; +actualmatch = string.match(pattern); +expectedmatch = ['123','456']; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.6.2-2.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.6.2-2.js new file mode 100644 index 0000000..cce4c2c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/15.10.6.2-2.js @@ -0,0 +1,362 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 18 Feb 2002 +* SUMMARY: Testing re.exec(str) when re.lastIndex is < 0 or > str.length +* +* Case 1: If re has the global flag set, then re(str) should be null +* Case 2: If re doesn't have this set, then re(str) should be unaffected +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=76717 +* +* +* From the ECMA-262 Final spec: +* +* 15.10.6.2 RegExp.prototype.exec(string) +* Performs a regular expression match of string against the regular +* expression and returns an Array object containing the results of +* the match, or null if the string did not match. +* +* The string ToString(string) is searched for an occurrence of the +* regular expression pattern as follows: +* +* 1. Let S be the value of ToString(string). +* 2. Let length be the length of S. +* 3. Let lastIndex be the value of the lastIndex property. +* 4. Let i be the value of ToInteger(lastIndex). +* 5. If the global property is false, let i = 0. +* 6. If i < 0 or i > length then set lastIndex to 0 and return null. +* 7. Call [[Match]], giving it the arguments S and i. +* If [[Match]] returned failure, go to step 8; +* otherwise let r be its State result and go to step 10. +* 8. Let i = i+1. +* 9. Go to step 6. +* 10. Let e be r's endIndex value. +* 11. If the global property is true, set lastIndex to e. +* +* etc. +* +* +* So: +* +* A. If the global flag is not set, |lastIndex| is set to 0 +* before the match is attempted; thus the match is unaffected. +* +* B. If the global flag IS set and re.lastIndex is >= 0 and <= str.length, +* |lastIndex| is incremented every time there is a match; not from +* i to i+1, but from i to "endIndex" e: +* +* e = (index of last input character matched so far by the pattern) + 1 +* +* The match is then attempted from this position in the string (Step 7). +* +* C. When the global flag IS set and re.lastIndex is < 0 or > str.length, +* |lastIndex| is set to 0 and the match returns null. +* +* +* Note the |lastIndex| property is writeable, and may be set arbitrarily +* by the programmer - and we will do that below. +* +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 76717; +var summary = 'Testing re.exec(str) when re.lastIndex is < 0 or > str.length'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +/****************************************************************************** + * + * Case 1 : when the global flag is set - + * + *****************************************************************************/ +pattern = /abc/gi; +string = 'AbcaBcabC'; + + status = inSection(1); + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc'); + addThis(); + + status = inSection(2); + actualmatch = pattern.exec(string); + expectedmatch = Array('aBc'); + addThis(); + + status = inSection(3); + actualmatch = pattern.exec(string); + expectedmatch = Array('abC'); + addThis(); + + /* + * At this point |lastIndex| is > string.length, so the match should be null - + */ + status = inSection(4); + actualmatch = pattern.exec(string); + expectedmatch = null; + addThis(); + + /* + * Now let's set |lastIndex| to -1, so the match should again be null - + */ + status = inSection(5); + pattern.lastIndex = -1; + actualmatch = pattern.exec(string); + expectedmatch = null; + addThis(); + + /* + * Now try some edge-case values. Thanks to the work done in + * http://bugzilla.mozilla.org/show_bug.cgi?id=124339, |lastIndex| + * is now stored as a double instead of a uint32 (unsigned integer). + * + * Note 2^32 -1 is the upper bound for uint32's, but doubles can go + * all the way up to Number.MAX_VALUE. So that's why we need cases + * between those two numbers. + */ + status = inSection(6); + pattern.lastIndex = Math.pow(2,32); + actualmatch = pattern.exec(string); + expectedmatch = null; + addThis(); + + status = inSection(7); + pattern.lastIndex = -Math.pow(2,32); + actualmatch = pattern.exec(string); + expectedmatch = null; + addThis(); + + status = inSection(8); + pattern.lastIndex = Math.pow(2,32) + 1; + actualmatch = pattern.exec(string); + expectedmatch = null; + addThis(); + + status = inSection(9); + pattern.lastIndex = -(Math.pow(2,32) + 1); + actualmatch = pattern.exec(string); + expectedmatch = null; + addThis(); + + status = inSection(10); + pattern.lastIndex = Math.pow(2,32) * 2; + actualmatch = pattern.exec(string); + expectedmatch = null; + addThis(); + + status = inSection(11); + pattern.lastIndex = -Math.pow(2,32) * 2; + actualmatch = pattern.exec(string); + expectedmatch = null; + addThis(); + + status = inSection(12); + pattern.lastIndex = Math.pow(2,40); + actualmatch = pattern.exec(string); + expectedmatch = null; + addThis(); + + status = inSection(13); + pattern.lastIndex = -Math.pow(2,40); + actualmatch = pattern.exec(string); + expectedmatch = null; + addThis(); + + status = inSection(14); + pattern.lastIndex = Number.MAX_VALUE; + actualmatch = pattern.exec(string); + expectedmatch = null; + addThis(); + + status = inSection(15); + pattern.lastIndex = -Number.MAX_VALUE; + actualmatch = pattern.exec(string); + expectedmatch = null; + addThis(); + + + +/****************************************************************************** + * + * Case 2: repeat all the above cases WITHOUT the global flag set. + * According to EMCA. |lastIndex| should get set to 0 before the match. + * + * Therefore re.exec(str) should be unaffected; thus our expected values + * below are now DIFFERENT when |lastIndex| is < 0 or > str.length + * + *****************************************************************************/ + +pattern = /abc/i; +string = 'AbcaBcabC'; + + status = inSection(16); + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc'); + addThis(); + + status = inSection(17); + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc'); // NOT Array('aBc') as before - + addThis(); + + status = inSection(18); + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc'); // NOT Array('abC') as before - + addThis(); + + /* + * At this point above, |lastIndex| WAS > string.length, but not here - + */ + status = inSection(19); + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc') // NOT null as before - + addThis(); + + /* + * Now let's set |lastIndex| to -1 + */ + status = inSection(20); + pattern.lastIndex = -1; + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc') // NOT null as before - + addThis(); + + /* + * Now try some edge-case values. Thanks to the work done in + * http://bugzilla.mozilla.org/show_bug.cgi?id=124339, |lastIndex| + * is now stored as a double instead of a uint32 (unsigned integer). + * + * Note 2^32 -1 is the upper bound for uint32's, but doubles can go + * all the way up to Number.MAX_VALUE. So that's why we need cases + * between those two numbers. + */ + status = inSection(21); + pattern.lastIndex = Math.pow(2,32); + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc') // NOT null as before - + addThis(); + + status = inSection(22); + pattern.lastIndex = -Math.pow(2,32); + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc') // NOT null as before - + addThis(); + + status = inSection(23); + pattern.lastIndex = Math.pow(2,32) + 1; + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc') // NOT null as before - + addThis(); + + status = inSection(24); + pattern.lastIndex = -(Math.pow(2,32) + 1); + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc') // NOT null as before - + addThis(); + + status = inSection(25); + pattern.lastIndex = Math.pow(2,32) * 2; + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc') // NOT null as before - + addThis(); + + status = inSection(26); + pattern.lastIndex = -Math.pow(2,32) * 2; + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc') // NOT null as before - + addThis(); + + status = inSection(27); + pattern.lastIndex = Math.pow(2,40); + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc') // NOT null as before -; + addThis(); + + status = inSection(28); + pattern.lastIndex = -Math.pow(2,40); + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc') // NOT null as before - + addThis(); + + status = inSection(29); + pattern.lastIndex = Number.MAX_VALUE; + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc') // NOT null as before - + addThis(); + + status = inSection(30); + pattern.lastIndex = -Number.MAX_VALUE; + actualmatch = pattern.exec(string); + expectedmatch = Array('Abc') // NOT null as before - + addThis(); + + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/octal-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/octal-001.js new file mode 100644 index 0000000..34b3e34 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/octal-001.js @@ -0,0 +1,131 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 18 July 2002 +* SUMMARY: Testing octal sequences in regexps +* See http://bugzilla.mozilla.org/show_bug.cgi?id=141078 +* +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 141078; +var summary = 'Testing octal sequences in regexps'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +status = inSection(1); +pattern = /\240/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +/* + * In the following sections, we test the octal escape sequence '\052'. + * This is character code 42, representing the asterisk character '*'. + * The Unicode escape for it would be '\u002A', the hex escape '\x2A'. + */ +status = inSection(2); +pattern = /ab\052c/; +string = 'ab*c'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab*c'); +addThis(); + +status = inSection(3); +pattern = /ab\052*c/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(4); +pattern = /ab(\052)+c/; +string = 'ab****c'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab****c', '*'); +addThis(); + +status = inSection(5); +pattern = /ab((\052)+)c/; +string = 'ab****c'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab****c', '****', '*'); +addThis(); + +status = inSection(6); +pattern = /(?:\052)c/; +string = 'ab****c'; +actualmatch = string.match(pattern); +expectedmatch = Array('*c'); +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/octal-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/octal-002.js new file mode 100644 index 0000000..6d75e48 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/octal-002.js @@ -0,0 +1,213 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 31 July 2002 +* SUMMARY: Testing regexps containing octal escape sequences +* This is an elaboration of mozilla/js/tests/ecma_2/RegExp/octal-003.js +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=141078 +* for a reference on octal escape sequences in regexps. +* +* NOTE: +* We will use the identities '\011' === '\u0009' === '\x09' === '\t' +* +* The first is an octal escape sequence (\(0-3)OO; O an octal digit). +* See ECMA-262 Edition 2, Section 7.7.4 "String Literals". These were +* dropped in Edition 3 but we support them for backward compatibility. +* +* The second is a Unicode escape sequence (\uHHHH; H a hex digit). +* Since octal 11 = hex 9, the two escapes define the same character. +* +* The third is a hex escape sequence (\xHH; H a hex digit). +* Since hex 09 = hex 0009, this defines the same character. +* +* The fourth is the familiar escape sequence for a horizontal tab, +* defined in the ECMA spec as having Unicode value \u0009. +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 141078; +var summary = 'Testing regexps containing octal escape sequences'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +/* + * Test a string containing the null character '\0' followed by the string '11' + * + * 'a' + String.fromCharCode(0) + '11'; + * + * Note we can't simply write 'a\011', because '\011' would be interpreted + * as the octal escape sequence for the tab character (see above). + * + * We should get no match from the regexp /.\011/, because it should be + * looking for the octal escape sequence \011, i.e. the tab character - + * + */ +status = inSection(1); +pattern = /.\011/; +string = 'a' + String.fromCharCode(0) + '11'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + + +/* + * Try same thing with 'xx' in place of '11'. + * + * Should get a match now, because the octal escape sequence in the regexp + * has been reduced from \011 to \0, and '\0' is present in the string - + */ +status = inSection(2); +pattern = /.\0xx/; +string = 'a' + String.fromCharCode(0) + 'xx'; +actualmatch = string.match(pattern); +expectedmatch = Array(string); +addThis(); + + +/* + * Same thing; don't use |String.fromCharCode(0)| this time. + * There is no ambiguity in '\0xx': it is the null character + * followed by two x's, no other interpretation is possible. + */ +status = inSection(3); +pattern = /.\0xx/; +string = 'a\0xx'; +actualmatch = string.match(pattern); +expectedmatch = Array(string); +addThis(); + + +/* + * This one should produce a match. The two-character string + * 'a' + '\011' is duplicated in the pattern and test string: + */ +status = inSection(4); +pattern = /.\011/; +string = 'a\011'; +actualmatch = string.match(pattern); +expectedmatch = Array(string); +addThis(); + + +/* + * Same as above, only now, for the second character of the string, + * use the Unicode escape '\u0009' instead of the octal escape '\011' + */ +status = inSection(5); +pattern = /.\011/; +string = 'a\u0009'; +actualmatch = string.match(pattern); +expectedmatch = Array(string); +addThis(); + + +/* + * Same as above, only now for the second character of the string, + * use the hex escape '\x09' instead of the octal escape '\011' + */ +status = inSection(6); +pattern = /.\011/; +string = 'a\x09'; +actualmatch = string.match(pattern); +expectedmatch = Array(string); +addThis(); + + +/* + * Same as above, only now for the second character of the string, + * use the escape '\t' instead of the octal escape '\011' + */ +status = inSection(7); +pattern = /.\011/; +string = 'a\t'; +actualmatch = string.match(pattern); +expectedmatch = Array(string); +addThis(); + + +/* + * Return to the string from Section 1. + * + * Unlike Section 1, use the RegExp() function to create the + * regexp pattern: null character followed by the string '11'. + * + * Since this is exactly what the string is, we should get a match - + */ +status = inSection(8); +string = 'a' + String.fromCharCode(0) + '11'; +pattern = RegExp(string); +actualmatch = string.match(pattern); +expectedmatch = Array(string); +addThis(); + + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/perlstress-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/perlstress-001.js new file mode 100644 index 0000000..fd544c2 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/perlstress-001.js @@ -0,0 +1,3225 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com, rogerl@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 2002-07-07 +* SUMMARY: Testing JS RegExp engine against Perl 5 RegExp engine. +* Adjust cnLBOUND, cnUBOUND below to restrict which sections are tested. +* +* This test was created by running various patterns and strings through the +* Perl 5 RegExp engine. We saved the results below to test the JS engine. +* +* NOTE: ECMA/JS and Perl do differ on certain points. We have either commented +* out such sections altogether, or modified them to fit what we expect from JS. +* +* EXAMPLES: +* +* - In JS, regexp captures (/(a) etc./) must hold |undefined| if not used. +* See http://bugzilla.mozilla.org/show_bug.cgi?id=123437. +* By contrast, in Perl, unmatched captures hold the empty string. +* We have modified such sections accordingly. Example: + + pattern = /^([^a-z])|(\^)$/; + string = '.'; + actualmatch = string.match(pattern); + //expectedmatch = Array('.', '.', ''); <<<--- Perl + expectedmatch = Array('.', '.', undefined); <<<--- JS + addThis(); + + +* - In JS, you can't refer to a capture before it's encountered & completed +* +* - Perl supports ] & ^] inside a [], ECMA does not +* +* - ECMA does support (?: (?= and (?! operators, but doesn't support (?< etc. +* +* - ECMA doesn't support (?imsx or (?-imsx +* +* - ECMA doesn't support (?(condition) +* +* - Perl has \Z has end-of-line, ECMA doesn't +* +* - In ECMA, ^ matches only the empty string before the first character +* +* - In ECMA, $ matches only the empty string at end of input (unless multiline) +* +* - ECMA spec says that each atom in a range must be a single character +* +* - ECMA doesn't support \A +* +* - ECMA doesn't have rules for [: +* +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 85721; +var summary = 'Testing regular expression edge cases'; +var cnSingleSpace = ' '; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); +var cnLBOUND = 1; +var cnUBOUND = 1000; + + +status = inSection(1); +pattern = /abc/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(2); +pattern = /abc/; +string = 'xabcy'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(3); +pattern = /abc/; +string = 'ababc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(4); +pattern = /ab*c/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(5); +pattern = /ab*bc/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(6); +pattern = /ab*bc/; +string = 'abbc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abbc'); +addThis(); + +status = inSection(7); +pattern = /ab*bc/; +string = 'abbbbc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abbbbc'); +addThis(); + +status = inSection(8); +pattern = /.{1}/; +string = 'abbbbc'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(9); +pattern = /.{3,4}/; +string = 'abbbbc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abbb'); +addThis(); + +status = inSection(10); +pattern = /ab{0,}bc/; +string = 'abbbbc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abbbbc'); +addThis(); + +status = inSection(11); +pattern = /ab+bc/; +string = 'abbc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abbc'); +addThis(); + +status = inSection(12); +pattern = /ab+bc/; +string = 'abbbbc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abbbbc'); +addThis(); + +status = inSection(13); +pattern = /ab{1,}bc/; +string = 'abbbbc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abbbbc'); +addThis(); + +status = inSection(14); +pattern = /ab{1,3}bc/; +string = 'abbbbc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abbbbc'); +addThis(); + +status = inSection(15); +pattern = /ab{3,4}bc/; +string = 'abbbbc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abbbbc'); +addThis(); + +status = inSection(16); +pattern = /ab?bc/; +string = 'abbc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abbc'); +addThis(); + +status = inSection(17); +pattern = /ab?bc/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(18); +pattern = /ab{0,1}bc/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(19); +pattern = /ab?c/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(20); +pattern = /ab{0,1}c/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(21); +pattern = /^abc$/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(22); +pattern = /^abc/; +string = 'abcc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(23); +pattern = /abc$/; +string = 'aabc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(24); +pattern = /^/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +status = inSection(25); +pattern = /$/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +status = inSection(26); +pattern = /a.c/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(27); +pattern = /a.c/; +string = 'axc'; +actualmatch = string.match(pattern); +expectedmatch = Array('axc'); +addThis(); + +status = inSection(28); +pattern = /a.*c/; +string = 'axyzc'; +actualmatch = string.match(pattern); +expectedmatch = Array('axyzc'); +addThis(); + +status = inSection(29); +pattern = /a[bc]d/; +string = 'abd'; +actualmatch = string.match(pattern); +expectedmatch = Array('abd'); +addThis(); + +status = inSection(30); +pattern = /a[b-d]e/; +string = 'ace'; +actualmatch = string.match(pattern); +expectedmatch = Array('ace'); +addThis(); + +status = inSection(31); +pattern = /a[b-d]/; +string = 'aac'; +actualmatch = string.match(pattern); +expectedmatch = Array('ac'); +addThis(); + +status = inSection(32); +pattern = /a[-b]/; +string = 'a-'; +actualmatch = string.match(pattern); +expectedmatch = Array('a-'); +addThis(); + +status = inSection(33); +pattern = /a[b-]/; +string = 'a-'; +actualmatch = string.match(pattern); +expectedmatch = Array('a-'); +addThis(); + +status = inSection(34); +pattern = /a]/; +string = 'a]'; +actualmatch = string.match(pattern); +expectedmatch = Array('a]'); +addThis(); + +/* Perl supports ] & ^] inside a [], ECMA does not +pattern = /a[]]b/; +status = inSection(35); +string = 'a]b'; +actualmatch = string.match(pattern); +expectedmatch = Array('a]b'); +addThis(); +*/ + +status = inSection(36); +pattern = /a[^bc]d/; +string = 'aed'; +actualmatch = string.match(pattern); +expectedmatch = Array('aed'); +addThis(); + +status = inSection(37); +pattern = /a[^-b]c/; +string = 'adc'; +actualmatch = string.match(pattern); +expectedmatch = Array('adc'); +addThis(); + +/* Perl supports ] & ^] inside a [], ECMA does not +status = inSection(38); +pattern = /a[^]b]c/; +string = 'adc'; +actualmatch = string.match(pattern); +expectedmatch = Array('adc'); +addThis(); +*/ + +status = inSection(39); +pattern = /\ba\b/; +string = 'a-'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(40); +pattern = /\ba\b/; +string = '-a'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(41); +pattern = /\ba\b/; +string = '-a-'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(42); +pattern = /\By\b/; +string = 'xy'; +actualmatch = string.match(pattern); +expectedmatch = Array('y'); +addThis(); + +status = inSection(43); +pattern = /\by\B/; +string = 'yz'; +actualmatch = string.match(pattern); +expectedmatch = Array('y'); +addThis(); + +status = inSection(44); +pattern = /\By\B/; +string = 'xyz'; +actualmatch = string.match(pattern); +expectedmatch = Array('y'); +addThis(); + +status = inSection(45); +pattern = /\w/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(46); +pattern = /\W/; +string = '-'; +actualmatch = string.match(pattern); +expectedmatch = Array('-'); +addThis(); + +status = inSection(47); +pattern = /a\Sb/; +string = 'a-b'; +actualmatch = string.match(pattern); +expectedmatch = Array('a-b'); +addThis(); + +status = inSection(48); +pattern = /\d/; +string = '1'; +actualmatch = string.match(pattern); +expectedmatch = Array('1'); +addThis(); + +status = inSection(49); +pattern = /\D/; +string = '-'; +actualmatch = string.match(pattern); +expectedmatch = Array('-'); +addThis(); + +status = inSection(50); +pattern = /[\w]/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(51); +pattern = /[\W]/; +string = '-'; +actualmatch = string.match(pattern); +expectedmatch = Array('-'); +addThis(); + +status = inSection(52); +pattern = /a[\S]b/; +string = 'a-b'; +actualmatch = string.match(pattern); +expectedmatch = Array('a-b'); +addThis(); + +status = inSection(53); +pattern = /[\d]/; +string = '1'; +actualmatch = string.match(pattern); +expectedmatch = Array('1'); +addThis(); + +status = inSection(54); +pattern = /[\D]/; +string = '-'; +actualmatch = string.match(pattern); +expectedmatch = Array('-'); +addThis(); + +status = inSection(55); +pattern = /ab|cd/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); + +status = inSection(56); +pattern = /ab|cd/; +string = 'abcd'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); + +status = inSection(57); +pattern = /()ef/; +string = 'def'; +actualmatch = string.match(pattern); +expectedmatch = Array('ef', ''); +addThis(); + +status = inSection(58); +pattern = /a\(b/; +string = 'a(b'; +actualmatch = string.match(pattern); +expectedmatch = Array('a(b'); +addThis(); + +status = inSection(59); +pattern = /a\(*b/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); + +status = inSection(60); +pattern = /a\(*b/; +string = 'a((b'; +actualmatch = string.match(pattern); +expectedmatch = Array('a((b'); +addThis(); + +status = inSection(61); +pattern = /a\\b/; +string = 'a\\b'; +actualmatch = string.match(pattern); +expectedmatch = Array('a\\b'); +addThis(); + +status = inSection(62); +pattern = /((a))/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('a', 'a', 'a'); +addThis(); + +status = inSection(63); +pattern = /(a)b(c)/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc', 'a', 'c'); +addThis(); + +status = inSection(64); +pattern = /a+b+c/; +string = 'aabbabc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(65); +pattern = /a{1,}b{1,}c/; +string = 'aabbabc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(66); +pattern = /a.+?c/; +string = 'abcabc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); + +status = inSection(67); +pattern = /(a+|b)*/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab', 'b'); +addThis(); + +status = inSection(68); +pattern = /(a+|b){0,}/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab', 'b'); +addThis(); + +status = inSection(69); +pattern = /(a+|b)+/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab', 'b'); +addThis(); + +status = inSection(70); +pattern = /(a+|b){1,}/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab', 'b'); +addThis(); + +status = inSection(71); +pattern = /(a+|b)?/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('a', 'a'); +addThis(); + +status = inSection(72); +pattern = /(a+|b){0,1}/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('a', 'a'); +addThis(); + +status = inSection(73); +pattern = /[^ab]*/; +string = 'cde'; +actualmatch = string.match(pattern); +expectedmatch = Array('cde'); +addThis(); + +status = inSection(74); +pattern = /([abc])*d/; +string = 'abbbcd'; +actualmatch = string.match(pattern); +expectedmatch = Array('abbbcd', 'c'); +addThis(); + +status = inSection(75); +pattern = /([abc])*bcd/; +string = 'abcd'; +actualmatch = string.match(pattern); +expectedmatch = Array('abcd', 'a'); +addThis(); + +status = inSection(76); +pattern = /a|b|c|d|e/; +string = 'e'; +actualmatch = string.match(pattern); +expectedmatch = Array('e'); +addThis(); + +status = inSection(77); +pattern = /(a|b|c|d|e)f/; +string = 'ef'; +actualmatch = string.match(pattern); +expectedmatch = Array('ef', 'e'); +addThis(); + +status = inSection(78); +pattern = /abcd*efg/; +string = 'abcdefg'; +actualmatch = string.match(pattern); +expectedmatch = Array('abcdefg'); +addThis(); + +status = inSection(79); +pattern = /ab*/; +string = 'xabyabbbz'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); + +status = inSection(80); +pattern = /ab*/; +string = 'xayabbbz'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(81); +pattern = /(ab|cd)e/; +string = 'abcde'; +actualmatch = string.match(pattern); +expectedmatch = Array('cde', 'cd'); +addThis(); + +status = inSection(82); +pattern = /[abhgefdc]ij/; +string = 'hij'; +actualmatch = string.match(pattern); +expectedmatch = Array('hij'); +addThis(); + +status = inSection(83); +pattern = /(abc|)ef/; +string = 'abcdef'; +actualmatch = string.match(pattern); +expectedmatch = Array('ef', ''); +addThis(); + +status = inSection(84); +pattern = /(a|b)c*d/; +string = 'abcd'; +actualmatch = string.match(pattern); +expectedmatch = Array('bcd', 'b'); +addThis(); + +status = inSection(85); +pattern = /(ab|ab*)bc/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc', 'a'); +addThis(); + +status = inSection(86); +pattern = /a([bc]*)c*/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc', 'bc'); +addThis(); + +status = inSection(87); +pattern = /a([bc]*)(c*d)/; +string = 'abcd'; +actualmatch = string.match(pattern); +expectedmatch = Array('abcd', 'bc', 'd'); +addThis(); + +status = inSection(88); +pattern = /a([bc]+)(c*d)/; +string = 'abcd'; +actualmatch = string.match(pattern); +expectedmatch = Array('abcd', 'bc', 'd'); +addThis(); + +status = inSection(89); +pattern = /a([bc]*)(c+d)/; +string = 'abcd'; +actualmatch = string.match(pattern); +expectedmatch = Array('abcd', 'b', 'cd'); +addThis(); + +status = inSection(90); +pattern = /a[bcd]*dcdcde/; +string = 'adcdcde'; +actualmatch = string.match(pattern); +expectedmatch = Array('adcdcde'); +addThis(); + +status = inSection(91); +pattern = /(ab|a)b*c/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc', 'ab'); +addThis(); + +status = inSection(92); +pattern = /((a)(b)c)(d)/; +string = 'abcd'; +actualmatch = string.match(pattern); +expectedmatch = Array('abcd', 'abc', 'a', 'b', 'd'); +addThis(); + +status = inSection(93); +pattern = /[a-zA-Z_][a-zA-Z0-9_]*/; +string = 'alpha'; +actualmatch = string.match(pattern); +expectedmatch = Array('alpha'); +addThis(); + +status = inSection(94); +pattern = /^a(bc+|b[eh])g|.h$/; +string = 'abh'; +actualmatch = string.match(pattern); +expectedmatch = Array('bh', undefined); +addThis(); + +status = inSection(95); +pattern = /(bc+d$|ef*g.|h?i(j|k))/; +string = 'effgz'; +actualmatch = string.match(pattern); +expectedmatch = Array('effgz', 'effgz', undefined); +addThis(); + +status = inSection(96); +pattern = /(bc+d$|ef*g.|h?i(j|k))/; +string = 'ij'; +actualmatch = string.match(pattern); +expectedmatch = Array('ij', 'ij', 'j'); +addThis(); + +status = inSection(97); +pattern = /(bc+d$|ef*g.|h?i(j|k))/; +string = 'reffgz'; +actualmatch = string.match(pattern); +expectedmatch = Array('effgz', 'effgz', undefined); +addThis(); + +status = inSection(98); +pattern = /((((((((((a))))))))))/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = Array('a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a'); +addThis(); + +status = inSection(99); +pattern = /((((((((((a))))))))))\10/; +string = 'aa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aa', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a'); +addThis(); + +status = inSection(100); +pattern = /((((((((((a))))))))))/; +string = 'a!'; +actualmatch = string.match(pattern); +expectedmatch = Array('a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a'); +addThis(); + +status = inSection(101); +pattern = /(((((((((a)))))))))/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = Array('a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a'); +addThis(); + +status = inSection(102); +pattern = /(.*)c(.*)/; +string = 'abcde'; +actualmatch = string.match(pattern); +expectedmatch = Array('abcde', 'ab', 'de'); +addThis(); + +status = inSection(103); +pattern = /abcd/; +string = 'abcd'; +actualmatch = string.match(pattern); +expectedmatch = Array('abcd'); +addThis(); + +status = inSection(104); +pattern = /a(bc)d/; +string = 'abcd'; +actualmatch = string.match(pattern); +expectedmatch = Array('abcd', 'bc'); +addThis(); + +status = inSection(105); +pattern = /a[-]?c/; +string = 'ac'; +actualmatch = string.match(pattern); +expectedmatch = Array('ac'); +addThis(); + +status = inSection(106); +pattern = /(abc)\1/; +string = 'abcabc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abcabc', 'abc'); +addThis(); + +status = inSection(107); +pattern = /([a-c]*)\1/; +string = 'abcabc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abcabc', 'abc'); +addThis(); + +status = inSection(108); +pattern = /(a)|\1/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = Array('a', 'a'); +addThis(); + +status = inSection(109); +pattern = /(([a-c])b*?\2)*/; +string = 'ababbbcbc'; +actualmatch = string.match(pattern); +expectedmatch = Array('ababb', 'bb', 'b'); +addThis(); + +status = inSection(110); +pattern = /(([a-c])b*?\2){3}/; +string = 'ababbbcbc'; +actualmatch = string.match(pattern); +expectedmatch = Array('ababbbcbc', 'cbc', 'c'); +addThis(); + +/* Can't refer to a capture before it's encountered & completed +status = inSection(111); +pattern = /((\3|b)\2(a)x)+/; +string = 'aaaxabaxbaaxbbax'; +actualmatch = string.match(pattern); +expectedmatch = Array('bbax', 'bbax', 'b', 'a'); +addThis(); + +status = inSection(112); +pattern = /((\3|b)\2(a)){2,}/; +string = 'bbaababbabaaaaabbaaaabba'; +actualmatch = string.match(pattern); +expectedmatch = Array('bbaaaabba', 'bba', 'b', 'a'); +addThis(); +*/ + +status = inSection(113); +pattern = /abc/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(114); +pattern = /abc/i; +string = 'XABCY'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(115); +pattern = /abc/i; +string = 'ABABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(116); +pattern = /ab*c/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(117); +pattern = /ab*bc/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(118); +pattern = /ab*bc/i; +string = 'ABBC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABBC'); +addThis(); + +status = inSection(119); +pattern = /ab*?bc/i; +string = 'ABBBBC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABBBBC'); +addThis(); + +status = inSection(120); +pattern = /ab{0,}?bc/i; +string = 'ABBBBC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABBBBC'); +addThis(); + +status = inSection(121); +pattern = /ab+?bc/i; +string = 'ABBC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABBC'); +addThis(); + +status = inSection(122); +pattern = /ab+bc/i; +string = 'ABBBBC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABBBBC'); +addThis(); + +status = inSection(123); +pattern = /ab{1,}?bc/i; +string = 'ABBBBC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABBBBC'); +addThis(); + +status = inSection(124); +pattern = /ab{1,3}?bc/i; +string = 'ABBBBC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABBBBC'); +addThis(); + +status = inSection(125); +pattern = /ab{3,4}?bc/i; +string = 'ABBBBC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABBBBC'); +addThis(); + +status = inSection(126); +pattern = /ab??bc/i; +string = 'ABBC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABBC'); +addThis(); + +status = inSection(127); +pattern = /ab??bc/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(128); +pattern = /ab{0,1}?bc/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(129); +pattern = /ab??c/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(130); +pattern = /ab{0,1}?c/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(131); +pattern = /^abc$/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(132); +pattern = /^abc/i; +string = 'ABCC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(133); +pattern = /abc$/i; +string = 'AABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(134); +pattern = /^/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +status = inSection(135); +pattern = /$/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +status = inSection(136); +pattern = /a.c/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(137); +pattern = /a.c/i; +string = 'AXC'; +actualmatch = string.match(pattern); +expectedmatch = Array('AXC'); +addThis(); + +status = inSection(138); +pattern = /a.*?c/i; +string = 'AXYZC'; +actualmatch = string.match(pattern); +expectedmatch = Array('AXYZC'); +addThis(); + +status = inSection(139); +pattern = /a[bc]d/i; +string = 'ABD'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABD'); +addThis(); + +status = inSection(140); +pattern = /a[b-d]e/i; +string = 'ACE'; +actualmatch = string.match(pattern); +expectedmatch = Array('ACE'); +addThis(); + +status = inSection(141); +pattern = /a[b-d]/i; +string = 'AAC'; +actualmatch = string.match(pattern); +expectedmatch = Array('AC'); +addThis(); + +status = inSection(142); +pattern = /a[-b]/i; +string = 'A-'; +actualmatch = string.match(pattern); +expectedmatch = Array('A-'); +addThis(); + +status = inSection(143); +pattern = /a[b-]/i; +string = 'A-'; +actualmatch = string.match(pattern); +expectedmatch = Array('A-'); +addThis(); + +status = inSection(144); +pattern = /a]/i; +string = 'A]'; +actualmatch = string.match(pattern); +expectedmatch = Array('A]'); +addThis(); + +/* Perl supports ] & ^] inside a [], ECMA does not +status = inSection(145); +pattern = /a[]]b/i; +string = 'A]B'; +actualmatch = string.match(pattern); +expectedmatch = Array('A]B'); +addThis(); +*/ + +status = inSection(146); +pattern = /a[^bc]d/i; +string = 'AED'; +actualmatch = string.match(pattern); +expectedmatch = Array('AED'); +addThis(); + +status = inSection(147); +pattern = /a[^-b]c/i; +string = 'ADC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ADC'); +addThis(); + +/* Perl supports ] & ^] inside a [], ECMA does not +status = inSection(148); +pattern = /a[^]b]c/i; +string = 'ADC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ADC'); +addThis(); +*/ + +status = inSection(149); +pattern = /ab|cd/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('AB'); +addThis(); + +status = inSection(150); +pattern = /ab|cd/i; +string = 'ABCD'; +actualmatch = string.match(pattern); +expectedmatch = Array('AB'); +addThis(); + +status = inSection(151); +pattern = /()ef/i; +string = 'DEF'; +actualmatch = string.match(pattern); +expectedmatch = Array('EF', ''); +addThis(); + +status = inSection(152); +pattern = /a\(b/i; +string = 'A(B'; +actualmatch = string.match(pattern); +expectedmatch = Array('A(B'); +addThis(); + +status = inSection(153); +pattern = /a\(*b/i; +string = 'AB'; +actualmatch = string.match(pattern); +expectedmatch = Array('AB'); +addThis(); + +status = inSection(154); +pattern = /a\(*b/i; +string = 'A((B'; +actualmatch = string.match(pattern); +expectedmatch = Array('A((B'); +addThis(); + +status = inSection(155); +pattern = /a\\b/i; +string = 'A\\B'; +actualmatch = string.match(pattern); +expectedmatch = Array('A\\B'); +addThis(); + +status = inSection(156); +pattern = /((a))/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('A', 'A', 'A'); +addThis(); + +status = inSection(157); +pattern = /(a)b(c)/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC', 'A', 'C'); +addThis(); + +status = inSection(158); +pattern = /a+b+c/i; +string = 'AABBABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(159); +pattern = /a{1,}b{1,}c/i; +string = 'AABBABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(160); +pattern = /a.+?c/i; +string = 'ABCABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(161); +pattern = /a.*?c/i; +string = 'ABCABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(162); +pattern = /a.{0,5}?c/i; +string = 'ABCABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC'); +addThis(); + +status = inSection(163); +pattern = /(a+|b)*/i; +string = 'AB'; +actualmatch = string.match(pattern); +expectedmatch = Array('AB', 'B'); +addThis(); + +status = inSection(164); +pattern = /(a+|b){0,}/i; +string = 'AB'; +actualmatch = string.match(pattern); +expectedmatch = Array('AB', 'B'); +addThis(); + +status = inSection(165); +pattern = /(a+|b)+/i; +string = 'AB'; +actualmatch = string.match(pattern); +expectedmatch = Array('AB', 'B'); +addThis(); + +status = inSection(166); +pattern = /(a+|b){1,}/i; +string = 'AB'; +actualmatch = string.match(pattern); +expectedmatch = Array('AB', 'B'); +addThis(); + +status = inSection(167); +pattern = /(a+|b)?/i; +string = 'AB'; +actualmatch = string.match(pattern); +expectedmatch = Array('A', 'A'); +addThis(); + +status = inSection(168); +pattern = /(a+|b){0,1}/i; +string = 'AB'; +actualmatch = string.match(pattern); +expectedmatch = Array('A', 'A'); +addThis(); + +status = inSection(169); +pattern = /(a+|b){0,1}?/i; +string = 'AB'; +actualmatch = string.match(pattern); +expectedmatch = Array('', undefined); +addThis(); + +status = inSection(170); +pattern = /[^ab]*/i; +string = 'CDE'; +actualmatch = string.match(pattern); +expectedmatch = Array('CDE'); +addThis(); + +status = inSection(171); +pattern = /([abc])*d/i; +string = 'ABBBCD'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABBBCD', 'C'); +addThis(); + +status = inSection(172); +pattern = /([abc])*bcd/i; +string = 'ABCD'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABCD', 'A'); +addThis(); + +status = inSection(173); +pattern = /a|b|c|d|e/i; +string = 'E'; +actualmatch = string.match(pattern); +expectedmatch = Array('E'); +addThis(); + +status = inSection(174); +pattern = /(a|b|c|d|e)f/i; +string = 'EF'; +actualmatch = string.match(pattern); +expectedmatch = Array('EF', 'E'); +addThis(); + +status = inSection(175); +pattern = /abcd*efg/i; +string = 'ABCDEFG'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABCDEFG'); +addThis(); + +status = inSection(176); +pattern = /ab*/i; +string = 'XABYABBBZ'; +actualmatch = string.match(pattern); +expectedmatch = Array('AB'); +addThis(); + +status = inSection(177); +pattern = /ab*/i; +string = 'XAYABBBZ'; +actualmatch = string.match(pattern); +expectedmatch = Array('A'); +addThis(); + +status = inSection(178); +pattern = /(ab|cd)e/i; +string = 'ABCDE'; +actualmatch = string.match(pattern); +expectedmatch = Array('CDE', 'CD'); +addThis(); + +status = inSection(179); +pattern = /[abhgefdc]ij/i; +string = 'HIJ'; +actualmatch = string.match(pattern); +expectedmatch = Array('HIJ'); +addThis(); + +status = inSection(180); +pattern = /(abc|)ef/i; +string = 'ABCDEF'; +actualmatch = string.match(pattern); +expectedmatch = Array('EF', ''); +addThis(); + +status = inSection(181); +pattern = /(a|b)c*d/i; +string = 'ABCD'; +actualmatch = string.match(pattern); +expectedmatch = Array('BCD', 'B'); +addThis(); + +status = inSection(182); +pattern = /(ab|ab*)bc/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC', 'A'); +addThis(); + +status = inSection(183); +pattern = /a([bc]*)c*/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC', 'BC'); +addThis(); + +status = inSection(184); +pattern = /a([bc]*)(c*d)/i; +string = 'ABCD'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABCD', 'BC', 'D'); +addThis(); + +status = inSection(185); +pattern = /a([bc]+)(c*d)/i; +string = 'ABCD'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABCD', 'BC', 'D'); +addThis(); + +status = inSection(186); +pattern = /a([bc]*)(c+d)/i; +string = 'ABCD'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABCD', 'B', 'CD'); +addThis(); + +status = inSection(187); +pattern = /a[bcd]*dcdcde/i; +string = 'ADCDCDE'; +actualmatch = string.match(pattern); +expectedmatch = Array('ADCDCDE'); +addThis(); + +status = inSection(188); +pattern = /(ab|a)b*c/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABC', 'AB'); +addThis(); + +status = inSection(189); +pattern = /((a)(b)c)(d)/i; +string = 'ABCD'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABCD', 'ABC', 'A', 'B', 'D'); +addThis(); + +status = inSection(190); +pattern = /[a-zA-Z_][a-zA-Z0-9_]*/i; +string = 'ALPHA'; +actualmatch = string.match(pattern); +expectedmatch = Array('ALPHA'); +addThis(); + +status = inSection(191); +pattern = /^a(bc+|b[eh])g|.h$/i; +string = 'ABH'; +actualmatch = string.match(pattern); +expectedmatch = Array('BH', undefined); +addThis(); + +status = inSection(192); +pattern = /(bc+d$|ef*g.|h?i(j|k))/i; +string = 'EFFGZ'; +actualmatch = string.match(pattern); +expectedmatch = Array('EFFGZ', 'EFFGZ', undefined); +addThis(); + +status = inSection(193); +pattern = /(bc+d$|ef*g.|h?i(j|k))/i; +string = 'IJ'; +actualmatch = string.match(pattern); +expectedmatch = Array('IJ', 'IJ', 'J'); +addThis(); + +status = inSection(194); +pattern = /(bc+d$|ef*g.|h?i(j|k))/i; +string = 'REFFGZ'; +actualmatch = string.match(pattern); +expectedmatch = Array('EFFGZ', 'EFFGZ', undefined); +addThis(); + +status = inSection(195); +pattern = /((((((((((a))))))))))/i; +string = 'A'; +actualmatch = string.match(pattern); +expectedmatch = Array('A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A'); +addThis(); + +status = inSection(196); +pattern = /((((((((((a))))))))))\10/i; +string = 'AA'; +actualmatch = string.match(pattern); +expectedmatch = Array('AA', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A'); +addThis(); + +status = inSection(197); +pattern = /((((((((((a))))))))))/i; +string = 'A!'; +actualmatch = string.match(pattern); +expectedmatch = Array('A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A'); +addThis(); + +status = inSection(198); +pattern = /(((((((((a)))))))))/i; +string = 'A'; +actualmatch = string.match(pattern); +expectedmatch = Array('A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A'); +addThis(); + +status = inSection(199); +pattern = /(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))/i; +string = 'A'; +actualmatch = string.match(pattern); +expectedmatch = Array('A', 'A'); +addThis(); + +status = inSection(200); +pattern = /(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/i; +string = 'C'; +actualmatch = string.match(pattern); +expectedmatch = Array('C', 'C'); +addThis(); + +status = inSection(201); +pattern = /(.*)c(.*)/i; +string = 'ABCDE'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABCDE', 'AB', 'DE'); +addThis(); + +status = inSection(202); +pattern = /abcd/i; +string = 'ABCD'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABCD'); +addThis(); + +status = inSection(203); +pattern = /a(bc)d/i; +string = 'ABCD'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABCD', 'BC'); +addThis(); + +status = inSection(204); +pattern = /a[-]?c/i; +string = 'AC'; +actualmatch = string.match(pattern); +expectedmatch = Array('AC'); +addThis(); + +status = inSection(205); +pattern = /(abc)\1/i; +string = 'ABCABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABCABC', 'ABC'); +addThis(); + +status = inSection(206); +pattern = /([a-c]*)\1/i; +string = 'ABCABC'; +actualmatch = string.match(pattern); +expectedmatch = Array('ABCABC', 'ABC'); +addThis(); + +status = inSection(207); +pattern = /a(?!b)./; +string = 'abad'; +actualmatch = string.match(pattern); +expectedmatch = Array('ad'); +addThis(); + +status = inSection(208); +pattern = /a(?=d)./; +string = 'abad'; +actualmatch = string.match(pattern); +expectedmatch = Array('ad'); +addThis(); + +status = inSection(209); +pattern = /a(?=c|d)./; +string = 'abad'; +actualmatch = string.match(pattern); +expectedmatch = Array('ad'); +addThis(); + +status = inSection(210); +pattern = /a(?:b|c|d)(.)/; +string = 'ace'; +actualmatch = string.match(pattern); +expectedmatch = Array('ace', 'e'); +addThis(); + +status = inSection(211); +pattern = /a(?:b|c|d)*(.)/; +string = 'ace'; +actualmatch = string.match(pattern); +expectedmatch = Array('ace', 'e'); +addThis(); + +status = inSection(212); +pattern = /a(?:b|c|d)+?(.)/; +string = 'ace'; +actualmatch = string.match(pattern); +expectedmatch = Array('ace', 'e'); +addThis(); + +status = inSection(213); +pattern = /a(?:b|c|d)+?(.)/; +string = 'acdbcdbe'; +actualmatch = string.match(pattern); +expectedmatch = Array('acd', 'd'); +addThis(); + +status = inSection(214); +pattern = /a(?:b|c|d)+(.)/; +string = 'acdbcdbe'; +actualmatch = string.match(pattern); +expectedmatch = Array('acdbcdbe', 'e'); +addThis(); + +status = inSection(215); +pattern = /a(?:b|c|d){2}(.)/; +string = 'acdbcdbe'; +actualmatch = string.match(pattern); +expectedmatch = Array('acdb', 'b'); +addThis(); + +status = inSection(216); +pattern = /a(?:b|c|d){4,5}(.)/; +string = 'acdbcdbe'; +actualmatch = string.match(pattern); +expectedmatch = Array('acdbcdb', 'b'); +addThis(); + +status = inSection(217); +pattern = /a(?:b|c|d){4,5}?(.)/; +string = 'acdbcdbe'; +actualmatch = string.match(pattern); +expectedmatch = Array('acdbcd', 'd'); +addThis(); + +// MODIFIED - ECMA has different rules for paren contents +status = inSection(218); +pattern = /((foo)|(bar))*/; +string = 'foobar'; +actualmatch = string.match(pattern); +//expectedmatch = Array('foobar', 'bar', 'foo', 'bar'); +expectedmatch = Array('foobar', 'bar', undefined, 'bar'); +addThis(); + +status = inSection(219); +pattern = /a(?:b|c|d){6,7}(.)/; +string = 'acdbcdbe'; +actualmatch = string.match(pattern); +expectedmatch = Array('acdbcdbe', 'e'); +addThis(); + +status = inSection(220); +pattern = /a(?:b|c|d){6,7}?(.)/; +string = 'acdbcdbe'; +actualmatch = string.match(pattern); +expectedmatch = Array('acdbcdbe', 'e'); +addThis(); + +status = inSection(221); +pattern = /a(?:b|c|d){5,6}(.)/; +string = 'acdbcdbe'; +actualmatch = string.match(pattern); +expectedmatch = Array('acdbcdbe', 'e'); +addThis(); + +status = inSection(222); +pattern = /a(?:b|c|d){5,6}?(.)/; +string = 'acdbcdbe'; +actualmatch = string.match(pattern); +expectedmatch = Array('acdbcdb', 'b'); +addThis(); + +status = inSection(223); +pattern = /a(?:b|c|d){5,7}(.)/; +string = 'acdbcdbe'; +actualmatch = string.match(pattern); +expectedmatch = Array('acdbcdbe', 'e'); +addThis(); + +status = inSection(224); +pattern = /a(?:b|c|d){5,7}?(.)/; +string = 'acdbcdbe'; +actualmatch = string.match(pattern); +expectedmatch = Array('acdbcdb', 'b'); +addThis(); + +status = inSection(225); +pattern = /a(?:b|(c|e){1,2}?|d)+?(.)/; +string = 'ace'; +actualmatch = string.match(pattern); +expectedmatch = Array('ace', 'c', 'e'); +addThis(); + +status = inSection(226); +pattern = /^(.+)?B/; +string = 'AB'; +actualmatch = string.match(pattern); +expectedmatch = Array('AB', 'A'); +addThis(); + +/* MODIFIED - ECMA has different rules for paren contents */ +status = inSection(227); +pattern = /^([^a-z])|(\^)$/; +string = '.'; +actualmatch = string.match(pattern); +//expectedmatch = Array('.', '.', ''); +expectedmatch = Array('.', '.', undefined); +addThis(); + +status = inSection(228); +pattern = /^[<>]&/; +string = '<&OUT'; +actualmatch = string.match(pattern); +expectedmatch = Array('<&'); +addThis(); + +/* Can't refer to a capture before it's encountered & completed +status = inSection(229); +pattern = /^(a\1?){4}$/; +string = 'aaaaaaaaaa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaaaaaaaaa', 'aaaa'); +addThis(); + +status = inSection(230); +pattern = /^(a(?(1)\1)){4}$/; +string = 'aaaaaaaaaa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaaaaaaaaa', 'aaaa'); +addThis(); +*/ + +status = inSection(231); +pattern = /((a{4})+)/; +string = 'aaaaaaaaa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaaaaaaa', 'aaaaaaaa', 'aaaa'); +addThis(); + +status = inSection(232); +pattern = /(((aa){2})+)/; +string = 'aaaaaaaaaa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaaaaaaa', 'aaaaaaaa', 'aaaa', 'aa'); +addThis(); + +status = inSection(233); +pattern = /(((a{2}){2})+)/; +string = 'aaaaaaaaaa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaaaaaaa', 'aaaaaaaa', 'aaaa', 'aa'); +addThis(); + +status = inSection(234); +pattern = /(?:(f)(o)(o)|(b)(a)(r))*/; +string = 'foobar'; +actualmatch = string.match(pattern); +//expectedmatch = Array('foobar', 'f', 'o', 'o', 'b', 'a', 'r'); +expectedmatch = Array('foobar', undefined, undefined, undefined, 'b', 'a', 'r'); +addThis(); + +/* ECMA supports (?: (?= and (?! but doesn't support (?< etc. +status = inSection(235); +pattern = /(?<=a)b/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('b'); +addThis(); + +status = inSection(236); +pattern = /(?<!c)b/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('b'); +addThis(); + +status = inSection(237); +pattern = /(?<!c)b/; +string = 'b'; +actualmatch = string.match(pattern); +expectedmatch = Array('b'); +addThis(); + +status = inSection(238); +pattern = /(?<!c)b/; +string = 'b'; +actualmatch = string.match(pattern); +expectedmatch = Array('b'); +addThis(); +*/ + +status = inSection(239); +pattern = /(?:..)*a/; +string = 'aba'; +actualmatch = string.match(pattern); +expectedmatch = Array('aba'); +addThis(); + +status = inSection(240); +pattern = /(?:..)*?a/; +string = 'aba'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +/* + * MODIFIED - ECMA has different rules for paren contents. Note + * this regexp has two non-capturing parens, and one capturing + * + * The issue: shouldn't the match be ['ab', undefined]? Because the + * '\1' matches the undefined value of the second iteration of the '*' + * (in which the 'b' part of the '|' matches). But Perl wants ['ab','b']. + * + * Answer: waldemar@netscape.com: + * + * The correct answer is ['ab', undefined]. Perl doesn't match + * ECMAScript here, and I'd say that Perl is wrong in this case. + */ +status = inSection(241); +pattern = /^(?:b|a(?=(.)))*\1/; +string = 'abc'; +actualmatch = string.match(pattern); +//expectedmatch = Array('ab', 'b'); +expectedmatch = Array('ab', undefined); +addThis(); + +status = inSection(242); +pattern = /^(){3,5}/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('', ''); +addThis(); + +status = inSection(243); +pattern = /^(a+)*ax/; +string = 'aax'; +actualmatch = string.match(pattern); +expectedmatch = Array('aax', 'a'); +addThis(); + +status = inSection(244); +pattern = /^((a|b)+)*ax/; +string = 'aax'; +actualmatch = string.match(pattern); +expectedmatch = Array('aax', 'a', 'a'); +addThis(); + +status = inSection(245); +pattern = /^((a|bc)+)*ax/; +string = 'aax'; +actualmatch = string.match(pattern); +expectedmatch = Array('aax', 'a', 'a'); +addThis(); + +/* MODIFIED - ECMA has different rules for paren contents */ +status = inSection(246); +pattern = /(a|x)*ab/; +string = 'cab'; +actualmatch = string.match(pattern); +//expectedmatch = Array('ab', ''); +expectedmatch = Array('ab', undefined); +addThis(); + +status = inSection(247); +pattern = /(a)*ab/; +string = 'cab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab', undefined); +addThis(); + +/* ECMA doesn't support (?imsx or (?-imsx +status = inSection(248); +pattern = /(?:(?i)a)b/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); + +status = inSection(249); +pattern = /((?i)a)b/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab', 'a'); +addThis(); + +status = inSection(250); +pattern = /(?:(?i)a)b/; +string = 'Ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('Ab'); +addThis(); + +status = inSection(251); +pattern = /((?i)a)b/; +string = 'Ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('Ab', 'A'); +addThis(); + +status = inSection(252); +pattern = /(?i:a)b/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); + +status = inSection(253); +pattern = /((?i:a))b/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab', 'a'); +addThis(); + +status = inSection(254); +pattern = /(?i:a)b/; +string = 'Ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('Ab'); +addThis(); + +status = inSection(255); +pattern = /((?i:a))b/; +string = 'Ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('Ab', 'A'); +addThis(); + +status = inSection(256); +pattern = /(?:(?-i)a)b/i; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); + +status = inSection(257); +pattern = /((?-i)a)b/i; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab', 'a'); +addThis(); + +status = inSection(258); +pattern = /(?:(?-i)a)b/i; +string = 'aB'; +actualmatch = string.match(pattern); +expectedmatch = Array('aB'); +addThis(); + +status = inSection(259); +pattern = /((?-i)a)b/i; +string = 'aB'; +actualmatch = string.match(pattern); +expectedmatch = Array('aB', 'a'); +addThis(); + +status = inSection(260); +pattern = /(?:(?-i)a)b/i; +string = 'aB'; +actualmatch = string.match(pattern); +expectedmatch = Array('aB'); +addThis(); + +status = inSection(261); +pattern = /((?-i)a)b/i; +string = 'aB'; +actualmatch = string.match(pattern); +expectedmatch = Array('aB', 'a'); +addThis(); + +status = inSection(262); +pattern = /(?-i:a)b/i; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); + +status = inSection(263); +pattern = /((?-i:a))b/i; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab', 'a'); +addThis(); + +status = inSection(264); +pattern = /(?-i:a)b/i; +string = 'aB'; +actualmatch = string.match(pattern); +expectedmatch = Array('aB'); +addThis(); + +status = inSection(265); +pattern = /((?-i:a))b/i; +string = 'aB'; +actualmatch = string.match(pattern); +expectedmatch = Array('aB', 'a'); +addThis(); + +status = inSection(266); +pattern = /(?-i:a)b/i; +string = 'aB'; +actualmatch = string.match(pattern); +expectedmatch = Array('aB'); +addThis(); + +status = inSection(267); +pattern = /((?-i:a))b/i; +string = 'aB'; +actualmatch = string.match(pattern); +expectedmatch = Array('aB', 'a'); +addThis(); + +status = inSection(268); +pattern = /((?s-i:a.))b/i; +string = 'a\nB'; +actualmatch = string.match(pattern); +expectedmatch = Array('a\nB', 'a\n'); +addThis(); +*/ + +status = inSection(269); +pattern = /(?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b)))/; +string = 'cabbbb'; +actualmatch = string.match(pattern); +expectedmatch = Array('cabbbb'); +addThis(); + +status = inSection(270); +pattern = /(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/; +string = 'caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'; +actualmatch = string.match(pattern); +expectedmatch = Array('caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'); +addThis(); + +status = inSection(271); +pattern = /(ab)\d\1/i; +string = 'Ab4ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('Ab4ab', 'Ab'); +addThis(); + +status = inSection(272); +pattern = /(ab)\d\1/i; +string = 'ab4Ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab4Ab', 'ab'); +addThis(); + +status = inSection(273); +pattern = /foo\w*\d{4}baz/; +string = 'foobar1234baz'; +actualmatch = string.match(pattern); +expectedmatch = Array('foobar1234baz'); +addThis(); + +status = inSection(274); +pattern = /x(~~)*(?:(?:F)?)?/; +string = 'x~~'; +actualmatch = string.match(pattern); +expectedmatch = Array('x~~', '~~'); +addThis(); + +/* Perl supports (?# but JS doesn't +status = inSection(275); +pattern = /^a(?#xxx){3}c/; +string = 'aaac'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaac'); +addThis(); +*/ + +/* ECMA doesn't support (?< etc +status = inSection(276); +pattern = /(?<![cd])[ab]/; +string = 'dbaacb'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(277); +pattern = /(?<!(c|d))[ab]/; +string = 'dbaacb'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(278); +pattern = /(?<!cd)[ab]/; +string = 'cdaccb'; +actualmatch = string.match(pattern); +expectedmatch = Array('b'); +addThis(); + +status = inSection(279); +pattern = /((?s)^a(.))((?m)^b$)/; +string = 'a\nb\nc\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('a\nb', 'a\n', '\n', 'b'); +addThis(); + +status = inSection(280); +pattern = /((?m)^b$)/; +string = 'a\nb\nc\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('b', 'b'); +addThis(); + +status = inSection(281); +pattern = /(?m)^b/; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('b'); +addThis(); + +status = inSection(282); +pattern = /(?m)^(b)/; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('b', 'b'); +addThis(); + +status = inSection(283); +pattern = /((?m)^b)/; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('b', 'b'); +addThis(); + +status = inSection(284); +pattern = /\n((?m)^b)/; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('\nb', 'b'); +addThis(); + +status = inSection(285); +pattern = /((?s).)c(?!.)/; +string = 'a\nb\nc\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('\nc', '\n'); +addThis(); + +status = inSection(286); +pattern = /((?s).)c(?!.)/; +string = 'a\nb\nc\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('\nc', '\n'); +addThis(); + +status = inSection(287); +pattern = /((?s)b.)c(?!.)/; +string = 'a\nb\nc\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('b\nc', 'b\n'); +addThis(); + +status = inSection(288); +pattern = /((?s)b.)c(?!.)/; +string = 'a\nb\nc\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('b\nc', 'b\n'); +addThis(); + +status = inSection(289); +pattern = /((?m)^b)/; +string = 'a\nb\nc\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('b', 'b'); +addThis(); +*/ + +/* ECMA doesn't support (?(condition) +status = inSection(290); +pattern = /(?(1)b|a)/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(291); +pattern = /(x)?(?(1)b|a)/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(292); +pattern = /()?(?(1)b|a)/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(293); +pattern = /()?(?(1)a|b)/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(294); +pattern = /^(\()?blah(?(1)(\)))$/; +string = '(blah)'; +actualmatch = string.match(pattern); +expectedmatch = Array('(blah)', '(', ')'); +addThis(); + +status = inSection(295); +pattern = /^(\()?blah(?(1)(\)))$/; +string = 'blah'; +actualmatch = string.match(pattern); +expectedmatch = Array('blah'); +addThis(); + +status = inSection(296); +pattern = /^(\(+)?blah(?(1)(\)))$/; +string = '(blah)'; +actualmatch = string.match(pattern); +expectedmatch = Array('(blah)', '(', ')'); +addThis(); + +status = inSection(297); +pattern = /^(\(+)?blah(?(1)(\)))$/; +string = 'blah'; +actualmatch = string.match(pattern); +expectedmatch = Array('blah'); +addThis(); + +status = inSection(298); +pattern = /(?(?!a)b|a)/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(299); +pattern = /(?(?=a)a|b)/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); +*/ + +status = inSection(300); +pattern = /(?=(a+?))(\1ab)/; +string = 'aaab'; +actualmatch = string.match(pattern); +expectedmatch = Array('aab', 'a', 'aab'); +addThis(); + +status = inSection(301); +pattern = /(\w+:)+/; +string = 'one:'; +actualmatch = string.match(pattern); +expectedmatch = Array('one:', 'one:'); +addThis(); + +/* ECMA doesn't support (?< etc +status = inSection(302); +pattern = /$(?<=^(a))/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = Array('', 'a'); +addThis(); +*/ + +status = inSection(303); +pattern = /(?=(a+?))(\1ab)/; +string = 'aaab'; +actualmatch = string.match(pattern); +expectedmatch = Array('aab', 'a', 'aab'); +addThis(); + +/* MODIFIED - ECMA has different rules for paren contents */ +status = inSection(304); +pattern = /([\w:]+::)?(\w+)$/; +string = 'abcd'; +actualmatch = string.match(pattern); +//expectedmatch = Array('abcd', '', 'abcd'); +expectedmatch = Array('abcd', undefined, 'abcd'); +addThis(); + +status = inSection(305); +pattern = /([\w:]+::)?(\w+)$/; +string = 'xy:z:::abcd'; +actualmatch = string.match(pattern); +expectedmatch = Array('xy:z:::abcd', 'xy:z:::', 'abcd'); +addThis(); + +status = inSection(306); +pattern = /^[^bcd]*(c+)/; +string = 'aexycd'; +actualmatch = string.match(pattern); +expectedmatch = Array('aexyc', 'c'); +addThis(); + +status = inSection(307); +pattern = /(a*)b+/; +string = 'caab'; +actualmatch = string.match(pattern); +expectedmatch = Array('aab', 'aa'); +addThis(); + +/* MODIFIED - ECMA has different rules for paren contents */ +status = inSection(308); +pattern = /([\w:]+::)?(\w+)$/; +string = 'abcd'; +actualmatch = string.match(pattern); +//expectedmatch = Array('abcd', '', 'abcd'); +expectedmatch = Array('abcd', undefined, 'abcd'); +addThis(); + +status = inSection(309); +pattern = /([\w:]+::)?(\w+)$/; +string = 'xy:z:::abcd'; +actualmatch = string.match(pattern); +expectedmatch = Array('xy:z:::abcd', 'xy:z:::', 'abcd'); +addThis(); + +status = inSection(310); +pattern = /^[^bcd]*(c+)/; +string = 'aexycd'; +actualmatch = string.match(pattern); +expectedmatch = Array('aexyc', 'c'); +addThis(); + +/* ECMA doesn't support (?> +status = inSection(311); +pattern = /(?>a+)b/; +string = 'aaab'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaab'); +addThis(); +*/ + +status = inSection(312); +pattern = /([[:]+)/; +string = 'a:[b]:'; +actualmatch = string.match(pattern); +expectedmatch = Array(':[', ':['); +addThis(); + +status = inSection(313); +pattern = /([[=]+)/; +string = 'a=[b]='; +actualmatch = string.match(pattern); +expectedmatch = Array('=[', '=['); +addThis(); + +status = inSection(314); +pattern = /([[.]+)/; +string = 'a.[b].'; +actualmatch = string.match(pattern); +expectedmatch = Array('.[', '.['); +addThis(); + +/* ECMA doesn't have rules for [: +status = inSection(315); +pattern = /[a[:]b[:c]/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc'); +addThis(); +*/ + +/* ECMA doesn't support (?> +status = inSection(316); +pattern = /((?>a+)b)/; +string = 'aaab'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaab', 'aaab'); +addThis(); + +status = inSection(317); +pattern = /(?>(a+))b/; +string = 'aaab'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaab', 'aaa'); +addThis(); + +status = inSection(318); +pattern = /((?>[^()]+)|\([^()]*\))+/; +string = '((abc(ade)ufh()()x'; +actualmatch = string.match(pattern); +expectedmatch = Array('abc(ade)ufh()()x', 'x'); +addThis(); +*/ + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(319); +pattern = /\Z/; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +status = inSection(320); +pattern = /\z/; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); +*/ + +status = inSection(321); +pattern = /$/; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(322); +pattern = /\Z/; +string = 'b\na\n'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +status = inSection(323); +pattern = /\z/; +string = 'b\na\n'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); +*/ + +status = inSection(324); +pattern = /$/; +string = 'b\na\n'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(325); +pattern = /\Z/; +string = 'b\na'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +status = inSection(326); +pattern = /\z/; +string = 'b\na'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); +*/ + +status = inSection(327); +pattern = /$/; +string = 'b\na'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(328); +pattern = /\Z/m; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +status = inSection(329); +pattern = /\z/m; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); +*/ + +status = inSection(330); +pattern = /$/m; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(331); +pattern = /\Z/m; +string = 'b\na\n'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +status = inSection(332); +pattern = /\z/m; +string = 'b\na\n'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); +*/ + +status = inSection(333); +pattern = /$/m; +string = 'b\na\n'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(334); +pattern = /\Z/m; +string = 'b\na'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +status = inSection(335); +pattern = /\z/m; +string = 'b\na'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); +*/ + +status = inSection(336); +pattern = /$/m; +string = 'b\na'; +actualmatch = string.match(pattern); +expectedmatch = Array(''); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(337); +pattern = /a\Z/; +string = 'b\na\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); +*/ + +/* $ only matches end of input unless multiline +status = inSection(338); +pattern = /a$/; +string = 'b\na\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); +*/ + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(339); +pattern = /a\Z/; +string = 'b\na'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(340); +pattern = /a\z/; +string = 'b\na'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); +*/ + +status = inSection(341); +pattern = /a$/; +string = 'b\na'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(342); +pattern = /a$/m; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(343); +pattern = /a\Z/m; +string = 'b\na\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); +*/ + +status = inSection(344); +pattern = /a$/m; +string = 'b\na\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(345); +pattern = /a\Z/m; +string = 'b\na'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +status = inSection(346); +pattern = /a\z/m; +string = 'b\na'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); +*/ + +status = inSection(347); +pattern = /a$/m; +string = 'b\na'; +actualmatch = string.match(pattern); +expectedmatch = Array('a'); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(348); +pattern = /aa\Z/; +string = 'b\naa\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('aa'); +addThis(); +*/ + +/* $ only matches end of input unless multiline +status = inSection(349); +pattern = /aa$/; +string = 'b\naa\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('aa'); +addThis(); +*/ + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(350); +pattern = /aa\Z/; +string = 'b\naa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aa'); +addThis(); + +status = inSection(351); +pattern = /aa\z/; +string = 'b\naa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aa'); +addThis(); +*/ + +status = inSection(352); +pattern = /aa$/; +string = 'b\naa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aa'); +addThis(); + +status = inSection(353); +pattern = /aa$/m; +string = 'aa\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('aa'); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(354); +pattern = /aa\Z/m; +string = 'b\naa\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('aa'); +addThis(); +*/ + +status = inSection(355); +pattern = /aa$/m; +string = 'b\naa\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('aa'); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(356); +pattern = /aa\Z/m; +string = 'b\naa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aa'); +addThis(); + +status = inSection(357); +pattern = /aa\z/m; +string = 'b\naa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aa'); +addThis(); +*/ + +status = inSection(358); +pattern = /aa$/m; +string = 'b\naa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aa'); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(359); +pattern = /ab\Z/; +string = 'b\nab\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); +*/ + +/* $ only matches end of input unless multiline +status = inSection(360); +pattern = /ab$/; +string = 'b\nab\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); +*/ + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(361); +pattern = /ab\Z/; +string = 'b\nab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); + +status = inSection(362); +pattern = /ab\z/; +string = 'b\nab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); +*/ + +status = inSection(363); +pattern = /ab$/; +string = 'b\nab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); + +status = inSection(364); +pattern = /ab$/m; +string = 'ab\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(365); +pattern = /ab\Z/m; +string = 'b\nab\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); +*/ + +status = inSection(366); +pattern = /ab$/m; +string = 'b\nab\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(367); +pattern = /ab\Z/m; +string = 'b\nab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); + +status = inSection(368); +pattern = /ab\z/m; +string = 'b\nab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); +*/ + +status = inSection(369); +pattern = /ab$/m; +string = 'b\nab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab'); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(370); +pattern = /abb\Z/; +string = 'b\nabb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('abb'); +addThis(); +*/ + +/* $ only matches end of input unless multiline +status = inSection(371); +pattern = /abb$/; +string = 'b\nabb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('abb'); +addThis(); +*/ + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(372); +pattern = /abb\Z/; +string = 'b\nabb'; +actualmatch = string.match(pattern); +expectedmatch = Array('abb'); +addThis(); + +status = inSection(373); +pattern = /abb\z/; +string = 'b\nabb'; +actualmatch = string.match(pattern); +expectedmatch = Array('abb'); +addThis(); +*/ + +status = inSection(374); +pattern = /abb$/; +string = 'b\nabb'; +actualmatch = string.match(pattern); +expectedmatch = Array('abb'); +addThis(); + +status = inSection(375); +pattern = /abb$/m; +string = 'abb\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('abb'); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(376); +pattern = /abb\Z/m; +string = 'b\nabb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('abb'); +addThis(); +*/ + +status = inSection(377); +pattern = /abb$/m; +string = 'b\nabb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('abb'); +addThis(); + +/* Perl has \Z has end-of-line, ECMA doesn't +status = inSection(378); +pattern = /abb\Z/m; +string = 'b\nabb'; +actualmatch = string.match(pattern); +expectedmatch = Array('abb'); +addThis(); + +status = inSection(379); +pattern = /abb\z/m; +string = 'b\nabb'; +actualmatch = string.match(pattern); +expectedmatch = Array('abb'); +addThis(); +*/ + +status = inSection(380); +pattern = /abb$/m; +string = 'b\nabb'; +actualmatch = string.match(pattern); +expectedmatch = Array('abb'); +addThis(); + +status = inSection(381); +pattern = /(^|x)(c)/; +string = 'ca'; +actualmatch = string.match(pattern); +expectedmatch = Array('c', '', 'c'); +addThis(); + +status = inSection(382); +pattern = /foo.bart/; +string = 'foo.bart'; +actualmatch = string.match(pattern); +expectedmatch = Array('foo.bart'); +addThis(); + +status = inSection(383); +pattern = /^d[x][x][x]/m; +string = 'abcd\ndxxx'; +actualmatch = string.match(pattern); +expectedmatch = Array('dxxx'); +addThis(); + +status = inSection(384); +pattern = /tt+$/; +string = 'xxxtt'; +actualmatch = string.match(pattern); +expectedmatch = Array('tt'); +addThis(); + +/* ECMA spec says that each atom in a range must be a single character +status = inSection(385); +pattern = /([a-\d]+)/; +string = 'za-9z'; +actualmatch = string.match(pattern); +expectedmatch = Array('9', '9'); +addThis(); + +status = inSection(386); +pattern = /([\d-z]+)/; +string = 'a0-za'; +actualmatch = string.match(pattern); +expectedmatch = Array('0-z', '0-z'); +addThis(); +*/ + +/* ECMA doesn't support [: +status = inSection(387); +pattern = /([a-[:digit:]]+)/; +string = 'za-9z'; +actualmatch = string.match(pattern); +expectedmatch = Array('a-9', 'a-9'); +addThis(); + +status = inSection(388); +pattern = /([[:digit:]-z]+)/; +string = '=0-z='; +actualmatch = string.match(pattern); +expectedmatch = Array('0-z', '0-z'); +addThis(); + +status = inSection(389); +pattern = /([[:digit:]-[:alpha:]]+)/; +string = '=0-z='; +actualmatch = string.match(pattern); +expectedmatch = Array('0-z', '0-z'); +addThis(); +*/ + +status = inSection(390); +pattern = /(\d+\.\d+)/; +string = '3.1415926'; +actualmatch = string.match(pattern); +expectedmatch = Array('3.1415926', '3.1415926'); +addThis(); + +status = inSection(391); +pattern = /\.c(pp|xx|c)?$/i; +string = 'IO.c'; +actualmatch = string.match(pattern); +expectedmatch = Array('.c', undefined); +addThis(); + +status = inSection(392); +pattern = /(\.c(pp|xx|c)?$)/i; +string = 'IO.c'; +actualmatch = string.match(pattern); +expectedmatch = Array('.c', '.c', undefined); +addThis(); + +status = inSection(393); +pattern = /(^|a)b/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = Array('ab', 'a'); +addThis(); + +status = inSection(394); +pattern = /^([ab]*?)(b)?(c)$/; +string = 'abac'; +actualmatch = string.match(pattern); +expectedmatch = Array('abac', 'aba', undefined, 'c'); +addThis(); + +status = inSection(395); +pattern = /^(?:.,){2}c/i; +string = 'a,b,c'; +actualmatch = string.match(pattern); +expectedmatch = Array('a,b,c'); +addThis(); + +status = inSection(396); +pattern = /^(.,){2}c/i; +string = 'a,b,c'; +actualmatch = string.match(pattern); +expectedmatch = Array('a,b,c', 'b,'); +addThis(); + +status = inSection(397); +pattern = /^(?:[^,]*,){2}c/; +string = 'a,b,c'; +actualmatch = string.match(pattern); +expectedmatch = Array('a,b,c'); +addThis(); + +status = inSection(398); +pattern = /^([^,]*,){2}c/; +string = 'a,b,c'; +actualmatch = string.match(pattern); +expectedmatch = Array('a,b,c', 'b,'); +addThis(); + +status = inSection(399); +pattern = /^([^,]*,){3}d/; +string = 'aaa,b,c,d'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaa,b,c,d', 'c,'); +addThis(); + +status = inSection(400); +pattern = /^([^,]*,){3,}d/; +string = 'aaa,b,c,d'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaa,b,c,d', 'c,'); +addThis(); + +status = inSection(401); +pattern = /^([^,]*,){0,3}d/; +string = 'aaa,b,c,d'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaa,b,c,d', 'c,'); +addThis(); + +status = inSection(402); +pattern = /^([^,]{1,3},){3}d/i; +string = 'aaa,b,c,d'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaa,b,c,d', 'c,'); +addThis(); + +status = inSection(403); +pattern = /^([^,]{1,3},){3,}d/; +string = 'aaa,b,c,d'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaa,b,c,d', 'c,'); +addThis(); + +status = inSection(404); +pattern = /^([^,]{1,3},){0,3}d/; +string = 'aaa,b,c,d'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaa,b,c,d', 'c,'); +addThis(); + +status = inSection(405); +pattern = /^([^,]{1,},){3}d/; +string = 'aaa,b,c,d'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaa,b,c,d', 'c,'); +addThis(); + +status = inSection(406); +pattern = /^([^,]{1,},){3,}d/; +string = 'aaa,b,c,d'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaa,b,c,d', 'c,'); +addThis(); + +status = inSection(407); +pattern = /^([^,]{1,},){0,3}d/; +string = 'aaa,b,c,d'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaa,b,c,d', 'c,'); +addThis(); + +status = inSection(408); +pattern = /^([^,]{0,3},){3}d/i; +string = 'aaa,b,c,d'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaa,b,c,d', 'c,'); +addThis(); + +status = inSection(409); +pattern = /^([^,]{0,3},){3,}d/; +string = 'aaa,b,c,d'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaa,b,c,d', 'c,'); +addThis(); + +status = inSection(410); +pattern = /^([^,]{0,3},){0,3}d/; +string = 'aaa,b,c,d'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaa,b,c,d', 'c,'); +addThis(); + +/* ECMA doesn't support \A +status = inSection(411); +pattern = /(?!\A)x/m; +string = 'a\nxb\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('\n'); +addThis(); +*/ + +status = inSection(412); +pattern = /^(a(b)?)+$/; +string = 'aba'; +actualmatch = string.match(pattern); +expectedmatch = Array('aba', 'a', undefined); +addThis(); + +status = inSection(413); +pattern = /^(aa(bb)?)+$/; +string = 'aabbaa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aabbaa', 'aa', undefined); +addThis(); + +status = inSection(414); +pattern = /^.{9}abc.*\n/m; +string = '123\nabcabcabcabc\n'; +actualmatch = string.match(pattern); +expectedmatch = Array('abcabcabcabc\n'); +addThis(); + +status = inSection(415); +pattern = /^(a)?a$/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = Array('a', undefined); +addThis(); + +status = inSection(416); +pattern = /^(a\1?)(a\1?)(a\2?)(a\3?)$/; +string = 'aaaaaa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaaaaa', 'a', 'aa', 'a', 'aa'); +addThis(); + +/* Can't refer to a capture before it's encountered & completed +status = inSection(417); +pattern = /^(a\1?){4}$/; +string = 'aaaaaa'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaaaaa', 'aaa'); +addThis(); +*/ + +status = inSection(418); +pattern = /^(0+)?(?:x(1))?/; +string = 'x1'; +actualmatch = string.match(pattern); +expectedmatch = Array('x1', undefined, '1'); +addThis(); + +status = inSection(419); +pattern = /^([0-9a-fA-F]+)(?:x([0-9a-fA-F]+)?)(?:x([0-9a-fA-F]+))?/; +string = '012cxx0190'; +actualmatch = string.match(pattern); +expectedmatch = Array('012cxx0190', '012c', undefined, '0190'); +addThis(); + +status = inSection(420); +pattern = /^(b+?|a){1,2}c/; +string = 'bbbac'; +actualmatch = string.match(pattern); +expectedmatch = Array('bbbac', 'a'); +addThis(); + +status = inSection(421); +pattern = /^(b+?|a){1,2}c/; +string = 'bbbbac'; +actualmatch = string.match(pattern); +expectedmatch = Array('bbbbac', 'a'); +addThis(); + +status = inSection(422); +pattern = /((?:aaaa|bbbb)cccc)?/; +string = 'aaaacccc'; +actualmatch = string.match(pattern); +expectedmatch = Array('aaaacccc', 'aaaacccc'); +addThis(); + +status = inSection(423); +pattern = /((?:aaaa|bbbb)cccc)?/; +string = 'bbbbcccc'; +actualmatch = string.match(pattern); +expectedmatch = Array('bbbbcccc', 'bbbbcccc'); +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + if(omitCurrentSection()) + return; + + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function omitCurrentSection() +{ + try + { + // current section number is in global status variable + var n = status.match(/(\d+)/)[1]; + return ((n < cnLBOUND) || (n > cnUBOUND)); + } + catch(e) + { + return false; + } +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/perlstress-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/perlstress-002.js new file mode 100644 index 0000000..44cfbb5 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/perlstress-002.js @@ -0,0 +1,1837 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com, rogerl@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 2002-07-07 +* SUMMARY: Testing JS RegExp engine against Perl 5 RegExp engine. +* Adjust cnLBOUND, cnUBOUND below to restrict which sections are tested. +* +* This test was created by running various patterns and strings through the +* Perl 5 RegExp engine. We saved the results below to test the JS engine. +* +* Each of the examples below is a negative test; that is, each produces a +* null match in Perl. Thus we set |expectedmatch| = |null| in each section. +* +* NOTE: ECMA/JS and Perl do differ on certain points. We have either commented +* out such sections altogether, or modified them to fit what we expect from JS. +* +* EXAMPLES: +* +* - ECMA does support (?: (?= and (?! operators, but doesn't support (?< etc. +* +* - ECMA doesn't support (?(condition) +* +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 85721; +var summary = 'Testing regular expression edge cases'; +var cnSingleSpace = ' '; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); +var cnLBOUND = 0; +var cnUBOUND = 1000; + + +status = inSection(1); +pattern = /abc/; +string = 'xbc'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(2); +pattern = /abc/; +string = 'axc'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(3); +pattern = /abc/; +string = 'abx'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(4); +pattern = /ab+bc/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(5); +pattern = /ab+bc/; +string = 'abq'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(6); +pattern = /ab{1,}bc/; +string = 'abq'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(7); +pattern = /ab{4,5}bc/; +string = 'abbbbc'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(8); +pattern = /ab?bc/; +string = 'abbbbc'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(9); +pattern = /^abc$/; +string = 'abcc'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(10); +pattern = /^abc$/; +string = 'aabc'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(11); +pattern = /abc$/; +string = 'aabcd'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(12); +pattern = /a.*c/; +string = 'axyzd'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(13); +pattern = /a[bc]d/; +string = 'abc'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(14); +pattern = /a[b-d]e/; +string = 'abd'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(15); +pattern = /a[^bc]d/; +string = 'abd'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(16); +pattern = /a[^-b]c/; +string = 'a-c'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(17); +pattern = /a[^]b]c/; +string = 'a]c'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(18); +pattern = /\by\b/; +string = 'xy'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(19); +pattern = /\by\b/; +string = 'yz'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(20); +pattern = /\by\b/; +string = 'xyz'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(21); +pattern = /\Ba\B/; +string = 'a-'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(22); +pattern = /\Ba\B/; +string = '-a'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(23); +pattern = /\Ba\B/; +string = '-a-'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(24); +pattern = /\w/; +string = '-'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(25); +pattern = /\W/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(26); +pattern = /a\sb/; +string = 'a-b'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(27); +pattern = /\d/; +string = '-'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(28); +pattern = /\D/; +string = '1'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(29); +pattern = /[\w]/; +string = '-'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(30); +pattern = /[\W]/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(31); +pattern = /a[\s]b/; +string = 'a-b'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(32); +pattern = /[\d]/; +string = '-'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(33); +pattern = /[\D]/; +string = '1'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(34); +pattern = /$b/; +string = 'b'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(35); +pattern = /^(ab|cd)e/; +string = 'abcde'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(36); +pattern = /a[bcd]+dcdcde/; +string = 'adcdcde'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(37); +pattern = /(bc+d$|ef*g.|h?i(j|k))/; +string = 'effg'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(38); +pattern = /(bc+d$|ef*g.|h?i(j|k))/; +string = 'bcdd'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(39); +pattern = /[k]/; +string = 'ab'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +// MODIFIED - ECMA has different rules for paren contents. +status = inSection(40); +pattern = /(a)|\1/; +string = 'x'; +actualmatch = string.match(pattern); +//expectedmatch = null; +expectedmatch = Array("", undefined); +addThis(); + +// MODIFIED - ECMA has different rules for paren contents. +status = inSection(41); +pattern = /((\3|b)\2(a)x)+/; +string = 'aaxabxbaxbbx'; +actualmatch = string.match(pattern); +//expectedmatch = null; +expectedmatch = Array("ax", "ax", "", "a"); +addThis(); + +status = inSection(42); +pattern = /abc/i; +string = 'XBC'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(43); +pattern = /abc/i; +string = 'AXC'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(44); +pattern = /abc/i; +string = 'ABX'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(45); +pattern = /ab+bc/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(46); +pattern = /ab+bc/i; +string = 'ABQ'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(47); +pattern = /ab{1,}bc/i; +string = 'ABQ'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(48); +pattern = /ab{4,5}?bc/i; +string = 'ABBBBC'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(49); +pattern = /ab??bc/i; +string = 'ABBBBC'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(50); +pattern = /^abc$/i; +string = 'ABCC'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(51); +pattern = /^abc$/i; +string = 'AABC'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(52); +pattern = /a.*c/i; +string = 'AXYZD'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(53); +pattern = /a[bc]d/i; +string = 'ABC'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(54); +pattern = /a[b-d]e/i; +string = 'ABD'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(55); +pattern = /a[^bc]d/i; +string = 'ABD'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(56); +pattern = /a[^-b]c/i; +string = 'A-C'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(57); +pattern = /a[^]b]c/i; +string = 'A]C'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(58); +pattern = /$b/i; +string = 'B'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(59); +pattern = /^(ab|cd)e/i; +string = 'ABCDE'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(60); +pattern = /a[bcd]+dcdcde/i; +string = 'ADCDCDE'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(61); +pattern = /(bc+d$|ef*g.|h?i(j|k))/i; +string = 'EFFG'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(62); +pattern = /(bc+d$|ef*g.|h?i(j|k))/i; +string = 'BCDD'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(63); +pattern = /[k]/i; +string = 'AB'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(64); +pattern = /^(a\1?){4}$/; +string = 'aaaaaaaaa'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(65); +pattern = /^(a\1?){4}$/; +string = 'aaaaaaaaaaa'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +/* ECMA doesn't support (?( +status = inSection(66); +pattern = /^(a(?(1)\1)){4}$/; +string = 'aaaaaaaaa'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(67); +pattern = /^(a(?(1)\1)){4}$/; +string = 'aaaaaaaaaaa'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); +*/ + +/* ECMA doesn't support (?< +status = inSection(68); +pattern = /(?<=a)b/; +string = 'cb'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(69); +pattern = /(?<=a)b/; +string = 'b'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(70); +pattern = /(?<!c)b/; +string = 'cb'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); +*/ + +/* ECMA doesn't support (?(condition) +status = inSection(71); +pattern = /(?:(?i)a)b/; +string = 'aB'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(72); +pattern = /((?i)a)b/; +string = 'aB'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(73); +pattern = /(?i:a)b/; +string = 'aB'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(74); +pattern = /((?i:a))b/; +string = 'aB'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(75); +pattern = /(?:(?-i)a)b/i; +string = 'Ab'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(76); +pattern = /((?-i)a)b/i; +string = 'Ab'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(77); +pattern = /(?:(?-i)a)b/i; +string = 'AB'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(78); +pattern = /((?-i)a)b/i; +string = 'AB'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(79); +pattern = /(?-i:a)b/i; +string = 'Ab'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(80); +pattern = /((?-i:a))b/i; +string = 'Ab'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(81); +pattern = /(?-i:a)b/i; +string = 'AB'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(82); +pattern = /((?-i:a))b/i; +string = 'AB'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(83); +pattern = /((?-i:a.))b/i; +string = 'a\nB'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(84); +pattern = /((?s-i:a.))b/i; +string = 'B\nB'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); +*/ + +/* ECMA doesn't support (?< +status = inSection(85); +pattern = /(?<![cd])b/; +string = 'dbcb'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(86); +pattern = /(?<!(c|d))b/; +string = 'dbcb'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); +*/ + +status = inSection(87); +pattern = /^(?:a?b?)*$/; +string = 'a--'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(88); +pattern = /^b/; +string = 'a\nb\nc\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(89); +pattern = /()^b/; +string = 'a\nb\nc\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +/* ECMA doesn't support (?( +status = inSection(90); +pattern = /(?(1)a|b)/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(91); +pattern = /(x)?(?(1)a|b)/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(92); +pattern = /()(?(1)b|a)/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(93); +pattern = /^(\()?blah(?(1)(\)))$/; +string = 'blah)'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(94); +pattern = /^(\()?blah(?(1)(\)))$/; +string = '(blah'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(95); +pattern = /^(\(+)?blah(?(1)(\)))$/; +string = 'blah)'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(96); +pattern = /^(\(+)?blah(?(1)(\)))$/; +string = '(blah'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(97); +pattern = /(?(?{0})a|b)/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(98); +pattern = /(?(?{1})b|a)/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(99); +pattern = /(?(?!a)a|b)/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(100); +pattern = /(?(?=a)b|a)/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); +*/ + +status = inSection(101); +pattern = /^(?=(a+?))\1ab/; +string = 'aaab'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(102); +pattern = /^(?=(a+?))\1ab/; +string = 'aaab'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(103); +pattern = /([\w:]+::)?(\w+)$/; +string = 'abcd:'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(104); +pattern = /([\w:]+::)?(\w+)$/; +string = 'abcd:'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(105); +pattern = /(>a+)ab/; +string = 'aaab'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(106); +pattern = /a\Z/; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(107); +pattern = /a\z/; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(108); +pattern = /a$/; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(109); +pattern = /a\z/; +string = 'b\na\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(110); +pattern = /a\z/m; +string = 'a\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(111); +pattern = /a\z/m; +string = 'b\na\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(112); +pattern = /aa\Z/; +string = 'aa\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(113); +pattern = /aa\z/; +string = 'aa\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(114); +pattern = /aa$/; +string = 'aa\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(115); +pattern = /aa\z/; +string = 'b\naa\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(116); +pattern = /aa\z/m; +string = 'aa\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(117); +pattern = /aa\z/m; +string = 'b\naa\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(118); +pattern = /aa\Z/; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(119); +pattern = /aa\z/; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(120); +pattern = /aa$/; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(121); +pattern = /aa\Z/; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(122); +pattern = /aa\z/; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(123); +pattern = /aa$/; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(124); +pattern = /aa\Z/; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(125); +pattern = /aa\z/; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(126); +pattern = /aa$/; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(127); +pattern = /aa\Z/m; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(128); +pattern = /aa\z/m; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(129); +pattern = /aa$/m; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(130); +pattern = /aa\Z/m; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(131); +pattern = /aa\z/m; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(132); +pattern = /aa$/m; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(133); +pattern = /aa\Z/m; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(134); +pattern = /aa\z/m; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(135); +pattern = /aa$/m; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(136); +pattern = /aa\Z/; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(137); +pattern = /aa\z/; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(138); +pattern = /aa$/; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(139); +pattern = /aa\Z/; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(140); +pattern = /aa\z/; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(141); +pattern = /aa$/; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(142); +pattern = /aa\Z/; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(143); +pattern = /aa\z/; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(144); +pattern = /aa$/; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(145); +pattern = /aa\Z/m; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(146); +pattern = /aa\z/m; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(147); +pattern = /aa$/m; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(148); +pattern = /aa\Z/m; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(149); +pattern = /aa\z/m; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(150); +pattern = /aa$/m; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(151); +pattern = /aa\Z/m; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(152); +pattern = /aa\z/m; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(153); +pattern = /aa$/m; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(154); +pattern = /ab\Z/; +string = 'ab\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(155); +pattern = /ab\z/; +string = 'ab\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(156); +pattern = /ab$/; +string = 'ab\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(157); +pattern = /ab\z/; +string = 'b\nab\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(158); +pattern = /ab\z/m; +string = 'ab\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(159); +pattern = /ab\z/m; +string = 'b\nab\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(160); +pattern = /ab\Z/; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(161); +pattern = /ab\z/; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(162); +pattern = /ab$/; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(163); +pattern = /ab\Z/; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(164); +pattern = /ab\z/; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(165); +pattern = /ab$/; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(166); +pattern = /ab\Z/; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(167); +pattern = /ab\z/; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(168); +pattern = /ab$/; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(169); +pattern = /ab\Z/m; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(170); +pattern = /ab\z/m; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(171); +pattern = /ab$/m; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(172); +pattern = /ab\Z/m; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(173); +pattern = /ab\z/m; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(174); +pattern = /ab$/m; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(175); +pattern = /ab\Z/m; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(176); +pattern = /ab\z/m; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(177); +pattern = /ab$/m; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(178); +pattern = /ab\Z/; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(179); +pattern = /ab\z/; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(180); +pattern = /ab$/; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(181); +pattern = /ab\Z/; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(182); +pattern = /ab\z/; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(183); +pattern = /ab$/; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(184); +pattern = /ab\Z/; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(185); +pattern = /ab\z/; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(186); +pattern = /ab$/; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(187); +pattern = /ab\Z/m; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(188); +pattern = /ab\z/m; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(189); +pattern = /ab$/m; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(190); +pattern = /ab\Z/m; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(191); +pattern = /ab\z/m; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(192); +pattern = /ab$/m; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(193); +pattern = /ab\Z/m; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(194); +pattern = /ab\z/m; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(195); +pattern = /ab$/m; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(196); +pattern = /abb\Z/; +string = 'abb\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(197); +pattern = /abb\z/; +string = 'abb\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(198); +pattern = /abb$/; +string = 'abb\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(199); +pattern = /abb\z/; +string = 'b\nabb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(200); +pattern = /abb\z/m; +string = 'abb\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(201); +pattern = /abb\z/m; +string = 'b\nabb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(202); +pattern = /abb\Z/; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(203); +pattern = /abb\z/; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(204); +pattern = /abb$/; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(205); +pattern = /abb\Z/; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(206); +pattern = /abb\z/; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(207); +pattern = /abb$/; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(208); +pattern = /abb\Z/; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(209); +pattern = /abb\z/; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(210); +pattern = /abb$/; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(211); +pattern = /abb\Z/m; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(212); +pattern = /abb\z/m; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(213); +pattern = /abb$/m; +string = 'ac\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(214); +pattern = /abb\Z/m; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(215); +pattern = /abb\z/m; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(216); +pattern = /abb$/m; +string = 'b\nac\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(217); +pattern = /abb\Z/m; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(218); +pattern = /abb\z/m; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(219); +pattern = /abb$/m; +string = 'b\nac'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(220); +pattern = /abb\Z/; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(221); +pattern = /abb\z/; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(222); +pattern = /abb$/; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(223); +pattern = /abb\Z/; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(224); +pattern = /abb\z/; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(225); +pattern = /abb$/; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(226); +pattern = /abb\Z/; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(227); +pattern = /abb\z/; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(228); +pattern = /abb$/; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(229); +pattern = /abb\Z/m; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(230); +pattern = /abb\z/m; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(231); +pattern = /abb$/m; +string = 'ca\nb\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(232); +pattern = /abb\Z/m; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(233); +pattern = /abb\z/m; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(234); +pattern = /abb$/m; +string = 'b\nca\n'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(235); +pattern = /abb\Z/m; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(236); +pattern = /abb\z/m; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(237); +pattern = /abb$/m; +string = 'b\nca'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(238); +pattern = /a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz/; +string = 'x'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(239); +pattern = /\GX.*X/; +string = 'aaaXbX'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(240); +pattern = /\.c(pp|xx|c)?$/i; +string = 'Changes'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(241); +pattern = /^([a-z]:)/; +string = 'C:/'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +status = inSection(242); +pattern = /(\w)?(abc)\1b/; +string = 'abcab'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); + +/* ECMA doesn't support (?( +status = inSection(243); +pattern = /^(a)?(?(1)a|b)+$/; +string = 'a'; +actualmatch = string.match(pattern); +expectedmatch = null; +addThis(); +*/ + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + if(omitCurrentSection()) + return; + + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function omitCurrentSection() +{ + try + { + // current section number is in global status variable + var n = status.match(/(\d+)/)[1]; + return ((n < cnLBOUND) || (n > cnUBOUND)); + } + catch(e) + { + return false; + } +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-100199.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-100199.js new file mode 100644 index 0000000..8380499 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-100199.js @@ -0,0 +1,286 @@ +/* +* 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 expressed +* 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): pschwartau@netscape.com +* Date: 17 September 2001 +* +* SUMMARY: Regression test for Bugzilla bug 100199 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=100199 +* +* The empty character class [] is a valid RegExp construct: the condition +* that a given character belong to a set containing no characters. As such, +* it can never be met and is always FALSE. Similarly, [^] is a condition +* that matches any given character and is always TRUE. +* +* Neither one of these conditions should cause syntax errors in a RegExp. +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 100199; +var summary = '[], [^] are valid RegExp conditions. Should not cause errors -'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +pattern = /[]/; + string = 'abc'; + status = inSection(1); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = ''; + status = inSection(2); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = '['; + status = inSection(3); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = '/'; + status = inSection(4); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = '['; + status = inSection(5); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = ']'; + status = inSection(6); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = '[]'; + status = inSection(7); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = '[ ]'; + status = inSection(8); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = ']['; + status = inSection(9); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + +pattern = /a[]/; + string = 'abc'; + status = inSection(10); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = ''; + status = inSection(11); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = 'a['; + status = inSection(12); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = 'a[]'; + status = inSection(13); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = '['; + status = inSection(14); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = ']'; + status = inSection(15); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = '[]'; + status = inSection(16); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = '[ ]'; + status = inSection(17); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + string = ']['; + status = inSection(18); + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + +pattern = /[^]/; + string = 'abc'; + status = inSection(19); + actualmatch = string.match(pattern); + expectedmatch = Array('a'); + addThis(); + + string = ''; + status = inSection(20); + actualmatch = string.match(pattern); + expectedmatch = null; //there are no characters to test against the condition + addThis(); + + string = '\/'; + status = inSection(21); + actualmatch = string.match(pattern); + expectedmatch = Array('/'); + addThis(); + + string = '\['; + status = inSection(22); + actualmatch = string.match(pattern); + expectedmatch = Array('['); + addThis(); + + string = '['; + status = inSection(23); + actualmatch = string.match(pattern); + expectedmatch = Array('['); + addThis(); + + string = ']'; + status = inSection(24); + actualmatch = string.match(pattern); + expectedmatch = Array(']'); + addThis(); + + string = '[]'; + status = inSection(25); + actualmatch = string.match(pattern); + expectedmatch = Array('['); + addThis(); + + string = '[ ]'; + status = inSection(26); + actualmatch = string.match(pattern); + expectedmatch = Array('['); + addThis(); + + string = ']['; + status = inSection(27); + actualmatch = string.match(pattern); + expectedmatch = Array(']'); + addThis(); + + +pattern = /a[^]/; + string = 'abc'; + status = inSection(28); + actualmatch = string.match(pattern); + expectedmatch = Array('ab'); + addThis(); + + string = ''; + status = inSection(29); + actualmatch = string.match(pattern); + expectedmatch = null; //there are no characters to test against the condition + addThis(); + + string = 'a['; + status = inSection(30); + actualmatch = string.match(pattern); + expectedmatch = Array('a['); + addThis(); + + string = 'a]'; + status = inSection(31); + actualmatch = string.match(pattern); + expectedmatch = Array('a]'); + addThis(); + + string = 'a[]'; + status = inSection(32); + actualmatch = string.match(pattern); + expectedmatch = Array('a['); + addThis(); + + string = 'a[ ]'; + status = inSection(33); + actualmatch = string.match(pattern); + expectedmatch = Array('a['); + addThis(); + + string = 'a]['; + status = inSection(34); + actualmatch = string.match(pattern); + expectedmatch = Array('a]'); + addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-103087.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-103087.js new file mode 100644 index 0000000..8cfc662 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-103087.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 expressed +* 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): bedney@technicalpursuit.com, pschwartau@netscape.com +* Date: 04 October 2001 +* +* SUMMARY: Arose from Bugzilla bug 103087: +* "The RegExp MarkupSPE in demo crashes Mozilla" +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=103087 +* The SpiderMonkey shell crashed on some of these regexps. +* +* The reported crash was on i=24 below ('MarkupSPE' regexp) +* I crashed on that, and also on i=43 ('XML_SPE' regexp) +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 103087; +var summary = "Testing that we don't crash on any of these regexps -"; +var re = ''; +var lm = ''; +var lc = ''; +var rc = ''; + + +// the regexps are built in pieces - +var NameStrt = "[A-Za-z_:]|[^\\x00-\\x7F]"; +var NameChar = "[A-Za-z0-9_:.-]|[^\\x00-\\x7F]"; +var Name = "(" + NameStrt + ")(" + NameChar + ")*"; +var TextSE = "[^<]+"; +var UntilHyphen = "[^-]*-"; +var Until2Hyphens = UntilHyphen + "([^-]" + UntilHyphen + ")*-"; +var CommentCE = Until2Hyphens + ">?"; +var UntilRSBs = "[^]]*]([^]]+])*]+"; +var CDATA_CE = UntilRSBs + "([^]>]" + UntilRSBs + ")*>"; +var S = "[ \\n\\t\\r]+"; +var QuoteSE = '"[^"]' + "*" + '"' + "|'[^']*'"; +var DT_IdentSE = S + Name + "(" + S + "(" + Name + "|" + QuoteSE + "))*"; +var MarkupDeclCE = "([^]\"'><]+|" + QuoteSE + ")*>"; +var S1 = "[\\n\\r\\t ]"; +var UntilQMs = "[^?]*\\?+"; +var PI_Tail = "\\?>|" + S1 + UntilQMs + "([^>?]" + UntilQMs + ")*>"; +var DT_ItemSE = "<(!(--" + Until2Hyphens + ">|[^-]" + MarkupDeclCE + ")|\\?" + Name + "(" + PI_Tail + "))|%" + Name + ";|" + S; +var DocTypeCE = DT_IdentSE + "(" + S + ")?(\\[(" + DT_ItemSE + ")*](" + S + ")?)?>?"; +var DeclCE = "--(" + CommentCE + ")?|\\[CDATA\\[(" + CDATA_CE + ")?|DOCTYPE(" + DocTypeCE + ")?"; +var PI_CE = Name + "(" + PI_Tail + ")?"; +var EndTagCE = Name + "(" + S + ")?>?"; +var AttValSE = '"[^<"]' + "*" + '"' + "|'[^<']*'"; +var ElemTagCE = Name + "(" + S + Name + "(" + S + ")?=(" + S + ")?(" + AttValSE + "))*(" + S + ")?/?>?"; +var MarkupSPE = "<(!(" + DeclCE + ")?|\\?(" + PI_CE + ")?|/(" + EndTagCE + ")?|(" + ElemTagCE + ")?)"; +var XML_SPE = TextSE + "|" + MarkupSPE; +var CommentRE = "<!--" + Until2Hyphens + ">"; +var CommentSPE = "<!--(" + CommentCE + ")?"; +var PI_RE = "<\\?" + Name + "(" + PI_Tail + ")"; +var Erroneous_PI_SE = "<\\?[^?]*(\\?[^>]+)*\\?>"; +var PI_SPE = "<\\?(" + PI_CE + ")?"; +var CDATA_RE = "<!\\[CDATA\\[" + CDATA_CE; +var CDATA_SPE = "<!\\[CDATA\\[(" + CDATA_CE + ")?"; +var ElemTagSE = "<(" + NameStrt + ")([^<>\"']+|" + AttValSE + ")*>"; +var ElemTagRE = "<" + Name + "(" + S + Name + "(" + S + ")?=(" + S + ")?(" + AttValSE + "))*(" + S + ")?/?>"; +var ElemTagSPE = "<" + ElemTagCE; +var EndTagRE = "</" + Name + "(" + S + ")?>"; +var EndTagSPE = "</(" + EndTagCE + ")?"; +var DocTypeSPE = "<!DOCTYPE(" + DocTypeCE + ")?"; +var PERef_APE = "%(" + Name + ";?)?"; +var HexPart = "x([0-9a-fA-F]+;?)?"; +var NumPart = "#([0-9]+;?|" + HexPart + ")?"; +var CGRef_APE = "&(" + Name + ";?|" + NumPart + ")?"; +var Text_PE = CGRef_APE + "|[^&]+"; +var EntityValue_PE = CGRef_APE + "|" + PERef_APE + "|[^%&]+"; + + +var rePatterns = new Array(AttValSE, CDATA_CE, CDATA_RE, CDATA_SPE, CGRef_APE, CommentCE, CommentRE, CommentSPE, DT_IdentSE, DT_ItemSE, DeclCE, DocTypeCE, DocTypeSPE, ElemTagCE, ElemTagRE, ElemTagSE, ElemTagSPE, EndTagCE, EndTagRE, EndTagSPE, EntityValue_PE, Erroneous_PI_SE, HexPart, MarkupDeclCE, MarkupSPE, Name, NameChar, NameStrt, NumPart, PERef_APE, PI_CE, PI_RE, PI_SPE, PI_Tail, QuoteSE, S, S1, TextSE, Text_PE, Until2Hyphens, UntilHyphen, UntilQMs, UntilRSBs, XML_SPE); + + +// here's a big string to test the regexps on - +var str = ''; +str += '<html xmlns="http://www.w3.org/1999/xhtml"' + '\n'; +str += ' xmlns:xlink="http://www.w3.org/XML/XLink/0.9">' + '\n'; +str += ' <head><title>Three Namespaces</title></head>' + '\n'; +str += ' <body>' + '\n'; +str += ' <h1 align="center">An Ellipse and a Rectangle</h1>' + '\n'; +str += ' <svg xmlns="http://www.w3.org/Graphics/SVG/SVG-19991203.dtd" ' + '\n'; +str += ' width="12cm" height="10cm">' + '\n'; +str += ' <ellipse rx="110" ry="130" />' + '\n'; +str += ' <rect x="4cm" y="1cm" width="3cm" height="6cm" />' + '\n'; +str += ' </svg>' + '\n'; +str += ' <p xlink:type="simple" xlink:href="ellipses.html">' + '\n'; +str += ' More about ellipses' + '\n'; +str += ' </p>' + '\n'; +str += ' <p xlink:type="simple" xlink:href="rectangles.html">' + '\n'; +str += ' More about rectangles' + '\n'; +str += ' </p>' + '\n'; +str += ' <hr/>' + '\n'; +str += ' <p>Last Modified February 13, 2000</p> ' + '\n'; +str += ' </body>' + '\n'; +str += '</html>'; + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i=0; i<rePatterns.length; i++) + { + status = inSection(i); + re = new RegExp(rePatterns[i]); + + // Test that we don't crash on any of these - + re.exec(str); + getResults(); + + // Just for the heck of it, test the current leftContext + re.exec(lc); + getResults(); + + // Test the current rightContext + re.exec(rc); + getResults(); + } + + exitFunc ('test'); +} + + +function getResults() +{ + lm = RegExp.lastMatch; + lc = RegExp.leftContext; + rc = RegExp.rightContext; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-105972.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-105972.js new file mode 100644 index 0000000..9f0cdb5 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-105972.js @@ -0,0 +1,136 @@ +/* +* 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 expressed +* 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): mozilla@pdavis.cx, pschwartau@netscape.com +* Date: 22 October 2001 +* +* SUMMARY: Regression test for Bugzilla bug 105972: +* "/^.*?$/ will not match anything" +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=105972 +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 105972; +var summary = 'Regression test for Bugzilla bug 105972'; +var cnEmptyString = ''; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +/* + * The bug: this match was coming up null in Rhino and SpiderMonkey. + * It should match the whole string. The reason: + * + * The * operator is greedy, but *? is non-greedy: it will stop + * at the simplest match it can find. But the pattern here asks us + * to match till the end of the string. So the simplest match must + * go all the way out to the end, and *? has no choice but to do it. + */ +status = inSection(1); +pattern = /^.*?$/; +string = 'Hello World'; +actualmatch = string.match(pattern); +expectedmatch = Array(string); +addThis(); + + +/* + * Leave off the '$' condition - here we expect the empty string. + * Unlike the above pattern, we don't have to match till the end of + * the string, so the non-greedy operator *? doesn't try to... + */ +status = inSection(2); +pattern = /^.*?/; +string = 'Hello World'; +actualmatch = string.match(pattern); +expectedmatch = Array(cnEmptyString); +addThis(); + + +/* + * Try '$' combined with an 'or' operator. + * + * The operator *? will consume the string from left to right, + * attempting to satisfy the condition (:|$). When it hits ':', + * the match will stop because the operator *? is non-greedy. + * + * The submatch $1 = (:|$) will contain the ':' + */ +status = inSection(3); +pattern = /^.*?(:|$)/; +string = 'Hello: World'; +actualmatch = string.match(pattern); +expectedmatch = Array('Hello:', ':'); +addThis(); + + +/* + * Again, '$' combined with an 'or' operator. + * + * The operator * will consume the string from left to right, + * attempting to satisfy the condition (:|$). When it hits ':', + * the match will not stop since * is greedy. The match will + * continue until it hits $, the end-of-string boundary. + * + * The submatch $1 = (:|$) will contain the empty string + * conceived to exist at the end-of-string boundary. + */ +status = inSection(4); +pattern = /^.*(:|$)/; +string = 'Hello: World'; +actualmatch = string.match(pattern); +expectedmatch = Array(string, cnEmptyString); +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-119909.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-119909.js new file mode 100644 index 0000000..4bb2866 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-119909.js @@ -0,0 +1,86 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2001 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): 1010mozilla@Ostermiller.com, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 14 Jan 2002 +* SUMMARY: Shouldn't crash on regexps with many nested parentheses +* See http://bugzilla.mozilla.org/show_bug.cgi?id=119909 +* +*/ +//----------------------------------------------------------------------------- +var bug = 119909; +var summary = "Shouldn't crash on regexps with many nested parentheses"; +var NO_BACKREFS = false; +var DO_BACKREFS = true; + + +//-------------------------------------------------- +test(); +//-------------------------------------------------- + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + // Changed the parameter from 500 to 200 for WebKit, because PCRE reports an error for more parentheses. + testThis(200, NO_BACKREFS, 'hello', 'goodbye'); + testThis(200, DO_BACKREFS, 'hello', 'goodbye'); + + exitFunc('test'); +} + + +/* + * Creates a regexp pattern like (((((((((hello))))))))) + * and tests str.search(), str.match(), str.replace() + */ +function testThis(numParens, doBackRefs, strOriginal, strReplace) +{ + var openParen = doBackRefs? '(' : '(?:'; + var closeParen = ')'; + var pattern = ''; + + for (var i=0; i<numParens; i++) {pattern += openParen;} + pattern += strOriginal; + for (i=0; i<numParens; i++) {pattern += closeParen;} + var re = new RegExp(pattern); + + var res = strOriginal.search(re); + res = strOriginal.match(re); + res = strOriginal.replace(re, strReplace); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-122076.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-122076.js new file mode 100644 index 0000000..ed2afc3 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-122076.js @@ -0,0 +1,103 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 12 Feb 2002 +* SUMMARY: Don't crash on invalid regexp literals / \\/ / +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=122076 +* The function checkURL() below sometimes caused a compile-time error: +* +* SyntaxError: unterminated parenthetical (: +* +* However, sometimes it would cause a crash instead. The presence of +* other functions below is merely fodder to help provoke the crash. +* The constant |STRESS| is number of times we'll try to crash on this. +* +*/ +//----------------------------------------------------------------------------- +var bug = 122076; +var summary = "Don't crash on invalid regexp literals / \\/ /"; +var STRESS = 10; +var sEval = ''; + +printBugNumber(bug); +printStatus(summary); + + +sEval += 'function checkDate()' +sEval += '{' +sEval += 'return (this.value.search(/^[012]?\d\/[0123]?\d\/[0]\d$/) != -1);' +sEval += '}' + +sEval += 'function checkDNSName()' +sEval += '{' +sEval += ' return (this.value.search(/^([\w\-]+\.)+([\w\-]{2,3})$/) != -1);' +sEval += '}' + +sEval += 'function checkEmail()' +sEval += '{' +sEval += ' return (this.value.search(/^([\w\-]+\.)*[\w\-]+@([\w\-]+\.)+([\w\-]{2,3})$/) != -1);' +sEval += '}' + +sEval += 'function checkHostOrIP()' +sEval += '{' +sEval += ' if (this.value.search(/^([\w\-]+\.)+([\w\-]{2,3})$/) == -1)' +sEval += ' return (this.value.search(/^[1-2]?\d{1,2}\.[1-2]?\d{1,2}\.[1-2]?\d{1,2}\.[1-2]?\d{1,2}$/) != -1);' +sEval += ' else' +sEval += ' return true;' +sEval += '}' + +sEval += 'function checkIPAddress()' +sEval += '{' +sEval += ' return (this.value.search(/^[1-2]?\d{1,2}\.[1-2]?\d{1,2}\.[1-2]?\d{1,2}\.[1-2]?\d{1,2}$/) != -1);' +sEval += '}' + +sEval += 'function checkURL()' +sEval += '{' +sEval += ' return (this.value.search(/^(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,4}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\/\*\$+@&#;`~=%!]*)(\.\w{2,})?)*\/?)$/) != -1);' +sEval += '}' + + +for (var i=0; i<STRESS; i++) +{ + try + { + eval(sEval); + } + catch(e) + { + } +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-123437.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-123437.js new file mode 100644 index 0000000..77194fe --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-123437.js @@ -0,0 +1,107 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): waldemar, rogerl, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 04 Feb 2002 +* SUMMARY: regexp backreferences must hold |undefined| if not used +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=123437 (SpiderMonkey) +* See http://bugzilla.mozilla.org/show_bug.cgi?id=123439 (Rhino) +* +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 123437; +var summary = 'regexp backreferences must hold |undefined| if not used'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +pattern = /(a)?a/; +string = 'a'; +status = inSection(1); +actualmatch = string.match(pattern); +expectedmatch = Array('a', undefined); +addThis(); + +pattern = /a|(b)/; +string = 'a'; +status = inSection(2); +actualmatch = string.match(pattern); +expectedmatch = Array('a', undefined); +addThis(); + +pattern = /(a)?(a)/; +string = 'a'; +status = inSection(3); +actualmatch = string.match(pattern); +expectedmatch = Array('a', undefined, 'a'); +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-165353.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-165353.js new file mode 100644 index 0000000..10a235f --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-165353.js @@ -0,0 +1,117 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): franky@pacificconnections.com, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 31 August 2002 +* SUMMARY: RegExp conformance test +* See http://bugzilla.mozilla.org/show_bug.cgi?id=165353 +* +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 165353; +var summary = 'RegExp conformance test'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +pattern = /^([a-z]+)*[a-z]$/; + status = inSection(1); + string = 'a'; + actualmatch = string.match(pattern); + expectedmatch = Array('a', undefined); + addThis(); + + status = inSection(2); + string = 'ab'; + actualmatch = string.match(pattern); + expectedmatch = Array('ab', 'a'); + addThis(); + + status = inSection(3); + string = 'abc'; + actualmatch = string.match(pattern); + expectedmatch = Array('abc', 'ab'); + addThis(); + + +string = 'www.netscape.com'; + status = inSection(4); + pattern = /^(([a-z]+)*[a-z]\.)+[a-z]{2,}$/; + actualmatch = string.match(pattern); + expectedmatch = Array('www.netscape.com', 'netscape.', 'netscap'); + addThis(); + + // add one more capturing parens to the previous regexp - + status = inSection(5); + pattern = /^(([a-z]+)*([a-z])\.)+[a-z]{2,}$/; + actualmatch = string.match(pattern); + expectedmatch = Array('www.netscape.com', 'netscape.', 'netscap', 'e'); + addThis(); + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-169497.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-169497.js new file mode 100644 index 0000000..0069bfd --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-169497.js @@ -0,0 +1,100 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): martin.honnen@t-online.de, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 31 August 2002 +* SUMMARY: RegExp conformance test +* See http://bugzilla.mozilla.org/show_bug.cgi?id=169497 +* +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 169497; +var summary = 'RegExp conformance test'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var sBody = ''; +var sHTML = ''; +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + +sBody += '<body onXXX="alert(event.type);">\n'; +sBody += '<p>Kibology for all<\/p>\n'; +sBody += '<p>All for Kibology<\/p>\n'; +sBody += '<\/body>'; + +sHTML += '<html>\n'; +sHTML += sBody; +sHTML += '\n<\/html>'; + +status = inSection(1); +string = sHTML; +pattern = /<body.*>((.*\n?)*?)<\/body>/i; +actualmatch = string.match(pattern); +expectedmatch = Array(sBody, '\n<p>Kibology for all</p>\n<p>All for Kibology</p>\n', '<p>All for Kibology</p>\n'); +addThis(); + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-169534.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-169534.js new file mode 100644 index 0000000..c29d11e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-169534.js @@ -0,0 +1,90 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 20 Sep 2002 +* SUMMARY: RegExp conformance test +* See http://bugzilla.mozilla.org/show_bug.cgi?id=169534 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 169534; +var summary = 'RegExp conformance test'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +status = inSection(1); +var re = /(\|)([\w\x81-\xff ]*)(\|)([\/a-z][\w:\/\.]*\.[a-z]{3,4})(\|)/ig; +var str = "To sign up click |here|https://www.xxxx.org/subscribe.htm|"; +actual = str.replace(re, '<a href="$4">$2</a>'); +expect = 'To sign up click <a href="https://www.xxxx.org/subscribe.htm">here</a>'; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-187133.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-187133.js new file mode 100644 index 0000000..bffcda8 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-187133.js @@ -0,0 +1,137 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): ji_bo@yahoo.com, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 06 January 2003 +* SUMMARY: RegExp conformance test +* See http://bugzilla.mozilla.org/show_bug.cgi?id=187133 +* +* The tests here employ the regular expression construct: +* +* (?!pattern) +* +* This is a "zero-width lookahead negative assertion". +* From the Perl documentation: +* +* For example, /foo(?!bar)/ matches any occurrence +* of 'foo' that isn't followed by 'bar'. +* +* It is "zero-width" means that it does not consume any characters and that +* the parens are non-capturing. A non-null match array in the example above +* will have only have length 1, not 2. +* +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 187133; +var summary = 'RegExp conformance test'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +pattern = /(\.(?!com|org)|\/)/; + status = inSection(1); + string = 'ah.info'; + actualmatch = string.match(pattern); + expectedmatch = ['.', '.']; + addThis(); + + status = inSection(2); + string = 'ah/info'; + actualmatch = string.match(pattern); + expectedmatch = ['/', '/']; + addThis(); + + status = inSection(3); + string = 'ah.com'; + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + +pattern = /(?!a|b)|c/; + status = inSection(4); + string = ''; + actualmatch = string.match(pattern); + expectedmatch = ['']; + addThis(); + + status = inSection(5); + string = 'bc'; + actualmatch = string.match(pattern); + expectedmatch = ['']; + addThis(); + + status = inSection(6); + string = 'd'; + actualmatch = string.match(pattern); + expectedmatch = ['']; + addThis(); + + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-188206.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-188206.js new file mode 100644 index 0000000..6fae0e1 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-188206.js @@ -0,0 +1,282 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): scole@planetweb.com, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 21 January 2003 +* SUMMARY: Invalid use of regexp quantifiers should generate SyntaxErrors +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=188206 +* and http://bugzilla.mozilla.org/show_bug.cgi?id=85721#c48 etc. +* and http://bugzilla.mozilla.org/show_bug.cgi?id=190685 +* and http://bugzilla.mozilla.org/show_bug.cgi?id=197451 +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 188206; +var summary = 'Invalid use of regexp quantifiers should generate SyntaxErrors'; +var TEST_PASSED = 'SyntaxError'; +var TEST_FAILED = 'Generated an error, but NOT a SyntaxError!'; +var TEST_FAILED_BADLY = 'Did not generate ANY error!!!'; +var CHECK_PASSED = 'Should not generate an error'; +var CHECK_FAILED = 'Generated an error!'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +/* + * All the following are invalid uses of regexp quantifiers and + * should generate SyntaxErrors. That's what we're testing for. + * + * To allow the test to compile and run, we have to hide the errors + * inside eval strings, and check they are caught at run-time - + * + */ +status = inSection(1); +testThis(' /a**/ '); + +status = inSection(2); +testThis(' /a***/ '); + +status = inSection(3); +testThis(' /a++/ '); + +status = inSection(4); +testThis(' /a+++/ '); + +/* + * The ? quantifier, unlike * or +, may appear twice in succession. + * Thus we need at least three in a row to provoke a SyntaxError - + */ + +status = inSection(5); +testThis(' /a???/ '); + +status = inSection(6); +testThis(' /a????/ '); + + +/* + * Now do some weird things on the left side of the regexps - + */ +status = inSection(7); +testThis(' /*a/ '); + +status = inSection(8); +testThis(' /**a/ '); + +status = inSection(9); +testThis(' /+a/ '); + +status = inSection(10); +testThis(' /++a/ '); + +status = inSection(11); +testThis(' /?a/ '); + +status = inSection(12); +testThis(' /??a/ '); + + +/* + * Misusing the {DecmalDigits} quantifier - according to ECMA, + * but not according to Perl. + * + * ECMA-262 Edition 3 prohibits the use of unescaped braces in + * regexp patterns, unless they form part of a quantifier. + * + * Hovever, Perl does not prohibit this. If not used as part + * of a quantifer, Perl treats braces literally. + * + * We decided to follow Perl on this for backward compatibility. + * See http://bugzilla.mozilla.org/show_bug.cgi?id=190685. + * + * Therefore NONE of the following ECMA violations should generate + * a SyntaxError. Note we use checkThis() instead of testThis(). + */ +status = inSection(13); +checkThis(' /a*{/ '); + +status = inSection(14); +checkThis(' /a{}/ '); + +status = inSection(15); +checkThis(' /{a/ '); + +status = inSection(16); +checkThis(' /}a/ '); + +status = inSection(17); +checkThis(' /x{abc}/ '); + +status = inSection(18); +checkThis(' /{{0}/ '); + +status = inSection(19); +checkThis(' /{{1}/ '); + +status = inSection(20); +checkThis(' /x{{0}/ '); + +status = inSection(21); +checkThis(' /x{{1}/ '); + +status = inSection(22); +checkThis(' /x{{0}}/ '); + +status = inSection(23); +checkThis(' /x{{1}}/ '); + +status = inSection(24); +checkThis(' /x{{0}}/ '); + +status = inSection(25); +checkThis(' /x{{1}}/ '); + +status = inSection(26); +checkThis(' /x{{0}}/ '); + +status = inSection(27); +checkThis(' /x{{1}}/ '); + + +/* + * Misusing the {DecmalDigits} quantifier - according to BOTH ECMA and Perl. + * + * Just as with the * and + quantifiers above, can't have two {DecmalDigits} + * quantifiers in succession - it's a SyntaxError. + */ +status = inSection(28); +testThis(' /x{1}{1}/ '); + +status = inSection(29); +testThis(' /x{1,}{1}/ '); + +status = inSection(30); +testThis(' /x{1,2}{1}/ '); + +status = inSection(31); +testThis(' /x{1}{1,}/ '); + +status = inSection(32); +testThis(' /x{1,}{1,}/ '); + +status = inSection(33); +testThis(' /x{1,2}{1,}/ '); + +status = inSection(34); +testThis(' /x{1}{1,2}/ '); + +status = inSection(35); +testThis(' /x{1,}{1,2}/ '); + +status = inSection(36); +testThis(' /x{1,2}{1,2}/ '); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +/* + * Invalid syntax should generate a SyntaxError + */ +function testThis(sInvalidSyntax) +{ + expect = TEST_PASSED; + actual = TEST_FAILED_BADLY; + + try + { + eval(sInvalidSyntax); + } + catch(e) + { + if (e instanceof SyntaxError) + actual = TEST_PASSED; + else + actual = TEST_FAILED; + } + + statusitems[UBound] = status; + expectedvalues[UBound] = expect; + actualvalues[UBound] = actual; + UBound++; +} + + +/* + * Allowed syntax shouldn't generate any errors + */ +function checkThis(sAllowedSyntax) +{ + expect = CHECK_PASSED; + actual = CHECK_PASSED; + + try + { + eval(sAllowedSyntax); + } + catch(e) + { + actual = CHECK_FAILED; + } + + statusitems[UBound] = status; + expectedvalues[UBound] = expect; + actualvalues[UBound] = actual; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-191479.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-191479.js new file mode 100644 index 0000000..a3d8b39 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-191479.js @@ -0,0 +1,193 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): flying@dom.natm.ru, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 31 January 2003 +* SUMMARY: Testing regular expressions of form /(x|y){n,}/ +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=191479 +* +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 191479; +var summary = 'Testing regular expressions of form /(x|y){n,}/'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +status = inSection(1); +string = '12 3 45'; +pattern = /(\d|\d\s){2,}/; +actualmatch = string.match(pattern); +expectedmatch = Array('12', '2'); +addThis(); + +status = inSection(2); +string = '12 3 45'; +pattern = /(\d|\d\s){4,}/; +actualmatch = string.match(pattern); +expectedmatch = Array(string, '5'); +addThis(); + +status = inSection(3); +string = '12 3 45'; +pattern = /(\d|\d\s)+/; +actualmatch = string.match(pattern); +expectedmatch = Array('12', '2'); +addThis(); + +status = inSection(4); +string = '12 3 45'; +pattern = /(\d\s?){4,}/; +actualmatch = string.match(pattern); +expectedmatch = Array(string, '5'); +addThis(); + +/* + * Let's reverse the operands in Sections 1-3 above - + */ +status = inSection(5); +string = '12 3 45'; +pattern = /(\d\s|\d){2,}/; +actualmatch = string.match(pattern); +expectedmatch = Array(string, '5'); +addThis(); + +status = inSection(6); +string = '12 3 45'; +pattern = /(\d\s|\d){4,}/; +actualmatch = string.match(pattern); +expectedmatch = Array(string, '5'); +addThis(); + +status = inSection(7); +string = '12 3 45'; +pattern = /(\d\s|\d)+/; +actualmatch = string.match(pattern); +expectedmatch = Array(string, '5'); +addThis(); + + +/* + * Let's take all 7 sections above and make each quantifer non-greedy. + * + * This is done by appending ? to it. It doesn't change the meaning of + * the quantifier, but makes it non-greedy, which affects the results - + */ +status = inSection(8); +string = '12 3 45'; +pattern = /(\d|\d\s){2,}?/; +actualmatch = string.match(pattern); +expectedmatch = Array('12', '2'); +addThis(); + +status = inSection(9); +string = '12 3 45'; +pattern = /(\d|\d\s){4,}?/; +actualmatch = string.match(pattern); +expectedmatch = Array('12 3 4', '4'); +addThis(); + +status = inSection(10); +string = '12 3 45'; +pattern = /(\d|\d\s)+?/; +actualmatch = string.match(pattern); +expectedmatch = Array('1', '1'); +addThis(); + +status = inSection(11); +string = '12 3 45'; +pattern = /(\d\s?){4,}?/; +actualmatch = string.match(pattern); +expectedmatch = Array('12 3 4', '4'); +addThis(); + +status = inSection(12); +string = '12 3 45'; +pattern = /(\d\s|\d){2,}?/; +actualmatch = string.match(pattern); +expectedmatch = Array('12 ', '2 '); +addThis(); + +status = inSection(13); +string = '12 3 45'; +pattern = /(\d\s|\d){4,}?/; +actualmatch = string.match(pattern); +expectedmatch = Array('12 3 4', '4'); +addThis(); + +status = inSection(14); +string = '12 3 45'; +pattern = /(\d\s|\d)+?/; +actualmatch = string.match(pattern); +expectedmatch = Array('1', '1'); +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-202564.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-202564.js new file mode 100644 index 0000000..14722c3 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-202564.js @@ -0,0 +1,96 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): drbrain-bugzilla@segment7.net, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 18 April 2003 +* SUMMARY: Testing regexp with many backreferences +* See http://bugzilla.mozilla.org/show_bug.cgi?id=202564 +* +* Note that in Section 1 below, we expect the 1st and 4th backreferences +* to hold |undefined| instead of the empty strings one gets in Perl and IE6. +* This is because per ECMA, regexp backreferences must hold |undefined| +* if not used. See http://bugzilla.mozilla.org/show_bug.cgi?id=123437. +* +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 202564; +var summary = 'Testing regexp with many backreferences'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +status = inSection(1); +string = 'Seattle, WA to Buckley, WA'; +pattern = /(?:(.+), )?(.+), (..) to (?:(.+), )?(.+), (..)/; +actualmatch = string.match(pattern); +expectedmatch = Array(string, undefined, "Seattle", "WA", undefined, "Buckley", "WA"); +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-209067.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-209067.js new file mode 100644 index 0000000..ba4c1e1 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-209067.js @@ -0,0 +1,1101 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 12 June 2003 +* SUMMARY: Testing complicated str.replace() +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=209067 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 209067; +var summary = 'Testing complicated str.replace()'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +function formatHTML(h) +{ + // a replace function used in the succeeding lines - + function S(s) + { + return s.replace(/</g,'<').replace(/>/g,'>'); + } + + h+='\n'; + h=h.replace(/&([^\s]+;)/g,'<&$1>'); + h=h.replace(new RegExp('<!-'+'-[\\s\\S]*-'+'->','g'), S); + h=h.replace(/"[^"]*"/g,S); + h=h.replace(/'[^']*'/g,S); + + + h=h.replace(/<([^>]*)>/g, + function(s,p) + { + if(s.match(/!doctype/i)) + return'<span class=doctype><' + p + '></span>'; + + p=p.replace(/\\'/g,'\\'').replace(/\\"/g,'\\"').replace(/^\s/,''); + p=p.replace(/(\s)([^<]+)$/g, + function(s,p1,p2) + { + p2=p2.replace(/(=)(\s*[^"'][^\s]*)(\s|$)/g,'$1<span class=attribute-value>$2</span>$3'); + p2=p2.replace(/("[^"]*")/g,'<span class=attribute-value>$1</span>'); + p2=p2.replace(/('[^']*')/g,'<span class=attribute-value>$1</span>'); + return p1 + '<span class=attribute-name>'+p2+'</span>'; + } + ) + + return'<<span class=' + (s.match(/<\s*\//)?'end-tag':'start-tag') + '>' + p + '</span>>'; + } + ) + + + h=h.replace(/<(&[^\s]+;)>/g,'<span class=entity>$1</span>'); + h=h.replace(/(<!--[\s\S]*-->)/g,'<span class=comment>$1</span>'); + + + numer=1; + h=h.replace(/(.*\n)/g, + function(s,p) + { + return (numer++) +'. ' + p; + } + ) + + + return'<span class=text>' + h + '</span>'; +} + + + +/* + * sanity check + */ +status = inSection(1); +actual = formatHTML('abc'); +expect = '<span class=text>1. abc\n</span>'; +addThis(); + + +/* + * The real test: can we run this without crashing? + * We are not validating the result, just running it. + */ +status = inSection(2); +var HUGE_TEST_STRING = hugeString(); +formatHTML(HUGE_TEST_STRING); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} + + +function hugeString() +{ +var s = ''; + +s += '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'; +s += '<html lang="en">'; +s += '<head>'; +s += ' <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">'; +s += ' <meta http-equiv="refresh" content="1800">'; +s += ' <title>CNN.com</title>'; +s += ' <link rel="Start" href="/">'; +s += ' <link rel="Search" href="/search/">'; +s += ' <link rel="stylesheet" href="http://i.cnn.net/cnn/.element/ssi/css/1.0/main.css" type="text/css">'; +s += ' <script language="JavaScript1.2" src="http://i.cnn.net/cnn/.element/ssi/js/1.0/main.js" type="text/javascript"></script>'; +s += '<script language="JavaScript1.1" src="http://ar.atwola.com/file/adsWrapper.js"></script>'; +s += '<style type="text/css">'; +s += '<!--'; +s += '.aoltextad { text-align: justify; font-size: 12px; color: black; font-family: Georgia, sans-serif }'; +s += '-->'; +s += '</style>'; +s += '<script language="JavaScript1.1" type="text/javascript" src="http://ar.atwola.com/file/adsPopup2.js"></script>'; +s += '<script language="JavaScript">'; +s += 'document.adoffset = 0;'; +s += 'document.adPopupDomain = "www.cnn.com";'; +s += 'document.adPopupFile = "/cnn_adspaces/adsPopup2.html";'; +s += 'document.adPopupInterval = "P24";'; +s += 'document.adPopunderInterval = "P24";'; +s += 'adSetOther("&TVAR="+escape("class=us.low"));'; +s += '</script>'; +s += ''; +s += ' '; +s += '</head>'; +s += '<body class="cnnMainPage">'; +s += ''; +s += ''; +s += ''; +s += '<a name="top_of_page"></a>'; +s += '<a href="#ContentArea"><img src="http://i.cnn.net/cnn/images/1.gif" alt="Click here to skip to main content." width="10" height="1" border="0" align="right"></a>'; +s += '<table width="770" border="0" cellpadding="0" cellspacing="0" style="speak: none">'; +s += ' <col width="229">'; +s += ' <col width="73">'; +s += ' <col width="468">'; +s += ' <tr>'; +s += ' <td colspan="3"><!--'; +s += '[[!~~ netscape hat ~~]][[table border="0" cellpadding="0" cellspacing="0" width="100%"]][[tr]][[td]][[script Language="Javascript" SRC="http://toolbar.aol.com/dashboard.twhat?dom=cnn" type="text/javascript"]][[/script]][[/td]][[/tr]][[/table]]'; +s += ''; +s += '[[div]][[img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="2" border="0"]][[/div]]'; +s += '-->'; +s += ' </td>'; +s += ' </tr>'; +s += ' <tr valign="bottom">'; +s += ' <td width="229" style="speak: normal"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/logo/cnn.gif" alt="CNN.com" width="229" height="52" border="0"></td>'; +s += ' <td width="73"></td>'; +s += ' <td width="468" align="right">'; +s += ' <!-- home/bottom.468x60 -->'; +s += '<script language="JavaScript1.1">'; +s += '<!--'; +s += 'adSetTarget("_top");'; +s += 'htmlAdWH( (new Array(93103287,93103287,93103300,93103300))[document.adoffset||0] , 468, 60);'; +s += '//-->'; +s += '</script>'; +s += '<noscript><a href="http://ar.atwola.com/link/93103287/aol" target="_top"><img src="http://ar.atwola.com/image/93103287/aol" alt="Click Here" width="468" height="60" border="0"></a></noscript> '; +s += ''; +s += ''; +s += ''; +s += ''; +s += ' </td>'; +s += ' </tr>'; +s += ' <tr><td colspan="3"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="2"></td></tr>'; +s += ' <tr>'; +s += ' <td colspan="3">'; +s += '</td>'; +s += ' </tr>'; +s += ' <tr><td colspan="3" bgcolor="#CC0000"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="3"></td></tr>'; +s += ' <tr>'; +s += ' <td colspan="3">'; +s += ''; +s += '<table width="770" border="0" cellpadding="0" cellspacing="0">'; +s += ' <form action="http://search.cnn.com/cnn/search" method="get" onsubmit="return CNN_validateSearchForm(this);">'; +s += '<input type="hidden" name="source" value="cnn">'; +s += '<input type="hidden" name="invocationType" value="search/top">'; +s += ' <tr><td colspan="4"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="1" border="0"></td></tr>'; +s += ' <tr><td colspan="4" bgcolor="#003366"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="3" border="0"></td></tr>'; +s += ' <tr>'; +s += ' <td rowspan="2"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/searchbar/bar.search.gif" alt="SEARCH" width="110" height="27" border="0"></td>'; +s += ' <td colspan="2"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/searchbar/bar.top.bevel.gif" alt="" width="653" height="3" border="0"></td>'; +s += ' <td rowspan="2"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/searchbar/bar.right.bevel.gif" alt="" width="7" height="27" border="0"></td>'; +s += ' </tr>'; +s += ' <tr bgcolor="#B6D8E0">'; +s += ' <td><table border="0" cellpadding="0" cellspacing="0">'; +s += ' <tr>'; +s += ' <td> </td>'; +s += ' <td nowrap><span class="cnnFormTextB" style="color:#369">The Web</span></td>'; +s += ' <td><input type="radio" name="sites" value="google" checked></td>'; +s += ' <td> </td>'; +s += ' <td><span class="cnnFormTextB" style="color:#369;">CNN.com</span></td>'; +s += ' <td><input type="radio" name="sites" value="cnn"></td>'; +s += ' <td> </td>'; +s += ' <td><input type="text" name="query" class="cnnFormText" value="" title="Enter text to search for and click Search" size="35" maxlength="40" style="width: 280px"></td>'; +s += ' <td> <input type="Submit" value="Search" class="cnnNavButton" style="padding: 0px; margin: 0px; width: 50px"></td>'; +s += ' </tr>'; +s += ' </table></td>'; +s += ' <td align="right"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/searchbar/bar.google.gif" alt="enhanced by Google" width="137" height="24" border="0"></td>'; +s += ' </tr>'; +s += ' <tr><td colspan="4"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/searchbar/bar.bottom.bevel.gif" alt="" width="770" height="3" border="0"></td></tr>'; +s += ' </form>'; +s += '</table>'; +s += ' </td>'; +s += ' </tr>'; +s += ''; +s += ''; +s += '</table>'; +s += ''; +s += '<table width="770" border="0" cellpadding="0" cellspacing="0">'; +s += ' <col width="126" align="left" valign="top">'; +s += ' <col width="10">'; +s += ' <col width="280">'; +s += ' <col width="10">'; +s += ' <col width="344">'; +s += ' <tr valign="top">'; +s += ' <td rowspan="5" width="126" style="speak: none"><table id="cnnNavBar" width="126" bgcolor="#EEEEEE" border="0" cellpadding="0" cellspacing="0" summary="CNN.com Navigation">'; +s += ' <col width="8" align="left" valign="top">'; +s += ' <col width="118" align="left" valign="top">'; +s += ' <tr bgcolor="#CCCCCC" class="cnnNavHiliteRow"><td width="8" class="swath"> </td>'; +s += ' <td class="cnnNavHilite" onClick="CNN_goTo("/")"><div class="cnnNavText"><a href="/">Home Page</a></div></td></tr>'; +s += ' <tr class="cnnNavRow"><td class="swath"> </td>'; +s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/WORLD/")"><div class="cnnNavText"><a href="/WORLD/">World</a></div></td></tr>'; +s += ' <tr class="cnnNavRow"><td class="swath"> </td>'; +s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/US/")"><div class="cnnNavText"><a href="/US/">U.S.</a></div></td></tr>'; +s += ' <tr class="cnnNavRow"><td class="swath"> </td>'; +s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/WEATHER/")"><div class="cnnNavText"><a href="/WEATHER/">Weather</a></div></td></tr>'; +s += ' <tr class="cnnNavRow"><td class="swath"> </td>'; +s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/money/")"><div class="cnnNavText"><a href="/money/">Business</a> <a href="/money/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/nav_at_money.gif" alt="at CNN/Money" width="51" height="5" border="0"></a></div></td></tr>'; +s += ' <tr class="cnnNavRow"><td class="swath"> </td>'; +s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/cnnsi/")"><div class="cnnNavText"><a href="/si/">Sports</a> <a href="/si/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/nav_at_si.gif" alt="at SI.com" width="50" height="5" border="0"></a></div></td></tr>'; +s += ' <tr class="cnnNavRow"><td class="swath"> </td>'; +s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/ALLPOLITICS/")"><div class="cnnNavText"><a href="/ALLPOLITICS/">Politics</a></div></td></tr>'; +s += ' <tr class="cnnNavRow"><td class="swath"> </td>'; +s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/LAW/")"><div class="cnnNavText"><a href="/LAW/">Law</a></div></td></tr>'; +s += ' <tr class="cnnNavRow"><td class="swath"> </td>'; +s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/TECH/")"><div class="cnnNavText"><a href="/TECH/">Technology</a></div></td></tr>'; +s += ' <tr class="cnnNavRow"><td class="swath"> </td>'; +s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/TECH/space/")"><div class="cnnNavText"><a href="/TECH/space/">Science & Space</a></div></td></tr>'; +s += ' <tr class="cnnNavRow"><td class="swath"> </td>'; +s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/HEALTH/")"><div class="cnnNavText"><a href="/HEALTH/">Health</a></div></td></tr>'; +s += ' <tr class="cnnNavRow"><td class="swath"> </td>'; +s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/SHOWBIZ/")"><div class="cnnNavText"><a href="/SHOWBIZ/">Entertainment</a></div></td></tr>'; +s += ' <tr class="cnnNavRow"><td class="swath"> </td>'; +s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/TRAVEL/")"><div class="cnnNavText"><a href="/TRAVEL/">Travel</a></div></td></tr>'; +s += ' <tr class="cnnNavRow"><td class="swath"> </td>'; +s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/EDUCATION/")"><div class="cnnNavText"><a href="/EDUCATION/">Education</a></div></td></tr>'; +s += ' <tr class="cnnNavRow"><td class="swath"> </td>'; +s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/SPECIALS/")"><div class="cnnNavText"><a href="/SPECIALS/">Special Reports</a></div></td></tr>'; +s += ' <tr bgcolor="#FFFFFF"><td class="cnnNavAd" colspan="2" align="center"><!-- home/left.120x90 -->'; +s += '<script language="JavaScript1.1">'; +s += '<!--'; +s += 'adSetTarget("_top");'; +s += 'htmlAdWH( (new Array(93166917,93166917,93170132,93170132))[document.adoffset||0] , 120, 90);'; +s += '//-->'; +s += '</script><noscript><a href="http://ar.atwola.com/link/93166917/aol" target="_top"><img src="http://ar.atwola.com/image/93166917/aol" alt="Click here for our advertiser" width="120" height="90" border="0"></a></noscript></td></tr>'; +s += ' <tr bgcolor="#999999" class="cnnNavGroupRow">'; +s += ' <td colspan="2" class="cnnNavGroup"><div class="cnnNavText">SERVICES</div></td></tr>'; +s += ' <tr class="cnnNavOtherRow"><td class="swath"> </td>'; +s += ' <td class="cnnNavOther" onMouseOver="CNN_navBar(this,1,0)" onMouseOut="CNN_navBar(this,0,0)" onClick="CNN_navBarClick(this,0,"/video/")"><div class="cnnNavText"><a href="/video/">Video</a></div></td></tr>'; +s += ' <tr class="cnnNavOtherRow"><td class="swath"> </td>'; +s += ' <td class="cnnNavOther" onMouseOver="CNN_navBar(this,1,0)" onMouseOut="CNN_navBar(this,0,0)" onClick="CNN_navBarClick(this,0,"/EMAIL/")"><div class="cnnNavText"><a href="/EMAIL/">E-Mail Services</a></div></td></tr>'; +s += ' <tr class="cnnNavOtherRow"><td class="swath"> </td>'; +s += ' <td class="cnnNavOther" onMouseOver="CNN_navBar(this,1,0)" onMouseOut="CNN_navBar(this,0,0)" onClick="CNN_navBarClick(this,0,"/mobile/CNNtoGO/")"><div class="cnnNavText"><a href="/mobile/CNNtoGO/">CNN To Go</a></div></td></tr>'; +s += ' <tr bgcolor="#999999" class="cnnNavGroupRow">'; +s += ' <td colspan="2" class="cnnNavGroup" style="background-color: #445B60"><div class="cnnNavText" style="color: #fff">SEARCH</div></td></tr>'; +s += ' <tr bgcolor="#CCCCCC"><td colspan="2" class="cnnNavSearch" style="background-color:#B6D8E0">'; +s += ''; +s += '<form action="http://search.cnn.com/cnn/search" method="get" name="nav_bottom_search" onSubmit="return CNN_validateSearchForm(this)" style="margin: 0px;">'; +s += ' <input type="hidden" name="sites" value="cnn">'; +s += ' <input type="hidden" name="source" value="cnn">'; +s += ' <input type="hidden" name="invocationType" value="side/bottom">'; +s += '<table width="100%" border="0" cellpadding="0" cellspacing="4">'; +s += ' <tr><td colspan="2"><table width="100%" border="0" cellpadding="0" cellspacing="0">'; +s += ' <tr>'; +s += ' <td align="left"><span class="cnnFormTextB" style="color: #369">Web</span></td>'; +s += ' <td><input type="radio" name="sites" value="google" checked></td>'; +s += ' <td align="right"><span class="cnnFormTextB" style="color: #369">CNN.com</span></td>'; +s += ' <td><input type="radio" name="sites" value="cnn"></td>'; +s += ' </tr>'; +s += ' </table></td></tr>'; +s += ' <tr><td colspan="2"><input type="text" name="query" class="cnnFormText" value="" title="Enter text to search for and click Search" size="7" maxlength="40" style="width: 100%"></td></tr>'; +s += ' <tr valign="top">'; +s += ' <td><input type="submit" value="Search" class="cnnNavButton" style="padding: 0px; margin: 0px; width: 50px"></td>'; +s += ' <td align="right"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/sect/SEARCH/nav.search.gif" alt="enhanced by Google" width="54" height="27"></td>'; +s += ' </tr>'; +s += '</table>'; +s += ''; +s += ''; +s += ''; +s += '</td></form></tr>'; +s += '</table>'; +s += ''; +s += ' </td>'; +s += ' <td rowspan="5" width="10"><a name="ContentArea"></a><img id="accessibilityPixel" src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="7" border="0"></td>'; +s += ' <td colspan="3" valign="middle">'; +s += ' <table border="0" cellpadding="0" cellspacing="0" width="100%">'; +s += ' <tr>'; +s += ' <td valign="top" nowrap><div class="cnnFinePrint" style="color: #333;padding:6px;padding-left:0px;">Updated: 05:53 p.m. EDT (2153 GMT) June 12, 2003</div></td>'; +s += ' <td align="right" nowrap class="cnnt1link"><a href="http://edition.cnn.com/">Visit International Edition</a> </td>'; +s += ' </tr><!--include virtual="/.element/ssi/sect/MAIN/1.0/banner.html"-->'; +s += ' </table>'; +s += ' </td>'; +s += ' </tr>'; +s += ' <tr valign="top">'; +s += ' <td rowspan="2" width="280" bgcolor="#EAEFF4">'; +s += ''; +s += '<!-- T1 -->'; +s += ' '; +s += ' <a href="/2003/SHOWBIZ/Movies/06/12/obit.peck/index.html"><img src="http://i.cnn.net/cnn/2003/SHOWBIZ/Movies/06/12/obit.peck/top.peck.obit.jpg" alt="Oscar-winner Peck dies" width="280" height="210" border="0" hspace="0" vspace="0"></a>'; +s += ''; +s += ' <div class="cnnMainT1">'; +s += ' <h2 style="font-size:20px;"><a href="/2003/SHOWBIZ/Movies/06/12/obit.peck/index.html">Oscar-winner Peck dies</a></h2>'; +s += '<p>'; +s += 'Actor Gregory Peck, who won an Oscar for his portrayal of upstanding lawyer Atticus Finch in 1962s "To Kill a Mockingbird," has died at age 87. Peck was best known for roles of dignified statesmen and people who followed a strong code of ethics. But he also could play against type. All told, Peck was nominated for five Academy Awards.'; +s += '</p>'; +s += ' <p>'; +s += ' <b><a href="/2003/SHOWBIZ/Movies/06/12/obit.peck/index.html" class="cnnt1link">FULL STORY</a></b>'; +s += ' </p>'; +s += ''; +s += ''; +s += ''; +s += '• <span class="cnnBodyText" style="font-weight:bold;color:#333;">Video: </span><img src="http://i.cnn.net/cnn/.element/img/1.0/misc/premium.gif" alt="premium content" width="9" height="11" hspace="0" vspace="0" border="0" align="absmiddle"> <a href="javascript:LaunchVideo("/showbiz/2003/06/12/peck.obit.affl.","300k");">A leading mans leading man</a><br>'; +s += ''; +s += ''; +s += ''; +s += ' '; +s += '• <span class="cnnBodyText" style="font-weight:bold;color:#333">Interactive: </span> <a href="javascript:CNN_openPopup("/interactive/entertainment/0306/peck.obit/frameset.exclude.html","620x430","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=620,height=430")">Gregory Peck through the years</a><br>'; +s += ''; +s += ' '; +s += '• <a href="http://www.cnn.com/2003/SHOWBIZ/Movies/06/12/peck.filmography/index.html" target="new">Gregory Peck filmography</a><img src="http://i.cnn.net/cnn/.element/img/1.0/misc/icon.external.links.gif" alt="external link" width="20" height="13" vspace="1" hspace="4" border="0" align="top"><br>'; +s += ''; +s += ' '; +s += '• <a href="http://www.cnn.com/2003/SHOWBIZ/Movies/06/04/heroes.villains.ap/index.html" target="new">Pecks Finch chararcter AFIs top hero</a><img src="http://i.cnn.net/cnn/.element/img/1.0/misc/icon.external.links.gif" alt="external link" width="20" height="13" vspace="1" hspace="4" border="0" align="top"><br>'; +s += ' </div>'; +s += ''; +s += '<!-- /T1 -->'; +s += ' </td>'; +s += ' '; +s += ' <td rowspan="2" width="10"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="10" height="1"></td>'; +s += ' <td width="344">'; +s += ''; +s += ''; +s += ''; +s += ''; +s += '<!-- T2 -->'; +s += ''; +s += '<div><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/px_c00.gif" alt="" width="344" height="2"></div>'; +s += '<table width="344" border="0" cellpadding="0" cellspacing="0">'; +s += ' <tr>'; +s += ' <td width="285" class="cnnTabbedBoxHeader" style="padding-left:0px;"><span class="cnnBigPrint"><b>MORE TOP STORIES</b></span></td>'; +s += ' <td width="59" class="cnnTabbedBoxTab" align="right" bgcolor="#336699"><a href="/userpicks"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/userpicks.gif" alt=" Hot Stories " width="59" height="11" border="0"></a></td>'; +s += ' </tr>'; +s += '</table>'; +s += '<div style="padding:6px;padding-left:0px;">'; +s += ''; +s += ' '; +s += '<div class="cnnMainNewT2">• <a href="/2003/WORLD/meast/06/12/mideast/index.html">7 dead in new Gaza strike</a>'; +s += '| <img src="http://i.cnn.net/cnn/.element/img/1.0/misc/premium.gif" alt="premium content" width="9" height="11" hspace="0" vspace="0" border="0" align="absmiddle"> <a href="javascript:LaunchVideo("/world/2003/06/11/cb.bush.roadmap.ap.","300k");">Video</a><br></div>'; +s += ''; +s += ' '; +s += '<div class="cnnMainNewT2">• <a href="/2003/WORLD/meast/06/12/sprj.irq.main/index.html">U.S. helicopter, jet down in Iraqi raid</a>'; +s += '| <img src="http://i.cnn.net/cnn/.element/img/1.0/misc/premium.gif" alt="premium content" width="9" height="11" hspace="0" vspace="0" border="0" align="absmiddle"> <a href="javascript:LaunchVideo("/iraq/2003/06/11/bw.iraq.oil.cnn.","300k");">Video</a><br></div>'; +s += ''; +s += ' '; +s += '<div class="cnnMainNewT2">• <a href="/2003/SHOWBIZ/TV/06/12/obit.brinkley/index.html">Television icon David Brinkley dead at 82</a><br></div>'; +s += ''; +s += ' '; +s += '<div class="cnnMainNewT2">• <a href="/2003/LAW/06/12/peterson.case/index.html">Peterson search warrants will be made public in July</a><br></div>'; +s += ''; +s += ' '; +s += '<div class="cnnMainNewT2">• <a href="/2003/WORLD/asiapcf/east/06/12/okinawa.rape/index.html">U.S. Marine held in new Okinawa rape case</a><br></div>'; +s += ''; +s += ' '; +s += '<div class="cnnMainNewT2">• <a href="/2003/TECH/space/06/12/sprj.colu.bolts.ap/index.html">New threat discovered for shuttle launches</a><br></div>'; +s += ''; +s += ' '; +s += '<div class="cnnMainNewT2">• <a href="/2003/SHOWBIZ/TV/06/12/television.sopranos.reut/index.html">"Soprano" Gandolfini shares his wealth with castmates</a><br></div>'; +s += '<!--[[div class="cnnMainNewT2"]]• [[b]][[span style="color:#C00;"]]CNN[[/span]]Radio:[[/b]] [[a href="javascript:CNN_openPopup("/audio/radio/preferences.html","radioplayer","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=200,height=124")"]]Bush on Medicare[[/a]] [[a href="javascript:CNN_openPopup("/audio/radio/preferences.html","radioplayer","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=200,height=124")"]][[img src="http://i.a.cnn.net/cnn/.element/img/1.0/misc/live.video.gif" alt="" width="61" height="14" vspace="0" hspace="2" align="absmiddle" border="0"]][[/a]][[img src="http://i.a.cnn.net/cnn/.element/img/1.0/misc/audio.gif" alt="" width="10" height="10" vspace="0" hspace="2" align="absmiddle"]][[br]][[/div]]--></div>'; +s += ''; +s += '<!-- /T2 -->'; +s += '<div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="10"></div>'; +s += ''; +s += '<!--include virtual="/.element/ssi/misc/1.0/war.zone.smmap.txt"-->'; +s += '<!-- =========== CNN Radio/Video Box =========== -->'; +s += '<!-- top line --> '; +s += '<div><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/px_ccc.gif" alt="" width="344" height="1"></div>'; +s += '<!-- /top line -->'; +s += ' <table width="344" border="0" cellpadding="0" cellspacing="0">'; +s += ' <tr valign="top">'; +s += '<!-- left-side line --> '; +s += ' <td bgcolor="#CCCCCC" width="1"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="30" hspace="0" vspace="0" border="0"></td>'; +s += '<!-- /left-side line --> '; +s += '<!-- CNNRadio cell -->'; +s += ' <td width="114"><div class="cnn6pxPad">'; +s += ' <span class="cnnBigPrint" style="color:#C00;font-weight:bold;">CNN</span><span class="cnnBigPrint" style="color:#000;font-weight:bold;">RADIO</span>'; +s += '<div class="cnnMainNewT2"><a href="javascript:CNN_openPopup("/audio/radio/preferences.html","radioplayer","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=200,height=124")">Listen to latest updates</a><img src="http://i.a.cnn.net/cnn/.element/img/1.0/misc/audio.gif" alt="" width="10" height="10" vspace="0" hspace="2" align="absmiddle">'; +s += '<div><img src="http://i.a.cnn.net/cnn/images/1.gif" alt="" width="1" height="5" hspace="0" vspace="0"></div>'; +s += '<!--'; +s += '[[span class="cnnFinePrint"]]sponsored by:[[/span]][[br]][[center]]'; +s += '[[!~~#include virtual="/cnn_adspaces/home/war_in_iraq/sponsor.88x31.ad"~~]]'; +s += ' [[/center]]'; +s += '-->'; +s += ' </div></td>'; +s += '<!-- /CNNRadio cell --> '; +s += '<!-- center line --> '; +s += ' <td bgcolor="#CCCCCC" width="1"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="1" hspace="0" vspace="0" border="0"></td>'; +s += '<!-- /center line --> '; +s += '<!-- video cell --> '; +s += ' <td width="227"><div class="cnn6pxPad">'; +s += '<!-- video box --> '; +s += '<table width="215" border="0" cellpadding="0" cellspacing="0">'; +s += ' <tr valign="top">'; +s += ' <td width="144"><span class="cnnBigPrint" style="font-weight:bold;">VIDEO</span></td>'; +s += ' <td width="6"><img src="http://i.a.cnn.net/cnn/images/1.gif" alt="" width="6" height="1" hspace="0" vspace="0"></td>'; +s += ' <td width="65"><a href="/video/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/more.video.blue.gif" alt="MORE VIDEO" width="62" height="11" hspace="0" vspace="0" border="0"></a></td></tr>'; +s += ' <tr>'; +s += ' <td width="215" colspan="3"><img src="http://i.a.cnn.net/cnn/images/1.gif" alt="" width="1" height="2" hspace="0" vspace="0"></td></tr>'; +s += ' <tr valign="top">'; +s += ' <td><div class="cnnBodyText">'; +s += ' Soldier broke dozens of hearts over e-mail<br>'; +s += ' <img src="http://i.a.cnn.net/cnn/images/icons/premium.gif" align="middle" alt="premium content" width="9" height="11" hspace="0" vspace="1" border="0"> <a href="javascript:LaunchVideo("/offbeat/2003/06/12/ms.casanova.col.ap.","300k");" class="cnnVideoLink">PLAY VIDEO</a></div>'; +s += ' </td>'; +s += '<td width="3"><img src="http://i.a.cnn.net/cnn/images/1.gif" alt="" width="3" height="1" hspace="0" vspace="0"></td> '; +s += ' <td width="65" align="right">'; +s += ' <a href="javascript:LaunchVideo("/offbeat/2003/06/12/ms.casanova.col.ap.","300k");"><img src="http://i.cnn.net/cnn/video/offbeat/2003/06/12/ms.casanova.col.vs.kndu.jpg" alt="" width="65" height="49" border="0" vspace="2" hspace="0"></a>'; +s += ' </td></tr>'; +s += '</table>'; +s += ' <!-- /video box --> '; +s += ' </div></td>'; +s += '<!-- /video cell --> '; +s += '<!-- right-side line --> '; +s += '<td bgcolor="#CCCCCC" width="1"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="1" hspace="0" vspace="0" border="0"></td>'; +s += '<!-- /right-side line --> '; +s += ' </tr>'; +s += ' </table>'; +s += ''; +s += '<!-- bottom line -->'; +s += '<div><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/px_ccc.gif" alt="" width="344" height="1"></div>'; +s += '<!-- /bottom line -->'; +s += '<!-- =========== /CNN Radio/Video Box =========== -->'; +s += ''; +s += '<div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="10"></div>'; +s += '<div><img src="http://i.cnn.net/cnn/.element/img/1.0/main/px_c00.gif" alt="" width="344" height="2"></div>'; +s += '<table width="344" border="0" cellpadding="0" cellspacing="0">'; +s += ' <tr>'; +s += ' <td width="260" class="cnnTabbedBoxHeader" style="padding-left:0px;"><span class="cnnBigPrint"><b>ON THE SCENE</b></span></td>'; +s += ' <td width="84" class="cnnTabbedBoxTab" align="right" bgcolor="#336699" style="padding: 0px 3px;"><a href="/LAW/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/superlinks/law.gif" alt="more reports" height="11" border="0" hspace="2" vspace="2" align="right"></a></td>'; +s += ' </tr>'; +s += '</table>'; +s += ''; +s += '<table width="344" border="0" cellpadding="5" cellspacing="0">'; +s += ' <tr valign="top">'; +s += ' <td style="padding-left:0px;"> <b>Jeffrey Toobin:</b> "It takes guts" for Peterson defense to subpoena judge over wiretap issue.'; +s += '<a href="/2003/LAW/06/12/otsc.toobin/index.html">Full Story</a></td>'; +s += ''; +s += '<td width="65" align="right" style="padding-left:6px;"><a href="/2003/LAW/06/12/otsc.toobin/index.html"><img src="http://i.cnn.net/cnn/2003/LAW/06/12/otsc.toobin/tz.toobin.jpg" alt="image" width="65" height="49" border="0" hspace="0" vspace="0"></a></td>'; +s += ' </tr>'; +s += '</table>'; +s += '<div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="10"></div>'; +s += ' </td>'; +s += ' </tr>'; +s += ' <tr valign="bottom">'; +s += ' <td>'; +s += '<table width="344" border="0" cellpadding="0" cellspacing="0">'; +s += ' <tr>'; +s += ' <td width="267" nowrap style="color: #c00; padding-left: 6px"><span class="cnnBigPrint" style="vertical-align: top"><b>BUSINESS</b></span>'; +s += ' <a href="/money/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/at_cnnmoney.gif" alt=" at CNN/Money " width="100" height="15" border="0"></a></td>'; +s += ' <td width="77" align="right"><a href="/money/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/business.news.blue.gif" alt=" Business News " width="77" height="11" border="0"></a></td>'; +s += ' </tr>'; +s += '</table>'; +s += ''; +s += '<table width="344" bgcolor="#EEEEEE" border="0" cellpadding="0" cellspacing="0" style="border: solid 1px #ddd">'; +s += ' <tr valign="top">'; +s += ' <td>'; +s += ' <table width="100%" border="0" cellpadding="0" cellspacing="4">'; +s += ' <tr>'; +s += ' <td colspan="3"><span class="cnnMenuText"><b>STOCK/FUND QUOTES: </b></span></td>'; +s += ' </tr><form action="http://qs.money.cnn.com/tq/stockquote" method="get" style="margin: 0px;">'; +s += ' <tr>'; +s += ' <td><span class="cnnFinePrint">enter symbol</span></td>'; +s += ' <td><input type="text" name="symbols" size="7" maxlength="40" class="cnnMenuText" title="Enter stock/fund symbol or name to get a quote"></td>'; +s += ' <td><input type="submit" value="GET" class="cnnNavButton"></td>'; +s += ' </tr></form>'; +s += ' </table>'; +s += ' <table width="100%" border="0" cellpadding="0" cellspacing="4">'; +s += ' <tr valign="top">'; +s += ' <td><span class="cnnFinePrint">sponsored by:</span></td>'; +s += ' <td align="right"><!--<a href="/money/news/specials/rebuild_iraq/"><img src="http://i.a.cnn.net/cnn/2003/images/04/17/money.box.gif" ALT="" width="150" height="31" HSPACE="0" VSPACE="0" border="0" align="left"></a>--><a href="http://ar.atwola.com/link/93103306/aol"><img src="http://ar.atwola.com/image/93103306/aol" alt="Click Here" width="88" height="31" border="0" hspace="0" vspace="0"></a></td>'; +s += ' </tr>'; +s += ' </table>'; +s += ' </td>'; +s += ' <td class="cnnMainMarketBox"> <table width="100%" border="0" cellpadding="4" cellspacing="0" summary="Market data from CNNmoney">'; +s += ' <tr class="noBottomBorder">'; +s += ' <td colspan="5"><span class="cnnMainMarketCell"><span class="cnnMenuText"><b><a href="/money/markets/">MARKETS:</a></b></span> <!-- 16:30:15 -->'; +s += ''; +s += '4:30pm ET, 6/12</span></td>'; +s += ' </tr>'; +s += ' <tr class="noTopBorder">'; +s += ' <td><span class="cnnMainMarketCell"><a href="/money/markets/dow.html" title="Dow Jones Industrial Average">DJIA</a></span></td>'; +s += ' <td><img src="http://i.cnn.net/cnn/.element/img/1.0/main/arrow_up.gif" alt="" width="9" height="9"></td>'; +s += ' <td align="right" nowrap><span class="cnnMainMarketCell">+13.30</span></td>'; +s += ' <td align="right" nowrap><span class="cnnMainMarketCell">9196.50</span></td>'; +s += ' <td align="right" nowrap><span class="cnnMainMarketCell">+ 0.14%</span></td>'; +s += ''; +s += ' </tr>'; +s += ' <tr>'; +s += ' <td><span class="cnnMainMarketCell"><a href="/money/markets/nasdaq.html" title="NASDAQ">NAS</a></span></td>'; +s += ' <td><img src="http://i.cnn.net/cnn/.element/img/1.0/main/arrow_up.gif" alt="" width="9" height="9"></td>'; +s += ' <td align="right" nowrap><span class="cnnMainMarketCell">+ 7.60</span></td>'; +s += ' <td align="right" nowrap><span class="cnnMainMarketCell">1653.62</span></td>'; +s += ' <td align="right" nowrap><span class="cnnMainMarketCell">+ 0.46%</span></td>'; +s += ''; +s += ' </tr>'; +s += ' <tr class="noBottomBorder">'; +s += ' <td><span class="cnnMainMarketCell"><a href="/money/markets/sandp.html" title="S&P 500">S&P</a></span></td>'; +s += ' <td><img src="http://i.cnn.net/cnn/.element/img/1.0/main/arrow_up.gif" alt="" width="9" height="9"></td>'; +s += ' <td align="right" nowrap><span class="cnnMainMarketCell">+ 1.03</span></td>'; +s += ' <td align="right" nowrap><span class="cnnMainMarketCell">998.51</span></td>'; +s += ' <td align="right" nowrap><span class="cnnMainMarketCell">+ 0.10%</span></td>'; +s += ''; +s += ' </tr>'; +s += ' </table>'; +s += '</td>'; +s += ' </tr>'; +s += '</table>'; +s += ''; +s += '</td>'; +s += ' </tr>'; +s += ' <tr>'; +s += ' <td colspan="3"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="4"></td>'; +s += ' </tr>'; +s += ' <tr align="center" valign="bottom">'; +s += ' <td width="280" bgcolor="#EEEEEE"><a href="/linkto/ftn.nytimes1.html"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/ftn.280x32.ny.times.gif" width="255" height="32" alt="" border="0"></a></td>'; +s += '<td width="10"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="10" height="1"></td>'; +s += ' <td width="344" bgcolor="#EEEEEE"><a href="/linkto/ftn.bn3.html"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/ftn.345x32.breaking.news.gif" width="340" height="32" alt="" border="0"></a></td>'; +s += ' </tr>'; +s += ''; +s += '</table>'; +s += ''; +s += ''; +s += '<div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="10"></div>'; +s += ''; +s += ''; +s += '<table width="770" border="0" cellpadding="0" cellspacing="0">'; +s += ' <col width="10">'; +s += ' <col width="483" align="left" valign="top">'; +s += ' <col width="10">'; +s += ' <col width="267" align="left" valign="top">'; +s += ' <tr valign="top">'; +s += ' <td rowspan="2"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="10" height="1"></td>'; +s += ' <td valign="top">'; +s += ' <table border="0" cellpadding="0" cellspacing="0">'; +s += ' <tr valign="top">'; +s += ' <td width="238">'; +s += ' <div><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/px_c00.gif" alt="" width="238" height="2"></div>'; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ' <table width="238" border="0" cellpadding="0" cellspacing="0">'; +s += ' <tr>'; +s += ' <td width="132" class="cnnTabbedBoxHeader" style="padding-left:0px;"><span class="cnnBigPrint"><b>MORE REAL TV</b></span></td>'; +s += ' <td width="106" class="cnnTabbedBoxTab" align="right" bgcolor="#336699" style="padding: 0px 3px;"><a href="/SHOWBIZ"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/entertainment.news.gif" alt="More Entertainment" border="0" width="102" height="11" hspace="2" vspace="2" align="right"></a></td>'; +s += ' </tr>'; +s += ' </table>'; +s += ' <div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="238" height="5" vspace="0" hspace="0"></div>'; +s += ' <table width="238" border="0" cellpadding="0" cellspacing="0">'; +s += ' <tr valign="top">'; +s += ' <td><div class="cnn6pxTpad">'; +s += ' '; +s += ' <a href="/2003/SHOWBIZ/06/11/eye.ent.voyeurs/index.html">Go ahead, follow me</a><br>'; +s += 'New reality series and the movie debut of "Idol" finalists'; +s += ' </div></td>'; +s += ' <td width="71" align="right"><a href="/2003/SHOWBIZ/06/11/eye.ent.voyeurs/index.html"><img src="http://i.a.cnn.net/cnn/2003/SHOWBIZ/06/11/eye.ent.voyeurs/tz.movies.gif" alt="Go ahead, follow me" width="65" height="49" border="0" vspace="6"></a></td>'; +s += ' </tr>'; +s += ' </table>'; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ' '; +s += ' <div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="238" height="5" vspace="0" hspace="0"></div>'; +s += '<!--include virtual="/.element/ssi/video/section_teases/topvideos_include.txt"-->'; +s += ' </td>'; +s += ' <td><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="7" height="1"></td>'; +s += ' <td width="238">'; +s += ' <div><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/px_c00.gif" alt="" width="238" height="2"></div>'; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ' <table width="238" border="0" cellpadding="0" cellspacing="0">'; +s += ' <tr>'; +s += ' <td width="157" class="cnnTabbedBoxHeader" style="padding-left:0px;"><span class="cnnBigPrint"><b>GIFT IDEAS</b></span></td>'; +s += ' <td width="81" class="cnnTabbedBoxTab" align="right" bgcolor="#336699" style="padding: 0px 3px;"><a href="/money"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/superlinks/business.gif" alt="Business News" border="0" width="77" height="11" hspace="2" vspace="2" align="right"></a></td>'; +s += ' </tr>'; +s += ' </table>'; +s += ' <div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="238" height="5" vspace="0" hspace="0"></div>'; +s += ' <table width="238" border="0" cellpadding="0" cellspacing="0">'; +s += ' <tr valign="top">'; +s += ' <td><div class="cnn6pxTpad">'; +s += ''; +s += ''; +s += '<span class="cnnBodyText" style="font-weight:bold;">CNN/Money: </span> <a href="/money/2003/06/12/news/companies/fathers_day/index.htm?cnn=yes">Fathers Day</a><br>'; +s += 'Smaller is better --from digital cameras to iPod'; +s += ' </div></td>'; +s += ' <td width="71" align="right"><a href="/money/2003/06/12/news/companies/fathers_day/index.htm?cnn=yes"><img src="http://i.a.cnn.net/cnn/images/programming.boxes/tz.money.dads.day.watch.jpg" alt="Fathers Day" width="65" height="49" border="0" vspace="6"></a></td>'; +s += ' </tr>'; +s += ' </table>'; +s += ' </td>'; +s += ' </tr>'; +s += ' </table>'; +s += ' <div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="238" height="10" vspace="0" hspace="0"></div> '; +s += '<table width="483" border="0" cellspacing="0" cellpadding="0">'; +s += ' <tr valign="top">'; +s += ' <td rowspan="9"><br></td>'; +s += ' <td width="238"><a href="/US/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/us.gif" alt="U.S. News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">'; +s += ''; +s += ' '; +s += '• <a href="/2003/US/South/06/11/miami.rapist/index.html">Miami police link 4 rapes to serial rapist</a><br>'; +s += ''; +s += ' '; +s += '• <a href="/2003/LAW/06/12/mistaken.identity.ap/index.html">Woman mistaken for fugitive jailed</a><br>'; +s += ''; +s += ' '; +s += '• <a href="/2003/US/Northeast/06/12/woman.impaled.ap/index.html">Pregnant woman impaled on mic stand</a><br>'; +s += ' </div></td>'; +s += ' <td rowspan="7" width="7"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="7" height="1"></td>'; +s += ' <td width="238"><a href="/WORLD/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/world.gif" alt="World News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">'; +s += ''; +s += ' '; +s += '• <a href="/2003/WORLD/europe/06/12/nato.bases/index.html">NATO reshapes for new era</a><br>'; +s += ''; +s += ' '; +s += '• <a href="/2003/WORLD/africa/06/12/congo.democratic/index.html">U.N. reviews Bunia peace force</a><br>'; +s += ''; +s += ''; +s += ''; +s += '• <span class="cnnBodyText" style="font-weight:bold;color:#900;">TIME.com: </span><a href="/time/magazine/article/0,9171,1101030616-457361,00.html?CNN=yes" target="new">Saddams curtain trail</a><img src="http://i.cnn.net/cnn/.element/img/1.0/misc/icon.external.links.gif" alt="external link" width="20" height="13" vspace="1" hspace="4" border="0" align="top"><br>'; +s += ' </div></td>'; +s += ' </tr><tr valign="top">'; +s += ' <td width="238"><a href="/TECH/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/technology.gif" alt="Sci-Tech News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">'; +s += ''; +s += ' '; +s += '• <a href="/2003/TECH/ptech/06/11/bus2.ptech.dvd.maker/index.html">Another reason to throw out your VCR</a><br>'; +s += ''; +s += ' '; +s += '• <a href="/2003/TECH/ptech/06/12/korea.samsung.reut/index.html">Flat screen TV prices dropping</a><br>'; +s += ' </div></td>'; +s += ' <td width="238"><a href="/SHOWBIZ/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/entertainment.gif" alt="Entertainment News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">'; +s += ''; +s += ' '; +s += '• <a href="/2003/SHOWBIZ/TV/06/12/cnn.obrien/index.html">CNN hires Soledad OBrien for "AM"</a><br>'; +s += ''; +s += ' '; +s += '• <a href="/2003/SHOWBIZ/TV/06/11/batchelor.troubles.ap/index.html">Dating show star let go by law firm</a><br>'; +s += ' </div></td>'; +s += ' </tr><tr valign="top">'; +s += ' <td width="238"><a href="/ALLPOLITICS/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/politics.gif" alt="Politics News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">'; +s += ''; +s += ' '; +s += '• <a href="/2003/ALLPOLITICS/06/11/schwarzenegger.ap/index.html">Schwarzenegger on California politics</a><br>'; +s += ''; +s += ' '; +s += '• <a href="/2003/ALLPOLITICS/06/12/tax.credit.ap/index.html">House approves extension on child tax credit</a><br>'; +s += ' </div></td>'; +s += ' <td width="238"><a href="/LAW/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/law.gif" alt="Law News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">'; +s += ''; +s += ' '; +s += '• <a href="/2003/LAW/06/12/plaintiff.advances.ap/index.html">Court bars cash advances to plaintiffs</a><br>'; +s += ''; +s += ' '; +s += '• <a href="/2003/LAW/06/11/jackson.lawsuit.ap/index.html">Lawsuit against Jackson settled</a><br>'; +s += ' </div></td>'; +s += ' </tr><tr valign="top">'; +s += ' <td width="238"><a href="/HEALTH/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/health.gif" alt="Health News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">'; +s += ''; +s += ' '; +s += '• <a href="/2003/HEALTH/06/12/monkeypox.ap/index.html">Monkeypox spreading person-to-person?</a><br>'; +s += ''; +s += ' '; +s += '• <a href="/2003/HEALTH/06/12/quick.xray.ap/index.html">A full body X-ray in 13 seconds</a><br>'; +s += ' </div></td>'; +s += ' <td width="238"><a href="/TECH/space/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/space.gif" alt="Space News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">'; +s += ''; +s += ' '; +s += '• <a href="/2003/TECH/science/06/12/hydrogen.ozone.ap/index.html">Hydrogen fuel may disturb ozone layer</a><br>'; +s += ''; +s += ' '; +s += '• <a href="/2003/TECH/space/06/12/sprj.colu.bolts.ap/index.html">New threat found for shuttle launches</a><br>'; +s += ' </div></td>'; +s += ' </tr><tr valign="top">'; +s += ' <td width="238"><a href="/TRAVEL/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/travel.gif" alt="Travel News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">'; +s += ''; +s += ' '; +s += '• <a href="/2003/TRAVEL/DESTINATIONS/06/12/walk.across.america.ap/index.html">Walking America from coast to coast</a><br>'; +s += ''; +s += ' '; +s += '• <a href="/2003/TRAVEL/06/11/bi.airlines.executives.reut/index.html">Airline execs not seeing sunny skies yet</a><br>'; +s += ' </div></td>'; +s += ' <td width="238"><a href="/EDUCATION/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/education.gif" alt="Education News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">'; +s += ''; +s += ' '; +s += '• <a href="/2003/EDUCATION/06/12/arabs.prom.ap/index.html">Arab students seek prom balance</a><br>'; +s += ''; +s += ' '; +s += '• <a href="/2003/EDUCATION/06/11/school.fundraising.ap/index.html">Public schools turn to upscale fundraising</a><br>'; +s += ' </div></td>'; +s += ' </tr><tr valign="top">'; +s += ' <td width="238"><a href="/si/index.html?cnn=yes"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/sports.gif" alt="Sports News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">'; +s += ''; +s += '• <a href="/cnnsi/golfonline/2003/us_open/news/2003/06/12/open_thursday_ap">Woods eyes third U.S. Open title</a><br>'; +s += '• <a href="/cnnsi/basketball/news/2003/06/12/jordan_ruling_ap">Judge denies Jordan's former lover $5M payoff</a><br>'; +s += ' </div></td>'; +s += ' <td width="238"><a href="/money/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/business.gif" alt="Business News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">'; +s += '• <a href="/money/2003/06/12/pf/saving/duppies/index.htm">Here come the "Duppies"</a><br>'; +s += '• <a href="/money/2003/06/12/technology/oracle/index.htm">Oracle beats estimates</a><br>'; +s += ' </div></td>'; +s += ' </tr>'; +s += '</table>'; +s += ' </td>'; +s += ' <td><img src="http://i.cnn.net/cnn/images/1.gif" width="10" hspace="0" vspace="0" alt=""></td>'; +s += ' <td valign="top">'; +s += ' <div><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/px_c00.gif" alt="" width="267" height="2"></div>'; +s += ' '; +s += '<table width="267" border="0" cellpadding="0" cellspacing="0">'; +s += ' <tr>'; +s += ' <td width="173" bgcolor="#003366"><div class="cnnBlueBoxHeader"><span class="cnnBigPrint"><b>WATCH CNN TV</b></span></div></td>'; +s += ' <td width="25" class="cnnBlueBoxHeader" align="right"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/misc/diagonal.gif" width="25" height="19" alt=""></td>'; +s += ' <td width="69" class="cnnBlueBoxTab" align="right" bgcolor="#336699"><a href="/CNN/Programs/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/tv.schedule.gif" alt="On CNN TV" border="0" width="65" height="11" hspace="2" vspace="2" align="right"></a></td>'; +s += ' </tr>'; +s += '</table>'; +s += '<table width="267" bgcolor="#EEEEEE" border="0" cellpadding="4" cellspacing="0">'; +s += ' <tr valign="top">'; +s += ' <td><a href="/CNN/Programs/american.morning/"><img src="http://i.cnn.net/cnn/CNN/Programs/includes/showbox/images/2003/05/tz.hemmer.jpg" alt="American Morning, 7 a.m. ET" width="65" height="49" border="0" align="right"></a><a href="/CNN/Programs/american.morning/"><b>American Morning (7 a.m. ET):</b></a> Tomorrow, singer Carnie Wilson talks about her new book, "Im Still Hungry."'; +s += ' </td>'; +s += ' </tr>'; +s += '</table>'; +s += ''; +s += '<!--'; +s += '[[table width="267" border="0" cellpadding="0" cellspacing="0"]]'; +s += '[[tr]][[td width="173" bgcolor="#003366"]][[div class="cnnBlueBoxHeader"]][[span class="cnnBigPrint"]][[b]]WATCH CNN TV[[/b]][[/span]][[/div]][[/td]][[td width="25" class="cnnBlueBoxHeader" align="right"]][[img src="http://i.a.cnn.net/cnn/.element/img/1.0/misc/diagonal.gif" width="25" height="19" alt=""]][[/td]][[td width="69" class="cnnBlueBoxTab" align="right" bgcolor="#336699"]][[a href="/CNN/Programs/"]][[img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/tv.schedule.gif" alt="On CNN TV" border="0" width="65" height="11" hspace="2" vspace="2" align="right"]][[/a]][[/td]][[/tr]][[/table]][[table width="267" bgcolor="#EEEEEE" border="0" cellpadding="4" cellspacing="0"]][[tr valign="top"]][[td]]'; +s += '[[img src="http://i.cnn.net/cnn/2003/images/05/31/tz.bw.jpg" alt="" width="65" height="49" border="0" align="right"]]'; +s += ' '; +s += '[[b]] CNN Presents: The Hunt for Eric Robert Rudolph (8 p.m. ET)[[/b]][[br]]Latest on his capture.'; +s += ' [[/td]]'; +s += ' [[/tr]]'; +s += ' [[/table]]'; +s += '-->'; +s += ''; +s += ' <div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="10"></div> '; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ' <div><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/px_c00.gif" alt="" width="267" height="2"></div>'; +s += ' <table width="267" border="0" cellpadding="0" cellspacing="0">'; +s += ' <tr>'; +s += ' <td width="184" bgcolor="#003366"><div class="cnnBlueBoxHeader"><span class="cnnBigPrint"><b>ANALYSIS</b></span></div></td>'; +s += ' <td width="25" class="cnnBlueBoxHeader" align="right"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/misc/diagonal.gif" width="25" height="19" alt=""></td>'; +s += ' <td width="58" class="cnnBlueBoxTab" align="right" bgcolor="#336699"><a href="/US"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/superlinks/us.gif" alt="U.S. News" border="0" width="54" height="11" hspace="2" vspace="2" align="right"></a></td>'; +s += ' </tr>'; +s += ' </table>'; +s += ' <table width="267" bgcolor="#EEEEEE" border="0" cellpadding="4" cellspacing="0">'; +s += ' <tr valign="top">'; +s += ' <td>'; +s += '<a href="/2003/US/06/12/nyt.safire/index.html"><img src="http://i.a.cnn.net/cnn/2003/US/06/12/nyt.safire/tz.stewart.jpg" alt="Fight It, Martha" width="65" height="49" border="0" align="right"></a>'; +s += ''; +s += ''; +s += '<span class="cnnBodyText" style="font-weight:bold;color:#000;">NYTimes: </span> <a href="/2003/US/06/12/nyt.safire/index.html">Fight It, Martha</a><br>'; +s += 'William Safire: I hope Martha Stewart beats this bum rap'; +s += ''; +s += ''; +s += ''; +s += ''; +s += ' </td>'; +s += ' </tr>'; +s += ' </table>'; +s += ' <div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="10"></div>'; +s += ' <div><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/px_c00.gif" alt="" width="267" height="2"></div>'; +s += ' <table width="267" border="0" cellpadding="0" cellspacing="0">'; +s += ' <tr>'; +s += ' <td width="164" bgcolor="#003366"><div class="cnnBlueBoxHeader"><span class="cnnBigPrint"><b>OFFBEAT</b></span></div></td>'; +s += ' <td width="25" class="cnnBlueBoxHeader" align="right"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/misc/diagonal.gif" width="25" height="19" alt=""></td>'; +s += ' <td width="78" class="cnnBlueBoxTab" align="right" bgcolor="#336699"><a href="/offbeat"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/superlinks/offbeat.gif" alt="more offbeat" width="74" height="11" border="0" hspace="2" vspace="2" align="right"></a></td>'; +s += ' </tr>'; +s += ' </table>'; +s += ' <table width="267" bgcolor="#DDDDDD" border="0" cellpadding="4" cellspacing="0">'; +s += ' <tr valign="top">'; +s += ' <td>'; +s += '<a href="/2003/HEALTH/06/12/offbeat.china.sperm.ap/index.html"><img src="http://i.a.cnn.net/cnn/2003/HEALTH/06/12/offbeat.china.sperm.ap/tz.china.sperm.jpg" alt="Waiting list" width="65" height="49" border="0" align="right"></a>'; +s += ' '; +s += ' <a href="/2003/HEALTH/06/12/offbeat.china.sperm.ap/index.html">Waiting list</a><br>'; +s += 'Chinas "smart sperm" bank needs donors'; +s += ' </td>'; +s += ' </tr>'; +s += ' </table>'; +s += ' <div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="10"></div>'; +s += ''; +s += ' <table width="267" bgcolor="#999999" border="0" cellpadding="0" cellspacing="0">'; +s += ' <tr>'; +s += ' <td>'; +s += ' <table width="100%" border="0" cellpadding="4" cellspacing="1">'; +s += ' <tr>'; +s += ' <td bgcolor="#EEEEEE" class="cnnMainWeatherBox"><a name="weatherBox"></a>'; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += ''; +s += '<table width="257" border="0" cellpadding="1" cellspacing="0">'; +s += '<form method="get" action="http://weather.cnn.com/weather/search" style="margin: 0px">'; +s += '<input type="hidden" name="mode" value="hplwp">'; +s += ' <tr>'; +s += ' <td bgcolor="#FFFFFF"><table width="255" bgcolor="#EAEFF4" border="0" cellpadding="4" cellspacing="0">'; +s += ' <tr>'; +s += ' <td colspan="2" class="cnnWEATHERrow"> <span class="cnnBigPrint">WEATHER</span></td>'; +s += ' </tr>'; +s += ' <tr>'; +s += ' <td colspan="2" class="cnnBodyText">Get your hometown weather on the home page! <b>Enter city name or U.S. Zip Code:</b></td>'; +s += ' </tr>'; +s += ' <tr>'; +s += ' <td><input class="cnnFormText" type="text" size="12" name="wsearch" value="" style="width:100px;"></td>'; +s += ' <td><input class="cnnNavButton" type="submit" value="PERSONALIZE"></td>'; +s += ' </tr>'; +s += ' <tr>'; +s += ' <td class="cnnBodyText" colspan="2">Or <a href="javascript:CNN_openPopup("http://weather.cnn.com/weather/select.popup/content2.jsp?mode=hplwp", "weather", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=260,height=250")"><b>select location from a list</b></a></td>'; +s += ' </tr>'; +s += ' </table></td>'; +s += ' </tr>'; +s += '</form>'; +s += '</table>'; +s += ''; +s += ''; +s += ''; +s += ' </td>'; +s += ' </tr>'; +s += ' <tr>'; +s += ' <td bgcolor="#EEEEEE">'; +s += ' <table width="100%" border="0" cellpadding="0" cellspacing="2">'; +s += ' <tr>'; +s += ' <td><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/quickvote.gif" alt="Quick Vote" width="107" height="24" border="0"></td>'; +s += ' <td width="88" align="right"><!-- ad home/quickvote/sponsor.88x31 -->'; +s += '<!-- ad commented while aol investigates 3/31/03 5:40 a.m. lk -->'; +s += '<a href="http://ar.atwola.com/link/93101912/aol"><img src="http://ar.atwola.com/image/93101912/aol" alt="Click Here" width="88" height="31" border="0" hspace="0" vspace="0"></a>'; +s += '</td>'; +s += ' </tr>'; +s += ' </table>'; +s += '<table width="100%" cellspacing="0" cellpadding="1" border="0"><form target="popuppoll" method="post" action="http://polls.cnn.com/poll">'; +s += '<INPUT TYPE=HIDDEN NAME="poll_id" VALUE="3966">'; +s += '<tr><td colspan="2" align="left"><span class="cnnBodyText">Should an international peacekeeping force be sent to the Mideast?<br></span></td></tr>'; +s += '<tr valign="top">'; +s += '<td><span class="cnnBodyText">Yes</span>'; +s += '</td><td align="right"><input value="1" type="radio" name="question_1"></td></tr>'; +s += '<tr valign="top">'; +s += '<td><span class="cnnBodyText">No</span>'; +s += '</td><td align="right"><input value="2" type="radio" name="question_1"></td></tr>'; +s += '<!-- /end Question 1 -->'; +s += '<tr>'; +s += '<td colspan="2">'; +s += '<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td><span class="cnnInterfaceLink"><nobr><a href="javascript:CNN_openPopup("/POLLSERVER/results/3966.html","popuppoll","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=510,height=400")">VIEW RESULTS</a></nobr></span></td>'; +s += '<td align="right"><input class="cnnFormButton" onclick="CNN_openPopup("","popuppoll","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=510,height=400")" value="VOTE" type="SUBMIT"></td></tr></table></td></tr>'; +s += '</form></table>'; +s += ''; +s += ' </td>'; +s += ' </tr>'; +s += '</table>'; +s += ''; +s += ' </td>'; +s += ' </tr>'; +s += ' </table>'; +s += ' <!-- /right --></td>'; +s += ' </tr>'; +s += ' <tr>'; +s += ' <td colspan="3" valign="bottom"> <img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/px_ccc.gif" alt="" width="483" height="1"> </td>'; +s += ' </tr>'; +s += '</table>'; +s += '<table width="770" border="0" cellpadding="0" cellspacing="0" summary="Links to stories from CNN partners">'; +s += ' <col width="10">'; +s += ' <col width="250" align="left" valign="top">'; +s += ' <col width="5">'; +s += ' <col width="250" align="left" valign="top">'; +s += ' <col width="5">'; +s += ' <col width="250" align="left" valign="top">'; +s += ' <tr><td colspan="6"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="2"></td></tr>'; +s += ' <tr valign="top">'; +s += ' <td rowspan="6" width="10"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="10" height="1"></td>'; +s += ' <td colspan="3"><span class="cnnMenuText" style="font-size: 12px"><b style="color: #c00">From our Partners</b></span>'; +s += ' <img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/icon_external.gif" alt=" External site icon " width="20" height="13" border="0" align="middle"></td>'; +s += ' <td colspan="2"></td>'; +s += ' </tr>'; +s += ' <tr><td colspan="5"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="2"></td></tr>'; +s += ' <tr><td colspan="5" bgcolor="#CCCCCC"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="1"></td></tr>'; +s += ' <tr><td colspan="5"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="2"></td></tr>'; +s += ' <tr valign="top">'; +s += ' <td class="cnnMainSections" width="250">'; +s += '<a href="/time/" target="new"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/partner_time.gif" alt="Time: " width="70" height="17" border="0"></a><br><div style="margin-top: 4px"> • <a target="new" href="/time/magazine/article/0,9171,1101030616-457387,00.html?CNN=yes">Where the Jobs Are</a><br> • <a target="new" href="/time/magazine/article/0,9171,1101030616-457373,00.html?CNN=yes">Of Dogs and Men</a><br> • <a target="new" href="/time/photoessays/gunmen/?CNN=yes">Photo Essay: Fighting the Peace</a><br></div><table border="0"><tr><td><img height="1" width="1" alt="" src="http://i.cnn.net/cnn/images/1.gif"/></td></tr><tr bgcolor="#dddddd"><td> <a target="new" href="/linkto/time.main.html">Subscribe to TIME</a> </td></tr></table> </td>'; +s += ' <td width="5"><br></td>'; +s += ' <td class="cnnMainSections" width="250">'; +s += '<a href="/cnnsi/index.html?cnn=yes"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/partner_si.gif" alt="CNNsi.com: " width="138" height="17" border="0"></a><br><div style="margin-top: 4px">'; +s += '• Marty Burns: <a target="new" href="/cnnsi/inside_game/marty_burns/news/2003/06/11/burns_game4/">Nets pull out all stops</a><br>'; +s += '• Michael Farber: <a target="new" href="/cnnsi/inside_game/michael_farber/news/2003/06/11/farber_wrapup/">Sens look good for "04</a><br>'; +s += '• Tim Layden: <a target="new" href="/cnnsi/inside_game/tim_layden/news/2003/06/11/layden_neuheisel/">NFL or bust for Neuheisel</a><br>'; +s += '</div>'; +s += '<table border="0"><tr><td><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="1"></td></tr><tr bgcolor="#dddddd"><td> <a href="http://subs.timeinc.net/CampaignHandler/si_cnnsi?source_id=19">Subscribe to Sports Illustrated</a> </td></tr></table>'; +s += ' </td>'; +s += ' <td width="5"><br></td>'; +s += ' <td class="cnnMainSections" width="250">'; +s += '<a href="/linkto/nyt/main.banner.html" target="new"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/partners_nyt.gif" alt="New York Times: " width="105" height="17" border="0"></a><br><div style="margin-top: 4px"> • <a target="new" href="/linkto/nyt/story/1.0612.html">U.S. Widens Checks at Foreign Ports</a><br> • <a target="new" href="/linkto/nyt/story/2.0612.html">Rumsfeld: Iran Developing Nuclear Arms</a><br> • <a target="new" href="/linkto/nyt/story/3.0612.html">Vandalism, "Improvements" Mar Great Wall</a><br></div><table border="0"><tr><td><img height="1" width="1" alt="" src="http://i.cnn.net/cnn/images/1.gif"/></td></tr><tr bgcolor="#dddddd"><td> <a target="new" href="/linkto/nyt.main.html">Get 50% OFF the NY Times</a> </td></tr></table> </td>'; +s += ' </tr>'; +s += ''; +s += '</table>'; +s += '<div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="2"></div>'; +s += ''; +s += '<table width="770" border="0" cellpadding="0" cellspacing="0">'; +s += ' <tr>'; +s += ' <td width="10"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="10" height="10"></td>'; +s += ' <td width="760">'; +s += '<!-- floor -->'; +s += ''; +s += '<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td bgcolor="#999999"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="1"></td></tr></table>'; +s += ''; +s += '<div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="1"></div>'; +s += ''; +s += '<table width="100%" bgcolor="#DEDEDE" border="0" cellpadding="3" cellspacing="0">'; +s += ' <tr> '; +s += ' <td><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="5" height="5"></td>'; +s += ' <td><a href="http://edition.cnn.com/" class="cnnFormTextB" onClick="clickEdLink()" style="color:#000;">International Edition</a></td>'; +s += '<form>'; +s += ' <td><select title="CNN.com is available in different languages" class="cnnMenuText" name="languages" size="1" style="font-weight: bold; vertical-align: middle" onChange="if (this.options[selectedIndex].value != "") location.href=this.options[selectedIndex].value">'; +s += ' <option value="" disabled selected>Languages</option>'; +s += ' <option value="" disabled>---------</option>'; +s += ' <option value="/cnnes/">Spanish</option>'; +s += ' <option value="http://cnn.de/">German</option>'; +s += ' <option value="http://cnnitalia.it/">Italian</option>'; +s += ' <option value="http://www.joins.com/cnn/">Korean</option>'; +s += ' <option value="http://arabic.cnn.com/">Arabic</option>'; +s += ' <option value="http://www.CNN.co.jp/">Japanese</option>'; +s += ' </select></td>'; +s += '</form>'; +s += ' <td><a href="/CNN/Programs/" class="cnnFormTextB" style="color:#000;">CNN TV</a></td>'; +s += ' <td><a href="/CNNI/" class="cnnFormTextB" style="color:#000;">CNN International</a></td>'; +s += ' <td><a href="/HLN/" class="cnnFormTextB" style="color:#000;">Headline News</a></td>'; +s += ' <td><a href="/TRANSCRIPTS/" class="cnnFormTextB" style="color:#000;">Transcripts</a></td>'; +s += ' <td><a href="/services/preferences/" title="Customize your CNN.com experience" class="cnnFormTextB" style="color:#000;">Preferences</a></td>'; +s += ' <td><a href="/INDEX/about.us/" class="cnnFormTextB" style="color:#000;">About CNN.com</a></td>'; +s += ' </tr>'; +s += '</table>'; +s += ''; +s += '<div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="1"></div>'; +s += ''; +s += '<table width="100%" bgcolor="#EFEFEF" border="0" cellpadding="4" cellspacing="0">'; +s += ' <tr valign="top"> '; +s += ' <td style="padding-left:10px"><div class="cnnSectCopyright">'; +s += '<b>© 2003 Cable News Network LP, LLLP.</b><br>'; +s += 'An AOL Time Warner Company. All Rights Reserved.<br>'; +s += '<a href="/interactive_legal.html">Terms</a> under which this service is provided to you.<br>'; +s += 'Read our <a href="/privacy.html">privacy guidelines</a>. <a href="/feedback/">Contact us</a>.'; +s += ' </div></td>'; +s += ' <td align="right"><table border="0" cellpadding="4" cellspacing="0">'; +s += ' <tr> '; +s += ' <td rowspan="2" align="middle"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/sect/SEARCH/dotted.line.gif" alt="" width="7" height="46"></td>'; +s += ' <td><img src="http://i.a.cnn.net/cnn/.element/img/1.0/misc/icon.external.links.gif" alt="external link" width="20" height="13"></td>'; +s += ' <td><div class="cnnSectExtSites">All external sites will open in a new browser.<br>'; +s += ' CNN.com does not endorse external sites.</div></td>'; +s += ' <td rowspan="2" align="middle"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/sect/SEARCH/dotted.line.gif" alt="" width="7" height="46"></td>'; +s += ' <td rowspan="2"><!-- home/powered_by/sponsor.88x31 -->'; +s += '<script language="JavaScript1.1">'; +s += '<!--'; +s += 'adSetTarget("_top");'; +s += 'htmlAdWH( (new Array(93103308,93103308,93103308,93103308))[document.adoffset||0] , 88, 31);'; +s += '//-->'; +s += '</script><noscript><a href="http://ar.atwola.com/link/93103308/aol" target="_top"><img src="http://ar.atwola.com/image/93103308/aol" alt="Click here for our advertiser" width="88" height="31" border="0"></a></noscript>'; +s += '</td>'; +s += ' </tr>'; +s += ' <tr valign="top"> '; +s += ' <td><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/icon_premium.gif" alt=" Premium content icon " width="9" height="11"></td>'; +s += ' <td><span class="cnnSectExtSites">Denotes premium content.</span></td>'; +s += ' </tr>'; +s += ' </table></td>'; +s += ' </tr>'; +s += '</table>'; +s += ''; +s += '<!-- /floor --></td>'; +s += ' </tr>'; +s += '</table>'; +s += ''; +s += ''; +s += ''; +s += '<!-- popunder ad generic/popunder_launch.720x300 -->'; +s += '<script language="JavaScript1.1" type="text/javascript">'; +s += '<!--'; +s += 'if (document.adPopupFile) {'; +s += ' if (document.adPopupInterval == null) {'; +s += ' document.adPopupInterval = "0";'; +s += ' }'; +s += ' if (document.adPopunderInterval == null) {'; +s += ' document.adPopunderInterval = document.adPopupInterval;'; +s += ' }'; +s += ' if (document.adPopupDomain != null) {'; +s += ' adSetPopDm(document.adPopupDomain);'; +s += ' }'; +s += ' adSetPopupWH("93162673", "720", "300", document.adPopupFile, document.adPopunderInterval, 20, 50, -1);'; +s += '}'; +s += '// -->'; +s += '</script>'; +s += ' '; +s += '<!-- home/bottom.eyeblaster -->'; +s += '<script language="JavaScript1.1" type="text/javascript">'; +s += '<!--'; +s += 'var MacPPC = (navigator.platform == "MacPPC") ? true : false;'; +s += 'if (!MacPPC) {'; +s += 'adSetType("J");'; +s += 'htmlAdWH( (new Array(93137910,93137910,93137910,93137910))[document.adoffset||0], 101, 1);'; +s += 'adSetType("");'; +s += '}'; +s += '// -->'; +s += '</script>'; +s += ''; +s += '<script language="JavaScript1.1" src="http://ar.atwola.com/file/adsEnd.js"></script>'; +s += ''; +s += '<img src="/cookie.crumb" alt="" width="1" height="1">'; +s += '<!--include virtual="/virtual/2002/main/survey.html"-->'; +s += '</body>'; +s += '</html>'; + +return s; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-209919.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-209919.js new file mode 100644 index 0000000..e1bb76c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-209919.js @@ -0,0 +1,169 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): sagdjb@softwareag.com, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 19 June 2003 +* SUMMARY: Testing regexp submatches with quantifiers +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=209919 +* +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 209919; +var summary = 'Testing regexp submatches with quantifiers'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +/* + * Waldemar: "ECMA-262 15.10.2.5, third algorithm, step 2.1 states that + * once the minimum repeat count (which is 0 for *, 1 for +, etc.) has + * been satisfied, an atom being repeated must not match the empty string." + * + * In this example, the minimum repeat count is 0, so the last thing the + * capturing parens is permitted to contain is the 'a'. It may NOT go on + * to capture the '' at the $ position of 'a', even though '' satifies + * the condition b* + * + */ +status = inSection(1); +string = 'a'; +pattern = /(a|b*)*/; +actualmatch = string.match(pattern); +expectedmatch = Array(string, 'a'); +addThis(); + + +/* + * In this example, the minimum repeat count is 5, so the capturing parens + * captures the 'a', then goes on to capture the '' at the $ position of 'a' + * 4 times before it has to stop. Therefore the last thing it contains is ''. + */ +status = inSection(2); +string = 'a'; +pattern = /(a|b*){5,}/; +actualmatch = string.match(pattern); +expectedmatch = Array(string, ''); +addThis(); + + +/* + * Reduction of the above examples to contain only the condition b* + * inside the capturing parens. This can be even harder to grasp! + * + * The global match is the '' at the ^ position of 'a', but the parens + * is NOT permitted to capture it since the minimum repeat count is 0! + */ +status = inSection(3); +string = 'a'; +pattern = /(b*)*/; +actualmatch = string.match(pattern); +expectedmatch = Array('', undefined); +addThis(); + + +/* + * Here we have used the + quantifier (repeat count 1) outside the parens. + * Therefore the parens must capture at least once before stopping, so it + * does capture the '' this time - + */ +status = inSection(4); +string = 'a'; +pattern = /(b*)+/; +actualmatch = string.match(pattern); +expectedmatch = Array('', ''); +addThis(); + + +/* + * More complex examples - + */ +pattern = /^\-?(\d{1,}|\.{0,})*(\,\d{1,})?$/; + + status = inSection(5); + string = '100.00'; + actualmatch = string.match(pattern); + expectedmatch = Array(string, '00', undefined); + addThis(); + + status = inSection(6); + string = '100,00'; + actualmatch = string.match(pattern); + expectedmatch = Array(string, '100', ',00'); + addThis(); + + status = inSection(7); + string = '1.000,00'; + actualmatch = string.match(pattern); + expectedmatch = Array(string, '000', ',00'); + addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-216591.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-216591.js new file mode 100644 index 0000000..cc86d73 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-216591.js @@ -0,0 +1,112 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): okin7@yahoo.fr, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 19 August 2003 +* SUMMARY: Regexp conformance test +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=216591 +* +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 216591; +var summary = 'Regexp conformance test'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +status = inSection(1); +string = 'a {result.data.DATA} b'; +pattern = /\{(([a-z0-9\-_]+?\.)+?)([a-z0-9\-_]+?)\}/i; +actualmatch = string.match(pattern); +expectedmatch = Array('{result.data.DATA}', 'result.data.', 'data.', 'DATA'); +addThis(); + +/* + * Add a global flag to the regexp. In Perl 5, this gives the same results as above. Compare: + * + * [ ] perl -e '"a {result.data.DATA} b" =~ /\{(([a-z0-9\-_]+?\.)+?)([a-z0-9\-_]+?)\}/i; print("$&, $1, $2, $3");' + * {result.data.DATA}, result.data., data., DATA + * + * [ ] perl -e '"a {result.data.DATA} b" =~ /\{(([a-z0-9\-_]+?\.)+?)([a-z0-9\-_]+?)\}/gi; print("$&, $1, $2, $3");' + * {result.data.DATA}, result.data., data., DATA + * + * + * But in JavaScript, there will no longer be any sub-captures: + */ +status = inSection(2); +string = 'a {result.data.DATA} b'; +pattern = /\{(([a-z0-9\-_]+?\.)+?)([a-z0-9\-_]+?)\}/gi; +actualmatch = string.match(pattern); +expectedmatch = Array('{result.data.DATA}'); +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-220367-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-220367-001.js new file mode 100644 index 0000000..e6a767e --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-220367-001.js @@ -0,0 +1,99 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor@fastmail.fm, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 26 September 2003 +* SUMMARY: Regexp conformance test +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=220367 +* +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 220367; +var summary = 'Regexp conformance test'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +status = inSection(1); +string = 'a'; +pattern = /(a)|(b)/; +actualmatch = string.match(pattern); +expectedmatch = Array(string, 'a', undefined); +addThis(); + +status = inSection(2); +string = 'b'; +pattern = /(a)|(b)/; +actualmatch = string.match(pattern); +expectedmatch = Array(string, undefined, 'b'); +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-220367-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-220367-002.js new file mode 100644 index 0000000..62eec23 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-220367-002.js @@ -0,0 +1,107 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor@fastmail.fm, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 26 September 2003 +* SUMMARY: Regexp conformance test +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=220367 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 220367; +var summary = 'Regexp conformance test'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + +var re = /(a)|(b)/; + +re.test('a'); + status = inSection(1); + actual = RegExp.$1; + expect = 'a'; + addThis(); + + status = inSection(2); + actual = RegExp.$2; + expect = ''; + addThis(); + +re.test('b'); + status = inSection(3); + actual = RegExp.$1; + expect = ''; + addThis(); + + status = inSection(4); + actual = RegExp.$2; + expect = 'b'; + addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-24712.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-24712.js new file mode 100644 index 0000000..41c17f6 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-24712.js @@ -0,0 +1,42 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * 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): + * Rob Ginda rginda@netscape.com + */ + +test(); + +function test() +{ + enterFunc ("test"); + + printBugNumber (24712); + + var re = /([\S]+([ \t]+[\S]+)*)[ \t]*=[ \t]*[\S]+/; + var result = re.exec("Course_Creator = Test"); + + if (!result) + reportFailure ("exec() returned null."); + + exitFunc ("test"); + +} + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-28686.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-28686.js new file mode 100644 index 0000000..599f613 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-28686.js @@ -0,0 +1,39 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * 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): + * Rob Ginda rginda@netscape.com + */ + +test(); + +function test() +{ + enterFunc ("test"); + + printBugNumber (28686); + + var str = 'foo "bar" baz'; + reportCompare ('foo \\"bar\\" baz', str.replace(/([\'\"])/g, "\\$1"), + "str.replace failed."); + + exitFunc ("test"); + +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-31316.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-31316.js new file mode 100644 index 0000000..b68e42a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-31316.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 expressed +* 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): pschwartau@netscape.com +* Date: 01 May 2001 +* +* SUMMARY: Regression test for Bugzilla bug 31316: +* "Rhino: Regexp matches return garbage" +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=31316 +*/ +//------------------------------------------------------------------------------------------------- +var i = 0; +var bug = 31316; +var summary = 'Regression test for Bugzilla bug 31316'; +var cnEmptyString = ''; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +status = inSection(1); +pattern = /<([^\/<>][^<>]*[^\/])>|<([^\/<>])>/; +string = '<p>Some<br />test</p>'; +actualmatch = string.match(pattern); +expectedmatch = Array('<p>', undefined, 'p'); +addThis(); + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-57572.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-57572.js new file mode 100644 index 0000000..de9834a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-57572.js @@ -0,0 +1,129 @@ +/* +* 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 expressed +* 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): pschwartau@netscape.com +* Date: 28 December 2000 +* +* SUMMARY: Testing regular expressions containing the ? character. +* Arose from Bugzilla bug 57572: "RegExp with ? matches incorrectly" +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=57572 +* +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 57572; +var summary = 'Testing regular expressions containing "?"'; +var cnEmptyString = ''; var cnSingleSpace = ' '; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +status = inSection(1); +pattern = /(\S+)?(.*)/; +string = 'Test this'; +actualmatch = string.match(pattern); +expectedmatch = Array(string, 'Test', ' this'); //single space in front of 'this' +addThis(); + +status = inSection(2); +pattern = /(\S+)? ?(.*)/; //single space between the ? characters +string= 'Test this'; +actualmatch = string.match(pattern); +expectedmatch = Array(string, 'Test', 'this'); //NO space in front of 'this' +addThis(); + +status = inSection(3); +pattern = /(\S+)?(.*)/; +string = 'Stupid phrase, with six - (short) words'; +actualmatch = string.match(pattern); +expectedmatch = Array(string, 'Stupid', ' phrase, with six - (short) words'); //single space in front of 'phrase' +addThis(); + +status = inSection(4); +pattern = /(\S+)? ?(.*)/; //single space between the ? characters +string = 'Stupid phrase, with six - (short) words'; +actualmatch = string.match(pattern); +expectedmatch = Array(string, 'Stupid', 'phrase, with six - (short) words'); //NO space in front of 'phrase' +addThis(); + + +// let's add an extra back-reference this time - three instead of two - +status = inSection(5); +pattern = /(\S+)?( ?)(.*)/; //single space before second ? character +string = 'Stupid phrase, with six - (short) words'; +actualmatch = string.match(pattern); +expectedmatch = Array(string, 'Stupid', cnSingleSpace, 'phrase, with six - (short) words'); +addThis(); + +status = inSection(6); +pattern = /^(\S+)?( ?)(B+)$/; //single space before second ? character +string = 'AAABBB'; +actualmatch = string.match(pattern); +expectedmatch = Array(string, 'AAABB', cnEmptyString, 'B'); +addThis(); + +status = inSection(7); +pattern = /(\S+)?(!?)(.*)/; +string = 'WOW !!! !!!'; +actualmatch = string.match(pattern); +expectedmatch = Array(string, 'WOW', cnEmptyString, ' !!! !!!'); +addThis(); + +status = inSection(8); +pattern = /(.+)?(!?)(!+)/; +string = 'WOW !!! !!!'; +actualmatch = string.match(pattern); +expectedmatch = Array(string, 'WOW !!! !!', cnEmptyString, '!'); +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-57631.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-57631.js new file mode 100644 index 0000000..1917ed4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-57631.js @@ -0,0 +1,128 @@ +/* +* 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): pschwartau@netscape.com +* Date: 26 November 2000 +* +* +* SUMMARY: This test arose from Bugzilla bug 57631: +* "RegExp with invalid pattern or invalid flag causes segfault" +* +* Either error should throw an exception of type SyntaxError, +* and we check to see that it does... +*/ +//------------------------------------------------------------------------------------------------- +var bug = '57631'; +var summary = 'Testing new RegExp(pattern,flag) with illegal pattern or flag'; +var statprefix = 'Testing for error creating illegal RegExp object on pattern '; +var statsuffix = 'and flag '; +var cnSUCCESS = 'SyntaxError'; +var cnFAILURE = 'not a SyntaxError'; +var singlequote = "'"; +var i = -1; var j = -1; var s = ''; var f = ''; +var obj = {}; +var status = ''; var actual = ''; var expect = ''; var msg = ''; +var legalpatterns = new Array(); var illegalpatterns = new Array(); +var legalflags = new Array(); var illegalflags = new Array(); + + +// valid regular expressions to try - +legalpatterns[0] = ''; +legalpatterns[1] = 'abc'; +legalpatterns[2] = '(.*)(3-1)\s\w'; +legalpatterns[3] = '(.*)(...)\\s\\w'; +legalpatterns[4] = '[^A-Za-z0-9_]'; +legalpatterns[5] = '[^\f\n\r\t\v](123.5)([4 - 8]$)'; + +// invalid regular expressions to try - +illegalpatterns[0] = '()'; +illegalpatterns[1] = '(a'; +illegalpatterns[2] = '( ]'; +illegalpatterns[3] = '\d{s}'; + +// valid flags to try - +legalflags[0] = 'i'; +legalflags[1] = 'g'; +legalflags[2] = 'm'; +legalflags[3] = undefined; + +// invalid flags to try - +illegalflags[0] = 'a'; +illegalflags[1] = 123; +illegalflags[2] = new RegExp(); + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + testIllegalRegExps(legalpatterns, illegalflags); + testIllegalRegExps(illegalpatterns, legalflags); + testIllegalRegExps(illegalpatterns, illegalflags); + + exitFunc ('test'); +} + + +// This function will only be called where all the patterns are illegal, or all the flags +function testIllegalRegExps(patterns, flags) +{ + for (i in patterns) + { + s = patterns[i]; + + for (j in flags) + { + f = flags[j]; + status = getStatus(s, f); + + try + { + // This should cause an exception if either s or f is illegal - + eval('obj = new RegExp(s, f);'); + } + catch(e) + { + // We expect to get a SyntaxError - test for this: + actual = (e instanceof SyntaxError)? cnSUCCESS : cnFAILURE; + expect = cnSUCCESS; + reportCompare(expect, actual, status); + } + } + } +} + + +function getStatus(regexp, flag) +{ + return (statprefix + quote(regexp) + statsuffix + quote(flag)); +} + + +function quote(text) +{ + return (singlequote + text + singlequote); +}
\ No newline at end of file diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-67773.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-67773.js new file mode 100644 index 0000000..e399050 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-67773.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 expressed +* 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): pschwartau@netscape.com +* Date: 06 February 2001 +* +* SUMMARY: Arose from Bugzilla bug 67773: +* "Regular subexpressions followed by + failing to run to completion" +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=67773 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=69989 +*/ +//------------------------------------------------------------------------------------------------- +var i = 0; +var bug = 67773; +var summary = 'Testing regular subexpressions followed by ? or +\n'; +var cnSingleSpace = ' '; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +pattern = /^(\S+)?( ?)(B+)$/; //single space before second ? character + status = inSection(1); + string = 'AAABBB AAABBB '; //single space at middle and at end - + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + status = inSection(2); + string = 'AAABBB BBB'; //single space in the middle + actualmatch = string.match(pattern); + expectedmatch = Array(string, 'AAABBB', cnSingleSpace, 'BBB'); + addThis(); + + status = inSection(3); + string = 'AAABBB AAABBB'; //single space in the middle + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + +pattern = /^(A+B)+$/; + status = inSection(4); + string = 'AABAAB'; + actualmatch = string.match(pattern); + expectedmatch = Array(string, 'AAB'); + addThis(); + + status = inSection(5); + string = 'ABAABAAAAAAB'; + actualmatch = string.match(pattern); + expectedmatch = Array(string, 'AAAAAAB'); + addThis(); + + status = inSection(6); + string = 'ABAABAABAB'; + actualmatch = string.match(pattern); + expectedmatch = Array(string, 'AB'); + addThis(); + + status = inSection(7); + string = 'ABAABAABABB'; + actualmatch = string.match(pattern); + expectedmatch = null; // because string doesn't match at end + addThis(); + + +pattern = /^(A+1)+$/; + status = inSection(8); + string = 'AA1AA1'; + actualmatch = string.match(pattern); + expectedmatch = Array(string, 'AA1'); + addThis(); + + +pattern = /^(\w+\-)+$/; + status = inSection(9); + string = ''; + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + status = inSection(10); + string = 'bla-'; + actualmatch = string.match(pattern); + expectedmatch = Array(string, string); + addThis(); + + status = inSection(11); + string = 'bla-bla'; // hyphen missing at end - + actualmatch = string.match(pattern); + expectedmatch = null; //because string doesn't match at end + addThis(); + + status = inSection(12); + string = 'bla-bla-'; + actualmatch = string.match(pattern); + expectedmatch = Array(string, 'bla-'); + addThis(); + + +pattern = /^(\S+)+(A+)$/; + status = inSection(13); + string = 'asdldflkjAAA'; + actualmatch = string.match(pattern); + expectedmatch = Array(string, 'asdldflkjAA', 'A'); + addThis(); + + status = inSection(14); + string = 'asdldflkj AAA'; // space in middle + actualmatch = string.match(pattern); + expectedmatch = null; //because of the space + addThis(); + + +pattern = /^(\S+)+(\d+)$/; + status = inSection(15); + string = 'asdldflkj122211'; + actualmatch = string.match(pattern); + expectedmatch = Array(string, 'asdldflkj12221', '1'); + addThis(); + + status = inSection(16); + string = 'asdldflkj1111111aaa1'; + actualmatch = string.match(pattern); + expectedmatch = Array(string, 'asdldflkj1111111aaa', '1'); + addThis(); + + +/* + * This one comes from Stephen Ostermiller. + * See http://bugzilla.mozilla.org/show_bug.cgi?id=69989 + */ +pattern = /^[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)+$/; + status = inSection(17); + string = 'some.host.tld'; + actualmatch = string.match(pattern); + expectedmatch = Array(string, '.tld', '.'); + addThis(); + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-72964.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-72964.js new file mode 100644 index 0000000..5965313 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-72964.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 expressed +* 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): pschwartau@netscape.com +* Date: 2001-07-17 +* +* SUMMARY: Regression test for Bugzilla bug 72964: +* "String method for pattern matching failed for Chinese Simplified (GB2312)" +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=72964 +*/ +//----------------------------------------------------------------------------- +var i = 0; +var bug = 72964; +var summary = 'Testing regular expressions containing non-Latin1 characters'; +var cnSingleSpace = ' '; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +pattern = /[\S]+/; + // 4 low Unicode chars = Latin1; whole string should match + status = inSection(1); + string = '\u00BF\u00CD\u00BB\u00A7'; + actualmatch = string.match(pattern); + expectedmatch = Array(string); + addThis(); + + // Now put a space in the middle; first half of string should match + status = inSection(2); + string = '\u00BF\u00CD \u00BB\u00A7'; + actualmatch = string.match(pattern); + expectedmatch = Array('\u00BF\u00CD'); + addThis(); + + + // 4 high Unicode chars = non-Latin1; whole string should match + status = inSection(3); + string = '\u4e00\uac00\u4e03\u4e00'; + actualmatch = string.match(pattern); + expectedmatch = Array(string); + addThis(); + + // Now put a space in the middle; first half of string should match + status = inSection(4); + string = '\u4e00\uac00 \u4e03\u4e00'; + actualmatch = string.match(pattern); + expectedmatch = Array('\u4e00\uac00'); + addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-76683.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-76683.js new file mode 100644 index 0000000..59b95b9 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-76683.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 expressed +* 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): pschwartau@netscape.com +* Date: 01 May 2001 +* +* SUMMARY: Regression test for Bugzilla bug 76683 on Rhino: +* "RegExp regression (NullPointerException)" +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=76683 +*/ +//------------------------------------------------------------------------------------------------- +var i = 0; +var bug = 76683; +var summary = 'Regression test for Bugzilla bug 76683'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +/* + * Rhino (2001-04-19) crashed on the 3rd regular expression below. + * It didn't matter what the string was. No problem in SpiderMonkey - + */ +string = 'abc'; + status = inSection(1); + pattern = /(<!--([^-]|-[^-]|--[^>])*-->)|(<([\$\w:\.\-]+)((([ ][^\/>]*)?\/>)|(([ ][^>]*)?>)))/; + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + status = inSection(2); + pattern = /(<!--([^-]|-[^-]|--[^>])*-->)|(<(tagPattern)((([ ][^\/>]*)?\/>)|(([ ][^>]*)?>)))/; + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + // This was the one causing a Rhino crash - + status = inSection(3); + pattern = /(<!--([^-]|-[^-]|--[^>])*-->)|(<(tagPattern)((([ ][^\/>]*)?\/>)|(([ ][^>]*)?>)))|(<\/tagPattern[^>]*>)/; + actualmatch = string.match(pattern); + expectedmatch = null; + addThis(); + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-78156.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-78156.js new file mode 100644 index 0000000..08947ce --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-78156.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 expressed +* 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): pschwartau@netscape.com +* Date: 06 February 2001 +* +* SUMMARY: Arose from Bugzilla bug 78156: +* "m flag of regular expression does not work with $" +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=78156 +* +* The m flag means a regular expression should search strings +* across multiple lines, i.e. across '\n', '\r'. +*/ +//------------------------------------------------------------------------------------------------- +var i = 0; +var bug = 78156; +var summary = 'Testing regular expressions with ^, $, and the m flag -'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + +/* + * All patterns have an m flag; all strings are multiline. + * Looking for digit characters at beginning/end of lines. + */ + +string = 'aaa\n789\r\nccc\r\n345'; + status = inSection(1); + pattern = /^\d/gm; + actualmatch = string.match(pattern); + expectedmatch = ['7','3']; + addThis(); + + status = inSection(2); + pattern = /\d$/gm; + actualmatch = string.match(pattern); + expectedmatch = ['9','5']; + addThis(); + +string = 'aaa\n789\r\nccc\r\nddd'; + status = inSection(3); + pattern = /^\d/gm; + actualmatch = string.match(pattern); + expectedmatch = ['7']; + addThis(); + + status = inSection(4); + pattern = /\d$/gm; + actualmatch = string.match(pattern); + expectedmatch = ['9']; + addThis(); + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-85721.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-85721.js new file mode 100644 index 0000000..41f5bc0 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-85721.js @@ -0,0 +1,271 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): rogerl@netscape.com, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 14 Feb 2002 +* SUMMARY: Performance: Regexp performance degraded from 4.7 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=85721 +* +* Adjust this testcase if necessary. The FAST constant defines +* an upper bound in milliseconds for any execution to take. +* +*/ +//----------------------------------------------------------------------------- +var bug = 85721; +var summary = 'Performance: execution of regular expression'; +var FAST = 100; // execution should be 100 ms or less to pass the test +var MSG_FAST = 'Execution took less than ' + FAST + ' ms'; +var MSG_SLOW = 'Execution took '; +var MSG_MS = ' ms'; +var str = ''; +var re = ''; +var status = ''; +var actual = ''; +var expect= ''; + +printBugNumber (bug); +printStatus (summary); + + +function elapsedTime(startTime) +{ + return new Date() - startTime; +} + + +function isThisFast(ms) +{ + if (ms <= FAST) + return MSG_FAST; + return MSG_SLOW + ms + MSG_MS; +} + + + +/* + * The first regexp. We'll test for performance (Section 1) and accuracy (Section 2). + */ +str='<sql:connection id="conn1"> <sql:url>www.m.com</sql:url> <sql:driver>drive.class</sql:driver>\n<sql:userId>foo</sql:userId> <sql:password>goo</sql:password> </sql:connection>'; +re = /<sql:connection id="([^\r\n]*?)">\s*<sql:url>\s*([^\r\n]*?)\s*<\/sql:url>\s*<sql:driver>\s*([^\r\n]*?)\s*<\/sql:driver>\s*(\s*<sql:userId>\s*([^\r\n]*?)\s*<\/sql:userId>\s*)?\s*(\s*<sql:password>\s*([^\r\n]*?)\s*<\/sql:password>\s*)?\s*<\/sql:connection>/; +expect = Array("<sql:connection id=\"conn1\"> <sql:url>www.m.com</sql:url> <sql:driver>drive.class</sql:driver>\n<sql:userId>foo</sql:userId> <sql:password>goo</sql:password> </sql:connection>","conn1","www.m.com","drive.class","<sql:userId>foo</sql:userId> ","foo","<sql:password>goo</sql:password> ","goo"); + +/* + * Check performance - + */ +status = inSection(1); +var start = new Date(); +var result = re.exec(str); +actual = elapsedTime(start); +reportCompare(isThisFast(FAST), isThisFast(actual), status); + +/* + * Check accuracy - + */ +status = inSection(2); +testRegExp([status], [re], [str], [result], [expect]); + + + +/* + * The second regexp (HUGE!). We'll test for performance (Section 3) and accuracy (Section 4). + * It comes from the O'Reilly book "Mastering Regular Expressions" by Jeffrey Friedl, Appendix B + */ + +//# Some things for avoiding backslashitis later on. +$esc = '\\\\'; +$Period = '\.'; +$space = '\040'; $tab = '\t'; +$OpenBR = '\\['; $CloseBR = '\\]'; +$OpenParen = '\\('; $CloseParen = '\\)'; +$NonASCII = '\x80-\xff'; $ctrl = '\000-\037'; +$CRlist = '\n\015'; //# note: this should really be only \015. +// Items 19, 20, 21 +$qtext = '[^' + $esc + $NonASCII + $CRlist + '\"]'; // # for within "..." +$dtext = '[^' + $esc + $NonASCII + $CRlist + $OpenBR + $CloseBR + ']'; // # for within [...] +$quoted_pair = $esc + '[^' + $NonASCII + ']'; // # an escaped character + +//############################################################################## +//# Items 22 and 23, comment. +//# Impossible to do properly with a regex, I make do by allowing at most one level of nesting. +$ctext = '[^' + $esc + $NonASCII + $CRlist + '()]'; + +//# $Cnested matches one non-nested comment. +//# It is unrolled, with normal of $ctext, special of $quoted_pair. +$Cnested = + $OpenParen + // # ( + $ctext + '*' + // # normal* + '(?:' + $quoted_pair + $ctext + '*)*' + // # (special normal*)* + $CloseParen; // # ) + + +//# $comment allows one level of nested parentheses +//# It is unrolled, with normal of $ctext, special of ($quoted_pair|$Cnested) +$comment = + $OpenParen + // # ( + $ctext + '*' + // # normal* + '(?:' + // # ( + '(?:' + $quoted_pair + '|' + $Cnested + ')' + // # special + $ctext + '*' + // # normal* + ')*' + // # )* + $CloseParen; // # ) + + +//############################################################################## +//# $X is optional whitespace/comments. +$X = + '[' + $space + $tab + ']*' + // # Nab whitespace. + '(?:' + $comment + '[' + $space + $tab + ']*)*'; // # If comment found, allow more spaces. + + +//# Item 10: atom +$atom_char = '[^(' + $space + '<>\@,;:\".' + $esc + $OpenBR + $CloseBR + $ctrl + $NonASCII + ']'; +$atom = + $atom_char + '+' + // # some number of atom characters... + '(?!' + $atom_char + ')'; // # ..not followed by something that could be part of an atom + +// # Item 11: doublequoted string, unrolled. +$quoted_str = + '\"' + // # " + $qtext + '*' + // # normal + '(?:' + $quoted_pair + $qtext + '*)*' + // # ( special normal* )* + '\"'; // # " + +//# Item 7: word is an atom or quoted string +$word = + '(?:' + + $atom + // # Atom + '|' + // # or + $quoted_str + // # Quoted string + ')' + +//# Item 12: domain-ref is just an atom +$domain_ref = $atom; + +//# Item 13: domain-literal is like a quoted string, but [...] instead of "..." +$domain_lit = + $OpenBR + // # [ + '(?:' + $dtext + '|' + $quoted_pair + ')*' + // # stuff + $CloseBR; // # ] + +// # Item 9: sub-domain is a domain-ref or domain-literal +$sub_domain = + '(?:' + + $domain_ref + + '|' + + $domain_lit + + ')' + + $X; // # optional trailing comments + +// # Item 6: domain is a list of subdomains separated by dots. +$domain = + $sub_domain + + '(?:' + + $Period + $X + $sub_domain + + ')*'; + +//# Item 8: a route. A bunch of "@ $domain" separated by commas, followed by a colon. +$route = + '\@' + $X + $domain + + '(?:,' + $X + '\@' + $X + $domain + ')*' + // # additional domains + ':' + + $X; // # optional trailing comments + +//# Item 6: local-part is a bunch of $word separated by periods +$local_part = + $word + $X + '(?:' + + $Period + $X + $word + $X + // # additional words + ')*'; + +// # Item 2: addr-spec is local@domain +$addr_spec = + $local_part + '\@' + $X + $domain; + +//# Item 4: route-addr is <route? addr-spec> +$route_addr = + '<' + $X + // # < + '(?:' + $route + ')?' + // # optional route + $addr_spec + // # address spec + '>'; // # > + +//# Item 3: phrase........ +$phrase_ctrl = '\000-\010\012-\037'; // # like ctrl, but without tab + +//# Like atom-char, but without listing space, and uses phrase_ctrl. +//# Since the class is negated, this matches the same as atom-char plus space and tab +$phrase_char = + '[^()<>\@,;:\".' + $esc + $OpenBR + $CloseBR + $NonASCII + $phrase_ctrl + ']'; + +// # We've worked it so that $word, $comment, and $quoted_str to not consume trailing $X +// # because we take care of it manually. +$phrase = + $word + // # leading word + $phrase_char + '*' + // # "normal" atoms and/or spaces + '(?:' + + '(?:' + $comment + '|' + $quoted_str + ')' + // # "special" comment or quoted string + $phrase_char + '*' + // # more "normal" + ')*'; + +// ## Item #1: mailbox is an addr_spec or a phrase/route_addr +$mailbox = + $X + // # optional leading comment + '(?:' + + $phrase + $route_addr + // # name and address + '|' + // # or + $addr_spec + // # address + ')'; + + +//########################################################################### + + +re = new RegExp($mailbox, "g"); +str = 'Jeffy<"That Tall Guy"@ora.com (this address is no longer active)>'; +expect = Array('Jeffy<"That Tall Guy"@ora.com (this address is no longer active)>'); + +/* + * Check performance - + */ +status = inSection(3); +var start = new Date(); +var result = re.exec(str); +actual = elapsedTime(start); +reportCompare(isThisFast(FAST), isThisFast(actual), status); + +/* + * Check accuracy - + */ +status = inSection(4); +testRegExp([status], [re], [str], [result], [expect]); diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-87231.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-87231.js new file mode 100644 index 0000000..7fde4ff --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-87231.js @@ -0,0 +1,124 @@ +/* +* 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 expressed +* 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): pschwartau@netscape.com +* Date: 22 June 2001 +* +* SUMMARY: Regression test for Bugzilla bug 87231: +* "Regular expression /(A)?(A.*)/ picks 'A' twice" +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=87231 +* Key case: +* +* pattern = /^(A)?(A.*)$/; +* string = 'A'; +* expectedmatch = Array('A', '', 'A'); +* +* +* We expect the 1st subexpression (A)? NOT to consume the single 'A'. +* Recall that "?" means "match 0 or 1 times". Here, it should NOT do +* greedy matching: it should match 0 times instead of 1. This allows +* the 2nd subexpression to make the only match it can: the single 'A'. +* Such "altruism" is the only way there can be a successful global match... +*/ +//------------------------------------------------------------------------------------------------- +var i = 0; +var bug = 87231; +var cnEmptyString = ''; +var summary = 'Testing regular expression /(A)?(A.*)/'; +var status = ''; +var statusmessages = new Array(); +var pattern = ''; +var patterns = new Array(); +var string = ''; +var strings = new Array(); +var actualmatch = ''; +var actualmatches = new Array(); +var expectedmatch = ''; +var expectedmatches = new Array(); + + +pattern = /^(A)?(A.*)$/; + status = inSection(1); + string = 'AAA'; + actualmatch = string.match(pattern); + expectedmatch = Array('AAA', 'A', 'AA'); + addThis(); + + status = inSection(2); + string = 'AA'; + actualmatch = string.match(pattern); + expectedmatch = Array('AA', 'A', 'A'); + addThis(); + + status = inSection(3); + string = 'A'; + actualmatch = string.match(pattern); + expectedmatch = Array('A', undefined, 'A'); // 'altruistic' case: see above + addThis(); + + +pattern = /(A)?(A.*)/; +var strL = 'zxcasd;fl\\\ ^'; +var strR = 'aaAAaaaf;lrlrzs'; + + status = inSection(4); + string = strL + 'AAA' + strR; + actualmatch = string.match(pattern); + expectedmatch = Array('AAA' + strR, 'A', 'AA' + strR); + addThis(); + + status = inSection(5); + string = strL + 'AA' + strR; + actualmatch = string.match(pattern); + expectedmatch = Array('AA' + strR, 'A', 'A' + strR); + addThis(); + + status = inSection(6); + string = strL + 'A' + strR; + actualmatch = string.match(pattern); + expectedmatch = Array('A' + strR, undefined, 'A' + strR); // 'altruistic' case: see above + addThis(); + + + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + + + +function addThis() +{ + statusmessages[i] = status; + patterns[i] = pattern; + strings[i] = string; + actualmatches[i] = actualmatch; + expectedmatches[i] = expectedmatch; + i++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-98306.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-98306.js new file mode 100644 index 0000000..e812ebf --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/regress-98306.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 expressed +* 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): jrgm@netscape.com, pschwartau@netscape.com +* Date: 04 September 2001 +* +* SUMMARY: Regression test for Bugzilla bug 98306 +* "JS parser crashes in ParseAtom for script using Regexp()" +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=98306 +*/ +//----------------------------------------------------------------------------- +var bug = 98306; +var summary = "Testing that we don't crash on this code -"; +var cnUBOUND = 10; +var re; +var s; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + s = '"Hello".match(/[/]/)'; + tryThis(s); + + s = 're = /[/'; + tryThis(s); + + s = 're = /[/]/'; + tryThis(s); + + s = 're = /[//]/'; + tryThis(s); + + exitFunc ('test'); +} + + +// Try to provoke a crash - +function tryThis(sCode) +{ + // sometimes more than one attempt is necessary - + for (var i=0; i<cnUBOUND; i++) + { + try + { + eval(sCode); + } + catch(e) + { + // do nothing; keep going - + } + } +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/shell.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/shell.js new file mode 100644 index 0000000..8dec83c --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/RegExp/shell.js @@ -0,0 +1,230 @@ +/* +* 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 expressed +* 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): pschwartau@netscape.com +* Date: 07 February 2001 +* +* Functionality common to RegExp testing - +*/ +//------------------------------------------------------------------------------------------------- +var MSG_PATTERN = '\nregexp = '; +var MSG_STRING = '\nstring = '; +var MSG_EXPECT = '\nExpect: '; +var MSG_ACTUAL = '\nActual: '; +var ERR_LENGTH = '\nERROR !!! match arrays have different lengths:'; +var ERR_MATCH = '\nERROR !!! regexp failed to give expected match array:'; +var ERR_NO_MATCH = '\nERROR !!! regexp FAILED to match anything !!!'; +var ERR_UNEXP_MATCH = '\nERROR !!! regexp MATCHED when we expected it to fail !!!'; +var CHAR_LBRACKET = '['; +var CHAR_RBRACKET = ']'; +var CHAR_QT_DBL = '"'; +var CHAR_QT = "'"; +var CHAR_NL = '\n'; +var CHAR_COMMA = ','; +var CHAR_SPACE = ' '; +var TYPE_STRING = typeof 'abc'; + + + +function testRegExp(statuses, patterns, strings, actualmatches, expectedmatches) +{ + var status = ''; + var pattern = new RegExp(); + var string = ''; + var actualmatch = new Array(); + var expectedmatch = new Array(); + var state = ''; + var lActual = -1; + var lExpect = -1; + + + for (var i=0; i != patterns.length; i++) + { + status = statuses[i]; + pattern = patterns[i]; + string = strings[i]; + actualmatch=actualmatches[i]; + expectedmatch=expectedmatches[i]; + state = getState(status, pattern, string); + + + if(actualmatch) + { + if(expectedmatch) + { + // expectedmatch and actualmatch are arrays - + lExpect = expectedmatch.length; + lActual = actualmatch.length; + + if (lActual != lExpect) + { + reportFailure( + state + ERR_LENGTH + + MSG_EXPECT + formatArray(expectedmatch) + + MSG_ACTUAL + formatArray(actualmatch) + + CHAR_NL + ); + continue; + } + + // OK, the arrays have same length - + if (formatArray(expectedmatch) != formatArray(actualmatch)) + { + reportFailure( + state + ERR_MATCH + + MSG_EXPECT + formatArray(expectedmatch) + + MSG_ACTUAL + formatArray(actualmatch) + + CHAR_NL + ); + } + + } + else //expectedmatch is null - that is, we did not expect a match - + { + reportFailure( + state + ERR_UNEXP_MATCH + + MSG_EXPECT + expectedmatch + + MSG_ACTUAL + formatArray(actualmatch) + + CHAR_NL + ); + } + + } + else // actualmatch is null + { + if (expectedmatch) + { + reportFailure( + state + ERR_NO_MATCH + + MSG_EXPECT + formatArray(expectedmatch) + + MSG_ACTUAL + actualmatch + + CHAR_NL + ); + } + else // we did not expect a match + { + // Being ultra-cautious. Presumably expectedmatch===actualmatch===null + reportCompare (expectedmatch, actualmatch, state); + } + } + } +} + + +function getState(status, pattern, string) +{ + /* + * Escape \n's, etc. to make them LITERAL in the presentation string. + * We don't have to worry about this in |pattern|; such escaping is + * done automatically by pattern.toString(), invoked implicitly below. + * + * One would like to simply do: string = string.replace(/(\s)/g, '\$1'). + * However, the backreference $1 is not a literal string value, + * so this method doesn't work. + * + * Also tried string = string.replace(/(\s)/g, escape('$1')); + * but this just inserts the escape of the literal '$1', i.e. '%241'. + */ + string = string.replace(/\n/g, '\\n'); + string = string.replace(/\r/g, '\\r'); + string = string.replace(/\t/g, '\\t'); + string = string.replace(/\v/g, '\\v'); + string = string.replace(/\f/g, '\\f'); + + return (status + MSG_PATTERN + pattern + MSG_STRING + singleQuote(string)); +} + + +/* + * If available, arr.toSource() gives more detail than arr.toString() + * + * var arr = Array(1,2,'3'); + * + * arr.toSource() + * [1, 2, "3"] + * + * arr.toString() + * 1,2,3 + * + * But toSource() doesn't exist in Rhino, so use our own imitation, below - + * + */ +function formatArray(arr) +{ + try + { + return arr.toSource(); + } + catch(e) + { + return toSource(arr); + } +} + + +/* + * Imitate SpiderMonkey's arr.toSource() method: + * + * a) Double-quote each array element that is of string type + * b) Represent |undefined| and |null| by empty strings + * c) Delimit elements by a comma + single space + * d) Do not add delimiter at the end UNLESS the last element is |undefined| + * e) Add square brackets to the beginning and end of the string + */ +function toSource(arr) +{ + var delim = CHAR_COMMA + CHAR_SPACE; + var elt = ''; + var ret = ''; + var len = arr.length; + + for (i=0; i<len; i++) + { + elt = arr[i]; + + switch(true) + { + case (typeof elt === TYPE_STRING) : + ret += doubleQuote(elt); + break; + + case (elt === undefined || elt === null) : + break; // add nothing but the delimiter, below - + + default: + ret += elt.toString(); + } + + if ((i < len-1) || (elt === undefined)) + ret += delim; + } + + return CHAR_LBRACKET + ret + CHAR_RBRACKET; +} + + +function doubleQuote(text) +{ + return CHAR_QT_DBL + text + CHAR_QT_DBL; +} + + +function singleQuote(text) +{ + return CHAR_QT + text + CHAR_QT; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-121744.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-121744.js new file mode 100644 index 0000000..ca4653a --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-121744.js @@ -0,0 +1,212 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 30 Jan 2002 +* Revised: 10 Apr 2002 +* Revised: 14 July 2002 +* +* SUMMARY: JS should error on |for(i in undefined)|, |for(i in null)| +* See http://bugzilla.mozilla.org/show_bug.cgi?id=121744 +* +* ECMA-262 3rd Edition Final spec says such statements should error. See: +* +* Section 12.6.4 The for-in Statement +* Section 9.9 ToObject +* +* +* BUT: SpiderMonkey has decided NOT to follow this; it's a bug in the spec. +* See http://bugzilla.mozilla.org/show_bug.cgi?id=131348 +* +* UPDATE: Rhino has also decided not to follow the spec on this. +* See http://bugzilla.mozilla.org/show_bug.cgi?id=136893 +* + + |--------------------------------------------------------------------| + | | + | So for now, adding an early return for this test so it won't run. | + | | + |--------------------------------------------------------------------| + +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 121744; +var summary = 'JS should error on |for(i in undefined)|, |for(i in null)|'; +var TEST_PASSED = 'TypeError'; +var TEST_FAILED = 'Generated an error, but NOT a TypeError!'; +var TEST_FAILED_BADLY = 'Did not generate ANY error!!!'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + +/* + * AS OF 14 JULY 2002, DON'T RUN THIS TEST IN EITHER RHINO OR SPIDERMONKEY - + */ +quit(); + + +status = inSection(1); +expect = TEST_PASSED; +actual = TEST_FAILED_BADLY; +/* + * OK, this should generate a TypeError + */ +try +{ + for (var i in undefined) + { + print(i); + } +} +catch(e) +{ + if (e instanceof TypeError) + actual = TEST_PASSED; + else + actual = TEST_FAILED; +} +addThis(); + + + +status = inSection(2); +expect = TEST_PASSED; +actual = TEST_FAILED_BADLY; +/* + * OK, this should generate a TypeError + */ +try +{ + for (var i in null) + { + print(i); + } +} +catch(e) +{ + if (e instanceof TypeError) + actual = TEST_PASSED; + else + actual = TEST_FAILED; +} +addThis(); + + + +status = inSection(3); +expect = TEST_PASSED; +actual = TEST_FAILED_BADLY; +/* + * Variable names that cannot be looked up generate ReferenceErrors; however, + * property names like obj.ZZZ that cannot be looked up are set to |undefined| + * + * Therefore, this should indirectly test | for (var i in undefined) | + */ +try +{ + for (var i in this.ZZZ) + { + print(i); + } +} +catch(e) +{ + if(e instanceof TypeError) + actual = TEST_PASSED; + else + actual = TEST_FAILED; +} +addThis(); + + + +status = inSection(4); +expect = TEST_PASSED; +actual = TEST_FAILED_BADLY; +/* + * The result of an unsuccessful regexp match is the null value + * Therefore, this should indirectly test | for (var i in null) | + */ +try +{ + for (var i in 'bbb'.match(/aaa/)) + { + print(i); + } +} +catch(e) +{ + if(e instanceof TypeError) + actual = TEST_PASSED; + else + actual = TEST_FAILED; +} +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-131348.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-131348.js new file mode 100644 index 0000000..7315373 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-131348.js @@ -0,0 +1,179 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 10 Apr 2002 +* Revised: 14 July 2002 +* +* SUMMARY: JS should NOT error on |for(i in undefined)|, |for(i in null)| +* +* ECMA-262 3rd Edition Final spec says such statements SHOULD error. See: +* +* Section 12.6.4 The for-in Statement +* Section 9.9 ToObject +* +* +* But SpiderMonkey has decided NOT to follow this; it's a bug in the spec. +* See http://bugzilla.mozilla.org/show_bug.cgi?id=131348 +* +* Update: Rhino has also decided not to follow the spec on this +* See http://bugzilla.mozilla.org/show_bug.cgi?id=136893 +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 131348; +var summary = 'JS should not error on |for(i in undefined)|, |for(i in null)|'; +var TEST_PASSED = 'No error'; +var TEST_FAILED = 'An error was generated!!!'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + + +status = inSection(1); +expect = TEST_PASSED; +actual = TEST_PASSED; +try +{ + for (var i in undefined) + { + print(i); + } +} +catch(e) +{ + actual = TEST_FAILED; +} +addThis(); + + + +status = inSection(2); +expect = TEST_PASSED; +actual = TEST_PASSED; +try +{ + for (var i in null) + { + print(i); + } +} +catch(e) +{ + actual = TEST_FAILED; +} +addThis(); + + + +status = inSection(3); +expect = TEST_PASSED; +actual = TEST_PASSED; +/* + * Variable names that cannot be looked up generate ReferenceErrors; however, + * property names like obj.ZZZ that cannot be looked up are set to |undefined| + * + * Therefore, this should indirectly test | for (var i in undefined) | + */ +try +{ + for (var i in this.ZZZ) + { + print(i); + } +} +catch(e) +{ + actual = TEST_FAILED; +} +addThis(); + + + +status = inSection(4); +expect = TEST_PASSED; +actual = TEST_PASSED; +/* + * The result of an unsuccessful regexp match is the null value + * Therefore, this should indirectly test | for (var i in null) | + */ +try +{ + for (var i in 'bbb'.match(/aaa/)) + { + print(i); + } +} +catch(e) +{ + actual = TEST_FAILED; +} +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-157509.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-157509.js new file mode 100644 index 0000000..ad6bd77 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-157509.js @@ -0,0 +1,106 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor3@apochta.com, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 15 July 2002 +* SUMMARY: Testing for SyntaxError on usage of '\' in identifiers +* See http://bugzilla.mozilla.org/show_bug.cgi?id=157509 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 157509; +var summary = "Testing for SyntaxError on usage of '\\' in identifiers"; +var TEST_PASSED = 'SyntaxError'; +var TEST_FAILED = 'Generated an error, but NOT a SyntaxError!'; +var TEST_FAILED_BADLY = 'Did not generate ANY error!!!'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +status = inSection(1); +expect = TEST_PASSED; +actual = TEST_FAILED_BADLY; +/* + * OK, this should generate a SyntaxError + */ +try +{ + eval('var a\\1 = 0;'); +} +catch(e) +{ + if (e instanceof SyntaxError) + actual = TEST_PASSED; + else + actual = TEST_FAILED; +} +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-194364.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-194364.js new file mode 100644 index 0000000..830a6c6 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-194364.js @@ -0,0 +1,134 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor@icesoft.no, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 21 February 2003 +* SUMMARY: Testing eval statements containing conditional function expressions +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=194364 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 194364; +var summary = 'Testing eval statements with conditional function expressions'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +status = inSection(1); +actual = eval('1; function() {}'); +expect = 1; +addThis(); + +status = inSection(2); +actual = eval('2; function f() {}'); +expect = 2; +addThis(); + +status = inSection(3); +actual = eval('3; if (true) function() {}'); +expect = 3; +addThis(); + +status = inSection(4); +actual = eval('4; if (true) function f() {}'); +expect = 4; +addThis(); + +status = inSection(5); +actual = eval('5; if (false) function() {}'); +expect = 5; +addThis(); + +status = inSection(6); +actual = eval('6; if (false) function f() {}'); +expect = 6; +addThis(); + +status = inSection(7); +actual = eval('7; switch(true) { case true: function() {} }'); +expect = 7; +addThis(); + +status = inSection(8); +actual = eval('8; switch(true) { case true: function f() {} }'); +expect = 8; +addThis(); + +status = inSection(9); +actual = eval('9; switch(false) { case false: function() {} }'); +expect = 9; +addThis(); + +status = inSection(10); +actual = eval('10; switch(false) { case false: function f() {} }'); +expect = 10; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-74474-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-74474-001.js new file mode 100644 index 0000000..d592264 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-74474-001.js @@ -0,0 +1,118 @@ +/* +* 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 expressed +* 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): pschwartau@netscape.com +* Date: 01 May 2001 +* +* SUMMARY: Regression test for Bugzilla bug 74474 +*"switch() misbehaves with duplicated labels" +* +* See ECMA3 Section 12.11, "The switch Statement" +* See http://bugzilla.mozilla.org/show_bug.cgi?id=74474 +*/ +//------------------------------------------------------------------------------------------------- +var UBound = 0; +var bug = 74474; +var summary = 'Testing switch statements with duplicate labels'; +var status = ''; +var statusitems = [ ]; +var actual = ''; +var actualvalues = [ ]; +var expect= ''; +var expectedvalues = [ ]; + + +status = 'Section A of test: the string literal "1" as a duplicate label'; +actual = ''; +switch ('1') +{ + case '1': + actual += 'a'; + case '1': + actual += 'b'; +} +expect = 'ab'; +addThis(); + + +status = 'Section B of test: the numeric literal 1 as a duplicate label'; +actual = ''; +switch (1) +{ + case 1: + actual += 'a'; + case 1: + actual += 'b'; +} +expect = 'ab'; +addThis(); + + +status = 'Section C of test: the numeric literal 1 as a duplicate label, via a function parameter'; +tryThis(1); +function tryThis(x) +{ + actual = ''; + + switch (x) + { + case x: + actual += 'a'; + case x: + actual += 'b'; + } +} +expect = 'ab'; +addThis(); + + + +//--------------------------------------------------------------------------------- +test(); +//--------------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], getStatus(i)); + } + + exitFunc ('test'); +} + + +function getStatus(i) +{ + return statusitems[i]; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-74474-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-74474-002.js new file mode 100644 index 0000000..52f8787 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-74474-002.js @@ -0,0 +1,9076 @@ +/* +* 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 expressed +* 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): brendan@mozilla.org, pschwartau@netscape.com +* Date: 09 May 2001 +* +* SUMMARY: Regression test for Bugzilla bug 74474 +* "switch() misbehaves with duplicated labels" +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=74474 +* See ECMA3 Section 12.11, "The switch Statement" +*/ +//------------------------------------------------------------------------------------------------- +var UBound = 0; +var bug = 74474; +var summary = 'Test of switch statement that overflows the stack-allocated bitmap'; +var status = '(No duplicated labels)'; +var statusitems = [ ]; +var actual = ''; +var actualvalues = [ ]; +var expect= ''; +var expectedvalues = [ ]; +var x = 3; + + +switch (x) +{ + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 20: + case 21: + case 22: + case 23: + case 24: + case 25: + case 26: + case 27: + case 28: + case 29: + case 30: + case 31: + case 32: + case 33: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 45: + case 46: + case 47: + case 48: + case 49: + case 50: + case 51: + case 52: + case 53: + case 54: + case 55: + case 56: + case 57: + case 58: + case 59: + case 60: + case 61: + case 62: + case 63: + case 64: + case 65: + case 66: + case 67: + case 68: + case 69: + case 70: + case 71: + case 72: + case 73: + case 74: + case 75: + case 76: + case 77: + case 78: + case 79: + case 80: + case 81: + case 82: + case 83: + case 84: + case 85: + case 86: + case 87: + case 88: + case 89: + case 90: + case 91: + case 92: + case 93: + case 94: + case 95: + case 96: + case 97: + case 98: + case 99: + case 100: + case 101: + case 102: + case 103: + case 104: + case 105: + case 106: + case 107: + case 108: + case 109: + case 110: + case 111: + case 112: + case 113: + case 114: + case 115: + case 116: + case 117: + case 118: + case 119: + case 120: + case 121: + case 122: + case 123: + case 124: + case 125: + case 126: + case 127: + case 128: + case 129: + case 130: + case 131: + case 132: + case 133: + case 134: + case 135: + case 136: + case 137: + case 138: + case 139: + case 140: + case 141: + case 142: + case 143: + case 144: + case 145: + case 146: + case 147: + case 148: + case 149: + case 150: + case 151: + case 152: + case 153: + case 154: + case 155: + case 156: + case 157: + case 158: + case 159: + case 160: + case 161: + case 162: + case 163: + case 164: + case 165: + case 166: + case 167: + case 168: + case 169: + case 170: + case 171: + case 172: + case 173: + case 174: + case 175: + case 176: + case 177: + case 178: + case 179: + case 180: + case 181: + case 182: + case 183: + case 184: + case 185: + case 186: + case 187: + case 188: + case 189: + case 190: + case 191: + case 192: + case 193: + case 194: + case 195: + case 196: + case 197: + case 198: + case 199: + case 200: + case 201: + case 202: + case 203: + case 204: + case 205: + case 206: + case 207: + case 208: + case 209: + case 210: + case 211: + case 212: + case 213: + case 214: + case 215: + case 216: + case 217: + case 218: + case 219: + case 220: + case 221: + case 222: + case 223: + case 224: + case 225: + case 226: + case 227: + case 228: + case 229: + case 230: + case 231: + case 232: + case 233: + case 234: + case 235: + case 236: + case 237: + case 238: + case 239: + case 240: + case 241: + case 242: + case 243: + case 244: + case 245: + case 246: + case 247: + case 248: + case 249: + case 250: + case 251: + case 252: + case 253: + case 254: + case 255: + case 256: + case 257: + case 258: + case 259: + case 260: + case 261: + case 262: + case 263: + case 264: + case 265: + case 266: + case 267: + case 268: + case 269: + case 270: + case 271: + case 272: + case 273: + case 274: + case 275: + case 276: + case 277: + case 278: + case 279: + case 280: + case 281: + case 282: + case 283: + case 284: + case 285: + case 286: + case 287: + case 288: + case 289: + case 290: + case 291: + case 292: + case 293: + case 294: + case 295: + case 296: + case 297: + case 298: + case 299: + case 300: + case 301: + case 302: + case 303: + case 304: + case 305: + case 306: + case 307: + case 308: + case 309: + case 310: + case 311: + case 312: + case 313: + case 314: + case 315: + case 316: + case 317: + case 318: + case 319: + case 320: + case 321: + case 322: + case 323: + case 324: + case 325: + case 326: + case 327: + case 328: + case 329: + case 330: + case 331: + case 332: + case 333: + case 334: + case 335: + case 336: + case 337: + case 338: + case 339: + case 340: + case 341: + case 342: + case 343: + case 344: + case 345: + case 346: + case 347: + case 348: + case 349: + case 350: + case 351: + case 352: + case 353: + case 354: + case 355: + case 356: + case 357: + case 358: + case 359: + case 360: + case 361: + case 362: + case 363: + case 364: + case 365: + case 366: + case 367: + case 368: + case 369: + case 370: + case 371: + case 372: + case 373: + case 374: + case 375: + case 376: + case 377: + case 378: + case 379: + case 380: + case 381: + case 382: + case 383: + case 384: + case 385: + case 386: + case 387: + case 388: + case 389: + case 390: + case 391: + case 392: + case 393: + case 394: + case 395: + case 396: + case 397: + case 398: + case 399: + case 400: + case 401: + case 402: + case 403: + case 404: + case 405: + case 406: + case 407: + case 408: + case 409: + case 410: + case 411: + case 412: + case 413: + case 414: + case 415: + case 416: + case 417: + case 418: + case 419: + case 420: + case 421: + case 422: + case 423: + case 424: + case 425: + case 426: + case 427: + case 428: + case 429: + case 430: + case 431: + case 432: + case 433: + case 434: + case 435: + case 436: + case 437: + case 438: + case 439: + case 440: + case 441: + case 442: + case 443: + case 444: + case 445: + case 446: + case 447: + case 448: + case 449: + case 450: + case 451: + case 452: + case 453: + case 454: + case 455: + case 456: + case 457: + case 458: + case 459: + case 460: + case 461: + case 462: + case 463: + case 464: + case 465: + case 466: + case 467: + case 468: + case 469: + case 470: + case 471: + case 472: + case 473: + case 474: + case 475: + case 476: + case 477: + case 478: + case 479: + case 480: + case 481: + case 482: + case 483: + case 484: + case 485: + case 486: + case 487: + case 488: + case 489: + case 490: + case 491: + case 492: + case 493: + case 494: + case 495: + case 496: + case 497: + case 498: + case 499: + case 500: + case 501: + case 502: + case 503: + case 504: + case 505: + case 506: + case 507: + case 508: + case 509: + case 510: + case 511: + case 512: + case 513: + case 514: + case 515: + case 516: + case 517: + case 518: + case 519: + case 520: + case 521: + case 522: + case 523: + case 524: + case 525: + case 526: + case 527: + case 528: + case 529: + case 530: + case 531: + case 532: + case 533: + case 534: + case 535: + case 536: + case 537: + case 538: + case 539: + case 540: + case 541: + case 542: + case 543: + case 544: + case 545: + case 546: + case 547: + case 548: + case 549: + case 550: + case 551: + case 552: + case 553: + case 554: + case 555: + case 556: + case 557: + case 558: + case 559: + case 560: + case 561: + case 562: + case 563: + case 564: + case 565: + case 566: + case 567: + case 568: + case 569: + case 570: + case 571: + case 572: + case 573: + case 574: + case 575: + case 576: + case 577: + case 578: + case 579: + case 580: + case 581: + case 582: + case 583: + case 584: + case 585: + case 586: + case 587: + case 588: + case 589: + case 590: + case 591: + case 592: + case 593: + case 594: + case 595: + case 596: + case 597: + case 598: + case 599: + case 600: + case 601: + case 602: + case 603: + case 604: + case 605: + case 606: + case 607: + case 608: + case 609: + case 610: + case 611: + case 612: + case 613: + case 614: + case 615: + case 616: + case 617: + case 618: + case 619: + case 620: + case 621: + case 622: + case 623: + case 624: + case 625: + case 626: + case 627: + case 628: + case 629: + case 630: + case 631: + case 632: + case 633: + case 634: + case 635: + case 636: + case 637: + case 638: + case 639: + case 640: + case 641: + case 642: + case 643: + case 644: + case 645: + case 646: + case 647: + case 648: + case 649: + case 650: + case 651: + case 652: + case 653: + case 654: + case 655: + case 656: + case 657: + case 658: + case 659: + case 660: + case 661: + case 662: + case 663: + case 664: + case 665: + case 666: + case 667: + case 668: + case 669: + case 670: + case 671: + case 672: + case 673: + case 674: + case 675: + case 676: + case 677: + case 678: + case 679: + case 680: + case 681: + case 682: + case 683: + case 684: + case 685: + case 686: + case 687: + case 688: + case 689: + case 690: + case 691: + case 692: + case 693: + case 694: + case 695: + case 696: + case 697: + case 698: + case 699: + case 700: + case 701: + case 702: + case 703: + case 704: + case 705: + case 706: + case 707: + case 708: + case 709: + case 710: + case 711: + case 712: + case 713: + case 714: + case 715: + case 716: + case 717: + case 718: + case 719: + case 720: + case 721: + case 722: + case 723: + case 724: + case 725: + case 726: + case 727: + case 728: + case 729: + case 730: + case 731: + case 732: + case 733: + case 734: + case 735: + case 736: + case 737: + case 738: + case 739: + case 740: + case 741: + case 742: + case 743: + case 744: + case 745: + case 746: + case 747: + case 748: + case 749: + case 750: + case 751: + case 752: + case 753: + case 754: + case 755: + case 756: + case 757: + case 758: + case 759: + case 760: + case 761: + case 762: + case 763: + case 764: + case 765: + case 766: + case 767: + case 768: + case 769: + case 770: + case 771: + case 772: + case 773: + case 774: + case 775: + case 776: + case 777: + case 778: + case 779: + case 780: + case 781: + case 782: + case 783: + case 784: + case 785: + case 786: + case 787: + case 788: + case 789: + case 790: + case 791: + case 792: + case 793: + case 794: + case 795: + case 796: + case 797: + case 798: + case 799: + case 800: + case 801: + case 802: + case 803: + case 804: + case 805: + case 806: + case 807: + case 808: + case 809: + case 810: + case 811: + case 812: + case 813: + case 814: + case 815: + case 816: + case 817: + case 818: + case 819: + case 820: + case 821: + case 822: + case 823: + case 824: + case 825: + case 826: + case 827: + case 828: + case 829: + case 830: + case 831: + case 832: + case 833: + case 834: + case 835: + case 836: + case 837: + case 838: + case 839: + case 840: + case 841: + case 842: + case 843: + case 844: + case 845: + case 846: + case 847: + case 848: + case 849: + case 850: + case 851: + case 852: + case 853: + case 854: + case 855: + case 856: + case 857: + case 858: + case 859: + case 860: + case 861: + case 862: + case 863: + case 864: + case 865: + case 866: + case 867: + case 868: + case 869: + case 870: + case 871: + case 872: + case 873: + case 874: + case 875: + case 876: + case 877: + case 878: + case 879: + case 880: + case 881: + case 882: + case 883: + case 884: + case 885: + case 886: + case 887: + case 888: + case 889: + case 890: + case 891: + case 892: + case 893: + case 894: + case 895: + case 896: + case 897: + case 898: + case 899: + case 900: + case 901: + case 902: + case 903: + case 904: + case 905: + case 906: + case 907: + case 908: + case 909: + case 910: + case 911: + case 912: + case 913: + case 914: + case 915: + case 916: + case 917: + case 918: + case 919: + case 920: + case 921: + case 922: + case 923: + case 924: + case 925: + case 926: + case 927: + case 928: + case 929: + case 930: + case 931: + case 932: + case 933: + case 934: + case 935: + case 936: + case 937: + case 938: + case 939: + case 940: + case 941: + case 942: + case 943: + case 944: + case 945: + case 946: + case 947: + case 948: + case 949: + case 950: + case 951: + case 952: + case 953: + case 954: + case 955: + case 956: + case 957: + case 958: + case 959: + case 960: + case 961: + case 962: + case 963: + case 964: + case 965: + case 966: + case 967: + case 968: + case 969: + case 970: + case 971: + case 972: + case 973: + case 974: + case 975: + case 976: + case 977: + case 978: + case 979: + case 980: + case 981: + case 982: + case 983: + case 984: + case 985: + case 986: + case 987: + case 988: + case 989: + case 990: + case 991: + case 992: + case 993: + case 994: + case 995: + case 996: + case 997: + case 998: + case 999: + case 1000: + case 1001: + case 1002: + case 1003: + case 1004: + case 1005: + case 1006: + case 1007: + case 1008: + case 1009: + case 1010: + case 1011: + case 1012: + case 1013: + case 1014: + case 1015: + case 1016: + case 1017: + case 1018: + case 1019: + case 1020: + case 1021: + case 1022: + case 1023: + case 1024: + case 1025: + case 1026: + case 1027: + case 1028: + case 1029: + case 1030: + case 1031: + case 1032: + case 1033: + case 1034: + case 1035: + case 1036: + case 1037: + case 1038: + case 1039: + case 1040: + case 1041: + case 1042: + case 1043: + case 1044: + case 1045: + case 1046: + case 1047: + case 1048: + case 1049: + case 1050: + case 1051: + case 1052: + case 1053: + case 1054: + case 1055: + case 1056: + case 1057: + case 1058: + case 1059: + case 1060: + case 1061: + case 1062: + case 1063: + case 1064: + case 1065: + case 1066: + case 1067: + case 1068: + case 1069: + case 1070: + case 1071: + case 1072: + case 1073: + case 1074: + case 1075: + case 1076: + case 1077: + case 1078: + case 1079: + case 1080: + case 1081: + case 1082: + case 1083: + case 1084: + case 1085: + case 1086: + case 1087: + case 1088: + case 1089: + case 1090: + case 1091: + case 1092: + case 1093: + case 1094: + case 1095: + case 1096: + case 1097: + case 1098: + case 1099: + case 1100: + case 1101: + case 1102: + case 1103: + case 1104: + case 1105: + case 1106: + case 1107: + case 1108: + case 1109: + case 1110: + case 1111: + case 1112: + case 1113: + case 1114: + case 1115: + case 1116: + case 1117: + case 1118: + case 1119: + case 1120: + case 1121: + case 1122: + case 1123: + case 1124: + case 1125: + case 1126: + case 1127: + case 1128: + case 1129: + case 1130: + case 1131: + case 1132: + case 1133: + case 1134: + case 1135: + case 1136: + case 1137: + case 1138: + case 1139: + case 1140: + case 1141: + case 1142: + case 1143: + case 1144: + case 1145: + case 1146: + case 1147: + case 1148: + case 1149: + case 1150: + case 1151: + case 1152: + case 1153: + case 1154: + case 1155: + case 1156: + case 1157: + case 1158: + case 1159: + case 1160: + case 1161: + case 1162: + case 1163: + case 1164: + case 1165: + case 1166: + case 1167: + case 1168: + case 1169: + case 1170: + case 1171: + case 1172: + case 1173: + case 1174: + case 1175: + case 1176: + case 1177: + case 1178: + case 1179: + case 1180: + case 1181: + case 1182: + case 1183: + case 1184: + case 1185: + case 1186: + case 1187: + case 1188: + case 1189: + case 1190: + case 1191: + case 1192: + case 1193: + case 1194: + case 1195: + case 1196: + case 1197: + case 1198: + case 1199: + case 1200: + case 1201: + case 1202: + case 1203: + case 1204: + case 1205: + case 1206: + case 1207: + case 1208: + case 1209: + case 1210: + case 1211: + case 1212: + case 1213: + case 1214: + case 1215: + case 1216: + case 1217: + case 1218: + case 1219: + case 1220: + case 1221: + case 1222: + case 1223: + case 1224: + case 1225: + case 1226: + case 1227: + case 1228: + case 1229: + case 1230: + case 1231: + case 1232: + case 1233: + case 1234: + case 1235: + case 1236: + case 1237: + case 1238: + case 1239: + case 1240: + case 1241: + case 1242: + case 1243: + case 1244: + case 1245: + case 1246: + case 1247: + case 1248: + case 1249: + case 1250: + case 1251: + case 1252: + case 1253: + case 1254: + case 1255: + case 1256: + case 1257: + case 1258: + case 1259: + case 1260: + case 1261: + case 1262: + case 1263: + case 1264: + case 1265: + case 1266: + case 1267: + case 1268: + case 1269: + case 1270: + case 1271: + case 1272: + case 1273: + case 1274: + case 1275: + case 1276: + case 1277: + case 1278: + case 1279: + case 1280: + case 1281: + case 1282: + case 1283: + case 1284: + case 1285: + case 1286: + case 1287: + case 1288: + case 1289: + case 1290: + case 1291: + case 1292: + case 1293: + case 1294: + case 1295: + case 1296: + case 1297: + case 1298: + case 1299: + case 1300: + case 1301: + case 1302: + case 1303: + case 1304: + case 1305: + case 1306: + case 1307: + case 1308: + case 1309: + case 1310: + case 1311: + case 1312: + case 1313: + case 1314: + case 1315: + case 1316: + case 1317: + case 1318: + case 1319: + case 1320: + case 1321: + case 1322: + case 1323: + case 1324: + case 1325: + case 1326: + case 1327: + case 1328: + case 1329: + case 1330: + case 1331: + case 1332: + case 1333: + case 1334: + case 1335: + case 1336: + case 1337: + case 1338: + case 1339: + case 1340: + case 1341: + case 1342: + case 1343: + case 1344: + case 1345: + case 1346: + case 1347: + case 1348: + case 1349: + case 1350: + case 1351: + case 1352: + case 1353: + case 1354: + case 1355: + case 1356: + case 1357: + case 1358: + case 1359: + case 1360: + case 1361: + case 1362: + case 1363: + case 1364: + case 1365: + case 1366: + case 1367: + case 1368: + case 1369: + case 1370: + case 1371: + case 1372: + case 1373: + case 1374: + case 1375: + case 1376: + case 1377: + case 1378: + case 1379: + case 1380: + case 1381: + case 1382: + case 1383: + case 1384: + case 1385: + case 1386: + case 1387: + case 1388: + case 1389: + case 1390: + case 1391: + case 1392: + case 1393: + case 1394: + case 1395: + case 1396: + case 1397: + case 1398: + case 1399: + case 1400: + case 1401: + case 1402: + case 1403: + case 1404: + case 1405: + case 1406: + case 1407: + case 1408: + case 1409: + case 1410: + case 1411: + case 1412: + case 1413: + case 1414: + case 1415: + case 1416: + case 1417: + case 1418: + case 1419: + case 1420: + case 1421: + case 1422: + case 1423: + case 1424: + case 1425: + case 1426: + case 1427: + case 1428: + case 1429: + case 1430: + case 1431: + case 1432: + case 1433: + case 1434: + case 1435: + case 1436: + case 1437: + case 1438: + case 1439: + case 1440: + case 1441: + case 1442: + case 1443: + case 1444: + case 1445: + case 1446: + case 1447: + case 1448: + case 1449: + case 1450: + case 1451: + case 1452: + case 1453: + case 1454: + case 1455: + case 1456: + case 1457: + case 1458: + case 1459: + case 1460: + case 1461: + case 1462: + case 1463: + case 1464: + case 1465: + case 1466: + case 1467: + case 1468: + case 1469: + case 1470: + case 1471: + case 1472: + case 1473: + case 1474: + case 1475: + case 1476: + case 1477: + case 1478: + case 1479: + case 1480: + case 1481: + case 1482: + case 1483: + case 1484: + case 1485: + case 1486: + case 1487: + case 1488: + case 1489: + case 1490: + case 1491: + case 1492: + case 1493: + case 1494: + case 1495: + case 1496: + case 1497: + case 1498: + case 1499: + case 1500: + case 1501: + case 1502: + case 1503: + case 1504: + case 1505: + case 1506: + case 1507: + case 1508: + case 1509: + case 1510: + case 1511: + case 1512: + case 1513: + case 1514: + case 1515: + case 1516: + case 1517: + case 1518: + case 1519: + case 1520: + case 1521: + case 1522: + case 1523: + case 1524: + case 1525: + case 1526: + case 1527: + case 1528: + case 1529: + case 1530: + case 1531: + case 1532: + case 1533: + case 1534: + case 1535: + case 1536: + case 1537: + case 1538: + case 1539: + case 1540: + case 1541: + case 1542: + case 1543: + case 1544: + case 1545: + case 1546: + case 1547: + case 1548: + case 1549: + case 1550: + case 1551: + case 1552: + case 1553: + case 1554: + case 1555: + case 1556: + case 1557: + case 1558: + case 1559: + case 1560: + case 1561: + case 1562: + case 1563: + case 1564: + case 1565: + case 1566: + case 1567: + case 1568: + case 1569: + case 1570: + case 1571: + case 1572: + case 1573: + case 1574: + case 1575: + case 1576: + case 1577: + case 1578: + case 1579: + case 1580: + case 1581: + case 1582: + case 1583: + case 1584: + case 1585: + case 1586: + case 1587: + case 1588: + case 1589: + case 1590: + case 1591: + case 1592: + case 1593: + case 1594: + case 1595: + case 1596: + case 1597: + case 1598: + case 1599: + case 1600: + case 1601: + case 1602: + case 1603: + case 1604: + case 1605: + case 1606: + case 1607: + case 1608: + case 1609: + case 1610: + case 1611: + case 1612: + case 1613: + case 1614: + case 1615: + case 1616: + case 1617: + case 1618: + case 1619: + case 1620: + case 1621: + case 1622: + case 1623: + case 1624: + case 1625: + case 1626: + case 1627: + case 1628: + case 1629: + case 1630: + case 1631: + case 1632: + case 1633: + case 1634: + case 1635: + case 1636: + case 1637: + case 1638: + case 1639: + case 1640: + case 1641: + case 1642: + case 1643: + case 1644: + case 1645: + case 1646: + case 1647: + case 1648: + case 1649: + case 1650: + case 1651: + case 1652: + case 1653: + case 1654: + case 1655: + case 1656: + case 1657: + case 1658: + case 1659: + case 1660: + case 1661: + case 1662: + case 1663: + case 1664: + case 1665: + case 1666: + case 1667: + case 1668: + case 1669: + case 1670: + case 1671: + case 1672: + case 1673: + case 1674: + case 1675: + case 1676: + case 1677: + case 1678: + case 1679: + case 1680: + case 1681: + case 1682: + case 1683: + case 1684: + case 1685: + case 1686: + case 1687: + case 1688: + case 1689: + case 1690: + case 1691: + case 1692: + case 1693: + case 1694: + case 1695: + case 1696: + case 1697: + case 1698: + case 1699: + case 1700: + case 1701: + case 1702: + case 1703: + case 1704: + case 1705: + case 1706: + case 1707: + case 1708: + case 1709: + case 1710: + case 1711: + case 1712: + case 1713: + case 1714: + case 1715: + case 1716: + case 1717: + case 1718: + case 1719: + case 1720: + case 1721: + case 1722: + case 1723: + case 1724: + case 1725: + case 1726: + case 1727: + case 1728: + case 1729: + case 1730: + case 1731: + case 1732: + case 1733: + case 1734: + case 1735: + case 1736: + case 1737: + case 1738: + case 1739: + case 1740: + case 1741: + case 1742: + case 1743: + case 1744: + case 1745: + case 1746: + case 1747: + case 1748: + case 1749: + case 1750: + case 1751: + case 1752: + case 1753: + case 1754: + case 1755: + case 1756: + case 1757: + case 1758: + case 1759: + case 1760: + case 1761: + case 1762: + case 1763: + case 1764: + case 1765: + case 1766: + case 1767: + case 1768: + case 1769: + case 1770: + case 1771: + case 1772: + case 1773: + case 1774: + case 1775: + case 1776: + case 1777: + case 1778: + case 1779: + case 1780: + case 1781: + case 1782: + case 1783: + case 1784: + case 1785: + case 1786: + case 1787: + case 1788: + case 1789: + case 1790: + case 1791: + case 1792: + case 1793: + case 1794: + case 1795: + case 1796: + case 1797: + case 1798: + case 1799: + case 1800: + case 1801: + case 1802: + case 1803: + case 1804: + case 1805: + case 1806: + case 1807: + case 1808: + case 1809: + case 1810: + case 1811: + case 1812: + case 1813: + case 1814: + case 1815: + case 1816: + case 1817: + case 1818: + case 1819: + case 1820: + case 1821: + case 1822: + case 1823: + case 1824: + case 1825: + case 1826: + case 1827: + case 1828: + case 1829: + case 1830: + case 1831: + case 1832: + case 1833: + case 1834: + case 1835: + case 1836: + case 1837: + case 1838: + case 1839: + case 1840: + case 1841: + case 1842: + case 1843: + case 1844: + case 1845: + case 1846: + case 1847: + case 1848: + case 1849: + case 1850: + case 1851: + case 1852: + case 1853: + case 1854: + case 1855: + case 1856: + case 1857: + case 1858: + case 1859: + case 1860: + case 1861: + case 1862: + case 1863: + case 1864: + case 1865: + case 1866: + case 1867: + case 1868: + case 1869: + case 1870: + case 1871: + case 1872: + case 1873: + case 1874: + case 1875: + case 1876: + case 1877: + case 1878: + case 1879: + case 1880: + case 1881: + case 1882: + case 1883: + case 1884: + case 1885: + case 1886: + case 1887: + case 1888: + case 1889: + case 1890: + case 1891: + case 1892: + case 1893: + case 1894: + case 1895: + case 1896: + case 1897: + case 1898: + case 1899: + case 1900: + case 1901: + case 1902: + case 1903: + case 1904: + case 1905: + case 1906: + case 1907: + case 1908: + case 1909: + case 1910: + case 1911: + case 1912: + case 1913: + case 1914: + case 1915: + case 1916: + case 1917: + case 1918: + case 1919: + case 1920: + case 1921: + case 1922: + case 1923: + case 1924: + case 1925: + case 1926: + case 1927: + case 1928: + case 1929: + case 1930: + case 1931: + case 1932: + case 1933: + case 1934: + case 1935: + case 1936: + case 1937: + case 1938: + case 1939: + case 1940: + case 1941: + case 1942: + case 1943: + case 1944: + case 1945: + case 1946: + case 1947: + case 1948: + case 1949: + case 1950: + case 1951: + case 1952: + case 1953: + case 1954: + case 1955: + case 1956: + case 1957: + case 1958: + case 1959: + case 1960: + case 1961: + case 1962: + case 1963: + case 1964: + case 1965: + case 1966: + case 1967: + case 1968: + case 1969: + case 1970: + case 1971: + case 1972: + case 1973: + case 1974: + case 1975: + case 1976: + case 1977: + case 1978: + case 1979: + case 1980: + case 1981: + case 1982: + case 1983: + case 1984: + case 1985: + case 1986: + case 1987: + case 1988: + case 1989: + case 1990: + case 1991: + case 1992: + case 1993: + case 1994: + case 1995: + case 1996: + case 1997: + case 1998: + case 1999: + case 2000: + case 2001: + case 2002: + case 2003: + case 2004: + case 2005: + case 2006: + case 2007: + case 2008: + case 2009: + case 2010: + case 2011: + case 2012: + case 2013: + case 2014: + case 2015: + case 2016: + case 2017: + case 2018: + case 2019: + case 2020: + case 2021: + case 2022: + case 2023: + case 2024: + case 2025: + case 2026: + case 2027: + case 2028: + case 2029: + case 2030: + case 2031: + case 2032: + case 2033: + case 2034: + case 2035: + case 2036: + case 2037: + case 2038: + case 2039: + case 2040: + case 2041: + case 2042: + case 2043: + case 2044: + case 2045: + case 2046: + case 2047: + case 2048: + case 2049: + case 2050: + case 2051: + case 2052: + case 2053: + case 2054: + case 2055: + case 2056: + case 2057: + case 2058: + case 2059: + case 2060: + case 2061: + case 2062: + case 2063: + case 2064: + case 2065: + case 2066: + case 2067: + case 2068: + case 2069: + case 2070: + case 2071: + case 2072: + case 2073: + case 2074: + case 2075: + case 2076: + case 2077: + case 2078: + case 2079: + case 2080: + case 2081: + case 2082: + case 2083: + case 2084: + case 2085: + case 2086: + case 2087: + case 2088: + case 2089: + case 2090: + case 2091: + case 2092: + case 2093: + case 2094: + case 2095: + case 2096: + case 2097: + case 2098: + case 2099: + case 2100: + case 2101: + case 2102: + case 2103: + case 2104: + case 2105: + case 2106: + case 2107: + case 2108: + case 2109: + case 2110: + case 2111: + case 2112: + case 2113: + case 2114: + case 2115: + case 2116: + case 2117: + case 2118: + case 2119: + case 2120: + case 2121: + case 2122: + case 2123: + case 2124: + case 2125: + case 2126: + case 2127: + case 2128: + case 2129: + case 2130: + case 2131: + case 2132: + case 2133: + case 2134: + case 2135: + case 2136: + case 2137: + case 2138: + case 2139: + case 2140: + case 2141: + case 2142: + case 2143: + case 2144: + case 2145: + case 2146: + case 2147: + case 2148: + case 2149: + case 2150: + case 2151: + case 2152: + case 2153: + case 2154: + case 2155: + case 2156: + case 2157: + case 2158: + case 2159: + case 2160: + case 2161: + case 2162: + case 2163: + case 2164: + case 2165: + case 2166: + case 2167: + case 2168: + case 2169: + case 2170: + case 2171: + case 2172: + case 2173: + case 2174: + case 2175: + case 2176: + case 2177: + case 2178: + case 2179: + case 2180: + case 2181: + case 2182: + case 2183: + case 2184: + case 2185: + case 2186: + case 2187: + case 2188: + case 2189: + case 2190: + case 2191: + case 2192: + case 2193: + case 2194: + case 2195: + case 2196: + case 2197: + case 2198: + case 2199: + case 2200: + case 2201: + case 2202: + case 2203: + case 2204: + case 2205: + case 2206: + case 2207: + case 2208: + case 2209: + case 2210: + case 2211: + case 2212: + case 2213: + case 2214: + case 2215: + case 2216: + case 2217: + case 2218: + case 2219: + case 2220: + case 2221: + case 2222: + case 2223: + case 2224: + case 2225: + case 2226: + case 2227: + case 2228: + case 2229: + case 2230: + case 2231: + case 2232: + case 2233: + case 2234: + case 2235: + case 2236: + case 2237: + case 2238: + case 2239: + case 2240: + case 2241: + case 2242: + case 2243: + case 2244: + case 2245: + case 2246: + case 2247: + case 2248: + case 2249: + case 2250: + case 2251: + case 2252: + case 2253: + case 2254: + case 2255: + case 2256: + case 2257: + case 2258: + case 2259: + case 2260: + case 2261: + case 2262: + case 2263: + case 2264: + case 2265: + case 2266: + case 2267: + case 2268: + case 2269: + case 2270: + case 2271: + case 2272: + case 2273: + case 2274: + case 2275: + case 2276: + case 2277: + case 2278: + case 2279: + case 2280: + case 2281: + case 2282: + case 2283: + case 2284: + case 2285: + case 2286: + case 2287: + case 2288: + case 2289: + case 2290: + case 2291: + case 2292: + case 2293: + case 2294: + case 2295: + case 2296: + case 2297: + case 2298: + case 2299: + case 2300: + case 2301: + case 2302: + case 2303: + case 2304: + case 2305: + case 2306: + case 2307: + case 2308: + case 2309: + case 2310: + case 2311: + case 2312: + case 2313: + case 2314: + case 2315: + case 2316: + case 2317: + case 2318: + case 2319: + case 2320: + case 2321: + case 2322: + case 2323: + case 2324: + case 2325: + case 2326: + case 2327: + case 2328: + case 2329: + case 2330: + case 2331: + case 2332: + case 2333: + case 2334: + case 2335: + case 2336: + case 2337: + case 2338: + case 2339: + case 2340: + case 2341: + case 2342: + case 2343: + case 2344: + case 2345: + case 2346: + case 2347: + case 2348: + case 2349: + case 2350: + case 2351: + case 2352: + case 2353: + case 2354: + case 2355: + case 2356: + case 2357: + case 2358: + case 2359: + case 2360: + case 2361: + case 2362: + case 2363: + case 2364: + case 2365: + case 2366: + case 2367: + case 2368: + case 2369: + case 2370: + case 2371: + case 2372: + case 2373: + case 2374: + case 2375: + case 2376: + case 2377: + case 2378: + case 2379: + case 2380: + case 2381: + case 2382: + case 2383: + case 2384: + case 2385: + case 2386: + case 2387: + case 2388: + case 2389: + case 2390: + case 2391: + case 2392: + case 2393: + case 2394: + case 2395: + case 2396: + case 2397: + case 2398: + case 2399: + case 2400: + case 2401: + case 2402: + case 2403: + case 2404: + case 2405: + case 2406: + case 2407: + case 2408: + case 2409: + case 2410: + case 2411: + case 2412: + case 2413: + case 2414: + case 2415: + case 2416: + case 2417: + case 2418: + case 2419: + case 2420: + case 2421: + case 2422: + case 2423: + case 2424: + case 2425: + case 2426: + case 2427: + case 2428: + case 2429: + case 2430: + case 2431: + case 2432: + case 2433: + case 2434: + case 2435: + case 2436: + case 2437: + case 2438: + case 2439: + case 2440: + case 2441: + case 2442: + case 2443: + case 2444: + case 2445: + case 2446: + case 2447: + case 2448: + case 2449: + case 2450: + case 2451: + case 2452: + case 2453: + case 2454: + case 2455: + case 2456: + case 2457: + case 2458: + case 2459: + case 2460: + case 2461: + case 2462: + case 2463: + case 2464: + case 2465: + case 2466: + case 2467: + case 2468: + case 2469: + case 2470: + case 2471: + case 2472: + case 2473: + case 2474: + case 2475: + case 2476: + case 2477: + case 2478: + case 2479: + case 2480: + case 2481: + case 2482: + case 2483: + case 2484: + case 2485: + case 2486: + case 2487: + case 2488: + case 2489: + case 2490: + case 2491: + case 2492: + case 2493: + case 2494: + case 2495: + case 2496: + case 2497: + case 2498: + case 2499: + case 2500: + case 2501: + case 2502: + case 2503: + case 2504: + case 2505: + case 2506: + case 2507: + case 2508: + case 2509: + case 2510: + case 2511: + case 2512: + case 2513: + case 2514: + case 2515: + case 2516: + case 2517: + case 2518: + case 2519: + case 2520: + case 2521: + case 2522: + case 2523: + case 2524: + case 2525: + case 2526: + case 2527: + case 2528: + case 2529: + case 2530: + case 2531: + case 2532: + case 2533: + case 2534: + case 2535: + case 2536: + case 2537: + case 2538: + case 2539: + case 2540: + case 2541: + case 2542: + case 2543: + case 2544: + case 2545: + case 2546: + case 2547: + case 2548: + case 2549: + case 2550: + case 2551: + case 2552: + case 2553: + case 2554: + case 2555: + case 2556: + case 2557: + case 2558: + case 2559: + case 2560: + case 2561: + case 2562: + case 2563: + case 2564: + case 2565: + case 2566: + case 2567: + case 2568: + case 2569: + case 2570: + case 2571: + case 2572: + case 2573: + case 2574: + case 2575: + case 2576: + case 2577: + case 2578: + case 2579: + case 2580: + case 2581: + case 2582: + case 2583: + case 2584: + case 2585: + case 2586: + case 2587: + case 2588: + case 2589: + case 2590: + case 2591: + case 2592: + case 2593: + case 2594: + case 2595: + case 2596: + case 2597: + case 2598: + case 2599: + case 2600: + case 2601: + case 2602: + case 2603: + case 2604: + case 2605: + case 2606: + case 2607: + case 2608: + case 2609: + case 2610: + case 2611: + case 2612: + case 2613: + case 2614: + case 2615: + case 2616: + case 2617: + case 2618: + case 2619: + case 2620: + case 2621: + case 2622: + case 2623: + case 2624: + case 2625: + case 2626: + case 2627: + case 2628: + case 2629: + case 2630: + case 2631: + case 2632: + case 2633: + case 2634: + case 2635: + case 2636: + case 2637: + case 2638: + case 2639: + case 2640: + case 2641: + case 2642: + case 2643: + case 2644: + case 2645: + case 2646: + case 2647: + case 2648: + case 2649: + case 2650: + case 2651: + case 2652: + case 2653: + case 2654: + case 2655: + case 2656: + case 2657: + case 2658: + case 2659: + case 2660: + case 2661: + case 2662: + case 2663: + case 2664: + case 2665: + case 2666: + case 2667: + case 2668: + case 2669: + case 2670: + case 2671: + case 2672: + case 2673: + case 2674: + case 2675: + case 2676: + case 2677: + case 2678: + case 2679: + case 2680: + case 2681: + case 2682: + case 2683: + case 2684: + case 2685: + case 2686: + case 2687: + case 2688: + case 2689: + case 2690: + case 2691: + case 2692: + case 2693: + case 2694: + case 2695: + case 2696: + case 2697: + case 2698: + case 2699: + case 2700: + case 2701: + case 2702: + case 2703: + case 2704: + case 2705: + case 2706: + case 2707: + case 2708: + case 2709: + case 2710: + case 2711: + case 2712: + case 2713: + case 2714: + case 2715: + case 2716: + case 2717: + case 2718: + case 2719: + case 2720: + case 2721: + case 2722: + case 2723: + case 2724: + case 2725: + case 2726: + case 2727: + case 2728: + case 2729: + case 2730: + case 2731: + case 2732: + case 2733: + case 2734: + case 2735: + case 2736: + case 2737: + case 2738: + case 2739: + case 2740: + case 2741: + case 2742: + case 2743: + case 2744: + case 2745: + case 2746: + case 2747: + case 2748: + case 2749: + case 2750: + case 2751: + case 2752: + case 2753: + case 2754: + case 2755: + case 2756: + case 2757: + case 2758: + case 2759: + case 2760: + case 2761: + case 2762: + case 2763: + case 2764: + case 2765: + case 2766: + case 2767: + case 2768: + case 2769: + case 2770: + case 2771: + case 2772: + case 2773: + case 2774: + case 2775: + case 2776: + case 2777: + case 2778: + case 2779: + case 2780: + case 2781: + case 2782: + case 2783: + case 2784: + case 2785: + case 2786: + case 2787: + case 2788: + case 2789: + case 2790: + case 2791: + case 2792: + case 2793: + case 2794: + case 2795: + case 2796: + case 2797: + case 2798: + case 2799: + case 2800: + case 2801: + case 2802: + case 2803: + case 2804: + case 2805: + case 2806: + case 2807: + case 2808: + case 2809: + case 2810: + case 2811: + case 2812: + case 2813: + case 2814: + case 2815: + case 2816: + case 2817: + case 2818: + case 2819: + case 2820: + case 2821: + case 2822: + case 2823: + case 2824: + case 2825: + case 2826: + case 2827: + case 2828: + case 2829: + case 2830: + case 2831: + case 2832: + case 2833: + case 2834: + case 2835: + case 2836: + case 2837: + case 2838: + case 2839: + case 2840: + case 2841: + case 2842: + case 2843: + case 2844: + case 2845: + case 2846: + case 2847: + case 2848: + case 2849: + case 2850: + case 2851: + case 2852: + case 2853: + case 2854: + case 2855: + case 2856: + case 2857: + case 2858: + case 2859: + case 2860: + case 2861: + case 2862: + case 2863: + case 2864: + case 2865: + case 2866: + case 2867: + case 2868: + case 2869: + case 2870: + case 2871: + case 2872: + case 2873: + case 2874: + case 2875: + case 2876: + case 2877: + case 2878: + case 2879: + case 2880: + case 2881: + case 2882: + case 2883: + case 2884: + case 2885: + case 2886: + case 2887: + case 2888: + case 2889: + case 2890: + case 2891: + case 2892: + case 2893: + case 2894: + case 2895: + case 2896: + case 2897: + case 2898: + case 2899: + case 2900: + case 2901: + case 2902: + case 2903: + case 2904: + case 2905: + case 2906: + case 2907: + case 2908: + case 2909: + case 2910: + case 2911: + case 2912: + case 2913: + case 2914: + case 2915: + case 2916: + case 2917: + case 2918: + case 2919: + case 2920: + case 2921: + case 2922: + case 2923: + case 2924: + case 2925: + case 2926: + case 2927: + case 2928: + case 2929: + case 2930: + case 2931: + case 2932: + case 2933: + case 2934: + case 2935: + case 2936: + case 2937: + case 2938: + case 2939: + case 2940: + case 2941: + case 2942: + case 2943: + case 2944: + case 2945: + case 2946: + case 2947: + case 2948: + case 2949: + case 2950: + case 2951: + case 2952: + case 2953: + case 2954: + case 2955: + case 2956: + case 2957: + case 2958: + case 2959: + case 2960: + case 2961: + case 2962: + case 2963: + case 2964: + case 2965: + case 2966: + case 2967: + case 2968: + case 2969: + case 2970: + case 2971: + case 2972: + case 2973: + case 2974: + case 2975: + case 2976: + case 2977: + case 2978: + case 2979: + case 2980: + case 2981: + case 2982: + case 2983: + case 2984: + case 2985: + case 2986: + case 2987: + case 2988: + case 2989: + case 2990: + case 2991: + case 2992: + case 2993: + case 2994: + case 2995: + case 2996: + case 2997: + case 2998: + case 2999: + case 3000: + case 3001: + case 3002: + case 3003: + case 3004: + case 3005: + case 3006: + case 3007: + case 3008: + case 3009: + case 3010: + case 3011: + case 3012: + case 3013: + case 3014: + case 3015: + case 3016: + case 3017: + case 3018: + case 3019: + case 3020: + case 3021: + case 3022: + case 3023: + case 3024: + case 3025: + case 3026: + case 3027: + case 3028: + case 3029: + case 3030: + case 3031: + case 3032: + case 3033: + case 3034: + case 3035: + case 3036: + case 3037: + case 3038: + case 3039: + case 3040: + case 3041: + case 3042: + case 3043: + case 3044: + case 3045: + case 3046: + case 3047: + case 3048: + case 3049: + case 3050: + case 3051: + case 3052: + case 3053: + case 3054: + case 3055: + case 3056: + case 3057: + case 3058: + case 3059: + case 3060: + case 3061: + case 3062: + case 3063: + case 3064: + case 3065: + case 3066: + case 3067: + case 3068: + case 3069: + case 3070: + case 3071: + case 3072: + case 3073: + case 3074: + case 3075: + case 3076: + case 3077: + case 3078: + case 3079: + case 3080: + case 3081: + case 3082: + case 3083: + case 3084: + case 3085: + case 3086: + case 3087: + case 3088: + case 3089: + case 3090: + case 3091: + case 3092: + case 3093: + case 3094: + case 3095: + case 3096: + case 3097: + case 3098: + case 3099: + case 3100: + case 3101: + case 3102: + case 3103: + case 3104: + case 3105: + case 3106: + case 3107: + case 3108: + case 3109: + case 3110: + case 3111: + case 3112: + case 3113: + case 3114: + case 3115: + case 3116: + case 3117: + case 3118: + case 3119: + case 3120: + case 3121: + case 3122: + case 3123: + case 3124: + case 3125: + case 3126: + case 3127: + case 3128: + case 3129: + case 3130: + case 3131: + case 3132: + case 3133: + case 3134: + case 3135: + case 3136: + case 3137: + case 3138: + case 3139: + case 3140: + case 3141: + case 3142: + case 3143: + case 3144: + case 3145: + case 3146: + case 3147: + case 3148: + case 3149: + case 3150: + case 3151: + case 3152: + case 3153: + case 3154: + case 3155: + case 3156: + case 3157: + case 3158: + case 3159: + case 3160: + case 3161: + case 3162: + case 3163: + case 3164: + case 3165: + case 3166: + case 3167: + case 3168: + case 3169: + case 3170: + case 3171: + case 3172: + case 3173: + case 3174: + case 3175: + case 3176: + case 3177: + case 3178: + case 3179: + case 3180: + case 3181: + case 3182: + case 3183: + case 3184: + case 3185: + case 3186: + case 3187: + case 3188: + case 3189: + case 3190: + case 3191: + case 3192: + case 3193: + case 3194: + case 3195: + case 3196: + case 3197: + case 3198: + case 3199: + case 3200: + case 3201: + case 3202: + case 3203: + case 3204: + case 3205: + case 3206: + case 3207: + case 3208: + case 3209: + case 3210: + case 3211: + case 3212: + case 3213: + case 3214: + case 3215: + case 3216: + case 3217: + case 3218: + case 3219: + case 3220: + case 3221: + case 3222: + case 3223: + case 3224: + case 3225: + case 3226: + case 3227: + case 3228: + case 3229: + case 3230: + case 3231: + case 3232: + case 3233: + case 3234: + case 3235: + case 3236: + case 3237: + case 3238: + case 3239: + case 3240: + case 3241: + case 3242: + case 3243: + case 3244: + case 3245: + case 3246: + case 3247: + case 3248: + case 3249: + case 3250: + case 3251: + case 3252: + case 3253: + case 3254: + case 3255: + case 3256: + case 3257: + case 3258: + case 3259: + case 3260: + case 3261: + case 3262: + case 3263: + case 3264: + case 3265: + case 3266: + case 3267: + case 3268: + case 3269: + case 3270: + case 3271: + case 3272: + case 3273: + case 3274: + case 3275: + case 3276: + case 3277: + case 3278: + case 3279: + case 3280: + case 3281: + case 3282: + case 3283: + case 3284: + case 3285: + case 3286: + case 3287: + case 3288: + case 3289: + case 3290: + case 3291: + case 3292: + case 3293: + case 3294: + case 3295: + case 3296: + case 3297: + case 3298: + case 3299: + case 3300: + case 3301: + case 3302: + case 3303: + case 3304: + case 3305: + case 3306: + case 3307: + case 3308: + case 3309: + case 3310: + case 3311: + case 3312: + case 3313: + case 3314: + case 3315: + case 3316: + case 3317: + case 3318: + case 3319: + case 3320: + case 3321: + case 3322: + case 3323: + case 3324: + case 3325: + case 3326: + case 3327: + case 3328: + case 3329: + case 3330: + case 3331: + case 3332: + case 3333: + case 3334: + case 3335: + case 3336: + case 3337: + case 3338: + case 3339: + case 3340: + case 3341: + case 3342: + case 3343: + case 3344: + case 3345: + case 3346: + case 3347: + case 3348: + case 3349: + case 3350: + case 3351: + case 3352: + case 3353: + case 3354: + case 3355: + case 3356: + case 3357: + case 3358: + case 3359: + case 3360: + case 3361: + case 3362: + case 3363: + case 3364: + case 3365: + case 3366: + case 3367: + case 3368: + case 3369: + case 3370: + case 3371: + case 3372: + case 3373: + case 3374: + case 3375: + case 3376: + case 3377: + case 3378: + case 3379: + case 3380: + case 3381: + case 3382: + case 3383: + case 3384: + case 3385: + case 3386: + case 3387: + case 3388: + case 3389: + case 3390: + case 3391: + case 3392: + case 3393: + case 3394: + case 3395: + case 3396: + case 3397: + case 3398: + case 3399: + case 3400: + case 3401: + case 3402: + case 3403: + case 3404: + case 3405: + case 3406: + case 3407: + case 3408: + case 3409: + case 3410: + case 3411: + case 3412: + case 3413: + case 3414: + case 3415: + case 3416: + case 3417: + case 3418: + case 3419: + case 3420: + case 3421: + case 3422: + case 3423: + case 3424: + case 3425: + case 3426: + case 3427: + case 3428: + case 3429: + case 3430: + case 3431: + case 3432: + case 3433: + case 3434: + case 3435: + case 3436: + case 3437: + case 3438: + case 3439: + case 3440: + case 3441: + case 3442: + case 3443: + case 3444: + case 3445: + case 3446: + case 3447: + case 3448: + case 3449: + case 3450: + case 3451: + case 3452: + case 3453: + case 3454: + case 3455: + case 3456: + case 3457: + case 3458: + case 3459: + case 3460: + case 3461: + case 3462: + case 3463: + case 3464: + case 3465: + case 3466: + case 3467: + case 3468: + case 3469: + case 3470: + case 3471: + case 3472: + case 3473: + case 3474: + case 3475: + case 3476: + case 3477: + case 3478: + case 3479: + case 3480: + case 3481: + case 3482: + case 3483: + case 3484: + case 3485: + case 3486: + case 3487: + case 3488: + case 3489: + case 3490: + case 3491: + case 3492: + case 3493: + case 3494: + case 3495: + case 3496: + case 3497: + case 3498: + case 3499: + case 3500: + case 3501: + case 3502: + case 3503: + case 3504: + case 3505: + case 3506: + case 3507: + case 3508: + case 3509: + case 3510: + case 3511: + case 3512: + case 3513: + case 3514: + case 3515: + case 3516: + case 3517: + case 3518: + case 3519: + case 3520: + case 3521: + case 3522: + case 3523: + case 3524: + case 3525: + case 3526: + case 3527: + case 3528: + case 3529: + case 3530: + case 3531: + case 3532: + case 3533: + case 3534: + case 3535: + case 3536: + case 3537: + case 3538: + case 3539: + case 3540: + case 3541: + case 3542: + case 3543: + case 3544: + case 3545: + case 3546: + case 3547: + case 3548: + case 3549: + case 3550: + case 3551: + case 3552: + case 3553: + case 3554: + case 3555: + case 3556: + case 3557: + case 3558: + case 3559: + case 3560: + case 3561: + case 3562: + case 3563: + case 3564: + case 3565: + case 3566: + case 3567: + case 3568: + case 3569: + case 3570: + case 3571: + case 3572: + case 3573: + case 3574: + case 3575: + case 3576: + case 3577: + case 3578: + case 3579: + case 3580: + case 3581: + case 3582: + case 3583: + case 3584: + case 3585: + case 3586: + case 3587: + case 3588: + case 3589: + case 3590: + case 3591: + case 3592: + case 3593: + case 3594: + case 3595: + case 3596: + case 3597: + case 3598: + case 3599: + case 3600: + case 3601: + case 3602: + case 3603: + case 3604: + case 3605: + case 3606: + case 3607: + case 3608: + case 3609: + case 3610: + case 3611: + case 3612: + case 3613: + case 3614: + case 3615: + case 3616: + case 3617: + case 3618: + case 3619: + case 3620: + case 3621: + case 3622: + case 3623: + case 3624: + case 3625: + case 3626: + case 3627: + case 3628: + case 3629: + case 3630: + case 3631: + case 3632: + case 3633: + case 3634: + case 3635: + case 3636: + case 3637: + case 3638: + case 3639: + case 3640: + case 3641: + case 3642: + case 3643: + case 3644: + case 3645: + case 3646: + case 3647: + case 3648: + case 3649: + case 3650: + case 3651: + case 3652: + case 3653: + case 3654: + case 3655: + case 3656: + case 3657: + case 3658: + case 3659: + case 3660: + case 3661: + case 3662: + case 3663: + case 3664: + case 3665: + case 3666: + case 3667: + case 3668: + case 3669: + case 3670: + case 3671: + case 3672: + case 3673: + case 3674: + case 3675: + case 3676: + case 3677: + case 3678: + case 3679: + case 3680: + case 3681: + case 3682: + case 3683: + case 3684: + case 3685: + case 3686: + case 3687: + case 3688: + case 3689: + case 3690: + case 3691: + case 3692: + case 3693: + case 3694: + case 3695: + case 3696: + case 3697: + case 3698: + case 3699: + case 3700: + case 3701: + case 3702: + case 3703: + case 3704: + case 3705: + case 3706: + case 3707: + case 3708: + case 3709: + case 3710: + case 3711: + case 3712: + case 3713: + case 3714: + case 3715: + case 3716: + case 3717: + case 3718: + case 3719: + case 3720: + case 3721: + case 3722: + case 3723: + case 3724: + case 3725: + case 3726: + case 3727: + case 3728: + case 3729: + case 3730: + case 3731: + case 3732: + case 3733: + case 3734: + case 3735: + case 3736: + case 3737: + case 3738: + case 3739: + case 3740: + case 3741: + case 3742: + case 3743: + case 3744: + case 3745: + case 3746: + case 3747: + case 3748: + case 3749: + case 3750: + case 3751: + case 3752: + case 3753: + case 3754: + case 3755: + case 3756: + case 3757: + case 3758: + case 3759: + case 3760: + case 3761: + case 3762: + case 3763: + case 3764: + case 3765: + case 3766: + case 3767: + case 3768: + case 3769: + case 3770: + case 3771: + case 3772: + case 3773: + case 3774: + case 3775: + case 3776: + case 3777: + case 3778: + case 3779: + case 3780: + case 3781: + case 3782: + case 3783: + case 3784: + case 3785: + case 3786: + case 3787: + case 3788: + case 3789: + case 3790: + case 3791: + case 3792: + case 3793: + case 3794: + case 3795: + case 3796: + case 3797: + case 3798: + case 3799: + case 3800: + case 3801: + case 3802: + case 3803: + case 3804: + case 3805: + case 3806: + case 3807: + case 3808: + case 3809: + case 3810: + case 3811: + case 3812: + case 3813: + case 3814: + case 3815: + case 3816: + case 3817: + case 3818: + case 3819: + case 3820: + case 3821: + case 3822: + case 3823: + case 3824: + case 3825: + case 3826: + case 3827: + case 3828: + case 3829: + case 3830: + case 3831: + case 3832: + case 3833: + case 3834: + case 3835: + case 3836: + case 3837: + case 3838: + case 3839: + case 3840: + case 3841: + case 3842: + case 3843: + case 3844: + case 3845: + case 3846: + case 3847: + case 3848: + case 3849: + case 3850: + case 3851: + case 3852: + case 3853: + case 3854: + case 3855: + case 3856: + case 3857: + case 3858: + case 3859: + case 3860: + case 3861: + case 3862: + case 3863: + case 3864: + case 3865: + case 3866: + case 3867: + case 3868: + case 3869: + case 3870: + case 3871: + case 3872: + case 3873: + case 3874: + case 3875: + case 3876: + case 3877: + case 3878: + case 3879: + case 3880: + case 3881: + case 3882: + case 3883: + case 3884: + case 3885: + case 3886: + case 3887: + case 3888: + case 3889: + case 3890: + case 3891: + case 3892: + case 3893: + case 3894: + case 3895: + case 3896: + case 3897: + case 3898: + case 3899: + case 3900: + case 3901: + case 3902: + case 3903: + case 3904: + case 3905: + case 3906: + case 3907: + case 3908: + case 3909: + case 3910: + case 3911: + case 3912: + case 3913: + case 3914: + case 3915: + case 3916: + case 3917: + case 3918: + case 3919: + case 3920: + case 3921: + case 3922: + case 3923: + case 3924: + case 3925: + case 3926: + case 3927: + case 3928: + case 3929: + case 3930: + case 3931: + case 3932: + case 3933: + case 3934: + case 3935: + case 3936: + case 3937: + case 3938: + case 3939: + case 3940: + case 3941: + case 3942: + case 3943: + case 3944: + case 3945: + case 3946: + case 3947: + case 3948: + case 3949: + case 3950: + case 3951: + case 3952: + case 3953: + case 3954: + case 3955: + case 3956: + case 3957: + case 3958: + case 3959: + case 3960: + case 3961: + case 3962: + case 3963: + case 3964: + case 3965: + case 3966: + case 3967: + case 3968: + case 3969: + case 3970: + case 3971: + case 3972: + case 3973: + case 3974: + case 3975: + case 3976: + case 3977: + case 3978: + case 3979: + case 3980: + case 3981: + case 3982: + case 3983: + case 3984: + case 3985: + case 3986: + case 3987: + case 3988: + case 3989: + case 3990: + case 3991: + case 3992: + case 3993: + case 3994: + case 3995: + case 3996: + case 3997: + case 3998: + case 3999: + case 4000: + case 4001: + case 4002: + case 4003: + case 4004: + case 4005: + case 4006: + case 4007: + case 4008: + case 4009: + case 4010: + case 4011: + case 4012: + case 4013: + case 4014: + case 4015: + case 4016: + case 4017: + case 4018: + case 4019: + case 4020: + case 4021: + case 4022: + case 4023: + case 4024: + case 4025: + case 4026: + case 4027: + case 4028: + case 4029: + case 4030: + case 4031: + case 4032: + case 4033: + case 4034: + case 4035: + case 4036: + case 4037: + case 4038: + case 4039: + case 4040: + case 4041: + case 4042: + case 4043: + case 4044: + case 4045: + case 4046: + case 4047: + case 4048: + case 4049: + case 4050: + case 4051: + case 4052: + case 4053: + case 4054: + case 4055: + case 4056: + case 4057: + case 4058: + case 4059: + case 4060: + case 4061: + case 4062: + case 4063: + case 4064: + case 4065: + case 4066: + case 4067: + case 4068: + case 4069: + case 4070: + case 4071: + case 4072: + case 4073: + case 4074: + case 4075: + case 4076: + case 4077: + case 4078: + case 4079: + case 4080: + case 4081: + case 4082: + case 4083: + case 4084: + case 4085: + case 4086: + case 4087: + case 4088: + case 4089: + case 4090: + case 4091: + case 4092: + case 4093: + case 4094: + case 4095: + case 4096: + case 4097: + case 4098: + case 4099: + case 4100: + case 4101: + case 4102: + case 4103: + case 4104: + case 4105: + case 4106: + case 4107: + case 4108: + case 4109: + case 4110: + case 4111: + case 4112: + case 4113: + case 4114: + case 4115: + case 4116: + case 4117: + case 4118: + case 4119: + case 4120: + case 4121: + case 4122: + case 4123: + case 4124: + case 4125: + case 4126: + case 4127: + case 4128: + case 4129: + case 4130: + case 4131: + case 4132: + case 4133: + case 4134: + case 4135: + case 4136: + case 4137: + case 4138: + case 4139: + case 4140: + case 4141: + case 4142: + case 4143: + case 4144: + case 4145: + case 4146: + case 4147: + case 4148: + case 4149: + case 4150: + case 4151: + case 4152: + case 4153: + case 4154: + case 4155: + case 4156: + case 4157: + case 4158: + case 4159: + case 4160: + case 4161: + case 4162: + case 4163: + case 4164: + case 4165: + case 4166: + case 4167: + case 4168: + case 4169: + case 4170: + case 4171: + case 4172: + case 4173: + case 4174: + case 4175: + case 4176: + case 4177: + case 4178: + case 4179: + case 4180: + case 4181: + case 4182: + case 4183: + case 4184: + case 4185: + case 4186: + case 4187: + case 4188: + case 4189: + case 4190: + case 4191: + case 4192: + case 4193: + case 4194: + case 4195: + case 4196: + case 4197: + case 4198: + case 4199: + case 4200: + case 4201: + case 4202: + case 4203: + case 4204: + case 4205: + case 4206: + case 4207: + case 4208: + case 4209: + case 4210: + case 4211: + case 4212: + case 4213: + case 4214: + case 4215: + case 4216: + case 4217: + case 4218: + case 4219: + case 4220: + case 4221: + case 4222: + case 4223: + case 4224: + case 4225: + case 4226: + case 4227: + case 4228: + case 4229: + case 4230: + case 4231: + case 4232: + case 4233: + case 4234: + case 4235: + case 4236: + case 4237: + case 4238: + case 4239: + case 4240: + case 4241: + case 4242: + case 4243: + case 4244: + case 4245: + case 4246: + case 4247: + case 4248: + case 4249: + case 4250: + case 4251: + case 4252: + case 4253: + case 4254: + case 4255: + case 4256: + case 4257: + case 4258: + case 4259: + case 4260: + case 4261: + case 4262: + case 4263: + case 4264: + case 4265: + case 4266: + case 4267: + case 4268: + case 4269: + case 4270: + case 4271: + case 4272: + case 4273: + case 4274: + case 4275: + case 4276: + case 4277: + case 4278: + case 4279: + case 4280: + case 4281: + case 4282: + case 4283: + case 4284: + case 4285: + case 4286: + case 4287: + case 4288: + case 4289: + case 4290: + case 4291: + case 4292: + case 4293: + case 4294: + case 4295: + case 4296: + case 4297: + case 4298: + case 4299: + case 4300: + case 4301: + case 4302: + case 4303: + case 4304: + case 4305: + case 4306: + case 4307: + case 4308: + case 4309: + case 4310: + case 4311: + case 4312: + case 4313: + case 4314: + case 4315: + case 4316: + case 4317: + case 4318: + case 4319: + case 4320: + case 4321: + case 4322: + case 4323: + case 4324: + case 4325: + case 4326: + case 4327: + case 4328: + case 4329: + case 4330: + case 4331: + case 4332: + case 4333: + case 4334: + case 4335: + case 4336: + case 4337: + case 4338: + case 4339: + case 4340: + case 4341: + case 4342: + case 4343: + case 4344: + case 4345: + case 4346: + case 4347: + case 4348: + case 4349: + case 4350: + case 4351: + case 4352: + case 4353: + case 4354: + case 4355: + case 4356: + case 4357: + case 4358: + case 4359: + case 4360: + case 4361: + case 4362: + case 4363: + case 4364: + case 4365: + case 4366: + case 4367: + case 4368: + case 4369: + case 4370: + case 4371: + case 4372: + case 4373: + case 4374: + case 4375: + case 4376: + case 4377: + case 4378: + case 4379: + case 4380: + case 4381: + case 4382: + case 4383: + case 4384: + case 4385: + case 4386: + case 4387: + case 4388: + case 4389: + case 4390: + case 4391: + case 4392: + case 4393: + case 4394: + case 4395: + case 4396: + case 4397: + case 4398: + case 4399: + case 4400: + case 4401: + case 4402: + case 4403: + case 4404: + case 4405: + case 4406: + case 4407: + case 4408: + case 4409: + case 4410: + case 4411: + case 4412: + case 4413: + case 4414: + case 4415: + case 4416: + case 4417: + case 4418: + case 4419: + case 4420: + case 4421: + case 4422: + case 4423: + case 4424: + case 4425: + case 4426: + case 4427: + case 4428: + case 4429: + case 4430: + case 4431: + case 4432: + case 4433: + case 4434: + case 4435: + case 4436: + case 4437: + case 4438: + case 4439: + case 4440: + case 4441: + case 4442: + case 4443: + case 4444: + case 4445: + case 4446: + case 4447: + case 4448: + case 4449: + case 4450: + case 4451: + case 4452: + case 4453: + case 4454: + case 4455: + case 4456: + case 4457: + case 4458: + case 4459: + case 4460: + case 4461: + case 4462: + case 4463: + case 4464: + case 4465: + case 4466: + case 4467: + case 4468: + case 4469: + case 4470: + case 4471: + case 4472: + case 4473: + case 4474: + case 4475: + case 4476: + case 4477: + case 4478: + case 4479: + case 4480: + case 4481: + case 4482: + case 4483: + case 4484: + case 4485: + case 4486: + case 4487: + case 4488: + case 4489: + case 4490: + case 4491: + case 4492: + case 4493: + case 4494: + case 4495: + case 4496: + case 4497: + case 4498: + case 4499: + case 4500: + case 4501: + case 4502: + case 4503: + case 4504: + case 4505: + case 4506: + case 4507: + case 4508: + case 4509: + case 4510: + case 4511: + case 4512: + case 4513: + case 4514: + case 4515: + case 4516: + case 4517: + case 4518: + case 4519: + case 4520: + case 4521: + case 4522: + case 4523: + case 4524: + case 4525: + case 4526: + case 4527: + case 4528: + case 4529: + case 4530: + case 4531: + case 4532: + case 4533: + case 4534: + case 4535: + case 4536: + case 4537: + case 4538: + case 4539: + case 4540: + case 4541: + case 4542: + case 4543: + case 4544: + case 4545: + case 4546: + case 4547: + case 4548: + case 4549: + case 4550: + case 4551: + case 4552: + case 4553: + case 4554: + case 4555: + case 4556: + case 4557: + case 4558: + case 4559: + case 4560: + case 4561: + case 4562: + case 4563: + case 4564: + case 4565: + case 4566: + case 4567: + case 4568: + case 4569: + case 4570: + case 4571: + case 4572: + case 4573: + case 4574: + case 4575: + case 4576: + case 4577: + case 4578: + case 4579: + case 4580: + case 4581: + case 4582: + case 4583: + case 4584: + case 4585: + case 4586: + case 4587: + case 4588: + case 4589: + case 4590: + case 4591: + case 4592: + case 4593: + case 4594: + case 4595: + case 4596: + case 4597: + case 4598: + case 4599: + case 4600: + case 4601: + case 4602: + case 4603: + case 4604: + case 4605: + case 4606: + case 4607: + case 4608: + case 4609: + case 4610: + case 4611: + case 4612: + case 4613: + case 4614: + case 4615: + case 4616: + case 4617: + case 4618: + case 4619: + case 4620: + case 4621: + case 4622: + case 4623: + case 4624: + case 4625: + case 4626: + case 4627: + case 4628: + case 4629: + case 4630: + case 4631: + case 4632: + case 4633: + case 4634: + case 4635: + case 4636: + case 4637: + case 4638: + case 4639: + case 4640: + case 4641: + case 4642: + case 4643: + case 4644: + case 4645: + case 4646: + case 4647: + case 4648: + case 4649: + case 4650: + case 4651: + case 4652: + case 4653: + case 4654: + case 4655: + case 4656: + case 4657: + case 4658: + case 4659: + case 4660: + case 4661: + case 4662: + case 4663: + case 4664: + case 4665: + case 4666: + case 4667: + case 4668: + case 4669: + case 4670: + case 4671: + case 4672: + case 4673: + case 4674: + case 4675: + case 4676: + case 4677: + case 4678: + case 4679: + case 4680: + case 4681: + case 4682: + case 4683: + case 4684: + case 4685: + case 4686: + case 4687: + case 4688: + case 4689: + case 4690: + case 4691: + case 4692: + case 4693: + case 4694: + case 4695: + case 4696: + case 4697: + case 4698: + case 4699: + case 4700: + case 4701: + case 4702: + case 4703: + case 4704: + case 4705: + case 4706: + case 4707: + case 4708: + case 4709: + case 4710: + case 4711: + case 4712: + case 4713: + case 4714: + case 4715: + case 4716: + case 4717: + case 4718: + case 4719: + case 4720: + case 4721: + case 4722: + case 4723: + case 4724: + case 4725: + case 4726: + case 4727: + case 4728: + case 4729: + case 4730: + case 4731: + case 4732: + case 4733: + case 4734: + case 4735: + case 4736: + case 4737: + case 4738: + case 4739: + case 4740: + case 4741: + case 4742: + case 4743: + case 4744: + case 4745: + case 4746: + case 4747: + case 4748: + case 4749: + case 4750: + case 4751: + case 4752: + case 4753: + case 4754: + case 4755: + case 4756: + case 4757: + case 4758: + case 4759: + case 4760: + case 4761: + case 4762: + case 4763: + case 4764: + case 4765: + case 4766: + case 4767: + case 4768: + case 4769: + case 4770: + case 4771: + case 4772: + case 4773: + case 4774: + case 4775: + case 4776: + case 4777: + case 4778: + case 4779: + case 4780: + case 4781: + case 4782: + case 4783: + case 4784: + case 4785: + case 4786: + case 4787: + case 4788: + case 4789: + case 4790: + case 4791: + case 4792: + case 4793: + case 4794: + case 4795: + case 4796: + case 4797: + case 4798: + case 4799: + case 4800: + case 4801: + case 4802: + case 4803: + case 4804: + case 4805: + case 4806: + case 4807: + case 4808: + case 4809: + case 4810: + case 4811: + case 4812: + case 4813: + case 4814: + case 4815: + case 4816: + case 4817: + case 4818: + case 4819: + case 4820: + case 4821: + case 4822: + case 4823: + case 4824: + case 4825: + case 4826: + case 4827: + case 4828: + case 4829: + case 4830: + case 4831: + case 4832: + case 4833: + case 4834: + case 4835: + case 4836: + case 4837: + case 4838: + case 4839: + case 4840: + case 4841: + case 4842: + case 4843: + case 4844: + case 4845: + case 4846: + case 4847: + case 4848: + case 4849: + case 4850: + case 4851: + case 4852: + case 4853: + case 4854: + case 4855: + case 4856: + case 4857: + case 4858: + case 4859: + case 4860: + case 4861: + case 4862: + case 4863: + case 4864: + case 4865: + case 4866: + case 4867: + case 4868: + case 4869: + case 4870: + case 4871: + case 4872: + case 4873: + case 4874: + case 4875: + case 4876: + case 4877: + case 4878: + case 4879: + case 4880: + case 4881: + case 4882: + case 4883: + case 4884: + case 4885: + case 4886: + case 4887: + case 4888: + case 4889: + case 4890: + case 4891: + case 4892: + case 4893: + case 4894: + case 4895: + case 4896: + case 4897: + case 4898: + case 4899: + case 4900: + case 4901: + case 4902: + case 4903: + case 4904: + case 4905: + case 4906: + case 4907: + case 4908: + case 4909: + case 4910: + case 4911: + case 4912: + case 4913: + case 4914: + case 4915: + case 4916: + case 4917: + case 4918: + case 4919: + case 4920: + case 4921: + case 4922: + case 4923: + case 4924: + case 4925: + case 4926: + case 4927: + case 4928: + case 4929: + case 4930: + case 4931: + case 4932: + case 4933: + case 4934: + case 4935: + case 4936: + case 4937: + case 4938: + case 4939: + case 4940: + case 4941: + case 4942: + case 4943: + case 4944: + case 4945: + case 4946: + case 4947: + case 4948: + case 4949: + case 4950: + case 4951: + case 4952: + case 4953: + case 4954: + case 4955: + case 4956: + case 4957: + case 4958: + case 4959: + case 4960: + case 4961: + case 4962: + case 4963: + case 4964: + case 4965: + case 4966: + case 4967: + case 4968: + case 4969: + case 4970: + case 4971: + case 4972: + case 4973: + case 4974: + case 4975: + case 4976: + case 4977: + case 4978: + case 4979: + case 4980: + case 4981: + case 4982: + case 4983: + case 4984: + case 4985: + case 4986: + case 4987: + case 4988: + case 4989: + case 4990: + case 4991: + case 4992: + case 4993: + case 4994: + case 4995: + case 4996: + case 4997: + case 4998: + case 4999: + case 5000: + case 5001: + case 5002: + case 5003: + case 5004: + case 5005: + case 5006: + case 5007: + case 5008: + case 5009: + case 5010: + case 5011: + case 5012: + case 5013: + case 5014: + case 5015: + case 5016: + case 5017: + case 5018: + case 5019: + case 5020: + case 5021: + case 5022: + case 5023: + case 5024: + case 5025: + case 5026: + case 5027: + case 5028: + case 5029: + case 5030: + case 5031: + case 5032: + case 5033: + case 5034: + case 5035: + case 5036: + case 5037: + case 5038: + case 5039: + case 5040: + case 5041: + case 5042: + case 5043: + case 5044: + case 5045: + case 5046: + case 5047: + case 5048: + case 5049: + case 5050: + case 5051: + case 5052: + case 5053: + case 5054: + case 5055: + case 5056: + case 5057: + case 5058: + case 5059: + case 5060: + case 5061: + case 5062: + case 5063: + case 5064: + case 5065: + case 5066: + case 5067: + case 5068: + case 5069: + case 5070: + case 5071: + case 5072: + case 5073: + case 5074: + case 5075: + case 5076: + case 5077: + case 5078: + case 5079: + case 5080: + case 5081: + case 5082: + case 5083: + case 5084: + case 5085: + case 5086: + case 5087: + case 5088: + case 5089: + case 5090: + case 5091: + case 5092: + case 5093: + case 5094: + case 5095: + case 5096: + case 5097: + case 5098: + case 5099: + case 5100: + case 5101: + case 5102: + case 5103: + case 5104: + case 5105: + case 5106: + case 5107: + case 5108: + case 5109: + case 5110: + case 5111: + case 5112: + case 5113: + case 5114: + case 5115: + case 5116: + case 5117: + case 5118: + case 5119: + case 5120: + case 5121: + case 5122: + case 5123: + case 5124: + case 5125: + case 5126: + case 5127: + case 5128: + case 5129: + case 5130: + case 5131: + case 5132: + case 5133: + case 5134: + case 5135: + case 5136: + case 5137: + case 5138: + case 5139: + case 5140: + case 5141: + case 5142: + case 5143: + case 5144: + case 5145: + case 5146: + case 5147: + case 5148: + case 5149: + case 5150: + case 5151: + case 5152: + case 5153: + case 5154: + case 5155: + case 5156: + case 5157: + case 5158: + case 5159: + case 5160: + case 5161: + case 5162: + case 5163: + case 5164: + case 5165: + case 5166: + case 5167: + case 5168: + case 5169: + case 5170: + case 5171: + case 5172: + case 5173: + case 5174: + case 5175: + case 5176: + case 5177: + case 5178: + case 5179: + case 5180: + case 5181: + case 5182: + case 5183: + case 5184: + case 5185: + case 5186: + case 5187: + case 5188: + case 5189: + case 5190: + case 5191: + case 5192: + case 5193: + case 5194: + case 5195: + case 5196: + case 5197: + case 5198: + case 5199: + case 5200: + case 5201: + case 5202: + case 5203: + case 5204: + case 5205: + case 5206: + case 5207: + case 5208: + case 5209: + case 5210: + case 5211: + case 5212: + case 5213: + case 5214: + case 5215: + case 5216: + case 5217: + case 5218: + case 5219: + case 5220: + case 5221: + case 5222: + case 5223: + case 5224: + case 5225: + case 5226: + case 5227: + case 5228: + case 5229: + case 5230: + case 5231: + case 5232: + case 5233: + case 5234: + case 5235: + case 5236: + case 5237: + case 5238: + case 5239: + case 5240: + case 5241: + case 5242: + case 5243: + case 5244: + case 5245: + case 5246: + case 5247: + case 5248: + case 5249: + case 5250: + case 5251: + case 5252: + case 5253: + case 5254: + case 5255: + case 5256: + case 5257: + case 5258: + case 5259: + case 5260: + case 5261: + case 5262: + case 5263: + case 5264: + case 5265: + case 5266: + case 5267: + case 5268: + case 5269: + case 5270: + case 5271: + case 5272: + case 5273: + case 5274: + case 5275: + case 5276: + case 5277: + case 5278: + case 5279: + case 5280: + case 5281: + case 5282: + case 5283: + case 5284: + case 5285: + case 5286: + case 5287: + case 5288: + case 5289: + case 5290: + case 5291: + case 5292: + case 5293: + case 5294: + case 5295: + case 5296: + case 5297: + case 5298: + case 5299: + case 5300: + case 5301: + case 5302: + case 5303: + case 5304: + case 5305: + case 5306: + case 5307: + case 5308: + case 5309: + case 5310: + case 5311: + case 5312: + case 5313: + case 5314: + case 5315: + case 5316: + case 5317: + case 5318: + case 5319: + case 5320: + case 5321: + case 5322: + case 5323: + case 5324: + case 5325: + case 5326: + case 5327: + case 5328: + case 5329: + case 5330: + case 5331: + case 5332: + case 5333: + case 5334: + case 5335: + case 5336: + case 5337: + case 5338: + case 5339: + case 5340: + case 5341: + case 5342: + case 5343: + case 5344: + case 5345: + case 5346: + case 5347: + case 5348: + case 5349: + case 5350: + case 5351: + case 5352: + case 5353: + case 5354: + case 5355: + case 5356: + case 5357: + case 5358: + case 5359: + case 5360: + case 5361: + case 5362: + case 5363: + case 5364: + case 5365: + case 5366: + case 5367: + case 5368: + case 5369: + case 5370: + case 5371: + case 5372: + case 5373: + case 5374: + case 5375: + case 5376: + case 5377: + case 5378: + case 5379: + case 5380: + case 5381: + case 5382: + case 5383: + case 5384: + case 5385: + case 5386: + case 5387: + case 5388: + case 5389: + case 5390: + case 5391: + case 5392: + case 5393: + case 5394: + case 5395: + case 5396: + case 5397: + case 5398: + case 5399: + case 5400: + case 5401: + case 5402: + case 5403: + case 5404: + case 5405: + case 5406: + case 5407: + case 5408: + case 5409: + case 5410: + case 5411: + case 5412: + case 5413: + case 5414: + case 5415: + case 5416: + case 5417: + case 5418: + case 5419: + case 5420: + case 5421: + case 5422: + case 5423: + case 5424: + case 5425: + case 5426: + case 5427: + case 5428: + case 5429: + case 5430: + case 5431: + case 5432: + case 5433: + case 5434: + case 5435: + case 5436: + case 5437: + case 5438: + case 5439: + case 5440: + case 5441: + case 5442: + case 5443: + case 5444: + case 5445: + case 5446: + case 5447: + case 5448: + case 5449: + case 5450: + case 5451: + case 5452: + case 5453: + case 5454: + case 5455: + case 5456: + case 5457: + case 5458: + case 5459: + case 5460: + case 5461: + case 5462: + case 5463: + case 5464: + case 5465: + case 5466: + case 5467: + case 5468: + case 5469: + case 5470: + case 5471: + case 5472: + case 5473: + case 5474: + case 5475: + case 5476: + case 5477: + case 5478: + case 5479: + case 5480: + case 5481: + case 5482: + case 5483: + case 5484: + case 5485: + case 5486: + case 5487: + case 5488: + case 5489: + case 5490: + case 5491: + case 5492: + case 5493: + case 5494: + case 5495: + case 5496: + case 5497: + case 5498: + case 5499: + case 5500: + case 5501: + case 5502: + case 5503: + case 5504: + case 5505: + case 5506: + case 5507: + case 5508: + case 5509: + case 5510: + case 5511: + case 5512: + case 5513: + case 5514: + case 5515: + case 5516: + case 5517: + case 5518: + case 5519: + case 5520: + case 5521: + case 5522: + case 5523: + case 5524: + case 5525: + case 5526: + case 5527: + case 5528: + case 5529: + case 5530: + case 5531: + case 5532: + case 5533: + case 5534: + case 5535: + case 5536: + case 5537: + case 5538: + case 5539: + case 5540: + case 5541: + case 5542: + case 5543: + case 5544: + case 5545: + case 5546: + case 5547: + case 5548: + case 5549: + case 5550: + case 5551: + case 5552: + case 5553: + case 5554: + case 5555: + case 5556: + case 5557: + case 5558: + case 5559: + case 5560: + case 5561: + case 5562: + case 5563: + case 5564: + case 5565: + case 5566: + case 5567: + case 5568: + case 5569: + case 5570: + case 5571: + case 5572: + case 5573: + case 5574: + case 5575: + case 5576: + case 5577: + case 5578: + case 5579: + case 5580: + case 5581: + case 5582: + case 5583: + case 5584: + case 5585: + case 5586: + case 5587: + case 5588: + case 5589: + case 5590: + case 5591: + case 5592: + case 5593: + case 5594: + case 5595: + case 5596: + case 5597: + case 5598: + case 5599: + case 5600: + case 5601: + case 5602: + case 5603: + case 5604: + case 5605: + case 5606: + case 5607: + case 5608: + case 5609: + case 5610: + case 5611: + case 5612: + case 5613: + case 5614: + case 5615: + case 5616: + case 5617: + case 5618: + case 5619: + case 5620: + case 5621: + case 5622: + case 5623: + case 5624: + case 5625: + case 5626: + case 5627: + case 5628: + case 5629: + case 5630: + case 5631: + case 5632: + case 5633: + case 5634: + case 5635: + case 5636: + case 5637: + case 5638: + case 5639: + case 5640: + case 5641: + case 5642: + case 5643: + case 5644: + case 5645: + case 5646: + case 5647: + case 5648: + case 5649: + case 5650: + case 5651: + case 5652: + case 5653: + case 5654: + case 5655: + case 5656: + case 5657: + case 5658: + case 5659: + case 5660: + case 5661: + case 5662: + case 5663: + case 5664: + case 5665: + case 5666: + case 5667: + case 5668: + case 5669: + case 5670: + case 5671: + case 5672: + case 5673: + case 5674: + case 5675: + case 5676: + case 5677: + case 5678: + case 5679: + case 5680: + case 5681: + case 5682: + case 5683: + case 5684: + case 5685: + case 5686: + case 5687: + case 5688: + case 5689: + case 5690: + case 5691: + case 5692: + case 5693: + case 5694: + case 5695: + case 5696: + case 5697: + case 5698: + case 5699: + case 5700: + case 5701: + case 5702: + case 5703: + case 5704: + case 5705: + case 5706: + case 5707: + case 5708: + case 5709: + case 5710: + case 5711: + case 5712: + case 5713: + case 5714: + case 5715: + case 5716: + case 5717: + case 5718: + case 5719: + case 5720: + case 5721: + case 5722: + case 5723: + case 5724: + case 5725: + case 5726: + case 5727: + case 5728: + case 5729: + case 5730: + case 5731: + case 5732: + case 5733: + case 5734: + case 5735: + case 5736: + case 5737: + case 5738: + case 5739: + case 5740: + case 5741: + case 5742: + case 5743: + case 5744: + case 5745: + case 5746: + case 5747: + case 5748: + case 5749: + case 5750: + case 5751: + case 5752: + case 5753: + case 5754: + case 5755: + case 5756: + case 5757: + case 5758: + case 5759: + case 5760: + case 5761: + case 5762: + case 5763: + case 5764: + case 5765: + case 5766: + case 5767: + case 5768: + case 5769: + case 5770: + case 5771: + case 5772: + case 5773: + case 5774: + case 5775: + case 5776: + case 5777: + case 5778: + case 5779: + case 5780: + case 5781: + case 5782: + case 5783: + case 5784: + case 5785: + case 5786: + case 5787: + case 5788: + case 5789: + case 5790: + case 5791: + case 5792: + case 5793: + case 5794: + case 5795: + case 5796: + case 5797: + case 5798: + case 5799: + case 5800: + case 5801: + case 5802: + case 5803: + case 5804: + case 5805: + case 5806: + case 5807: + case 5808: + case 5809: + case 5810: + case 5811: + case 5812: + case 5813: + case 5814: + case 5815: + case 5816: + case 5817: + case 5818: + case 5819: + case 5820: + case 5821: + case 5822: + case 5823: + case 5824: + case 5825: + case 5826: + case 5827: + case 5828: + case 5829: + case 5830: + case 5831: + case 5832: + case 5833: + case 5834: + case 5835: + case 5836: + case 5837: + case 5838: + case 5839: + case 5840: + case 5841: + case 5842: + case 5843: + case 5844: + case 5845: + case 5846: + case 5847: + case 5848: + case 5849: + case 5850: + case 5851: + case 5852: + case 5853: + case 5854: + case 5855: + case 5856: + case 5857: + case 5858: + case 5859: + case 5860: + case 5861: + case 5862: + case 5863: + case 5864: + case 5865: + case 5866: + case 5867: + case 5868: + case 5869: + case 5870: + case 5871: + case 5872: + case 5873: + case 5874: + case 5875: + case 5876: + case 5877: + case 5878: + case 5879: + case 5880: + case 5881: + case 5882: + case 5883: + case 5884: + case 5885: + case 5886: + case 5887: + case 5888: + case 5889: + case 5890: + case 5891: + case 5892: + case 5893: + case 5894: + case 5895: + case 5896: + case 5897: + case 5898: + case 5899: + case 5900: + case 5901: + case 5902: + case 5903: + case 5904: + case 5905: + case 5906: + case 5907: + case 5908: + case 5909: + case 5910: + case 5911: + case 5912: + case 5913: + case 5914: + case 5915: + case 5916: + case 5917: + case 5918: + case 5919: + case 5920: + case 5921: + case 5922: + case 5923: + case 5924: + case 5925: + case 5926: + case 5927: + case 5928: + case 5929: + case 5930: + case 5931: + case 5932: + case 5933: + case 5934: + case 5935: + case 5936: + case 5937: + case 5938: + case 5939: + case 5940: + case 5941: + case 5942: + case 5943: + case 5944: + case 5945: + case 5946: + case 5947: + case 5948: + case 5949: + case 5950: + case 5951: + case 5952: + case 5953: + case 5954: + case 5955: + case 5956: + case 5957: + case 5958: + case 5959: + case 5960: + case 5961: + case 5962: + case 5963: + case 5964: + case 5965: + case 5966: + case 5967: + case 5968: + case 5969: + case 5970: + case 5971: + case 5972: + case 5973: + case 5974: + case 5975: + case 5976: + case 5977: + case 5978: + case 5979: + case 5980: + case 5981: + case 5982: + case 5983: + case 5984: + case 5985: + case 5986: + case 5987: + case 5988: + case 5989: + case 5990: + case 5991: + case 5992: + case 5993: + case 5994: + case 5995: + case 5996: + case 5997: + case 5998: + case 5999: + case 6000: + case 6001: + case 6002: + case 6003: + case 6004: + case 6005: + case 6006: + case 6007: + case 6008: + case 6009: + case 6010: + case 6011: + case 6012: + case 6013: + case 6014: + case 6015: + case 6016: + case 6017: + case 6018: + case 6019: + case 6020: + case 6021: + case 6022: + case 6023: + case 6024: + case 6025: + case 6026: + case 6027: + case 6028: + case 6029: + case 6030: + case 6031: + case 6032: + case 6033: + case 6034: + case 6035: + case 6036: + case 6037: + case 6038: + case 6039: + case 6040: + case 6041: + case 6042: + case 6043: + case 6044: + case 6045: + case 6046: + case 6047: + case 6048: + case 6049: + case 6050: + case 6051: + case 6052: + case 6053: + case 6054: + case 6055: + case 6056: + case 6057: + case 6058: + case 6059: + case 6060: + case 6061: + case 6062: + case 6063: + case 6064: + case 6065: + case 6066: + case 6067: + case 6068: + case 6069: + case 6070: + case 6071: + case 6072: + case 6073: + case 6074: + case 6075: + case 6076: + case 6077: + case 6078: + case 6079: + case 6080: + case 6081: + case 6082: + case 6083: + case 6084: + case 6085: + case 6086: + case 6087: + case 6088: + case 6089: + case 6090: + case 6091: + case 6092: + case 6093: + case 6094: + case 6095: + case 6096: + case 6097: + case 6098: + case 6099: + case 6100: + case 6101: + case 6102: + case 6103: + case 6104: + case 6105: + case 6106: + case 6107: + case 6108: + case 6109: + case 6110: + case 6111: + case 6112: + case 6113: + case 6114: + case 6115: + case 6116: + case 6117: + case 6118: + case 6119: + case 6120: + case 6121: + case 6122: + case 6123: + case 6124: + case 6125: + case 6126: + case 6127: + case 6128: + case 6129: + case 6130: + case 6131: + case 6132: + case 6133: + case 6134: + case 6135: + case 6136: + case 6137: + case 6138: + case 6139: + case 6140: + case 6141: + case 6142: + case 6143: + case 6144: + case 6145: + case 6146: + case 6147: + case 6148: + case 6149: + case 6150: + case 6151: + case 6152: + case 6153: + case 6154: + case 6155: + case 6156: + case 6157: + case 6158: + case 6159: + case 6160: + case 6161: + case 6162: + case 6163: + case 6164: + case 6165: + case 6166: + case 6167: + case 6168: + case 6169: + case 6170: + case 6171: + case 6172: + case 6173: + case 6174: + case 6175: + case 6176: + case 6177: + case 6178: + case 6179: + case 6180: + case 6181: + case 6182: + case 6183: + case 6184: + case 6185: + case 6186: + case 6187: + case 6188: + case 6189: + case 6190: + case 6191: + case 6192: + case 6193: + case 6194: + case 6195: + case 6196: + case 6197: + case 6198: + case 6199: + case 6200: + case 6201: + case 6202: + case 6203: + case 6204: + case 6205: + case 6206: + case 6207: + case 6208: + case 6209: + case 6210: + case 6211: + case 6212: + case 6213: + case 6214: + case 6215: + case 6216: + case 6217: + case 6218: + case 6219: + case 6220: + case 6221: + case 6222: + case 6223: + case 6224: + case 6225: + case 6226: + case 6227: + case 6228: + case 6229: + case 6230: + case 6231: + case 6232: + case 6233: + case 6234: + case 6235: + case 6236: + case 6237: + case 6238: + case 6239: + case 6240: + case 6241: + case 6242: + case 6243: + case 6244: + case 6245: + case 6246: + case 6247: + case 6248: + case 6249: + case 6250: + case 6251: + case 6252: + case 6253: + case 6254: + case 6255: + case 6256: + case 6257: + case 6258: + case 6259: + case 6260: + case 6261: + case 6262: + case 6263: + case 6264: + case 6265: + case 6266: + case 6267: + case 6268: + case 6269: + case 6270: + case 6271: + case 6272: + case 6273: + case 6274: + case 6275: + case 6276: + case 6277: + case 6278: + case 6279: + case 6280: + case 6281: + case 6282: + case 6283: + case 6284: + case 6285: + case 6286: + case 6287: + case 6288: + case 6289: + case 6290: + case 6291: + case 6292: + case 6293: + case 6294: + case 6295: + case 6296: + case 6297: + case 6298: + case 6299: + case 6300: + case 6301: + case 6302: + case 6303: + case 6304: + case 6305: + case 6306: + case 6307: + case 6308: + case 6309: + case 6310: + case 6311: + case 6312: + case 6313: + case 6314: + case 6315: + case 6316: + case 6317: + case 6318: + case 6319: + case 6320: + case 6321: + case 6322: + case 6323: + case 6324: + case 6325: + case 6326: + case 6327: + case 6328: + case 6329: + case 6330: + case 6331: + case 6332: + case 6333: + case 6334: + case 6335: + case 6336: + case 6337: + case 6338: + case 6339: + case 6340: + case 6341: + case 6342: + case 6343: + case 6344: + case 6345: + case 6346: + case 6347: + case 6348: + case 6349: + case 6350: + case 6351: + case 6352: + case 6353: + case 6354: + case 6355: + case 6356: + case 6357: + case 6358: + case 6359: + case 6360: + case 6361: + case 6362: + case 6363: + case 6364: + case 6365: + case 6366: + case 6367: + case 6368: + case 6369: + case 6370: + case 6371: + case 6372: + case 6373: + case 6374: + case 6375: + case 6376: + case 6377: + case 6378: + case 6379: + case 6380: + case 6381: + case 6382: + case 6383: + case 6384: + case 6385: + case 6386: + case 6387: + case 6388: + case 6389: + case 6390: + case 6391: + case 6392: + case 6393: + case 6394: + case 6395: + case 6396: + case 6397: + case 6398: + case 6399: + case 6400: + case 6401: + case 6402: + case 6403: + case 6404: + case 6405: + case 6406: + case 6407: + case 6408: + case 6409: + case 6410: + case 6411: + case 6412: + case 6413: + case 6414: + case 6415: + case 6416: + case 6417: + case 6418: + case 6419: + case 6420: + case 6421: + case 6422: + case 6423: + case 6424: + case 6425: + case 6426: + case 6427: + case 6428: + case 6429: + case 6430: + case 6431: + case 6432: + case 6433: + case 6434: + case 6435: + case 6436: + case 6437: + case 6438: + case 6439: + case 6440: + case 6441: + case 6442: + case 6443: + case 6444: + case 6445: + case 6446: + case 6447: + case 6448: + case 6449: + case 6450: + case 6451: + case 6452: + case 6453: + case 6454: + case 6455: + case 6456: + case 6457: + case 6458: + case 6459: + case 6460: + case 6461: + case 6462: + case 6463: + case 6464: + case 6465: + case 6466: + case 6467: + case 6468: + case 6469: + case 6470: + case 6471: + case 6472: + case 6473: + case 6474: + case 6475: + case 6476: + case 6477: + case 6478: + case 6479: + case 6480: + case 6481: + case 6482: + case 6483: + case 6484: + case 6485: + case 6486: + case 6487: + case 6488: + case 6489: + case 6490: + case 6491: + case 6492: + case 6493: + case 6494: + case 6495: + case 6496: + case 6497: + case 6498: + case 6499: + case 6500: + case 6501: + case 6502: + case 6503: + case 6504: + case 6505: + case 6506: + case 6507: + case 6508: + case 6509: + case 6510: + case 6511: + case 6512: + case 6513: + case 6514: + case 6515: + case 6516: + case 6517: + case 6518: + case 6519: + case 6520: + case 6521: + case 6522: + case 6523: + case 6524: + case 6525: + case 6526: + case 6527: + case 6528: + case 6529: + case 6530: + case 6531: + case 6532: + case 6533: + case 6534: + case 6535: + case 6536: + case 6537: + case 6538: + case 6539: + case 6540: + case 6541: + case 6542: + case 6543: + case 6544: + case 6545: + case 6546: + case 6547: + case 6548: + case 6549: + case 6550: + case 6551: + case 6552: + case 6553: + case 6554: + case 6555: + case 6556: + case 6557: + case 6558: + case 6559: + case 6560: + case 6561: + case 6562: + case 6563: + case 6564: + case 6565: + case 6566: + case 6567: + case 6568: + case 6569: + case 6570: + case 6571: + case 6572: + case 6573: + case 6574: + case 6575: + case 6576: + case 6577: + case 6578: + case 6579: + case 6580: + case 6581: + case 6582: + case 6583: + case 6584: + case 6585: + case 6586: + case 6587: + case 6588: + case 6589: + case 6590: + case 6591: + case 6592: + case 6593: + case 6594: + case 6595: + case 6596: + case 6597: + case 6598: + case 6599: + case 6600: + case 6601: + case 6602: + case 6603: + case 6604: + case 6605: + case 6606: + case 6607: + case 6608: + case 6609: + case 6610: + case 6611: + case 6612: + case 6613: + case 6614: + case 6615: + case 6616: + case 6617: + case 6618: + case 6619: + case 6620: + case 6621: + case 6622: + case 6623: + case 6624: + case 6625: + case 6626: + case 6627: + case 6628: + case 6629: + case 6630: + case 6631: + case 6632: + case 6633: + case 6634: + case 6635: + case 6636: + case 6637: + case 6638: + case 6639: + case 6640: + case 6641: + case 6642: + case 6643: + case 6644: + case 6645: + case 6646: + case 6647: + case 6648: + case 6649: + case 6650: + case 6651: + case 6652: + case 6653: + case 6654: + case 6655: + case 6656: + case 6657: + case 6658: + case 6659: + case 6660: + case 6661: + case 6662: + case 6663: + case 6664: + case 6665: + case 6666: + case 6667: + case 6668: + case 6669: + case 6670: + case 6671: + case 6672: + case 6673: + case 6674: + case 6675: + case 6676: + case 6677: + case 6678: + case 6679: + case 6680: + case 6681: + case 6682: + case 6683: + case 6684: + case 6685: + case 6686: + case 6687: + case 6688: + case 6689: + case 6690: + case 6691: + case 6692: + case 6693: + case 6694: + case 6695: + case 6696: + case 6697: + case 6698: + case 6699: + case 6700: + case 6701: + case 6702: + case 6703: + case 6704: + case 6705: + case 6706: + case 6707: + case 6708: + case 6709: + case 6710: + case 6711: + case 6712: + case 6713: + case 6714: + case 6715: + case 6716: + case 6717: + case 6718: + case 6719: + case 6720: + case 6721: + case 6722: + case 6723: + case 6724: + case 6725: + case 6726: + case 6727: + case 6728: + case 6729: + case 6730: + case 6731: + case 6732: + case 6733: + case 6734: + case 6735: + case 6736: + case 6737: + case 6738: + case 6739: + case 6740: + case 6741: + case 6742: + case 6743: + case 6744: + case 6745: + case 6746: + case 6747: + case 6748: + case 6749: + case 6750: + case 6751: + case 6752: + case 6753: + case 6754: + case 6755: + case 6756: + case 6757: + case 6758: + case 6759: + case 6760: + case 6761: + case 6762: + case 6763: + case 6764: + case 6765: + case 6766: + case 6767: + case 6768: + case 6769: + case 6770: + case 6771: + case 6772: + case 6773: + case 6774: + case 6775: + case 6776: + case 6777: + case 6778: + case 6779: + case 6780: + case 6781: + case 6782: + case 6783: + case 6784: + case 6785: + case 6786: + case 6787: + case 6788: + case 6789: + case 6790: + case 6791: + case 6792: + case 6793: + case 6794: + case 6795: + case 6796: + case 6797: + case 6798: + case 6799: + case 6800: + case 6801: + case 6802: + case 6803: + case 6804: + case 6805: + case 6806: + case 6807: + case 6808: + case 6809: + case 6810: + case 6811: + case 6812: + case 6813: + case 6814: + case 6815: + case 6816: + case 6817: + case 6818: + case 6819: + case 6820: + case 6821: + case 6822: + case 6823: + case 6824: + case 6825: + case 6826: + case 6827: + case 6828: + case 6829: + case 6830: + case 6831: + case 6832: + case 6833: + case 6834: + case 6835: + case 6836: + case 6837: + case 6838: + case 6839: + case 6840: + case 6841: + case 6842: + case 6843: + case 6844: + case 6845: + case 6846: + case 6847: + case 6848: + case 6849: + case 6850: + case 6851: + case 6852: + case 6853: + case 6854: + case 6855: + case 6856: + case 6857: + case 6858: + case 6859: + case 6860: + case 6861: + case 6862: + case 6863: + case 6864: + case 6865: + case 6866: + case 6867: + case 6868: + case 6869: + case 6870: + case 6871: + case 6872: + case 6873: + case 6874: + case 6875: + case 6876: + case 6877: + case 6878: + case 6879: + case 6880: + case 6881: + case 6882: + case 6883: + case 6884: + case 6885: + case 6886: + case 6887: + case 6888: + case 6889: + case 6890: + case 6891: + case 6892: + case 6893: + case 6894: + case 6895: + case 6896: + case 6897: + case 6898: + case 6899: + case 6900: + case 6901: + case 6902: + case 6903: + case 6904: + case 6905: + case 6906: + case 6907: + case 6908: + case 6909: + case 6910: + case 6911: + case 6912: + case 6913: + case 6914: + case 6915: + case 6916: + case 6917: + case 6918: + case 6919: + case 6920: + case 6921: + case 6922: + case 6923: + case 6924: + case 6925: + case 6926: + case 6927: + case 6928: + case 6929: + case 6930: + case 6931: + case 6932: + case 6933: + case 6934: + case 6935: + case 6936: + case 6937: + case 6938: + case 6939: + case 6940: + case 6941: + case 6942: + case 6943: + case 6944: + case 6945: + case 6946: + case 6947: + case 6948: + case 6949: + case 6950: + case 6951: + case 6952: + case 6953: + case 6954: + case 6955: + case 6956: + case 6957: + case 6958: + case 6959: + case 6960: + case 6961: + case 6962: + case 6963: + case 6964: + case 6965: + case 6966: + case 6967: + case 6968: + case 6969: + case 6970: + case 6971: + case 6972: + case 6973: + case 6974: + case 6975: + case 6976: + case 6977: + case 6978: + case 6979: + case 6980: + case 6981: + case 6982: + case 6983: + case 6984: + case 6985: + case 6986: + case 6987: + case 6988: + case 6989: + case 6990: + case 6991: + case 6992: + case 6993: + case 6994: + case 6995: + case 6996: + case 6997: + case 6998: + case 6999: + case 7000: + case 7001: + case 7002: + case 7003: + case 7004: + case 7005: + case 7006: + case 7007: + case 7008: + case 7009: + case 7010: + case 7011: + case 7012: + case 7013: + case 7014: + case 7015: + case 7016: + case 7017: + case 7018: + case 7019: + case 7020: + case 7021: + case 7022: + case 7023: + case 7024: + case 7025: + case 7026: + case 7027: + case 7028: + case 7029: + case 7030: + case 7031: + case 7032: + case 7033: + case 7034: + case 7035: + case 7036: + case 7037: + case 7038: + case 7039: + case 7040: + case 7041: + case 7042: + case 7043: + case 7044: + case 7045: + case 7046: + case 7047: + case 7048: + case 7049: + case 7050: + case 7051: + case 7052: + case 7053: + case 7054: + case 7055: + case 7056: + case 7057: + case 7058: + case 7059: + case 7060: + case 7061: + case 7062: + case 7063: + case 7064: + case 7065: + case 7066: + case 7067: + case 7068: + case 7069: + case 7070: + case 7071: + case 7072: + case 7073: + case 7074: + case 7075: + case 7076: + case 7077: + case 7078: + case 7079: + case 7080: + case 7081: + case 7082: + case 7083: + case 7084: + case 7085: + case 7086: + case 7087: + case 7088: + case 7089: + case 7090: + case 7091: + case 7092: + case 7093: + case 7094: + case 7095: + case 7096: + case 7097: + case 7098: + case 7099: + case 7100: + case 7101: + case 7102: + case 7103: + case 7104: + case 7105: + case 7106: + case 7107: + case 7108: + case 7109: + case 7110: + case 7111: + case 7112: + case 7113: + case 7114: + case 7115: + case 7116: + case 7117: + case 7118: + case 7119: + case 7120: + case 7121: + case 7122: + case 7123: + case 7124: + case 7125: + case 7126: + case 7127: + case 7128: + case 7129: + case 7130: + case 7131: + case 7132: + case 7133: + case 7134: + case 7135: + case 7136: + case 7137: + case 7138: + case 7139: + case 7140: + case 7141: + case 7142: + case 7143: + case 7144: + case 7145: + case 7146: + case 7147: + case 7148: + case 7149: + case 7150: + case 7151: + case 7152: + case 7153: + case 7154: + case 7155: + case 7156: + case 7157: + case 7158: + case 7159: + case 7160: + case 7161: + case 7162: + case 7163: + case 7164: + case 7165: + case 7166: + case 7167: + case 7168: + case 7169: + case 7170: + case 7171: + case 7172: + case 7173: + case 7174: + case 7175: + case 7176: + case 7177: + case 7178: + case 7179: + case 7180: + case 7181: + case 7182: + case 7183: + case 7184: + case 7185: + case 7186: + case 7187: + case 7188: + case 7189: + case 7190: + case 7191: + case 7192: + case 7193: + case 7194: + case 7195: + case 7196: + case 7197: + case 7198: + case 7199: + case 7200: + case 7201: + case 7202: + case 7203: + case 7204: + case 7205: + case 7206: + case 7207: + case 7208: + case 7209: + case 7210: + case 7211: + case 7212: + case 7213: + case 7214: + case 7215: + case 7216: + case 7217: + case 7218: + case 7219: + case 7220: + case 7221: + case 7222: + case 7223: + case 7224: + case 7225: + case 7226: + case 7227: + case 7228: + case 7229: + case 7230: + case 7231: + case 7232: + case 7233: + case 7234: + case 7235: + case 7236: + case 7237: + case 7238: + case 7239: + case 7240: + case 7241: + case 7242: + case 7243: + case 7244: + case 7245: + case 7246: + case 7247: + case 7248: + case 7249: + case 7250: + case 7251: + case 7252: + case 7253: + case 7254: + case 7255: + case 7256: + case 7257: + case 7258: + case 7259: + case 7260: + case 7261: + case 7262: + case 7263: + case 7264: + case 7265: + case 7266: + case 7267: + case 7268: + case 7269: + case 7270: + case 7271: + case 7272: + case 7273: + case 7274: + case 7275: + case 7276: + case 7277: + case 7278: + case 7279: + case 7280: + case 7281: + case 7282: + case 7283: + case 7284: + case 7285: + case 7286: + case 7287: + case 7288: + case 7289: + case 7290: + case 7291: + case 7292: + case 7293: + case 7294: + case 7295: + case 7296: + case 7297: + case 7298: + case 7299: + case 7300: + case 7301: + case 7302: + case 7303: + case 7304: + case 7305: + case 7306: + case 7307: + case 7308: + case 7309: + case 7310: + case 7311: + case 7312: + case 7313: + case 7314: + case 7315: + case 7316: + case 7317: + case 7318: + case 7319: + case 7320: + case 7321: + case 7322: + case 7323: + case 7324: + case 7325: + case 7326: + case 7327: + case 7328: + case 7329: + case 7330: + case 7331: + case 7332: + case 7333: + case 7334: + case 7335: + case 7336: + case 7337: + case 7338: + case 7339: + case 7340: + case 7341: + case 7342: + case 7343: + case 7344: + case 7345: + case 7346: + case 7347: + case 7348: + case 7349: + case 7350: + case 7351: + case 7352: + case 7353: + case 7354: + case 7355: + case 7356: + case 7357: + case 7358: + case 7359: + case 7360: + case 7361: + case 7362: + case 7363: + case 7364: + case 7365: + case 7366: + case 7367: + case 7368: + case 7369: + case 7370: + case 7371: + case 7372: + case 7373: + case 7374: + case 7375: + case 7376: + case 7377: + case 7378: + case 7379: + case 7380: + case 7381: + case 7382: + case 7383: + case 7384: + case 7385: + case 7386: + case 7387: + case 7388: + case 7389: + case 7390: + case 7391: + case 7392: + case 7393: + case 7394: + case 7395: + case 7396: + case 7397: + case 7398: + case 7399: + case 7400: + case 7401: + case 7402: + case 7403: + case 7404: + case 7405: + case 7406: + case 7407: + case 7408: + case 7409: + case 7410: + case 7411: + case 7412: + case 7413: + case 7414: + case 7415: + case 7416: + case 7417: + case 7418: + case 7419: + case 7420: + case 7421: + case 7422: + case 7423: + case 7424: + case 7425: + case 7426: + case 7427: + case 7428: + case 7429: + case 7430: + case 7431: + case 7432: + case 7433: + case 7434: + case 7435: + case 7436: + case 7437: + case 7438: + case 7439: + case 7440: + case 7441: + case 7442: + case 7443: + case 7444: + case 7445: + case 7446: + case 7447: + case 7448: + case 7449: + case 7450: + case 7451: + case 7452: + case 7453: + case 7454: + case 7455: + case 7456: + case 7457: + case 7458: + case 7459: + case 7460: + case 7461: + case 7462: + case 7463: + case 7464: + case 7465: + case 7466: + case 7467: + case 7468: + case 7469: + case 7470: + case 7471: + case 7472: + case 7473: + case 7474: + case 7475: + case 7476: + case 7477: + case 7478: + case 7479: + case 7480: + case 7481: + case 7482: + case 7483: + case 7484: + case 7485: + case 7486: + case 7487: + case 7488: + case 7489: + case 7490: + case 7491: + case 7492: + case 7493: + case 7494: + case 7495: + case 7496: + case 7497: + case 7498: + case 7499: + case 7500: + case 7501: + case 7502: + case 7503: + case 7504: + case 7505: + case 7506: + case 7507: + case 7508: + case 7509: + case 7510: + case 7511: + case 7512: + case 7513: + case 7514: + case 7515: + case 7516: + case 7517: + case 7518: + case 7519: + case 7520: + case 7521: + case 7522: + case 7523: + case 7524: + case 7525: + case 7526: + case 7527: + case 7528: + case 7529: + case 7530: + case 7531: + case 7532: + case 7533: + case 7534: + case 7535: + case 7536: + case 7537: + case 7538: + case 7539: + case 7540: + case 7541: + case 7542: + case 7543: + case 7544: + case 7545: + case 7546: + case 7547: + case 7548: + case 7549: + case 7550: + case 7551: + case 7552: + case 7553: + case 7554: + case 7555: + case 7556: + case 7557: + case 7558: + case 7559: + case 7560: + case 7561: + case 7562: + case 7563: + case 7564: + case 7565: + case 7566: + case 7567: + case 7568: + case 7569: + case 7570: + case 7571: + case 7572: + case 7573: + case 7574: + case 7575: + case 7576: + case 7577: + case 7578: + case 7579: + case 7580: + case 7581: + case 7582: + case 7583: + case 7584: + case 7585: + case 7586: + case 7587: + case 7588: + case 7589: + case 7590: + case 7591: + case 7592: + case 7593: + case 7594: + case 7595: + case 7596: + case 7597: + case 7598: + case 7599: + case 7600: + case 7601: + case 7602: + case 7603: + case 7604: + case 7605: + case 7606: + case 7607: + case 7608: + case 7609: + case 7610: + case 7611: + case 7612: + case 7613: + case 7614: + case 7615: + case 7616: + case 7617: + case 7618: + case 7619: + case 7620: + case 7621: + case 7622: + case 7623: + case 7624: + case 7625: + case 7626: + case 7627: + case 7628: + case 7629: + case 7630: + case 7631: + case 7632: + case 7633: + case 7634: + case 7635: + case 7636: + case 7637: + case 7638: + case 7639: + case 7640: + case 7641: + case 7642: + case 7643: + case 7644: + case 7645: + case 7646: + case 7647: + case 7648: + case 7649: + case 7650: + case 7651: + case 7652: + case 7653: + case 7654: + case 7655: + case 7656: + case 7657: + case 7658: + case 7659: + case 7660: + case 7661: + case 7662: + case 7663: + case 7664: + case 7665: + case 7666: + case 7667: + case 7668: + case 7669: + case 7670: + case 7671: + case 7672: + case 7673: + case 7674: + case 7675: + case 7676: + case 7677: + case 7678: + case 7679: + case 7680: + case 7681: + case 7682: + case 7683: + case 7684: + case 7685: + case 7686: + case 7687: + case 7688: + case 7689: + case 7690: + case 7691: + case 7692: + case 7693: + case 7694: + case 7695: + case 7696: + case 7697: + case 7698: + case 7699: + case 7700: + case 7701: + case 7702: + case 7703: + case 7704: + case 7705: + case 7706: + case 7707: + case 7708: + case 7709: + case 7710: + case 7711: + case 7712: + case 7713: + case 7714: + case 7715: + case 7716: + case 7717: + case 7718: + case 7719: + case 7720: + case 7721: + case 7722: + case 7723: + case 7724: + case 7725: + case 7726: + case 7727: + case 7728: + case 7729: + case 7730: + case 7731: + case 7732: + case 7733: + case 7734: + case 7735: + case 7736: + case 7737: + case 7738: + case 7739: + case 7740: + case 7741: + case 7742: + case 7743: + case 7744: + case 7745: + case 7746: + case 7747: + case 7748: + case 7749: + case 7750: + case 7751: + case 7752: + case 7753: + case 7754: + case 7755: + case 7756: + case 7757: + case 7758: + case 7759: + case 7760: + case 7761: + case 7762: + case 7763: + case 7764: + case 7765: + case 7766: + case 7767: + case 7768: + case 7769: + case 7770: + case 7771: + case 7772: + case 7773: + case 7774: + case 7775: + case 7776: + case 7777: + case 7778: + case 7779: + case 7780: + case 7781: + case 7782: + case 7783: + case 7784: + case 7785: + case 7786: + case 7787: + case 7788: + case 7789: + case 7790: + case 7791: + case 7792: + case 7793: + case 7794: + case 7795: + case 7796: + case 7797: + case 7798: + case 7799: + case 7800: + case 7801: + case 7802: + case 7803: + case 7804: + case 7805: + case 7806: + case 7807: + case 7808: + case 7809: + case 7810: + case 7811: + case 7812: + case 7813: + case 7814: + case 7815: + case 7816: + case 7817: + case 7818: + case 7819: + case 7820: + case 7821: + case 7822: + case 7823: + case 7824: + case 7825: + case 7826: + case 7827: + case 7828: + case 7829: + case 7830: + case 7831: + case 7832: + case 7833: + case 7834: + case 7835: + case 7836: + case 7837: + case 7838: + case 7839: + case 7840: + case 7841: + case 7842: + case 7843: + case 7844: + case 7845: + case 7846: + case 7847: + case 7848: + case 7849: + case 7850: + case 7851: + case 7852: + case 7853: + case 7854: + case 7855: + case 7856: + case 7857: + case 7858: + case 7859: + case 7860: + case 7861: + case 7862: + case 7863: + case 7864: + case 7865: + case 7866: + case 7867: + case 7868: + case 7869: + case 7870: + case 7871: + case 7872: + case 7873: + case 7874: + case 7875: + case 7876: + case 7877: + case 7878: + case 7879: + case 7880: + case 7881: + case 7882: + case 7883: + case 7884: + case 7885: + case 7886: + case 7887: + case 7888: + case 7889: + case 7890: + case 7891: + case 7892: + case 7893: + case 7894: + case 7895: + case 7896: + case 7897: + case 7898: + case 7899: + case 7900: + case 7901: + case 7902: + case 7903: + case 7904: + case 7905: + case 7906: + case 7907: + case 7908: + case 7909: + case 7910: + case 7911: + case 7912: + case 7913: + case 7914: + case 7915: + case 7916: + case 7917: + case 7918: + case 7919: + case 7920: + case 7921: + case 7922: + case 7923: + case 7924: + case 7925: + case 7926: + case 7927: + case 7928: + case 7929: + case 7930: + case 7931: + case 7932: + case 7933: + case 7934: + case 7935: + case 7936: + case 7937: + case 7938: + case 7939: + case 7940: + case 7941: + case 7942: + case 7943: + case 7944: + case 7945: + case 7946: + case 7947: + case 7948: + case 7949: + case 7950: + case 7951: + case 7952: + case 7953: + case 7954: + case 7955: + case 7956: + case 7957: + case 7958: + case 7959: + case 7960: + case 7961: + case 7962: + case 7963: + case 7964: + case 7965: + case 7966: + case 7967: + case 7968: + case 7969: + case 7970: + case 7971: + case 7972: + case 7973: + case 7974: + case 7975: + case 7976: + case 7977: + case 7978: + case 7979: + case 7980: + case 7981: + case 7982: + case 7983: + case 7984: + case 7985: + case 7986: + case 7987: + case 7988: + case 7989: + case 7990: + case 7991: + case 7992: + case 7993: + case 7994: + case 7995: + case 7996: + case 7997: + case 7998: + case 7999: + case 8000: + case 8001: + case 8002: + case 8003: + case 8004: + case 8005: + case 8006: + case 8007: + case 8008: + case 8009: + case 8010: + case 8011: + case 8012: + case 8013: + case 8014: + case 8015: + case 8016: + case 8017: + case 8018: + case 8019: + case 8020: + case 8021: + case 8022: + case 8023: + case 8024: + case 8025: + case 8026: + case 8027: + case 8028: + case 8029: + case 8030: + case 8031: + case 8032: + case 8033: + case 8034: + case 8035: + case 8036: + case 8037: + case 8038: + case 8039: + case 8040: + case 8041: + case 8042: + case 8043: + case 8044: + case 8045: + case 8046: + case 8047: + case 8048: + case 8049: + case 8050: + case 8051: + case 8052: + case 8053: + case 8054: + case 8055: + case 8056: + case 8057: + case 8058: + case 8059: + case 8060: + case 8061: + case 8062: + case 8063: + case 8064: + case 8065: + case 8066: + case 8067: + case 8068: + case 8069: + case 8070: + case 8071: + case 8072: + case 8073: + case 8074: + case 8075: + case 8076: + case 8077: + case 8078: + case 8079: + case 8080: + case 8081: + case 8082: + case 8083: + case 8084: + case 8085: + case 8086: + case 8087: + case 8088: + case 8089: + case 8090: + case 8091: + case 8092: + case 8093: + case 8094: + case 8095: + case 8096: + case 8097: + case 8098: + case 8099: + case 8100: + case 8101: + case 8102: + case 8103: + case 8104: + case 8105: + case 8106: + case 8107: + case 8108: + case 8109: + case 8110: + case 8111: + case 8112: + case 8113: + case 8114: + case 8115: + case 8116: + case 8117: + case 8118: + case 8119: + case 8120: + case 8121: + case 8122: + case 8123: + case 8124: + case 8125: + case 8126: + case 8127: + case 8128: + case 8129: + case 8130: + case 8131: + case 8132: + case 8133: + case 8134: + case 8135: + case 8136: + case 8137: + case 8138: + case 8139: + case 8140: + case 8141: + case 8142: + case 8143: + case 8144: + case 8145: + case 8146: + case 8147: + case 8148: + case 8149: + case 8150: + case 8151: + case 8152: + case 8153: + case 8154: + case 8155: + case 8156: + case 8157: + case 8158: + case 8159: + case 8160: + case 8161: + case 8162: + case 8163: + case 8164: + case 8165: + case 8166: + case 8167: + case 8168: + case 8169: + case 8170: + case 8171: + case 8172: + case 8173: + case 8174: + case 8175: + case 8176: + case 8177: + case 8178: + case 8179: + case 8180: + case 8181: + case 8182: + case 8183: + case 8184: + case 8185: + case 8186: + case 8187: + case 8188: + case 8189: + case 8190: + case 8191: + case 8192: + case 8193: + case 8194: + case 8195: + case 8196: + case 8197: + case 8198: + case 8199: + case 8200: + case 8201: + case 8202: + case 8203: + case 8204: + case 8205: + case 8206: + case 8207: + case 8208: + case 8209: + case 8210: + case 8211: + case 8212: + case 8213: + case 8214: + case 8215: + case 8216: + case 8217: + case 8218: + case 8219: + case 8220: + case 8221: + case 8222: + case 8223: + case 8224: + case 8225: + case 8226: + case 8227: + case 8228: + case 8229: + case 8230: + case 8231: + case 8232: + case 8233: + case 8234: + case 8235: + case 8236: + case 8237: + case 8238: + case 8239: + case 8240: + case 8241: + case 8242: + case 8243: + case 8244: + case 8245: + case 8246: + case 8247: + case 8248: + case 8249: + case 8250: + case 8251: + case 8252: + case 8253: + case 8254: + case 8255: + case 8256: + case 8257: + case 8258: + case 8259: + case 8260: + case 8261: + case 8262: + case 8263: + case 8264: + case 8265: + case 8266: + case 8267: + case 8268: + case 8269: + case 8270: + case 8271: + case 8272: + case 8273: + case 8274: + case 8275: + case 8276: + case 8277: + case 8278: + case 8279: + case 8280: + case 8281: + case 8282: + case 8283: + case 8284: + case 8285: + case 8286: + case 8287: + case 8288: + case 8289: + case 8290: + case 8291: + case 8292: + case 8293: + case 8294: + case 8295: + case 8296: + case 8297: + case 8298: + case 8299: + case 8300: + case 8301: + case 8302: + case 8303: + case 8304: + case 8305: + case 8306: + case 8307: + case 8308: + case 8309: + case 8310: + case 8311: + case 8312: + case 8313: + case 8314: + case 8315: + case 8316: + case 8317: + case 8318: + case 8319: + case 8320: + case 8321: + case 8322: + case 8323: + case 8324: + case 8325: + case 8326: + case 8327: + case 8328: + case 8329: + case 8330: + case 8331: + case 8332: + case 8333: + case 8334: + case 8335: + case 8336: + case 8337: + case 8338: + case 8339: + case 8340: + case 8341: + case 8342: + case 8343: + case 8344: + case 8345: + case 8346: + case 8347: + case 8348: + case 8349: + case 8350: + case 8351: + case 8352: + case 8353: + case 8354: + case 8355: + case 8356: + case 8357: + case 8358: + case 8359: + case 8360: + case 8361: + case 8362: + case 8363: + case 8364: + case 8365: + case 8366: + case 8367: + case 8368: + case 8369: + case 8370: + case 8371: + case 8372: + case 8373: + case 8374: + case 8375: + case 8376: + case 8377: + case 8378: + case 8379: + case 8380: + case 8381: + case 8382: + case 8383: + case 8384: + case 8385: + case 8386: + case 8387: + case 8388: + case 8389: + case 8390: + case 8391: + case 8392: + case 8393: + case 8394: + case 8395: + case 8396: + case 8397: + case 8398: + case 8399: + case 8400: + case 8401: + case 8402: + case 8403: + case 8404: + case 8405: + case 8406: + case 8407: + case 8408: + case 8409: + case 8410: + case 8411: + case 8412: + case 8413: + case 8414: + case 8415: + case 8416: + case 8417: + case 8418: + case 8419: + case 8420: + case 8421: + case 8422: + case 8423: + case 8424: + case 8425: + case 8426: + case 8427: + case 8428: + case 8429: + case 8430: + case 8431: + case 8432: + case 8433: + case 8434: + case 8435: + case 8436: + case 8437: + case 8438: + case 8439: + case 8440: + case 8441: + case 8442: + case 8443: + case 8444: + case 8445: + case 8446: + case 8447: + case 8448: + case 8449: + case 8450: + case 8451: + case 8452: + case 8453: + case 8454: + case 8455: + case 8456: + case 8457: + case 8458: + case 8459: + case 8460: + case 8461: + case 8462: + case 8463: + case 8464: + case 8465: + case 8466: + case 8467: + case 8468: + case 8469: + case 8470: + case 8471: + case 8472: + case 8473: + case 8474: + case 8475: + case 8476: + case 8477: + case 8478: + case 8479: + case 8480: + case 8481: + case 8482: + case 8483: + case 8484: + case 8485: + case 8486: + case 8487: + case 8488: + case 8489: + case 8490: + case 8491: + case 8492: + case 8493: + case 8494: + case 8495: + case 8496: + case 8497: + case 8498: + case 8499: + case 8500: + case 8501: + case 8502: + case 8503: + case 8504: + case 8505: + case 8506: + case 8507: + case 8508: + case 8509: + case 8510: + case 8511: + case 8512: + case 8513: + case 8514: + case 8515: + case 8516: + case 8517: + case 8518: + case 8519: + case 8520: + case 8521: + case 8522: + case 8523: + case 8524: + case 8525: + case 8526: + case 8527: + case 8528: + case 8529: + case 8530: + case 8531: + case 8532: + case 8533: + case 8534: + case 8535: + case 8536: + case 8537: + case 8538: + case 8539: + case 8540: + case 8541: + case 8542: + case 8543: + case 8544: + case 8545: + case 8546: + case 8547: + case 8548: + case 8549: + case 8550: + case 8551: + case 8552: + case 8553: + case 8554: + case 8555: + case 8556: + case 8557: + case 8558: + case 8559: + case 8560: + case 8561: + case 8562: + case 8563: + case 8564: + case 8565: + case 8566: + case 8567: + case 8568: + case 8569: + case 8570: + case 8571: + case 8572: + case 8573: + case 8574: + case 8575: + case 8576: + case 8577: + case 8578: + case 8579: + case 8580: + case 8581: + case 8582: + case 8583: + case 8584: + case 8585: + case 8586: + case 8587: + case 8588: + case 8589: + case 8590: + case 8591: + case 8592: + case 8593: + case 8594: + case 8595: + case 8596: + case 8597: + case 8598: + case 8599: + case 8600: + case 8601: + case 8602: + case 8603: + case 8604: + case 8605: + case 8606: + case 8607: + case 8608: + case 8609: + case 8610: + case 8611: + case 8612: + case 8613: + case 8614: + case 8615: + case 8616: + case 8617: + case 8618: + case 8619: + case 8620: + case 8621: + case 8622: + case 8623: + case 8624: + case 8625: + case 8626: + case 8627: + case 8628: + case 8629: + case 8630: + case 8631: + case 8632: + case 8633: + case 8634: + case 8635: + case 8636: + case 8637: + case 8638: + case 8639: + case 8640: + case 8641: + case 8642: + case 8643: + case 8644: + case 8645: + case 8646: + case 8647: + case 8648: + case 8649: + case 8650: + case 8651: + case 8652: + case 8653: + case 8654: + case 8655: + case 8656: + case 8657: + case 8658: + case 8659: + case 8660: + case 8661: + case 8662: + case 8663: + case 8664: + case 8665: + case 8666: + case 8667: + case 8668: + case 8669: + case 8670: + case 8671: + case 8672: + case 8673: + case 8674: + case 8675: + case 8676: + case 8677: + case 8678: + case 8679: + case 8680: + case 8681: + case 8682: + case 8683: + case 8684: + case 8685: + case 8686: + case 8687: + case 8688: + case 8689: + case 8690: + case 8691: + case 8692: + case 8693: + case 8694: + case 8695: + case 8696: + case 8697: + case 8698: + case 8699: + case 8700: + case 8701: + case 8702: + case 8703: + case 8704: + case 8705: + case 8706: + case 8707: + case 8708: + case 8709: + case 8710: + case 8711: + case 8712: + case 8713: + case 8714: + case 8715: + case 8716: + case 8717: + case 8718: + case 8719: + case 8720: + case 8721: + case 8722: + case 8723: + case 8724: + case 8725: + case 8726: + case 8727: + case 8728: + case 8729: + case 8730: + case 8731: + case 8732: + case 8733: + case 8734: + case 8735: + case 8736: + case 8737: + case 8738: + case 8739: + case 8740: + case 8741: + case 8742: + case 8743: + case 8744: + case 8745: + case 8746: + case 8747: + case 8748: + case 8749: + case 8750: + case 8751: + case 8752: + case 8753: + case 8754: + case 8755: + case 8756: + case 8757: + case 8758: + case 8759: + case 8760: + case 8761: + case 8762: + case 8763: + case 8764: + case 8765: + case 8766: + case 8767: + case 8768: + case 8769: + case 8770: + case 8771: + case 8772: + case 8773: + case 8774: + case 8775: + case 8776: + case 8777: + case 8778: + case 8779: + case 8780: + case 8781: + case 8782: + case 8783: + case 8784: + case 8785: + case 8786: + case 8787: + case 8788: + case 8789: + case 8790: + case 8791: + case 8792: + case 8793: + case 8794: + case 8795: + case 8796: + case 8797: + case 8798: + case 8799: + case 8800: + case 8801: + case 8802: + case 8803: + case 8804: + case 8805: + case 8806: + case 8807: + case 8808: + case 8809: + case 8810: + case 8811: + case 8812: + case 8813: + case 8814: + case 8815: + case 8816: + case 8817: + case 8818: + case 8819: + case 8820: + case 8821: + case 8822: + case 8823: + case 8824: + case 8825: + case 8826: + case 8827: + case 8828: + case 8829: + case 8830: + case 8831: + case 8832: + case 8833: + case 8834: + case 8835: + case 8836: + case 8837: + case 8838: + case 8839: + case 8840: + case 8841: + case 8842: + case 8843: + case 8844: + case 8845: + case 8846: + case 8847: + case 8848: + case 8849: + case 8850: + case 8851: + case 8852: + case 8853: + case 8854: + case 8855: + case 8856: + case 8857: + case 8858: + case 8859: + case 8860: + case 8861: + case 8862: + case 8863: + case 8864: + case 8865: + case 8866: + case 8867: + case 8868: + case 8869: + case 8870: + case 8871: + case 8872: + case 8873: + case 8874: + case 8875: + case 8876: + case 8877: + case 8878: + case 8879: + case 8880: + case 8881: + case 8882: + case 8883: + case 8884: + case 8885: + case 8886: + case 8887: + case 8888: + case 8889: + case 8890: + case 8891: + case 8892: + case 8893: + case 8894: + case 8895: + case 8896: + case 8897: + case 8898: + case 8899: + case 8900: + case 8901: + case 8902: + case 8903: + case 8904: + case 8905: + case 8906: + case 8907: + case 8908: + case 8909: + case 8910: + case 8911: + case 8912: + case 8913: + case 8914: + case 8915: + case 8916: + case 8917: + case 8918: + case 8919: + case 8920: + case 8921: + case 8922: + case 8923: + case 8924: + case 8925: + case 8926: + case 8927: + case 8928: + case 8929: + case 8930: + case 8931: + case 8932: + case 8933: + case 8934: + case 8935: + case 8936: + case 8937: + case 8938: + case 8939: + case 8940: + case 8941: + case 8942: + case 8943: + case 8944: + case 8945: + case 8946: + case 8947: + case 8948: + case 8949: + case 8950: + case 8951: + case 8952: + case 8953: + case 8954: + case 8955: + case 8956: + case 8957: + case 8958: + case 8959: + case 8960: + case 8961: + case 8962: + case 8963: + case 8964: + case 8965: + case 8966: + case 8967: + case 8968: + case 8969: + case 8970: + case 8971: + case 8972: + case 8973: + case 8974: + case 8975: + case 8976: + case 8977: + case 8978: + case 8979: + case 8980: + case 8981: + case 8982: + case 8983: + case 8984: + case 8985: + case 8986: + case 8987: + case 8988: + case 8989: + case 8990: + case 8991: + case 8992: + case 8993: + case 8994: + case 8995: + case 8996: + case 8997: + case 8998: + case 8999: + actual += 'a'; +} +expect = 'a'; +addThis(); + + + +//--------------------------------------------------------------------------------- +test(); +//--------------------------------------------------------------------------------- + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-74474-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-74474-003.js new file mode 100644 index 0000000..681fb3f --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-74474-003.js @@ -0,0 +1,9078 @@ +/* +* 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 expressed +* 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): brendan@mozilla.org, pschwartau@netscape.com +* Date: 09 May 2001 +* +* SUMMARY: Regression test for Bugzilla bug 74474 +* "switch() misbehaves with duplicated labels" +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=74474 +* See ECMA3 Section 12.11, "The switch Statement" +*/ +//------------------------------------------------------------------------------------------------- +var UBound = 0; +var bug = 74474; +var summary = 'Test of switch statement that overflows the stack-allocated bitmap'; +var status = '(One duplicated label [8998])'; +var statusitems = [ ]; +var actual = ''; +var actualvalues = [ ]; +var expect= ''; +var expectedvalues = [ ]; +var x = 3; + + +switch (x) +{ + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 20: + case 21: + case 22: + case 23: + case 24: + case 25: + case 26: + case 27: + case 28: + case 29: + case 30: + case 31: + case 32: + case 33: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 45: + case 46: + case 47: + case 48: + case 49: + case 50: + case 51: + case 52: + case 53: + case 54: + case 55: + case 56: + case 57: + case 58: + case 59: + case 60: + case 61: + case 62: + case 63: + case 64: + case 65: + case 66: + case 67: + case 68: + case 69: + case 70: + case 71: + case 72: + case 73: + case 74: + case 75: + case 76: + case 77: + case 78: + case 79: + case 80: + case 81: + case 82: + case 83: + case 84: + case 85: + case 86: + case 87: + case 88: + case 89: + case 90: + case 91: + case 92: + case 93: + case 94: + case 95: + case 96: + case 97: + case 98: + case 99: + case 100: + case 101: + case 102: + case 103: + case 104: + case 105: + case 106: + case 107: + case 108: + case 109: + case 110: + case 111: + case 112: + case 113: + case 114: + case 115: + case 116: + case 117: + case 118: + case 119: + case 120: + case 121: + case 122: + case 123: + case 124: + case 125: + case 126: + case 127: + case 128: + case 129: + case 130: + case 131: + case 132: + case 133: + case 134: + case 135: + case 136: + case 137: + case 138: + case 139: + case 140: + case 141: + case 142: + case 143: + case 144: + case 145: + case 146: + case 147: + case 148: + case 149: + case 150: + case 151: + case 152: + case 153: + case 154: + case 155: + case 156: + case 157: + case 158: + case 159: + case 160: + case 161: + case 162: + case 163: + case 164: + case 165: + case 166: + case 167: + case 168: + case 169: + case 170: + case 171: + case 172: + case 173: + case 174: + case 175: + case 176: + case 177: + case 178: + case 179: + case 180: + case 181: + case 182: + case 183: + case 184: + case 185: + case 186: + case 187: + case 188: + case 189: + case 190: + case 191: + case 192: + case 193: + case 194: + case 195: + case 196: + case 197: + case 198: + case 199: + case 200: + case 201: + case 202: + case 203: + case 204: + case 205: + case 206: + case 207: + case 208: + case 209: + case 210: + case 211: + case 212: + case 213: + case 214: + case 215: + case 216: + case 217: + case 218: + case 219: + case 220: + case 221: + case 222: + case 223: + case 224: + case 225: + case 226: + case 227: + case 228: + case 229: + case 230: + case 231: + case 232: + case 233: + case 234: + case 235: + case 236: + case 237: + case 238: + case 239: + case 240: + case 241: + case 242: + case 243: + case 244: + case 245: + case 246: + case 247: + case 248: + case 249: + case 250: + case 251: + case 252: + case 253: + case 254: + case 255: + case 256: + case 257: + case 258: + case 259: + case 260: + case 261: + case 262: + case 263: + case 264: + case 265: + case 266: + case 267: + case 268: + case 269: + case 270: + case 271: + case 272: + case 273: + case 274: + case 275: + case 276: + case 277: + case 278: + case 279: + case 280: + case 281: + case 282: + case 283: + case 284: + case 285: + case 286: + case 287: + case 288: + case 289: + case 290: + case 291: + case 292: + case 293: + case 294: + case 295: + case 296: + case 297: + case 298: + case 299: + case 300: + case 301: + case 302: + case 303: + case 304: + case 305: + case 306: + case 307: + case 308: + case 309: + case 310: + case 311: + case 312: + case 313: + case 314: + case 315: + case 316: + case 317: + case 318: + case 319: + case 320: + case 321: + case 322: + case 323: + case 324: + case 325: + case 326: + case 327: + case 328: + case 329: + case 330: + case 331: + case 332: + case 333: + case 334: + case 335: + case 336: + case 337: + case 338: + case 339: + case 340: + case 341: + case 342: + case 343: + case 344: + case 345: + case 346: + case 347: + case 348: + case 349: + case 350: + case 351: + case 352: + case 353: + case 354: + case 355: + case 356: + case 357: + case 358: + case 359: + case 360: + case 361: + case 362: + case 363: + case 364: + case 365: + case 366: + case 367: + case 368: + case 369: + case 370: + case 371: + case 372: + case 373: + case 374: + case 375: + case 376: + case 377: + case 378: + case 379: + case 380: + case 381: + case 382: + case 383: + case 384: + case 385: + case 386: + case 387: + case 388: + case 389: + case 390: + case 391: + case 392: + case 393: + case 394: + case 395: + case 396: + case 397: + case 398: + case 399: + case 400: + case 401: + case 402: + case 403: + case 404: + case 405: + case 406: + case 407: + case 408: + case 409: + case 410: + case 411: + case 412: + case 413: + case 414: + case 415: + case 416: + case 417: + case 418: + case 419: + case 420: + case 421: + case 422: + case 423: + case 424: + case 425: + case 426: + case 427: + case 428: + case 429: + case 430: + case 431: + case 432: + case 433: + case 434: + case 435: + case 436: + case 437: + case 438: + case 439: + case 440: + case 441: + case 442: + case 443: + case 444: + case 445: + case 446: + case 447: + case 448: + case 449: + case 450: + case 451: + case 452: + case 453: + case 454: + case 455: + case 456: + case 457: + case 458: + case 459: + case 460: + case 461: + case 462: + case 463: + case 464: + case 465: + case 466: + case 467: + case 468: + case 469: + case 470: + case 471: + case 472: + case 473: + case 474: + case 475: + case 476: + case 477: + case 478: + case 479: + case 480: + case 481: + case 482: + case 483: + case 484: + case 485: + case 486: + case 487: + case 488: + case 489: + case 490: + case 491: + case 492: + case 493: + case 494: + case 495: + case 496: + case 497: + case 498: + case 499: + case 500: + case 501: + case 502: + case 503: + case 504: + case 505: + case 506: + case 507: + case 508: + case 509: + case 510: + case 511: + case 512: + case 513: + case 514: + case 515: + case 516: + case 517: + case 518: + case 519: + case 520: + case 521: + case 522: + case 523: + case 524: + case 525: + case 526: + case 527: + case 528: + case 529: + case 530: + case 531: + case 532: + case 533: + case 534: + case 535: + case 536: + case 537: + case 538: + case 539: + case 540: + case 541: + case 542: + case 543: + case 544: + case 545: + case 546: + case 547: + case 548: + case 549: + case 550: + case 551: + case 552: + case 553: + case 554: + case 555: + case 556: + case 557: + case 558: + case 559: + case 560: + case 561: + case 562: + case 563: + case 564: + case 565: + case 566: + case 567: + case 568: + case 569: + case 570: + case 571: + case 572: + case 573: + case 574: + case 575: + case 576: + case 577: + case 578: + case 579: + case 580: + case 581: + case 582: + case 583: + case 584: + case 585: + case 586: + case 587: + case 588: + case 589: + case 590: + case 591: + case 592: + case 593: + case 594: + case 595: + case 596: + case 597: + case 598: + case 599: + case 600: + case 601: + case 602: + case 603: + case 604: + case 605: + case 606: + case 607: + case 608: + case 609: + case 610: + case 611: + case 612: + case 613: + case 614: + case 615: + case 616: + case 617: + case 618: + case 619: + case 620: + case 621: + case 622: + case 623: + case 624: + case 625: + case 626: + case 627: + case 628: + case 629: + case 630: + case 631: + case 632: + case 633: + case 634: + case 635: + case 636: + case 637: + case 638: + case 639: + case 640: + case 641: + case 642: + case 643: + case 644: + case 645: + case 646: + case 647: + case 648: + case 649: + case 650: + case 651: + case 652: + case 653: + case 654: + case 655: + case 656: + case 657: + case 658: + case 659: + case 660: + case 661: + case 662: + case 663: + case 664: + case 665: + case 666: + case 667: + case 668: + case 669: + case 670: + case 671: + case 672: + case 673: + case 674: + case 675: + case 676: + case 677: + case 678: + case 679: + case 680: + case 681: + case 682: + case 683: + case 684: + case 685: + case 686: + case 687: + case 688: + case 689: + case 690: + case 691: + case 692: + case 693: + case 694: + case 695: + case 696: + case 697: + case 698: + case 699: + case 700: + case 701: + case 702: + case 703: + case 704: + case 705: + case 706: + case 707: + case 708: + case 709: + case 710: + case 711: + case 712: + case 713: + case 714: + case 715: + case 716: + case 717: + case 718: + case 719: + case 720: + case 721: + case 722: + case 723: + case 724: + case 725: + case 726: + case 727: + case 728: + case 729: + case 730: + case 731: + case 732: + case 733: + case 734: + case 735: + case 736: + case 737: + case 738: + case 739: + case 740: + case 741: + case 742: + case 743: + case 744: + case 745: + case 746: + case 747: + case 748: + case 749: + case 750: + case 751: + case 752: + case 753: + case 754: + case 755: + case 756: + case 757: + case 758: + case 759: + case 760: + case 761: + case 762: + case 763: + case 764: + case 765: + case 766: + case 767: + case 768: + case 769: + case 770: + case 771: + case 772: + case 773: + case 774: + case 775: + case 776: + case 777: + case 778: + case 779: + case 780: + case 781: + case 782: + case 783: + case 784: + case 785: + case 786: + case 787: + case 788: + case 789: + case 790: + case 791: + case 792: + case 793: + case 794: + case 795: + case 796: + case 797: + case 798: + case 799: + case 800: + case 801: + case 802: + case 803: + case 804: + case 805: + case 806: + case 807: + case 808: + case 809: + case 810: + case 811: + case 812: + case 813: + case 814: + case 815: + case 816: + case 817: + case 818: + case 819: + case 820: + case 821: + case 822: + case 823: + case 824: + case 825: + case 826: + case 827: + case 828: + case 829: + case 830: + case 831: + case 832: + case 833: + case 834: + case 835: + case 836: + case 837: + case 838: + case 839: + case 840: + case 841: + case 842: + case 843: + case 844: + case 845: + case 846: + case 847: + case 848: + case 849: + case 850: + case 851: + case 852: + case 853: + case 854: + case 855: + case 856: + case 857: + case 858: + case 859: + case 860: + case 861: + case 862: + case 863: + case 864: + case 865: + case 866: + case 867: + case 868: + case 869: + case 870: + case 871: + case 872: + case 873: + case 874: + case 875: + case 876: + case 877: + case 878: + case 879: + case 880: + case 881: + case 882: + case 883: + case 884: + case 885: + case 886: + case 887: + case 888: + case 889: + case 890: + case 891: + case 892: + case 893: + case 894: + case 895: + case 896: + case 897: + case 898: + case 899: + case 900: + case 901: + case 902: + case 903: + case 904: + case 905: + case 906: + case 907: + case 908: + case 909: + case 910: + case 911: + case 912: + case 913: + case 914: + case 915: + case 916: + case 917: + case 918: + case 919: + case 920: + case 921: + case 922: + case 923: + case 924: + case 925: + case 926: + case 927: + case 928: + case 929: + case 930: + case 931: + case 932: + case 933: + case 934: + case 935: + case 936: + case 937: + case 938: + case 939: + case 940: + case 941: + case 942: + case 943: + case 944: + case 945: + case 946: + case 947: + case 948: + case 949: + case 950: + case 951: + case 952: + case 953: + case 954: + case 955: + case 956: + case 957: + case 958: + case 959: + case 960: + case 961: + case 962: + case 963: + case 964: + case 965: + case 966: + case 967: + case 968: + case 969: + case 970: + case 971: + case 972: + case 973: + case 974: + case 975: + case 976: + case 977: + case 978: + case 979: + case 980: + case 981: + case 982: + case 983: + case 984: + case 985: + case 986: + case 987: + case 988: + case 989: + case 990: + case 991: + case 992: + case 993: + case 994: + case 995: + case 996: + case 997: + case 998: + case 999: + case 1000: + case 1001: + case 1002: + case 1003: + case 1004: + case 1005: + case 1006: + case 1007: + case 1008: + case 1009: + case 1010: + case 1011: + case 1012: + case 1013: + case 1014: + case 1015: + case 1016: + case 1017: + case 1018: + case 1019: + case 1020: + case 1021: + case 1022: + case 1023: + case 1024: + case 1025: + case 1026: + case 1027: + case 1028: + case 1029: + case 1030: + case 1031: + case 1032: + case 1033: + case 1034: + case 1035: + case 1036: + case 1037: + case 1038: + case 1039: + case 1040: + case 1041: + case 1042: + case 1043: + case 1044: + case 1045: + case 1046: + case 1047: + case 1048: + case 1049: + case 1050: + case 1051: + case 1052: + case 1053: + case 1054: + case 1055: + case 1056: + case 1057: + case 1058: + case 1059: + case 1060: + case 1061: + case 1062: + case 1063: + case 1064: + case 1065: + case 1066: + case 1067: + case 1068: + case 1069: + case 1070: + case 1071: + case 1072: + case 1073: + case 1074: + case 1075: + case 1076: + case 1077: + case 1078: + case 1079: + case 1080: + case 1081: + case 1082: + case 1083: + case 1084: + case 1085: + case 1086: + case 1087: + case 1088: + case 1089: + case 1090: + case 1091: + case 1092: + case 1093: + case 1094: + case 1095: + case 1096: + case 1097: + case 1098: + case 1099: + case 1100: + case 1101: + case 1102: + case 1103: + case 1104: + case 1105: + case 1106: + case 1107: + case 1108: + case 1109: + case 1110: + case 1111: + case 1112: + case 1113: + case 1114: + case 1115: + case 1116: + case 1117: + case 1118: + case 1119: + case 1120: + case 1121: + case 1122: + case 1123: + case 1124: + case 1125: + case 1126: + case 1127: + case 1128: + case 1129: + case 1130: + case 1131: + case 1132: + case 1133: + case 1134: + case 1135: + case 1136: + case 1137: + case 1138: + case 1139: + case 1140: + case 1141: + case 1142: + case 1143: + case 1144: + case 1145: + case 1146: + case 1147: + case 1148: + case 1149: + case 1150: + case 1151: + case 1152: + case 1153: + case 1154: + case 1155: + case 1156: + case 1157: + case 1158: + case 1159: + case 1160: + case 1161: + case 1162: + case 1163: + case 1164: + case 1165: + case 1166: + case 1167: + case 1168: + case 1169: + case 1170: + case 1171: + case 1172: + case 1173: + case 1174: + case 1175: + case 1176: + case 1177: + case 1178: + case 1179: + case 1180: + case 1181: + case 1182: + case 1183: + case 1184: + case 1185: + case 1186: + case 1187: + case 1188: + case 1189: + case 1190: + case 1191: + case 1192: + case 1193: + case 1194: + case 1195: + case 1196: + case 1197: + case 1198: + case 1199: + case 1200: + case 1201: + case 1202: + case 1203: + case 1204: + case 1205: + case 1206: + case 1207: + case 1208: + case 1209: + case 1210: + case 1211: + case 1212: + case 1213: + case 1214: + case 1215: + case 1216: + case 1217: + case 1218: + case 1219: + case 1220: + case 1221: + case 1222: + case 1223: + case 1224: + case 1225: + case 1226: + case 1227: + case 1228: + case 1229: + case 1230: + case 1231: + case 1232: + case 1233: + case 1234: + case 1235: + case 1236: + case 1237: + case 1238: + case 1239: + case 1240: + case 1241: + case 1242: + case 1243: + case 1244: + case 1245: + case 1246: + case 1247: + case 1248: + case 1249: + case 1250: + case 1251: + case 1252: + case 1253: + case 1254: + case 1255: + case 1256: + case 1257: + case 1258: + case 1259: + case 1260: + case 1261: + case 1262: + case 1263: + case 1264: + case 1265: + case 1266: + case 1267: + case 1268: + case 1269: + case 1270: + case 1271: + case 1272: + case 1273: + case 1274: + case 1275: + case 1276: + case 1277: + case 1278: + case 1279: + case 1280: + case 1281: + case 1282: + case 1283: + case 1284: + case 1285: + case 1286: + case 1287: + case 1288: + case 1289: + case 1290: + case 1291: + case 1292: + case 1293: + case 1294: + case 1295: + case 1296: + case 1297: + case 1298: + case 1299: + case 1300: + case 1301: + case 1302: + case 1303: + case 1304: + case 1305: + case 1306: + case 1307: + case 1308: + case 1309: + case 1310: + case 1311: + case 1312: + case 1313: + case 1314: + case 1315: + case 1316: + case 1317: + case 1318: + case 1319: + case 1320: + case 1321: + case 1322: + case 1323: + case 1324: + case 1325: + case 1326: + case 1327: + case 1328: + case 1329: + case 1330: + case 1331: + case 1332: + case 1333: + case 1334: + case 1335: + case 1336: + case 1337: + case 1338: + case 1339: + case 1340: + case 1341: + case 1342: + case 1343: + case 1344: + case 1345: + case 1346: + case 1347: + case 1348: + case 1349: + case 1350: + case 1351: + case 1352: + case 1353: + case 1354: + case 1355: + case 1356: + case 1357: + case 1358: + case 1359: + case 1360: + case 1361: + case 1362: + case 1363: + case 1364: + case 1365: + case 1366: + case 1367: + case 1368: + case 1369: + case 1370: + case 1371: + case 1372: + case 1373: + case 1374: + case 1375: + case 1376: + case 1377: + case 1378: + case 1379: + case 1380: + case 1381: + case 1382: + case 1383: + case 1384: + case 1385: + case 1386: + case 1387: + case 1388: + case 1389: + case 1390: + case 1391: + case 1392: + case 1393: + case 1394: + case 1395: + case 1396: + case 1397: + case 1398: + case 1399: + case 1400: + case 1401: + case 1402: + case 1403: + case 1404: + case 1405: + case 1406: + case 1407: + case 1408: + case 1409: + case 1410: + case 1411: + case 1412: + case 1413: + case 1414: + case 1415: + case 1416: + case 1417: + case 1418: + case 1419: + case 1420: + case 1421: + case 1422: + case 1423: + case 1424: + case 1425: + case 1426: + case 1427: + case 1428: + case 1429: + case 1430: + case 1431: + case 1432: + case 1433: + case 1434: + case 1435: + case 1436: + case 1437: + case 1438: + case 1439: + case 1440: + case 1441: + case 1442: + case 1443: + case 1444: + case 1445: + case 1446: + case 1447: + case 1448: + case 1449: + case 1450: + case 1451: + case 1452: + case 1453: + case 1454: + case 1455: + case 1456: + case 1457: + case 1458: + case 1459: + case 1460: + case 1461: + case 1462: + case 1463: + case 1464: + case 1465: + case 1466: + case 1467: + case 1468: + case 1469: + case 1470: + case 1471: + case 1472: + case 1473: + case 1474: + case 1475: + case 1476: + case 1477: + case 1478: + case 1479: + case 1480: + case 1481: + case 1482: + case 1483: + case 1484: + case 1485: + case 1486: + case 1487: + case 1488: + case 1489: + case 1490: + case 1491: + case 1492: + case 1493: + case 1494: + case 1495: + case 1496: + case 1497: + case 1498: + case 1499: + case 1500: + case 1501: + case 1502: + case 1503: + case 1504: + case 1505: + case 1506: + case 1507: + case 1508: + case 1509: + case 1510: + case 1511: + case 1512: + case 1513: + case 1514: + case 1515: + case 1516: + case 1517: + case 1518: + case 1519: + case 1520: + case 1521: + case 1522: + case 1523: + case 1524: + case 1525: + case 1526: + case 1527: + case 1528: + case 1529: + case 1530: + case 1531: + case 1532: + case 1533: + case 1534: + case 1535: + case 1536: + case 1537: + case 1538: + case 1539: + case 1540: + case 1541: + case 1542: + case 1543: + case 1544: + case 1545: + case 1546: + case 1547: + case 1548: + case 1549: + case 1550: + case 1551: + case 1552: + case 1553: + case 1554: + case 1555: + case 1556: + case 1557: + case 1558: + case 1559: + case 1560: + case 1561: + case 1562: + case 1563: + case 1564: + case 1565: + case 1566: + case 1567: + case 1568: + case 1569: + case 1570: + case 1571: + case 1572: + case 1573: + case 1574: + case 1575: + case 1576: + case 1577: + case 1578: + case 1579: + case 1580: + case 1581: + case 1582: + case 1583: + case 1584: + case 1585: + case 1586: + case 1587: + case 1588: + case 1589: + case 1590: + case 1591: + case 1592: + case 1593: + case 1594: + case 1595: + case 1596: + case 1597: + case 1598: + case 1599: + case 1600: + case 1601: + case 1602: + case 1603: + case 1604: + case 1605: + case 1606: + case 1607: + case 1608: + case 1609: + case 1610: + case 1611: + case 1612: + case 1613: + case 1614: + case 1615: + case 1616: + case 1617: + case 1618: + case 1619: + case 1620: + case 1621: + case 1622: + case 1623: + case 1624: + case 1625: + case 1626: + case 1627: + case 1628: + case 1629: + case 1630: + case 1631: + case 1632: + case 1633: + case 1634: + case 1635: + case 1636: + case 1637: + case 1638: + case 1639: + case 1640: + case 1641: + case 1642: + case 1643: + case 1644: + case 1645: + case 1646: + case 1647: + case 1648: + case 1649: + case 1650: + case 1651: + case 1652: + case 1653: + case 1654: + case 1655: + case 1656: + case 1657: + case 1658: + case 1659: + case 1660: + case 1661: + case 1662: + case 1663: + case 1664: + case 1665: + case 1666: + case 1667: + case 1668: + case 1669: + case 1670: + case 1671: + case 1672: + case 1673: + case 1674: + case 1675: + case 1676: + case 1677: + case 1678: + case 1679: + case 1680: + case 1681: + case 1682: + case 1683: + case 1684: + case 1685: + case 1686: + case 1687: + case 1688: + case 1689: + case 1690: + case 1691: + case 1692: + case 1693: + case 1694: + case 1695: + case 1696: + case 1697: + case 1698: + case 1699: + case 1700: + case 1701: + case 1702: + case 1703: + case 1704: + case 1705: + case 1706: + case 1707: + case 1708: + case 1709: + case 1710: + case 1711: + case 1712: + case 1713: + case 1714: + case 1715: + case 1716: + case 1717: + case 1718: + case 1719: + case 1720: + case 1721: + case 1722: + case 1723: + case 1724: + case 1725: + case 1726: + case 1727: + case 1728: + case 1729: + case 1730: + case 1731: + case 1732: + case 1733: + case 1734: + case 1735: + case 1736: + case 1737: + case 1738: + case 1739: + case 1740: + case 1741: + case 1742: + case 1743: + case 1744: + case 1745: + case 1746: + case 1747: + case 1748: + case 1749: + case 1750: + case 1751: + case 1752: + case 1753: + case 1754: + case 1755: + case 1756: + case 1757: + case 1758: + case 1759: + case 1760: + case 1761: + case 1762: + case 1763: + case 1764: + case 1765: + case 1766: + case 1767: + case 1768: + case 1769: + case 1770: + case 1771: + case 1772: + case 1773: + case 1774: + case 1775: + case 1776: + case 1777: + case 1778: + case 1779: + case 1780: + case 1781: + case 1782: + case 1783: + case 1784: + case 1785: + case 1786: + case 1787: + case 1788: + case 1789: + case 1790: + case 1791: + case 1792: + case 1793: + case 1794: + case 1795: + case 1796: + case 1797: + case 1798: + case 1799: + case 1800: + case 1801: + case 1802: + case 1803: + case 1804: + case 1805: + case 1806: + case 1807: + case 1808: + case 1809: + case 1810: + case 1811: + case 1812: + case 1813: + case 1814: + case 1815: + case 1816: + case 1817: + case 1818: + case 1819: + case 1820: + case 1821: + case 1822: + case 1823: + case 1824: + case 1825: + case 1826: + case 1827: + case 1828: + case 1829: + case 1830: + case 1831: + case 1832: + case 1833: + case 1834: + case 1835: + case 1836: + case 1837: + case 1838: + case 1839: + case 1840: + case 1841: + case 1842: + case 1843: + case 1844: + case 1845: + case 1846: + case 1847: + case 1848: + case 1849: + case 1850: + case 1851: + case 1852: + case 1853: + case 1854: + case 1855: + case 1856: + case 1857: + case 1858: + case 1859: + case 1860: + case 1861: + case 1862: + case 1863: + case 1864: + case 1865: + case 1866: + case 1867: + case 1868: + case 1869: + case 1870: + case 1871: + case 1872: + case 1873: + case 1874: + case 1875: + case 1876: + case 1877: + case 1878: + case 1879: + case 1880: + case 1881: + case 1882: + case 1883: + case 1884: + case 1885: + case 1886: + case 1887: + case 1888: + case 1889: + case 1890: + case 1891: + case 1892: + case 1893: + case 1894: + case 1895: + case 1896: + case 1897: + case 1898: + case 1899: + case 1900: + case 1901: + case 1902: + case 1903: + case 1904: + case 1905: + case 1906: + case 1907: + case 1908: + case 1909: + case 1910: + case 1911: + case 1912: + case 1913: + case 1914: + case 1915: + case 1916: + case 1917: + case 1918: + case 1919: + case 1920: + case 1921: + case 1922: + case 1923: + case 1924: + case 1925: + case 1926: + case 1927: + case 1928: + case 1929: + case 1930: + case 1931: + case 1932: + case 1933: + case 1934: + case 1935: + case 1936: + case 1937: + case 1938: + case 1939: + case 1940: + case 1941: + case 1942: + case 1943: + case 1944: + case 1945: + case 1946: + case 1947: + case 1948: + case 1949: + case 1950: + case 1951: + case 1952: + case 1953: + case 1954: + case 1955: + case 1956: + case 1957: + case 1958: + case 1959: + case 1960: + case 1961: + case 1962: + case 1963: + case 1964: + case 1965: + case 1966: + case 1967: + case 1968: + case 1969: + case 1970: + case 1971: + case 1972: + case 1973: + case 1974: + case 1975: + case 1976: + case 1977: + case 1978: + case 1979: + case 1980: + case 1981: + case 1982: + case 1983: + case 1984: + case 1985: + case 1986: + case 1987: + case 1988: + case 1989: + case 1990: + case 1991: + case 1992: + case 1993: + case 1994: + case 1995: + case 1996: + case 1997: + case 1998: + case 1999: + case 2000: + case 2001: + case 2002: + case 2003: + case 2004: + case 2005: + case 2006: + case 2007: + case 2008: + case 2009: + case 2010: + case 2011: + case 2012: + case 2013: + case 2014: + case 2015: + case 2016: + case 2017: + case 2018: + case 2019: + case 2020: + case 2021: + case 2022: + case 2023: + case 2024: + case 2025: + case 2026: + case 2027: + case 2028: + case 2029: + case 2030: + case 2031: + case 2032: + case 2033: + case 2034: + case 2035: + case 2036: + case 2037: + case 2038: + case 2039: + case 2040: + case 2041: + case 2042: + case 2043: + case 2044: + case 2045: + case 2046: + case 2047: + case 2048: + case 2049: + case 2050: + case 2051: + case 2052: + case 2053: + case 2054: + case 2055: + case 2056: + case 2057: + case 2058: + case 2059: + case 2060: + case 2061: + case 2062: + case 2063: + case 2064: + case 2065: + case 2066: + case 2067: + case 2068: + case 2069: + case 2070: + case 2071: + case 2072: + case 2073: + case 2074: + case 2075: + case 2076: + case 2077: + case 2078: + case 2079: + case 2080: + case 2081: + case 2082: + case 2083: + case 2084: + case 2085: + case 2086: + case 2087: + case 2088: + case 2089: + case 2090: + case 2091: + case 2092: + case 2093: + case 2094: + case 2095: + case 2096: + case 2097: + case 2098: + case 2099: + case 2100: + case 2101: + case 2102: + case 2103: + case 2104: + case 2105: + case 2106: + case 2107: + case 2108: + case 2109: + case 2110: + case 2111: + case 2112: + case 2113: + case 2114: + case 2115: + case 2116: + case 2117: + case 2118: + case 2119: + case 2120: + case 2121: + case 2122: + case 2123: + case 2124: + case 2125: + case 2126: + case 2127: + case 2128: + case 2129: + case 2130: + case 2131: + case 2132: + case 2133: + case 2134: + case 2135: + case 2136: + case 2137: + case 2138: + case 2139: + case 2140: + case 2141: + case 2142: + case 2143: + case 2144: + case 2145: + case 2146: + case 2147: + case 2148: + case 2149: + case 2150: + case 2151: + case 2152: + case 2153: + case 2154: + case 2155: + case 2156: + case 2157: + case 2158: + case 2159: + case 2160: + case 2161: + case 2162: + case 2163: + case 2164: + case 2165: + case 2166: + case 2167: + case 2168: + case 2169: + case 2170: + case 2171: + case 2172: + case 2173: + case 2174: + case 2175: + case 2176: + case 2177: + case 2178: + case 2179: + case 2180: + case 2181: + case 2182: + case 2183: + case 2184: + case 2185: + case 2186: + case 2187: + case 2188: + case 2189: + case 2190: + case 2191: + case 2192: + case 2193: + case 2194: + case 2195: + case 2196: + case 2197: + case 2198: + case 2199: + case 2200: + case 2201: + case 2202: + case 2203: + case 2204: + case 2205: + case 2206: + case 2207: + case 2208: + case 2209: + case 2210: + case 2211: + case 2212: + case 2213: + case 2214: + case 2215: + case 2216: + case 2217: + case 2218: + case 2219: + case 2220: + case 2221: + case 2222: + case 2223: + case 2224: + case 2225: + case 2226: + case 2227: + case 2228: + case 2229: + case 2230: + case 2231: + case 2232: + case 2233: + case 2234: + case 2235: + case 2236: + case 2237: + case 2238: + case 2239: + case 2240: + case 2241: + case 2242: + case 2243: + case 2244: + case 2245: + case 2246: + case 2247: + case 2248: + case 2249: + case 2250: + case 2251: + case 2252: + case 2253: + case 2254: + case 2255: + case 2256: + case 2257: + case 2258: + case 2259: + case 2260: + case 2261: + case 2262: + case 2263: + case 2264: + case 2265: + case 2266: + case 2267: + case 2268: + case 2269: + case 2270: + case 2271: + case 2272: + case 2273: + case 2274: + case 2275: + case 2276: + case 2277: + case 2278: + case 2279: + case 2280: + case 2281: + case 2282: + case 2283: + case 2284: + case 2285: + case 2286: + case 2287: + case 2288: + case 2289: + case 2290: + case 2291: + case 2292: + case 2293: + case 2294: + case 2295: + case 2296: + case 2297: + case 2298: + case 2299: + case 2300: + case 2301: + case 2302: + case 2303: + case 2304: + case 2305: + case 2306: + case 2307: + case 2308: + case 2309: + case 2310: + case 2311: + case 2312: + case 2313: + case 2314: + case 2315: + case 2316: + case 2317: + case 2318: + case 2319: + case 2320: + case 2321: + case 2322: + case 2323: + case 2324: + case 2325: + case 2326: + case 2327: + case 2328: + case 2329: + case 2330: + case 2331: + case 2332: + case 2333: + case 2334: + case 2335: + case 2336: + case 2337: + case 2338: + case 2339: + case 2340: + case 2341: + case 2342: + case 2343: + case 2344: + case 2345: + case 2346: + case 2347: + case 2348: + case 2349: + case 2350: + case 2351: + case 2352: + case 2353: + case 2354: + case 2355: + case 2356: + case 2357: + case 2358: + case 2359: + case 2360: + case 2361: + case 2362: + case 2363: + case 2364: + case 2365: + case 2366: + case 2367: + case 2368: + case 2369: + case 2370: + case 2371: + case 2372: + case 2373: + case 2374: + case 2375: + case 2376: + case 2377: + case 2378: + case 2379: + case 2380: + case 2381: + case 2382: + case 2383: + case 2384: + case 2385: + case 2386: + case 2387: + case 2388: + case 2389: + case 2390: + case 2391: + case 2392: + case 2393: + case 2394: + case 2395: + case 2396: + case 2397: + case 2398: + case 2399: + case 2400: + case 2401: + case 2402: + case 2403: + case 2404: + case 2405: + case 2406: + case 2407: + case 2408: + case 2409: + case 2410: + case 2411: + case 2412: + case 2413: + case 2414: + case 2415: + case 2416: + case 2417: + case 2418: + case 2419: + case 2420: + case 2421: + case 2422: + case 2423: + case 2424: + case 2425: + case 2426: + case 2427: + case 2428: + case 2429: + case 2430: + case 2431: + case 2432: + case 2433: + case 2434: + case 2435: + case 2436: + case 2437: + case 2438: + case 2439: + case 2440: + case 2441: + case 2442: + case 2443: + case 2444: + case 2445: + case 2446: + case 2447: + case 2448: + case 2449: + case 2450: + case 2451: + case 2452: + case 2453: + case 2454: + case 2455: + case 2456: + case 2457: + case 2458: + case 2459: + case 2460: + case 2461: + case 2462: + case 2463: + case 2464: + case 2465: + case 2466: + case 2467: + case 2468: + case 2469: + case 2470: + case 2471: + case 2472: + case 2473: + case 2474: + case 2475: + case 2476: + case 2477: + case 2478: + case 2479: + case 2480: + case 2481: + case 2482: + case 2483: + case 2484: + case 2485: + case 2486: + case 2487: + case 2488: + case 2489: + case 2490: + case 2491: + case 2492: + case 2493: + case 2494: + case 2495: + case 2496: + case 2497: + case 2498: + case 2499: + case 2500: + case 2501: + case 2502: + case 2503: + case 2504: + case 2505: + case 2506: + case 2507: + case 2508: + case 2509: + case 2510: + case 2511: + case 2512: + case 2513: + case 2514: + case 2515: + case 2516: + case 2517: + case 2518: + case 2519: + case 2520: + case 2521: + case 2522: + case 2523: + case 2524: + case 2525: + case 2526: + case 2527: + case 2528: + case 2529: + case 2530: + case 2531: + case 2532: + case 2533: + case 2534: + case 2535: + case 2536: + case 2537: + case 2538: + case 2539: + case 2540: + case 2541: + case 2542: + case 2543: + case 2544: + case 2545: + case 2546: + case 2547: + case 2548: + case 2549: + case 2550: + case 2551: + case 2552: + case 2553: + case 2554: + case 2555: + case 2556: + case 2557: + case 2558: + case 2559: + case 2560: + case 2561: + case 2562: + case 2563: + case 2564: + case 2565: + case 2566: + case 2567: + case 2568: + case 2569: + case 2570: + case 2571: + case 2572: + case 2573: + case 2574: + case 2575: + case 2576: + case 2577: + case 2578: + case 2579: + case 2580: + case 2581: + case 2582: + case 2583: + case 2584: + case 2585: + case 2586: + case 2587: + case 2588: + case 2589: + case 2590: + case 2591: + case 2592: + case 2593: + case 2594: + case 2595: + case 2596: + case 2597: + case 2598: + case 2599: + case 2600: + case 2601: + case 2602: + case 2603: + case 2604: + case 2605: + case 2606: + case 2607: + case 2608: + case 2609: + case 2610: + case 2611: + case 2612: + case 2613: + case 2614: + case 2615: + case 2616: + case 2617: + case 2618: + case 2619: + case 2620: + case 2621: + case 2622: + case 2623: + case 2624: + case 2625: + case 2626: + case 2627: + case 2628: + case 2629: + case 2630: + case 2631: + case 2632: + case 2633: + case 2634: + case 2635: + case 2636: + case 2637: + case 2638: + case 2639: + case 2640: + case 2641: + case 2642: + case 2643: + case 2644: + case 2645: + case 2646: + case 2647: + case 2648: + case 2649: + case 2650: + case 2651: + case 2652: + case 2653: + case 2654: + case 2655: + case 2656: + case 2657: + case 2658: + case 2659: + case 2660: + case 2661: + case 2662: + case 2663: + case 2664: + case 2665: + case 2666: + case 2667: + case 2668: + case 2669: + case 2670: + case 2671: + case 2672: + case 2673: + case 2674: + case 2675: + case 2676: + case 2677: + case 2678: + case 2679: + case 2680: + case 2681: + case 2682: + case 2683: + case 2684: + case 2685: + case 2686: + case 2687: + case 2688: + case 2689: + case 2690: + case 2691: + case 2692: + case 2693: + case 2694: + case 2695: + case 2696: + case 2697: + case 2698: + case 2699: + case 2700: + case 2701: + case 2702: + case 2703: + case 2704: + case 2705: + case 2706: + case 2707: + case 2708: + case 2709: + case 2710: + case 2711: + case 2712: + case 2713: + case 2714: + case 2715: + case 2716: + case 2717: + case 2718: + case 2719: + case 2720: + case 2721: + case 2722: + case 2723: + case 2724: + case 2725: + case 2726: + case 2727: + case 2728: + case 2729: + case 2730: + case 2731: + case 2732: + case 2733: + case 2734: + case 2735: + case 2736: + case 2737: + case 2738: + case 2739: + case 2740: + case 2741: + case 2742: + case 2743: + case 2744: + case 2745: + case 2746: + case 2747: + case 2748: + case 2749: + case 2750: + case 2751: + case 2752: + case 2753: + case 2754: + case 2755: + case 2756: + case 2757: + case 2758: + case 2759: + case 2760: + case 2761: + case 2762: + case 2763: + case 2764: + case 2765: + case 2766: + case 2767: + case 2768: + case 2769: + case 2770: + case 2771: + case 2772: + case 2773: + case 2774: + case 2775: + case 2776: + case 2777: + case 2778: + case 2779: + case 2780: + case 2781: + case 2782: + case 2783: + case 2784: + case 2785: + case 2786: + case 2787: + case 2788: + case 2789: + case 2790: + case 2791: + case 2792: + case 2793: + case 2794: + case 2795: + case 2796: + case 2797: + case 2798: + case 2799: + case 2800: + case 2801: + case 2802: + case 2803: + case 2804: + case 2805: + case 2806: + case 2807: + case 2808: + case 2809: + case 2810: + case 2811: + case 2812: + case 2813: + case 2814: + case 2815: + case 2816: + case 2817: + case 2818: + case 2819: + case 2820: + case 2821: + case 2822: + case 2823: + case 2824: + case 2825: + case 2826: + case 2827: + case 2828: + case 2829: + case 2830: + case 2831: + case 2832: + case 2833: + case 2834: + case 2835: + case 2836: + case 2837: + case 2838: + case 2839: + case 2840: + case 2841: + case 2842: + case 2843: + case 2844: + case 2845: + case 2846: + case 2847: + case 2848: + case 2849: + case 2850: + case 2851: + case 2852: + case 2853: + case 2854: + case 2855: + case 2856: + case 2857: + case 2858: + case 2859: + case 2860: + case 2861: + case 2862: + case 2863: + case 2864: + case 2865: + case 2866: + case 2867: + case 2868: + case 2869: + case 2870: + case 2871: + case 2872: + case 2873: + case 2874: + case 2875: + case 2876: + case 2877: + case 2878: + case 2879: + case 2880: + case 2881: + case 2882: + case 2883: + case 2884: + case 2885: + case 2886: + case 2887: + case 2888: + case 2889: + case 2890: + case 2891: + case 2892: + case 2893: + case 2894: + case 2895: + case 2896: + case 2897: + case 2898: + case 2899: + case 2900: + case 2901: + case 2902: + case 2903: + case 2904: + case 2905: + case 2906: + case 2907: + case 2908: + case 2909: + case 2910: + case 2911: + case 2912: + case 2913: + case 2914: + case 2915: + case 2916: + case 2917: + case 2918: + case 2919: + case 2920: + case 2921: + case 2922: + case 2923: + case 2924: + case 2925: + case 2926: + case 2927: + case 2928: + case 2929: + case 2930: + case 2931: + case 2932: + case 2933: + case 2934: + case 2935: + case 2936: + case 2937: + case 2938: + case 2939: + case 2940: + case 2941: + case 2942: + case 2943: + case 2944: + case 2945: + case 2946: + case 2947: + case 2948: + case 2949: + case 2950: + case 2951: + case 2952: + case 2953: + case 2954: + case 2955: + case 2956: + case 2957: + case 2958: + case 2959: + case 2960: + case 2961: + case 2962: + case 2963: + case 2964: + case 2965: + case 2966: + case 2967: + case 2968: + case 2969: + case 2970: + case 2971: + case 2972: + case 2973: + case 2974: + case 2975: + case 2976: + case 2977: + case 2978: + case 2979: + case 2980: + case 2981: + case 2982: + case 2983: + case 2984: + case 2985: + case 2986: + case 2987: + case 2988: + case 2989: + case 2990: + case 2991: + case 2992: + case 2993: + case 2994: + case 2995: + case 2996: + case 2997: + case 2998: + case 2999: + case 3000: + case 3001: + case 3002: + case 3003: + case 3004: + case 3005: + case 3006: + case 3007: + case 3008: + case 3009: + case 3010: + case 3011: + case 3012: + case 3013: + case 3014: + case 3015: + case 3016: + case 3017: + case 3018: + case 3019: + case 3020: + case 3021: + case 3022: + case 3023: + case 3024: + case 3025: + case 3026: + case 3027: + case 3028: + case 3029: + case 3030: + case 3031: + case 3032: + case 3033: + case 3034: + case 3035: + case 3036: + case 3037: + case 3038: + case 3039: + case 3040: + case 3041: + case 3042: + case 3043: + case 3044: + case 3045: + case 3046: + case 3047: + case 3048: + case 3049: + case 3050: + case 3051: + case 3052: + case 3053: + case 3054: + case 3055: + case 3056: + case 3057: + case 3058: + case 3059: + case 3060: + case 3061: + case 3062: + case 3063: + case 3064: + case 3065: + case 3066: + case 3067: + case 3068: + case 3069: + case 3070: + case 3071: + case 3072: + case 3073: + case 3074: + case 3075: + case 3076: + case 3077: + case 3078: + case 3079: + case 3080: + case 3081: + case 3082: + case 3083: + case 3084: + case 3085: + case 3086: + case 3087: + case 3088: + case 3089: + case 3090: + case 3091: + case 3092: + case 3093: + case 3094: + case 3095: + case 3096: + case 3097: + case 3098: + case 3099: + case 3100: + case 3101: + case 3102: + case 3103: + case 3104: + case 3105: + case 3106: + case 3107: + case 3108: + case 3109: + case 3110: + case 3111: + case 3112: + case 3113: + case 3114: + case 3115: + case 3116: + case 3117: + case 3118: + case 3119: + case 3120: + case 3121: + case 3122: + case 3123: + case 3124: + case 3125: + case 3126: + case 3127: + case 3128: + case 3129: + case 3130: + case 3131: + case 3132: + case 3133: + case 3134: + case 3135: + case 3136: + case 3137: + case 3138: + case 3139: + case 3140: + case 3141: + case 3142: + case 3143: + case 3144: + case 3145: + case 3146: + case 3147: + case 3148: + case 3149: + case 3150: + case 3151: + case 3152: + case 3153: + case 3154: + case 3155: + case 3156: + case 3157: + case 3158: + case 3159: + case 3160: + case 3161: + case 3162: + case 3163: + case 3164: + case 3165: + case 3166: + case 3167: + case 3168: + case 3169: + case 3170: + case 3171: + case 3172: + case 3173: + case 3174: + case 3175: + case 3176: + case 3177: + case 3178: + case 3179: + case 3180: + case 3181: + case 3182: + case 3183: + case 3184: + case 3185: + case 3186: + case 3187: + case 3188: + case 3189: + case 3190: + case 3191: + case 3192: + case 3193: + case 3194: + case 3195: + case 3196: + case 3197: + case 3198: + case 3199: + case 3200: + case 3201: + case 3202: + case 3203: + case 3204: + case 3205: + case 3206: + case 3207: + case 3208: + case 3209: + case 3210: + case 3211: + case 3212: + case 3213: + case 3214: + case 3215: + case 3216: + case 3217: + case 3218: + case 3219: + case 3220: + case 3221: + case 3222: + case 3223: + case 3224: + case 3225: + case 3226: + case 3227: + case 3228: + case 3229: + case 3230: + case 3231: + case 3232: + case 3233: + case 3234: + case 3235: + case 3236: + case 3237: + case 3238: + case 3239: + case 3240: + case 3241: + case 3242: + case 3243: + case 3244: + case 3245: + case 3246: + case 3247: + case 3248: + case 3249: + case 3250: + case 3251: + case 3252: + case 3253: + case 3254: + case 3255: + case 3256: + case 3257: + case 3258: + case 3259: + case 3260: + case 3261: + case 3262: + case 3263: + case 3264: + case 3265: + case 3266: + case 3267: + case 3268: + case 3269: + case 3270: + case 3271: + case 3272: + case 3273: + case 3274: + case 3275: + case 3276: + case 3277: + case 3278: + case 3279: + case 3280: + case 3281: + case 3282: + case 3283: + case 3284: + case 3285: + case 3286: + case 3287: + case 3288: + case 3289: + case 3290: + case 3291: + case 3292: + case 3293: + case 3294: + case 3295: + case 3296: + case 3297: + case 3298: + case 3299: + case 3300: + case 3301: + case 3302: + case 3303: + case 3304: + case 3305: + case 3306: + case 3307: + case 3308: + case 3309: + case 3310: + case 3311: + case 3312: + case 3313: + case 3314: + case 3315: + case 3316: + case 3317: + case 3318: + case 3319: + case 3320: + case 3321: + case 3322: + case 3323: + case 3324: + case 3325: + case 3326: + case 3327: + case 3328: + case 3329: + case 3330: + case 3331: + case 3332: + case 3333: + case 3334: + case 3335: + case 3336: + case 3337: + case 3338: + case 3339: + case 3340: + case 3341: + case 3342: + case 3343: + case 3344: + case 3345: + case 3346: + case 3347: + case 3348: + case 3349: + case 3350: + case 3351: + case 3352: + case 3353: + case 3354: + case 3355: + case 3356: + case 3357: + case 3358: + case 3359: + case 3360: + case 3361: + case 3362: + case 3363: + case 3364: + case 3365: + case 3366: + case 3367: + case 3368: + case 3369: + case 3370: + case 3371: + case 3372: + case 3373: + case 3374: + case 3375: + case 3376: + case 3377: + case 3378: + case 3379: + case 3380: + case 3381: + case 3382: + case 3383: + case 3384: + case 3385: + case 3386: + case 3387: + case 3388: + case 3389: + case 3390: + case 3391: + case 3392: + case 3393: + case 3394: + case 3395: + case 3396: + case 3397: + case 3398: + case 3399: + case 3400: + case 3401: + case 3402: + case 3403: + case 3404: + case 3405: + case 3406: + case 3407: + case 3408: + case 3409: + case 3410: + case 3411: + case 3412: + case 3413: + case 3414: + case 3415: + case 3416: + case 3417: + case 3418: + case 3419: + case 3420: + case 3421: + case 3422: + case 3423: + case 3424: + case 3425: + case 3426: + case 3427: + case 3428: + case 3429: + case 3430: + case 3431: + case 3432: + case 3433: + case 3434: + case 3435: + case 3436: + case 3437: + case 3438: + case 3439: + case 3440: + case 3441: + case 3442: + case 3443: + case 3444: + case 3445: + case 3446: + case 3447: + case 3448: + case 3449: + case 3450: + case 3451: + case 3452: + case 3453: + case 3454: + case 3455: + case 3456: + case 3457: + case 3458: + case 3459: + case 3460: + case 3461: + case 3462: + case 3463: + case 3464: + case 3465: + case 3466: + case 3467: + case 3468: + case 3469: + case 3470: + case 3471: + case 3472: + case 3473: + case 3474: + case 3475: + case 3476: + case 3477: + case 3478: + case 3479: + case 3480: + case 3481: + case 3482: + case 3483: + case 3484: + case 3485: + case 3486: + case 3487: + case 3488: + case 3489: + case 3490: + case 3491: + case 3492: + case 3493: + case 3494: + case 3495: + case 3496: + case 3497: + case 3498: + case 3499: + case 3500: + case 3501: + case 3502: + case 3503: + case 3504: + case 3505: + case 3506: + case 3507: + case 3508: + case 3509: + case 3510: + case 3511: + case 3512: + case 3513: + case 3514: + case 3515: + case 3516: + case 3517: + case 3518: + case 3519: + case 3520: + case 3521: + case 3522: + case 3523: + case 3524: + case 3525: + case 3526: + case 3527: + case 3528: + case 3529: + case 3530: + case 3531: + case 3532: + case 3533: + case 3534: + case 3535: + case 3536: + case 3537: + case 3538: + case 3539: + case 3540: + case 3541: + case 3542: + case 3543: + case 3544: + case 3545: + case 3546: + case 3547: + case 3548: + case 3549: + case 3550: + case 3551: + case 3552: + case 3553: + case 3554: + case 3555: + case 3556: + case 3557: + case 3558: + case 3559: + case 3560: + case 3561: + case 3562: + case 3563: + case 3564: + case 3565: + case 3566: + case 3567: + case 3568: + case 3569: + case 3570: + case 3571: + case 3572: + case 3573: + case 3574: + case 3575: + case 3576: + case 3577: + case 3578: + case 3579: + case 3580: + case 3581: + case 3582: + case 3583: + case 3584: + case 3585: + case 3586: + case 3587: + case 3588: + case 3589: + case 3590: + case 3591: + case 3592: + case 3593: + case 3594: + case 3595: + case 3596: + case 3597: + case 3598: + case 3599: + case 3600: + case 3601: + case 3602: + case 3603: + case 3604: + case 3605: + case 3606: + case 3607: + case 3608: + case 3609: + case 3610: + case 3611: + case 3612: + case 3613: + case 3614: + case 3615: + case 3616: + case 3617: + case 3618: + case 3619: + case 3620: + case 3621: + case 3622: + case 3623: + case 3624: + case 3625: + case 3626: + case 3627: + case 3628: + case 3629: + case 3630: + case 3631: + case 3632: + case 3633: + case 3634: + case 3635: + case 3636: + case 3637: + case 3638: + case 3639: + case 3640: + case 3641: + case 3642: + case 3643: + case 3644: + case 3645: + case 3646: + case 3647: + case 3648: + case 3649: + case 3650: + case 3651: + case 3652: + case 3653: + case 3654: + case 3655: + case 3656: + case 3657: + case 3658: + case 3659: + case 3660: + case 3661: + case 3662: + case 3663: + case 3664: + case 3665: + case 3666: + case 3667: + case 3668: + case 3669: + case 3670: + case 3671: + case 3672: + case 3673: + case 3674: + case 3675: + case 3676: + case 3677: + case 3678: + case 3679: + case 3680: + case 3681: + case 3682: + case 3683: + case 3684: + case 3685: + case 3686: + case 3687: + case 3688: + case 3689: + case 3690: + case 3691: + case 3692: + case 3693: + case 3694: + case 3695: + case 3696: + case 3697: + case 3698: + case 3699: + case 3700: + case 3701: + case 3702: + case 3703: + case 3704: + case 3705: + case 3706: + case 3707: + case 3708: + case 3709: + case 3710: + case 3711: + case 3712: + case 3713: + case 3714: + case 3715: + case 3716: + case 3717: + case 3718: + case 3719: + case 3720: + case 3721: + case 3722: + case 3723: + case 3724: + case 3725: + case 3726: + case 3727: + case 3728: + case 3729: + case 3730: + case 3731: + case 3732: + case 3733: + case 3734: + case 3735: + case 3736: + case 3737: + case 3738: + case 3739: + case 3740: + case 3741: + case 3742: + case 3743: + case 3744: + case 3745: + case 3746: + case 3747: + case 3748: + case 3749: + case 3750: + case 3751: + case 3752: + case 3753: + case 3754: + case 3755: + case 3756: + case 3757: + case 3758: + case 3759: + case 3760: + case 3761: + case 3762: + case 3763: + case 3764: + case 3765: + case 3766: + case 3767: + case 3768: + case 3769: + case 3770: + case 3771: + case 3772: + case 3773: + case 3774: + case 3775: + case 3776: + case 3777: + case 3778: + case 3779: + case 3780: + case 3781: + case 3782: + case 3783: + case 3784: + case 3785: + case 3786: + case 3787: + case 3788: + case 3789: + case 3790: + case 3791: + case 3792: + case 3793: + case 3794: + case 3795: + case 3796: + case 3797: + case 3798: + case 3799: + case 3800: + case 3801: + case 3802: + case 3803: + case 3804: + case 3805: + case 3806: + case 3807: + case 3808: + case 3809: + case 3810: + case 3811: + case 3812: + case 3813: + case 3814: + case 3815: + case 3816: + case 3817: + case 3818: + case 3819: + case 3820: + case 3821: + case 3822: + case 3823: + case 3824: + case 3825: + case 3826: + case 3827: + case 3828: + case 3829: + case 3830: + case 3831: + case 3832: + case 3833: + case 3834: + case 3835: + case 3836: + case 3837: + case 3838: + case 3839: + case 3840: + case 3841: + case 3842: + case 3843: + case 3844: + case 3845: + case 3846: + case 3847: + case 3848: + case 3849: + case 3850: + case 3851: + case 3852: + case 3853: + case 3854: + case 3855: + case 3856: + case 3857: + case 3858: + case 3859: + case 3860: + case 3861: + case 3862: + case 3863: + case 3864: + case 3865: + case 3866: + case 3867: + case 3868: + case 3869: + case 3870: + case 3871: + case 3872: + case 3873: + case 3874: + case 3875: + case 3876: + case 3877: + case 3878: + case 3879: + case 3880: + case 3881: + case 3882: + case 3883: + case 3884: + case 3885: + case 3886: + case 3887: + case 3888: + case 3889: + case 3890: + case 3891: + case 3892: + case 3893: + case 3894: + case 3895: + case 3896: + case 3897: + case 3898: + case 3899: + case 3900: + case 3901: + case 3902: + case 3903: + case 3904: + case 3905: + case 3906: + case 3907: + case 3908: + case 3909: + case 3910: + case 3911: + case 3912: + case 3913: + case 3914: + case 3915: + case 3916: + case 3917: + case 3918: + case 3919: + case 3920: + case 3921: + case 3922: + case 3923: + case 3924: + case 3925: + case 3926: + case 3927: + case 3928: + case 3929: + case 3930: + case 3931: + case 3932: + case 3933: + case 3934: + case 3935: + case 3936: + case 3937: + case 3938: + case 3939: + case 3940: + case 3941: + case 3942: + case 3943: + case 3944: + case 3945: + case 3946: + case 3947: + case 3948: + case 3949: + case 3950: + case 3951: + case 3952: + case 3953: + case 3954: + case 3955: + case 3956: + case 3957: + case 3958: + case 3959: + case 3960: + case 3961: + case 3962: + case 3963: + case 3964: + case 3965: + case 3966: + case 3967: + case 3968: + case 3969: + case 3970: + case 3971: + case 3972: + case 3973: + case 3974: + case 3975: + case 3976: + case 3977: + case 3978: + case 3979: + case 3980: + case 3981: + case 3982: + case 3983: + case 3984: + case 3985: + case 3986: + case 3987: + case 3988: + case 3989: + case 3990: + case 3991: + case 3992: + case 3993: + case 3994: + case 3995: + case 3996: + case 3997: + case 3998: + case 3999: + case 4000: + case 4001: + case 4002: + case 4003: + case 4004: + case 4005: + case 4006: + case 4007: + case 4008: + case 4009: + case 4010: + case 4011: + case 4012: + case 4013: + case 4014: + case 4015: + case 4016: + case 4017: + case 4018: + case 4019: + case 4020: + case 4021: + case 4022: + case 4023: + case 4024: + case 4025: + case 4026: + case 4027: + case 4028: + case 4029: + case 4030: + case 4031: + case 4032: + case 4033: + case 4034: + case 4035: + case 4036: + case 4037: + case 4038: + case 4039: + case 4040: + case 4041: + case 4042: + case 4043: + case 4044: + case 4045: + case 4046: + case 4047: + case 4048: + case 4049: + case 4050: + case 4051: + case 4052: + case 4053: + case 4054: + case 4055: + case 4056: + case 4057: + case 4058: + case 4059: + case 4060: + case 4061: + case 4062: + case 4063: + case 4064: + case 4065: + case 4066: + case 4067: + case 4068: + case 4069: + case 4070: + case 4071: + case 4072: + case 4073: + case 4074: + case 4075: + case 4076: + case 4077: + case 4078: + case 4079: + case 4080: + case 4081: + case 4082: + case 4083: + case 4084: + case 4085: + case 4086: + case 4087: + case 4088: + case 4089: + case 4090: + case 4091: + case 4092: + case 4093: + case 4094: + case 4095: + case 4096: + case 4097: + case 4098: + case 4099: + case 4100: + case 4101: + case 4102: + case 4103: + case 4104: + case 4105: + case 4106: + case 4107: + case 4108: + case 4109: + case 4110: + case 4111: + case 4112: + case 4113: + case 4114: + case 4115: + case 4116: + case 4117: + case 4118: + case 4119: + case 4120: + case 4121: + case 4122: + case 4123: + case 4124: + case 4125: + case 4126: + case 4127: + case 4128: + case 4129: + case 4130: + case 4131: + case 4132: + case 4133: + case 4134: + case 4135: + case 4136: + case 4137: + case 4138: + case 4139: + case 4140: + case 4141: + case 4142: + case 4143: + case 4144: + case 4145: + case 4146: + case 4147: + case 4148: + case 4149: + case 4150: + case 4151: + case 4152: + case 4153: + case 4154: + case 4155: + case 4156: + case 4157: + case 4158: + case 4159: + case 4160: + case 4161: + case 4162: + case 4163: + case 4164: + case 4165: + case 4166: + case 4167: + case 4168: + case 4169: + case 4170: + case 4171: + case 4172: + case 4173: + case 4174: + case 4175: + case 4176: + case 4177: + case 4178: + case 4179: + case 4180: + case 4181: + case 4182: + case 4183: + case 4184: + case 4185: + case 4186: + case 4187: + case 4188: + case 4189: + case 4190: + case 4191: + case 4192: + case 4193: + case 4194: + case 4195: + case 4196: + case 4197: + case 4198: + case 4199: + case 4200: + case 4201: + case 4202: + case 4203: + case 4204: + case 4205: + case 4206: + case 4207: + case 4208: + case 4209: + case 4210: + case 4211: + case 4212: + case 4213: + case 4214: + case 4215: + case 4216: + case 4217: + case 4218: + case 4219: + case 4220: + case 4221: + case 4222: + case 4223: + case 4224: + case 4225: + case 4226: + case 4227: + case 4228: + case 4229: + case 4230: + case 4231: + case 4232: + case 4233: + case 4234: + case 4235: + case 4236: + case 4237: + case 4238: + case 4239: + case 4240: + case 4241: + case 4242: + case 4243: + case 4244: + case 4245: + case 4246: + case 4247: + case 4248: + case 4249: + case 4250: + case 4251: + case 4252: + case 4253: + case 4254: + case 4255: + case 4256: + case 4257: + case 4258: + case 4259: + case 4260: + case 4261: + case 4262: + case 4263: + case 4264: + case 4265: + case 4266: + case 4267: + case 4268: + case 4269: + case 4270: + case 4271: + case 4272: + case 4273: + case 4274: + case 4275: + case 4276: + case 4277: + case 4278: + case 4279: + case 4280: + case 4281: + case 4282: + case 4283: + case 4284: + case 4285: + case 4286: + case 4287: + case 4288: + case 4289: + case 4290: + case 4291: + case 4292: + case 4293: + case 4294: + case 4295: + case 4296: + case 4297: + case 4298: + case 4299: + case 4300: + case 4301: + case 4302: + case 4303: + case 4304: + case 4305: + case 4306: + case 4307: + case 4308: + case 4309: + case 4310: + case 4311: + case 4312: + case 4313: + case 4314: + case 4315: + case 4316: + case 4317: + case 4318: + case 4319: + case 4320: + case 4321: + case 4322: + case 4323: + case 4324: + case 4325: + case 4326: + case 4327: + case 4328: + case 4329: + case 4330: + case 4331: + case 4332: + case 4333: + case 4334: + case 4335: + case 4336: + case 4337: + case 4338: + case 4339: + case 4340: + case 4341: + case 4342: + case 4343: + case 4344: + case 4345: + case 4346: + case 4347: + case 4348: + case 4349: + case 4350: + case 4351: + case 4352: + case 4353: + case 4354: + case 4355: + case 4356: + case 4357: + case 4358: + case 4359: + case 4360: + case 4361: + case 4362: + case 4363: + case 4364: + case 4365: + case 4366: + case 4367: + case 4368: + case 4369: + case 4370: + case 4371: + case 4372: + case 4373: + case 4374: + case 4375: + case 4376: + case 4377: + case 4378: + case 4379: + case 4380: + case 4381: + case 4382: + case 4383: + case 4384: + case 4385: + case 4386: + case 4387: + case 4388: + case 4389: + case 4390: + case 4391: + case 4392: + case 4393: + case 4394: + case 4395: + case 4396: + case 4397: + case 4398: + case 4399: + case 4400: + case 4401: + case 4402: + case 4403: + case 4404: + case 4405: + case 4406: + case 4407: + case 4408: + case 4409: + case 4410: + case 4411: + case 4412: + case 4413: + case 4414: + case 4415: + case 4416: + case 4417: + case 4418: + case 4419: + case 4420: + case 4421: + case 4422: + case 4423: + case 4424: + case 4425: + case 4426: + case 4427: + case 4428: + case 4429: + case 4430: + case 4431: + case 4432: + case 4433: + case 4434: + case 4435: + case 4436: + case 4437: + case 4438: + case 4439: + case 4440: + case 4441: + case 4442: + case 4443: + case 4444: + case 4445: + case 4446: + case 4447: + case 4448: + case 4449: + case 4450: + case 4451: + case 4452: + case 4453: + case 4454: + case 4455: + case 4456: + case 4457: + case 4458: + case 4459: + case 4460: + case 4461: + case 4462: + case 4463: + case 4464: + case 4465: + case 4466: + case 4467: + case 4468: + case 4469: + case 4470: + case 4471: + case 4472: + case 4473: + case 4474: + case 4475: + case 4476: + case 4477: + case 4478: + case 4479: + case 4480: + case 4481: + case 4482: + case 4483: + case 4484: + case 4485: + case 4486: + case 4487: + case 4488: + case 4489: + case 4490: + case 4491: + case 4492: + case 4493: + case 4494: + case 4495: + case 4496: + case 4497: + case 4498: + case 4499: + case 4500: + case 4501: + case 4502: + case 4503: + case 4504: + case 4505: + case 4506: + case 4507: + case 4508: + case 4509: + case 4510: + case 4511: + case 4512: + case 4513: + case 4514: + case 4515: + case 4516: + case 4517: + case 4518: + case 4519: + case 4520: + case 4521: + case 4522: + case 4523: + case 4524: + case 4525: + case 4526: + case 4527: + case 4528: + case 4529: + case 4530: + case 4531: + case 4532: + case 4533: + case 4534: + case 4535: + case 4536: + case 4537: + case 4538: + case 4539: + case 4540: + case 4541: + case 4542: + case 4543: + case 4544: + case 4545: + case 4546: + case 4547: + case 4548: + case 4549: + case 4550: + case 4551: + case 4552: + case 4553: + case 4554: + case 4555: + case 4556: + case 4557: + case 4558: + case 4559: + case 4560: + case 4561: + case 4562: + case 4563: + case 4564: + case 4565: + case 4566: + case 4567: + case 4568: + case 4569: + case 4570: + case 4571: + case 4572: + case 4573: + case 4574: + case 4575: + case 4576: + case 4577: + case 4578: + case 4579: + case 4580: + case 4581: + case 4582: + case 4583: + case 4584: + case 4585: + case 4586: + case 4587: + case 4588: + case 4589: + case 4590: + case 4591: + case 4592: + case 4593: + case 4594: + case 4595: + case 4596: + case 4597: + case 4598: + case 4599: + case 4600: + case 4601: + case 4602: + case 4603: + case 4604: + case 4605: + case 4606: + case 4607: + case 4608: + case 4609: + case 4610: + case 4611: + case 4612: + case 4613: + case 4614: + case 4615: + case 4616: + case 4617: + case 4618: + case 4619: + case 4620: + case 4621: + case 4622: + case 4623: + case 4624: + case 4625: + case 4626: + case 4627: + case 4628: + case 4629: + case 4630: + case 4631: + case 4632: + case 4633: + case 4634: + case 4635: + case 4636: + case 4637: + case 4638: + case 4639: + case 4640: + case 4641: + case 4642: + case 4643: + case 4644: + case 4645: + case 4646: + case 4647: + case 4648: + case 4649: + case 4650: + case 4651: + case 4652: + case 4653: + case 4654: + case 4655: + case 4656: + case 4657: + case 4658: + case 4659: + case 4660: + case 4661: + case 4662: + case 4663: + case 4664: + case 4665: + case 4666: + case 4667: + case 4668: + case 4669: + case 4670: + case 4671: + case 4672: + case 4673: + case 4674: + case 4675: + case 4676: + case 4677: + case 4678: + case 4679: + case 4680: + case 4681: + case 4682: + case 4683: + case 4684: + case 4685: + case 4686: + case 4687: + case 4688: + case 4689: + case 4690: + case 4691: + case 4692: + case 4693: + case 4694: + case 4695: + case 4696: + case 4697: + case 4698: + case 4699: + case 4700: + case 4701: + case 4702: + case 4703: + case 4704: + case 4705: + case 4706: + case 4707: + case 4708: + case 4709: + case 4710: + case 4711: + case 4712: + case 4713: + case 4714: + case 4715: + case 4716: + case 4717: + case 4718: + case 4719: + case 4720: + case 4721: + case 4722: + case 4723: + case 4724: + case 4725: + case 4726: + case 4727: + case 4728: + case 4729: + case 4730: + case 4731: + case 4732: + case 4733: + case 4734: + case 4735: + case 4736: + case 4737: + case 4738: + case 4739: + case 4740: + case 4741: + case 4742: + case 4743: + case 4744: + case 4745: + case 4746: + case 4747: + case 4748: + case 4749: + case 4750: + case 4751: + case 4752: + case 4753: + case 4754: + case 4755: + case 4756: + case 4757: + case 4758: + case 4759: + case 4760: + case 4761: + case 4762: + case 4763: + case 4764: + case 4765: + case 4766: + case 4767: + case 4768: + case 4769: + case 4770: + case 4771: + case 4772: + case 4773: + case 4774: + case 4775: + case 4776: + case 4777: + case 4778: + case 4779: + case 4780: + case 4781: + case 4782: + case 4783: + case 4784: + case 4785: + case 4786: + case 4787: + case 4788: + case 4789: + case 4790: + case 4791: + case 4792: + case 4793: + case 4794: + case 4795: + case 4796: + case 4797: + case 4798: + case 4799: + case 4800: + case 4801: + case 4802: + case 4803: + case 4804: + case 4805: + case 4806: + case 4807: + case 4808: + case 4809: + case 4810: + case 4811: + case 4812: + case 4813: + case 4814: + case 4815: + case 4816: + case 4817: + case 4818: + case 4819: + case 4820: + case 4821: + case 4822: + case 4823: + case 4824: + case 4825: + case 4826: + case 4827: + case 4828: + case 4829: + case 4830: + case 4831: + case 4832: + case 4833: + case 4834: + case 4835: + case 4836: + case 4837: + case 4838: + case 4839: + case 4840: + case 4841: + case 4842: + case 4843: + case 4844: + case 4845: + case 4846: + case 4847: + case 4848: + case 4849: + case 4850: + case 4851: + case 4852: + case 4853: + case 4854: + case 4855: + case 4856: + case 4857: + case 4858: + case 4859: + case 4860: + case 4861: + case 4862: + case 4863: + case 4864: + case 4865: + case 4866: + case 4867: + case 4868: + case 4869: + case 4870: + case 4871: + case 4872: + case 4873: + case 4874: + case 4875: + case 4876: + case 4877: + case 4878: + case 4879: + case 4880: + case 4881: + case 4882: + case 4883: + case 4884: + case 4885: + case 4886: + case 4887: + case 4888: + case 4889: + case 4890: + case 4891: + case 4892: + case 4893: + case 4894: + case 4895: + case 4896: + case 4897: + case 4898: + case 4899: + case 4900: + case 4901: + case 4902: + case 4903: + case 4904: + case 4905: + case 4906: + case 4907: + case 4908: + case 4909: + case 4910: + case 4911: + case 4912: + case 4913: + case 4914: + case 4915: + case 4916: + case 4917: + case 4918: + case 4919: + case 4920: + case 4921: + case 4922: + case 4923: + case 4924: + case 4925: + case 4926: + case 4927: + case 4928: + case 4929: + case 4930: + case 4931: + case 4932: + case 4933: + case 4934: + case 4935: + case 4936: + case 4937: + case 4938: + case 4939: + case 4940: + case 4941: + case 4942: + case 4943: + case 4944: + case 4945: + case 4946: + case 4947: + case 4948: + case 4949: + case 4950: + case 4951: + case 4952: + case 4953: + case 4954: + case 4955: + case 4956: + case 4957: + case 4958: + case 4959: + case 4960: + case 4961: + case 4962: + case 4963: + case 4964: + case 4965: + case 4966: + case 4967: + case 4968: + case 4969: + case 4970: + case 4971: + case 4972: + case 4973: + case 4974: + case 4975: + case 4976: + case 4977: + case 4978: + case 4979: + case 4980: + case 4981: + case 4982: + case 4983: + case 4984: + case 4985: + case 4986: + case 4987: + case 4988: + case 4989: + case 4990: + case 4991: + case 4992: + case 4993: + case 4994: + case 4995: + case 4996: + case 4997: + case 4998: + case 4999: + case 5000: + case 5001: + case 5002: + case 5003: + case 5004: + case 5005: + case 5006: + case 5007: + case 5008: + case 5009: + case 5010: + case 5011: + case 5012: + case 5013: + case 5014: + case 5015: + case 5016: + case 5017: + case 5018: + case 5019: + case 5020: + case 5021: + case 5022: + case 5023: + case 5024: + case 5025: + case 5026: + case 5027: + case 5028: + case 5029: + case 5030: + case 5031: + case 5032: + case 5033: + case 5034: + case 5035: + case 5036: + case 5037: + case 5038: + case 5039: + case 5040: + case 5041: + case 5042: + case 5043: + case 5044: + case 5045: + case 5046: + case 5047: + case 5048: + case 5049: + case 5050: + case 5051: + case 5052: + case 5053: + case 5054: + case 5055: + case 5056: + case 5057: + case 5058: + case 5059: + case 5060: + case 5061: + case 5062: + case 5063: + case 5064: + case 5065: + case 5066: + case 5067: + case 5068: + case 5069: + case 5070: + case 5071: + case 5072: + case 5073: + case 5074: + case 5075: + case 5076: + case 5077: + case 5078: + case 5079: + case 5080: + case 5081: + case 5082: + case 5083: + case 5084: + case 5085: + case 5086: + case 5087: + case 5088: + case 5089: + case 5090: + case 5091: + case 5092: + case 5093: + case 5094: + case 5095: + case 5096: + case 5097: + case 5098: + case 5099: + case 5100: + case 5101: + case 5102: + case 5103: + case 5104: + case 5105: + case 5106: + case 5107: + case 5108: + case 5109: + case 5110: + case 5111: + case 5112: + case 5113: + case 5114: + case 5115: + case 5116: + case 5117: + case 5118: + case 5119: + case 5120: + case 5121: + case 5122: + case 5123: + case 5124: + case 5125: + case 5126: + case 5127: + case 5128: + case 5129: + case 5130: + case 5131: + case 5132: + case 5133: + case 5134: + case 5135: + case 5136: + case 5137: + case 5138: + case 5139: + case 5140: + case 5141: + case 5142: + case 5143: + case 5144: + case 5145: + case 5146: + case 5147: + case 5148: + case 5149: + case 5150: + case 5151: + case 5152: + case 5153: + case 5154: + case 5155: + case 5156: + case 5157: + case 5158: + case 5159: + case 5160: + case 5161: + case 5162: + case 5163: + case 5164: + case 5165: + case 5166: + case 5167: + case 5168: + case 5169: + case 5170: + case 5171: + case 5172: + case 5173: + case 5174: + case 5175: + case 5176: + case 5177: + case 5178: + case 5179: + case 5180: + case 5181: + case 5182: + case 5183: + case 5184: + case 5185: + case 5186: + case 5187: + case 5188: + case 5189: + case 5190: + case 5191: + case 5192: + case 5193: + case 5194: + case 5195: + case 5196: + case 5197: + case 5198: + case 5199: + case 5200: + case 5201: + case 5202: + case 5203: + case 5204: + case 5205: + case 5206: + case 5207: + case 5208: + case 5209: + case 5210: + case 5211: + case 5212: + case 5213: + case 5214: + case 5215: + case 5216: + case 5217: + case 5218: + case 5219: + case 5220: + case 5221: + case 5222: + case 5223: + case 5224: + case 5225: + case 5226: + case 5227: + case 5228: + case 5229: + case 5230: + case 5231: + case 5232: + case 5233: + case 5234: + case 5235: + case 5236: + case 5237: + case 5238: + case 5239: + case 5240: + case 5241: + case 5242: + case 5243: + case 5244: + case 5245: + case 5246: + case 5247: + case 5248: + case 5249: + case 5250: + case 5251: + case 5252: + case 5253: + case 5254: + case 5255: + case 5256: + case 5257: + case 5258: + case 5259: + case 5260: + case 5261: + case 5262: + case 5263: + case 5264: + case 5265: + case 5266: + case 5267: + case 5268: + case 5269: + case 5270: + case 5271: + case 5272: + case 5273: + case 5274: + case 5275: + case 5276: + case 5277: + case 5278: + case 5279: + case 5280: + case 5281: + case 5282: + case 5283: + case 5284: + case 5285: + case 5286: + case 5287: + case 5288: + case 5289: + case 5290: + case 5291: + case 5292: + case 5293: + case 5294: + case 5295: + case 5296: + case 5297: + case 5298: + case 5299: + case 5300: + case 5301: + case 5302: + case 5303: + case 5304: + case 5305: + case 5306: + case 5307: + case 5308: + case 5309: + case 5310: + case 5311: + case 5312: + case 5313: + case 5314: + case 5315: + case 5316: + case 5317: + case 5318: + case 5319: + case 5320: + case 5321: + case 5322: + case 5323: + case 5324: + case 5325: + case 5326: + case 5327: + case 5328: + case 5329: + case 5330: + case 5331: + case 5332: + case 5333: + case 5334: + case 5335: + case 5336: + case 5337: + case 5338: + case 5339: + case 5340: + case 5341: + case 5342: + case 5343: + case 5344: + case 5345: + case 5346: + case 5347: + case 5348: + case 5349: + case 5350: + case 5351: + case 5352: + case 5353: + case 5354: + case 5355: + case 5356: + case 5357: + case 5358: + case 5359: + case 5360: + case 5361: + case 5362: + case 5363: + case 5364: + case 5365: + case 5366: + case 5367: + case 5368: + case 5369: + case 5370: + case 5371: + case 5372: + case 5373: + case 5374: + case 5375: + case 5376: + case 5377: + case 5378: + case 5379: + case 5380: + case 5381: + case 5382: + case 5383: + case 5384: + case 5385: + case 5386: + case 5387: + case 5388: + case 5389: + case 5390: + case 5391: + case 5392: + case 5393: + case 5394: + case 5395: + case 5396: + case 5397: + case 5398: + case 5399: + case 5400: + case 5401: + case 5402: + case 5403: + case 5404: + case 5405: + case 5406: + case 5407: + case 5408: + case 5409: + case 5410: + case 5411: + case 5412: + case 5413: + case 5414: + case 5415: + case 5416: + case 5417: + case 5418: + case 5419: + case 5420: + case 5421: + case 5422: + case 5423: + case 5424: + case 5425: + case 5426: + case 5427: + case 5428: + case 5429: + case 5430: + case 5431: + case 5432: + case 5433: + case 5434: + case 5435: + case 5436: + case 5437: + case 5438: + case 5439: + case 5440: + case 5441: + case 5442: + case 5443: + case 5444: + case 5445: + case 5446: + case 5447: + case 5448: + case 5449: + case 5450: + case 5451: + case 5452: + case 5453: + case 5454: + case 5455: + case 5456: + case 5457: + case 5458: + case 5459: + case 5460: + case 5461: + case 5462: + case 5463: + case 5464: + case 5465: + case 5466: + case 5467: + case 5468: + case 5469: + case 5470: + case 5471: + case 5472: + case 5473: + case 5474: + case 5475: + case 5476: + case 5477: + case 5478: + case 5479: + case 5480: + case 5481: + case 5482: + case 5483: + case 5484: + case 5485: + case 5486: + case 5487: + case 5488: + case 5489: + case 5490: + case 5491: + case 5492: + case 5493: + case 5494: + case 5495: + case 5496: + case 5497: + case 5498: + case 5499: + case 5500: + case 5501: + case 5502: + case 5503: + case 5504: + case 5505: + case 5506: + case 5507: + case 5508: + case 5509: + case 5510: + case 5511: + case 5512: + case 5513: + case 5514: + case 5515: + case 5516: + case 5517: + case 5518: + case 5519: + case 5520: + case 5521: + case 5522: + case 5523: + case 5524: + case 5525: + case 5526: + case 5527: + case 5528: + case 5529: + case 5530: + case 5531: + case 5532: + case 5533: + case 5534: + case 5535: + case 5536: + case 5537: + case 5538: + case 5539: + case 5540: + case 5541: + case 5542: + case 5543: + case 5544: + case 5545: + case 5546: + case 5547: + case 5548: + case 5549: + case 5550: + case 5551: + case 5552: + case 5553: + case 5554: + case 5555: + case 5556: + case 5557: + case 5558: + case 5559: + case 5560: + case 5561: + case 5562: + case 5563: + case 5564: + case 5565: + case 5566: + case 5567: + case 5568: + case 5569: + case 5570: + case 5571: + case 5572: + case 5573: + case 5574: + case 5575: + case 5576: + case 5577: + case 5578: + case 5579: + case 5580: + case 5581: + case 5582: + case 5583: + case 5584: + case 5585: + case 5586: + case 5587: + case 5588: + case 5589: + case 5590: + case 5591: + case 5592: + case 5593: + case 5594: + case 5595: + case 5596: + case 5597: + case 5598: + case 5599: + case 5600: + case 5601: + case 5602: + case 5603: + case 5604: + case 5605: + case 5606: + case 5607: + case 5608: + case 5609: + case 5610: + case 5611: + case 5612: + case 5613: + case 5614: + case 5615: + case 5616: + case 5617: + case 5618: + case 5619: + case 5620: + case 5621: + case 5622: + case 5623: + case 5624: + case 5625: + case 5626: + case 5627: + case 5628: + case 5629: + case 5630: + case 5631: + case 5632: + case 5633: + case 5634: + case 5635: + case 5636: + case 5637: + case 5638: + case 5639: + case 5640: + case 5641: + case 5642: + case 5643: + case 5644: + case 5645: + case 5646: + case 5647: + case 5648: + case 5649: + case 5650: + case 5651: + case 5652: + case 5653: + case 5654: + case 5655: + case 5656: + case 5657: + case 5658: + case 5659: + case 5660: + case 5661: + case 5662: + case 5663: + case 5664: + case 5665: + case 5666: + case 5667: + case 5668: + case 5669: + case 5670: + case 5671: + case 5672: + case 5673: + case 5674: + case 5675: + case 5676: + case 5677: + case 5678: + case 5679: + case 5680: + case 5681: + case 5682: + case 5683: + case 5684: + case 5685: + case 5686: + case 5687: + case 5688: + case 5689: + case 5690: + case 5691: + case 5692: + case 5693: + case 5694: + case 5695: + case 5696: + case 5697: + case 5698: + case 5699: + case 5700: + case 5701: + case 5702: + case 5703: + case 5704: + case 5705: + case 5706: + case 5707: + case 5708: + case 5709: + case 5710: + case 5711: + case 5712: + case 5713: + case 5714: + case 5715: + case 5716: + case 5717: + case 5718: + case 5719: + case 5720: + case 5721: + case 5722: + case 5723: + case 5724: + case 5725: + case 5726: + case 5727: + case 5728: + case 5729: + case 5730: + case 5731: + case 5732: + case 5733: + case 5734: + case 5735: + case 5736: + case 5737: + case 5738: + case 5739: + case 5740: + case 5741: + case 5742: + case 5743: + case 5744: + case 5745: + case 5746: + case 5747: + case 5748: + case 5749: + case 5750: + case 5751: + case 5752: + case 5753: + case 5754: + case 5755: + case 5756: + case 5757: + case 5758: + case 5759: + case 5760: + case 5761: + case 5762: + case 5763: + case 5764: + case 5765: + case 5766: + case 5767: + case 5768: + case 5769: + case 5770: + case 5771: + case 5772: + case 5773: + case 5774: + case 5775: + case 5776: + case 5777: + case 5778: + case 5779: + case 5780: + case 5781: + case 5782: + case 5783: + case 5784: + case 5785: + case 5786: + case 5787: + case 5788: + case 5789: + case 5790: + case 5791: + case 5792: + case 5793: + case 5794: + case 5795: + case 5796: + case 5797: + case 5798: + case 5799: + case 5800: + case 5801: + case 5802: + case 5803: + case 5804: + case 5805: + case 5806: + case 5807: + case 5808: + case 5809: + case 5810: + case 5811: + case 5812: + case 5813: + case 5814: + case 5815: + case 5816: + case 5817: + case 5818: + case 5819: + case 5820: + case 5821: + case 5822: + case 5823: + case 5824: + case 5825: + case 5826: + case 5827: + case 5828: + case 5829: + case 5830: + case 5831: + case 5832: + case 5833: + case 5834: + case 5835: + case 5836: + case 5837: + case 5838: + case 5839: + case 5840: + case 5841: + case 5842: + case 5843: + case 5844: + case 5845: + case 5846: + case 5847: + case 5848: + case 5849: + case 5850: + case 5851: + case 5852: + case 5853: + case 5854: + case 5855: + case 5856: + case 5857: + case 5858: + case 5859: + case 5860: + case 5861: + case 5862: + case 5863: + case 5864: + case 5865: + case 5866: + case 5867: + case 5868: + case 5869: + case 5870: + case 5871: + case 5872: + case 5873: + case 5874: + case 5875: + case 5876: + case 5877: + case 5878: + case 5879: + case 5880: + case 5881: + case 5882: + case 5883: + case 5884: + case 5885: + case 5886: + case 5887: + case 5888: + case 5889: + case 5890: + case 5891: + case 5892: + case 5893: + case 5894: + case 5895: + case 5896: + case 5897: + case 5898: + case 5899: + case 5900: + case 5901: + case 5902: + case 5903: + case 5904: + case 5905: + case 5906: + case 5907: + case 5908: + case 5909: + case 5910: + case 5911: + case 5912: + case 5913: + case 5914: + case 5915: + case 5916: + case 5917: + case 5918: + case 5919: + case 5920: + case 5921: + case 5922: + case 5923: + case 5924: + case 5925: + case 5926: + case 5927: + case 5928: + case 5929: + case 5930: + case 5931: + case 5932: + case 5933: + case 5934: + case 5935: + case 5936: + case 5937: + case 5938: + case 5939: + case 5940: + case 5941: + case 5942: + case 5943: + case 5944: + case 5945: + case 5946: + case 5947: + case 5948: + case 5949: + case 5950: + case 5951: + case 5952: + case 5953: + case 5954: + case 5955: + case 5956: + case 5957: + case 5958: + case 5959: + case 5960: + case 5961: + case 5962: + case 5963: + case 5964: + case 5965: + case 5966: + case 5967: + case 5968: + case 5969: + case 5970: + case 5971: + case 5972: + case 5973: + case 5974: + case 5975: + case 5976: + case 5977: + case 5978: + case 5979: + case 5980: + case 5981: + case 5982: + case 5983: + case 5984: + case 5985: + case 5986: + case 5987: + case 5988: + case 5989: + case 5990: + case 5991: + case 5992: + case 5993: + case 5994: + case 5995: + case 5996: + case 5997: + case 5998: + case 5999: + case 6000: + case 6001: + case 6002: + case 6003: + case 6004: + case 6005: + case 6006: + case 6007: + case 6008: + case 6009: + case 6010: + case 6011: + case 6012: + case 6013: + case 6014: + case 6015: + case 6016: + case 6017: + case 6018: + case 6019: + case 6020: + case 6021: + case 6022: + case 6023: + case 6024: + case 6025: + case 6026: + case 6027: + case 6028: + case 6029: + case 6030: + case 6031: + case 6032: + case 6033: + case 6034: + case 6035: + case 6036: + case 6037: + case 6038: + case 6039: + case 6040: + case 6041: + case 6042: + case 6043: + case 6044: + case 6045: + case 6046: + case 6047: + case 6048: + case 6049: + case 6050: + case 6051: + case 6052: + case 6053: + case 6054: + case 6055: + case 6056: + case 6057: + case 6058: + case 6059: + case 6060: + case 6061: + case 6062: + case 6063: + case 6064: + case 6065: + case 6066: + case 6067: + case 6068: + case 6069: + case 6070: + case 6071: + case 6072: + case 6073: + case 6074: + case 6075: + case 6076: + case 6077: + case 6078: + case 6079: + case 6080: + case 6081: + case 6082: + case 6083: + case 6084: + case 6085: + case 6086: + case 6087: + case 6088: + case 6089: + case 6090: + case 6091: + case 6092: + case 6093: + case 6094: + case 6095: + case 6096: + case 6097: + case 6098: + case 6099: + case 6100: + case 6101: + case 6102: + case 6103: + case 6104: + case 6105: + case 6106: + case 6107: + case 6108: + case 6109: + case 6110: + case 6111: + case 6112: + case 6113: + case 6114: + case 6115: + case 6116: + case 6117: + case 6118: + case 6119: + case 6120: + case 6121: + case 6122: + case 6123: + case 6124: + case 6125: + case 6126: + case 6127: + case 6128: + case 6129: + case 6130: + case 6131: + case 6132: + case 6133: + case 6134: + case 6135: + case 6136: + case 6137: + case 6138: + case 6139: + case 6140: + case 6141: + case 6142: + case 6143: + case 6144: + case 6145: + case 6146: + case 6147: + case 6148: + case 6149: + case 6150: + case 6151: + case 6152: + case 6153: + case 6154: + case 6155: + case 6156: + case 6157: + case 6158: + case 6159: + case 6160: + case 6161: + case 6162: + case 6163: + case 6164: + case 6165: + case 6166: + case 6167: + case 6168: + case 6169: + case 6170: + case 6171: + case 6172: + case 6173: + case 6174: + case 6175: + case 6176: + case 6177: + case 6178: + case 6179: + case 6180: + case 6181: + case 6182: + case 6183: + case 6184: + case 6185: + case 6186: + case 6187: + case 6188: + case 6189: + case 6190: + case 6191: + case 6192: + case 6193: + case 6194: + case 6195: + case 6196: + case 6197: + case 6198: + case 6199: + case 6200: + case 6201: + case 6202: + case 6203: + case 6204: + case 6205: + case 6206: + case 6207: + case 6208: + case 6209: + case 6210: + case 6211: + case 6212: + case 6213: + case 6214: + case 6215: + case 6216: + case 6217: + case 6218: + case 6219: + case 6220: + case 6221: + case 6222: + case 6223: + case 6224: + case 6225: + case 6226: + case 6227: + case 6228: + case 6229: + case 6230: + case 6231: + case 6232: + case 6233: + case 6234: + case 6235: + case 6236: + case 6237: + case 6238: + case 6239: + case 6240: + case 6241: + case 6242: + case 6243: + case 6244: + case 6245: + case 6246: + case 6247: + case 6248: + case 6249: + case 6250: + case 6251: + case 6252: + case 6253: + case 6254: + case 6255: + case 6256: + case 6257: + case 6258: + case 6259: + case 6260: + case 6261: + case 6262: + case 6263: + case 6264: + case 6265: + case 6266: + case 6267: + case 6268: + case 6269: + case 6270: + case 6271: + case 6272: + case 6273: + case 6274: + case 6275: + case 6276: + case 6277: + case 6278: + case 6279: + case 6280: + case 6281: + case 6282: + case 6283: + case 6284: + case 6285: + case 6286: + case 6287: + case 6288: + case 6289: + case 6290: + case 6291: + case 6292: + case 6293: + case 6294: + case 6295: + case 6296: + case 6297: + case 6298: + case 6299: + case 6300: + case 6301: + case 6302: + case 6303: + case 6304: + case 6305: + case 6306: + case 6307: + case 6308: + case 6309: + case 6310: + case 6311: + case 6312: + case 6313: + case 6314: + case 6315: + case 6316: + case 6317: + case 6318: + case 6319: + case 6320: + case 6321: + case 6322: + case 6323: + case 6324: + case 6325: + case 6326: + case 6327: + case 6328: + case 6329: + case 6330: + case 6331: + case 6332: + case 6333: + case 6334: + case 6335: + case 6336: + case 6337: + case 6338: + case 6339: + case 6340: + case 6341: + case 6342: + case 6343: + case 6344: + case 6345: + case 6346: + case 6347: + case 6348: + case 6349: + case 6350: + case 6351: + case 6352: + case 6353: + case 6354: + case 6355: + case 6356: + case 6357: + case 6358: + case 6359: + case 6360: + case 6361: + case 6362: + case 6363: + case 6364: + case 6365: + case 6366: + case 6367: + case 6368: + case 6369: + case 6370: + case 6371: + case 6372: + case 6373: + case 6374: + case 6375: + case 6376: + case 6377: + case 6378: + case 6379: + case 6380: + case 6381: + case 6382: + case 6383: + case 6384: + case 6385: + case 6386: + case 6387: + case 6388: + case 6389: + case 6390: + case 6391: + case 6392: + case 6393: + case 6394: + case 6395: + case 6396: + case 6397: + case 6398: + case 6399: + case 6400: + case 6401: + case 6402: + case 6403: + case 6404: + case 6405: + case 6406: + case 6407: + case 6408: + case 6409: + case 6410: + case 6411: + case 6412: + case 6413: + case 6414: + case 6415: + case 6416: + case 6417: + case 6418: + case 6419: + case 6420: + case 6421: + case 6422: + case 6423: + case 6424: + case 6425: + case 6426: + case 6427: + case 6428: + case 6429: + case 6430: + case 6431: + case 6432: + case 6433: + case 6434: + case 6435: + case 6436: + case 6437: + case 6438: + case 6439: + case 6440: + case 6441: + case 6442: + case 6443: + case 6444: + case 6445: + case 6446: + case 6447: + case 6448: + case 6449: + case 6450: + case 6451: + case 6452: + case 6453: + case 6454: + case 6455: + case 6456: + case 6457: + case 6458: + case 6459: + case 6460: + case 6461: + case 6462: + case 6463: + case 6464: + case 6465: + case 6466: + case 6467: + case 6468: + case 6469: + case 6470: + case 6471: + case 6472: + case 6473: + case 6474: + case 6475: + case 6476: + case 6477: + case 6478: + case 6479: + case 6480: + case 6481: + case 6482: + case 6483: + case 6484: + case 6485: + case 6486: + case 6487: + case 6488: + case 6489: + case 6490: + case 6491: + case 6492: + case 6493: + case 6494: + case 6495: + case 6496: + case 6497: + case 6498: + case 6499: + case 6500: + case 6501: + case 6502: + case 6503: + case 6504: + case 6505: + case 6506: + case 6507: + case 6508: + case 6509: + case 6510: + case 6511: + case 6512: + case 6513: + case 6514: + case 6515: + case 6516: + case 6517: + case 6518: + case 6519: + case 6520: + case 6521: + case 6522: + case 6523: + case 6524: + case 6525: + case 6526: + case 6527: + case 6528: + case 6529: + case 6530: + case 6531: + case 6532: + case 6533: + case 6534: + case 6535: + case 6536: + case 6537: + case 6538: + case 6539: + case 6540: + case 6541: + case 6542: + case 6543: + case 6544: + case 6545: + case 6546: + case 6547: + case 6548: + case 6549: + case 6550: + case 6551: + case 6552: + case 6553: + case 6554: + case 6555: + case 6556: + case 6557: + case 6558: + case 6559: + case 6560: + case 6561: + case 6562: + case 6563: + case 6564: + case 6565: + case 6566: + case 6567: + case 6568: + case 6569: + case 6570: + case 6571: + case 6572: + case 6573: + case 6574: + case 6575: + case 6576: + case 6577: + case 6578: + case 6579: + case 6580: + case 6581: + case 6582: + case 6583: + case 6584: + case 6585: + case 6586: + case 6587: + case 6588: + case 6589: + case 6590: + case 6591: + case 6592: + case 6593: + case 6594: + case 6595: + case 6596: + case 6597: + case 6598: + case 6599: + case 6600: + case 6601: + case 6602: + case 6603: + case 6604: + case 6605: + case 6606: + case 6607: + case 6608: + case 6609: + case 6610: + case 6611: + case 6612: + case 6613: + case 6614: + case 6615: + case 6616: + case 6617: + case 6618: + case 6619: + case 6620: + case 6621: + case 6622: + case 6623: + case 6624: + case 6625: + case 6626: + case 6627: + case 6628: + case 6629: + case 6630: + case 6631: + case 6632: + case 6633: + case 6634: + case 6635: + case 6636: + case 6637: + case 6638: + case 6639: + case 6640: + case 6641: + case 6642: + case 6643: + case 6644: + case 6645: + case 6646: + case 6647: + case 6648: + case 6649: + case 6650: + case 6651: + case 6652: + case 6653: + case 6654: + case 6655: + case 6656: + case 6657: + case 6658: + case 6659: + case 6660: + case 6661: + case 6662: + case 6663: + case 6664: + case 6665: + case 6666: + case 6667: + case 6668: + case 6669: + case 6670: + case 6671: + case 6672: + case 6673: + case 6674: + case 6675: + case 6676: + case 6677: + case 6678: + case 6679: + case 6680: + case 6681: + case 6682: + case 6683: + case 6684: + case 6685: + case 6686: + case 6687: + case 6688: + case 6689: + case 6690: + case 6691: + case 6692: + case 6693: + case 6694: + case 6695: + case 6696: + case 6697: + case 6698: + case 6699: + case 6700: + case 6701: + case 6702: + case 6703: + case 6704: + case 6705: + case 6706: + case 6707: + case 6708: + case 6709: + case 6710: + case 6711: + case 6712: + case 6713: + case 6714: + case 6715: + case 6716: + case 6717: + case 6718: + case 6719: + case 6720: + case 6721: + case 6722: + case 6723: + case 6724: + case 6725: + case 6726: + case 6727: + case 6728: + case 6729: + case 6730: + case 6731: + case 6732: + case 6733: + case 6734: + case 6735: + case 6736: + case 6737: + case 6738: + case 6739: + case 6740: + case 6741: + case 6742: + case 6743: + case 6744: + case 6745: + case 6746: + case 6747: + case 6748: + case 6749: + case 6750: + case 6751: + case 6752: + case 6753: + case 6754: + case 6755: + case 6756: + case 6757: + case 6758: + case 6759: + case 6760: + case 6761: + case 6762: + case 6763: + case 6764: + case 6765: + case 6766: + case 6767: + case 6768: + case 6769: + case 6770: + case 6771: + case 6772: + case 6773: + case 6774: + case 6775: + case 6776: + case 6777: + case 6778: + case 6779: + case 6780: + case 6781: + case 6782: + case 6783: + case 6784: + case 6785: + case 6786: + case 6787: + case 6788: + case 6789: + case 6790: + case 6791: + case 6792: + case 6793: + case 6794: + case 6795: + case 6796: + case 6797: + case 6798: + case 6799: + case 6800: + case 6801: + case 6802: + case 6803: + case 6804: + case 6805: + case 6806: + case 6807: + case 6808: + case 6809: + case 6810: + case 6811: + case 6812: + case 6813: + case 6814: + case 6815: + case 6816: + case 6817: + case 6818: + case 6819: + case 6820: + case 6821: + case 6822: + case 6823: + case 6824: + case 6825: + case 6826: + case 6827: + case 6828: + case 6829: + case 6830: + case 6831: + case 6832: + case 6833: + case 6834: + case 6835: + case 6836: + case 6837: + case 6838: + case 6839: + case 6840: + case 6841: + case 6842: + case 6843: + case 6844: + case 6845: + case 6846: + case 6847: + case 6848: + case 6849: + case 6850: + case 6851: + case 6852: + case 6853: + case 6854: + case 6855: + case 6856: + case 6857: + case 6858: + case 6859: + case 6860: + case 6861: + case 6862: + case 6863: + case 6864: + case 6865: + case 6866: + case 6867: + case 6868: + case 6869: + case 6870: + case 6871: + case 6872: + case 6873: + case 6874: + case 6875: + case 6876: + case 6877: + case 6878: + case 6879: + case 6880: + case 6881: + case 6882: + case 6883: + case 6884: + case 6885: + case 6886: + case 6887: + case 6888: + case 6889: + case 6890: + case 6891: + case 6892: + case 6893: + case 6894: + case 6895: + case 6896: + case 6897: + case 6898: + case 6899: + case 6900: + case 6901: + case 6902: + case 6903: + case 6904: + case 6905: + case 6906: + case 6907: + case 6908: + case 6909: + case 6910: + case 6911: + case 6912: + case 6913: + case 6914: + case 6915: + case 6916: + case 6917: + case 6918: + case 6919: + case 6920: + case 6921: + case 6922: + case 6923: + case 6924: + case 6925: + case 6926: + case 6927: + case 6928: + case 6929: + case 6930: + case 6931: + case 6932: + case 6933: + case 6934: + case 6935: + case 6936: + case 6937: + case 6938: + case 6939: + case 6940: + case 6941: + case 6942: + case 6943: + case 6944: + case 6945: + case 6946: + case 6947: + case 6948: + case 6949: + case 6950: + case 6951: + case 6952: + case 6953: + case 6954: + case 6955: + case 6956: + case 6957: + case 6958: + case 6959: + case 6960: + case 6961: + case 6962: + case 6963: + case 6964: + case 6965: + case 6966: + case 6967: + case 6968: + case 6969: + case 6970: + case 6971: + case 6972: + case 6973: + case 6974: + case 6975: + case 6976: + case 6977: + case 6978: + case 6979: + case 6980: + case 6981: + case 6982: + case 6983: + case 6984: + case 6985: + case 6986: + case 6987: + case 6988: + case 6989: + case 6990: + case 6991: + case 6992: + case 6993: + case 6994: + case 6995: + case 6996: + case 6997: + case 6998: + case 6999: + case 7000: + case 7001: + case 7002: + case 7003: + case 7004: + case 7005: + case 7006: + case 7007: + case 7008: + case 7009: + case 7010: + case 7011: + case 7012: + case 7013: + case 7014: + case 7015: + case 7016: + case 7017: + case 7018: + case 7019: + case 7020: + case 7021: + case 7022: + case 7023: + case 7024: + case 7025: + case 7026: + case 7027: + case 7028: + case 7029: + case 7030: + case 7031: + case 7032: + case 7033: + case 7034: + case 7035: + case 7036: + case 7037: + case 7038: + case 7039: + case 7040: + case 7041: + case 7042: + case 7043: + case 7044: + case 7045: + case 7046: + case 7047: + case 7048: + case 7049: + case 7050: + case 7051: + case 7052: + case 7053: + case 7054: + case 7055: + case 7056: + case 7057: + case 7058: + case 7059: + case 7060: + case 7061: + case 7062: + case 7063: + case 7064: + case 7065: + case 7066: + case 7067: + case 7068: + case 7069: + case 7070: + case 7071: + case 7072: + case 7073: + case 7074: + case 7075: + case 7076: + case 7077: + case 7078: + case 7079: + case 7080: + case 7081: + case 7082: + case 7083: + case 7084: + case 7085: + case 7086: + case 7087: + case 7088: + case 7089: + case 7090: + case 7091: + case 7092: + case 7093: + case 7094: + case 7095: + case 7096: + case 7097: + case 7098: + case 7099: + case 7100: + case 7101: + case 7102: + case 7103: + case 7104: + case 7105: + case 7106: + case 7107: + case 7108: + case 7109: + case 7110: + case 7111: + case 7112: + case 7113: + case 7114: + case 7115: + case 7116: + case 7117: + case 7118: + case 7119: + case 7120: + case 7121: + case 7122: + case 7123: + case 7124: + case 7125: + case 7126: + case 7127: + case 7128: + case 7129: + case 7130: + case 7131: + case 7132: + case 7133: + case 7134: + case 7135: + case 7136: + case 7137: + case 7138: + case 7139: + case 7140: + case 7141: + case 7142: + case 7143: + case 7144: + case 7145: + case 7146: + case 7147: + case 7148: + case 7149: + case 7150: + case 7151: + case 7152: + case 7153: + case 7154: + case 7155: + case 7156: + case 7157: + case 7158: + case 7159: + case 7160: + case 7161: + case 7162: + case 7163: + case 7164: + case 7165: + case 7166: + case 7167: + case 7168: + case 7169: + case 7170: + case 7171: + case 7172: + case 7173: + case 7174: + case 7175: + case 7176: + case 7177: + case 7178: + case 7179: + case 7180: + case 7181: + case 7182: + case 7183: + case 7184: + case 7185: + case 7186: + case 7187: + case 7188: + case 7189: + case 7190: + case 7191: + case 7192: + case 7193: + case 7194: + case 7195: + case 7196: + case 7197: + case 7198: + case 7199: + case 7200: + case 7201: + case 7202: + case 7203: + case 7204: + case 7205: + case 7206: + case 7207: + case 7208: + case 7209: + case 7210: + case 7211: + case 7212: + case 7213: + case 7214: + case 7215: + case 7216: + case 7217: + case 7218: + case 7219: + case 7220: + case 7221: + case 7222: + case 7223: + case 7224: + case 7225: + case 7226: + case 7227: + case 7228: + case 7229: + case 7230: + case 7231: + case 7232: + case 7233: + case 7234: + case 7235: + case 7236: + case 7237: + case 7238: + case 7239: + case 7240: + case 7241: + case 7242: + case 7243: + case 7244: + case 7245: + case 7246: + case 7247: + case 7248: + case 7249: + case 7250: + case 7251: + case 7252: + case 7253: + case 7254: + case 7255: + case 7256: + case 7257: + case 7258: + case 7259: + case 7260: + case 7261: + case 7262: + case 7263: + case 7264: + case 7265: + case 7266: + case 7267: + case 7268: + case 7269: + case 7270: + case 7271: + case 7272: + case 7273: + case 7274: + case 7275: + case 7276: + case 7277: + case 7278: + case 7279: + case 7280: + case 7281: + case 7282: + case 7283: + case 7284: + case 7285: + case 7286: + case 7287: + case 7288: + case 7289: + case 7290: + case 7291: + case 7292: + case 7293: + case 7294: + case 7295: + case 7296: + case 7297: + case 7298: + case 7299: + case 7300: + case 7301: + case 7302: + case 7303: + case 7304: + case 7305: + case 7306: + case 7307: + case 7308: + case 7309: + case 7310: + case 7311: + case 7312: + case 7313: + case 7314: + case 7315: + case 7316: + case 7317: + case 7318: + case 7319: + case 7320: + case 7321: + case 7322: + case 7323: + case 7324: + case 7325: + case 7326: + case 7327: + case 7328: + case 7329: + case 7330: + case 7331: + case 7332: + case 7333: + case 7334: + case 7335: + case 7336: + case 7337: + case 7338: + case 7339: + case 7340: + case 7341: + case 7342: + case 7343: + case 7344: + case 7345: + case 7346: + case 7347: + case 7348: + case 7349: + case 7350: + case 7351: + case 7352: + case 7353: + case 7354: + case 7355: + case 7356: + case 7357: + case 7358: + case 7359: + case 7360: + case 7361: + case 7362: + case 7363: + case 7364: + case 7365: + case 7366: + case 7367: + case 7368: + case 7369: + case 7370: + case 7371: + case 7372: + case 7373: + case 7374: + case 7375: + case 7376: + case 7377: + case 7378: + case 7379: + case 7380: + case 7381: + case 7382: + case 7383: + case 7384: + case 7385: + case 7386: + case 7387: + case 7388: + case 7389: + case 7390: + case 7391: + case 7392: + case 7393: + case 7394: + case 7395: + case 7396: + case 7397: + case 7398: + case 7399: + case 7400: + case 7401: + case 7402: + case 7403: + case 7404: + case 7405: + case 7406: + case 7407: + case 7408: + case 7409: + case 7410: + case 7411: + case 7412: + case 7413: + case 7414: + case 7415: + case 7416: + case 7417: + case 7418: + case 7419: + case 7420: + case 7421: + case 7422: + case 7423: + case 7424: + case 7425: + case 7426: + case 7427: + case 7428: + case 7429: + case 7430: + case 7431: + case 7432: + case 7433: + case 7434: + case 7435: + case 7436: + case 7437: + case 7438: + case 7439: + case 7440: + case 7441: + case 7442: + case 7443: + case 7444: + case 7445: + case 7446: + case 7447: + case 7448: + case 7449: + case 7450: + case 7451: + case 7452: + case 7453: + case 7454: + case 7455: + case 7456: + case 7457: + case 7458: + case 7459: + case 7460: + case 7461: + case 7462: + case 7463: + case 7464: + case 7465: + case 7466: + case 7467: + case 7468: + case 7469: + case 7470: + case 7471: + case 7472: + case 7473: + case 7474: + case 7475: + case 7476: + case 7477: + case 7478: + case 7479: + case 7480: + case 7481: + case 7482: + case 7483: + case 7484: + case 7485: + case 7486: + case 7487: + case 7488: + case 7489: + case 7490: + case 7491: + case 7492: + case 7493: + case 7494: + case 7495: + case 7496: + case 7497: + case 7498: + case 7499: + case 7500: + case 7501: + case 7502: + case 7503: + case 7504: + case 7505: + case 7506: + case 7507: + case 7508: + case 7509: + case 7510: + case 7511: + case 7512: + case 7513: + case 7514: + case 7515: + case 7516: + case 7517: + case 7518: + case 7519: + case 7520: + case 7521: + case 7522: + case 7523: + case 7524: + case 7525: + case 7526: + case 7527: + case 7528: + case 7529: + case 7530: + case 7531: + case 7532: + case 7533: + case 7534: + case 7535: + case 7536: + case 7537: + case 7538: + case 7539: + case 7540: + case 7541: + case 7542: + case 7543: + case 7544: + case 7545: + case 7546: + case 7547: + case 7548: + case 7549: + case 7550: + case 7551: + case 7552: + case 7553: + case 7554: + case 7555: + case 7556: + case 7557: + case 7558: + case 7559: + case 7560: + case 7561: + case 7562: + case 7563: + case 7564: + case 7565: + case 7566: + case 7567: + case 7568: + case 7569: + case 7570: + case 7571: + case 7572: + case 7573: + case 7574: + case 7575: + case 7576: + case 7577: + case 7578: + case 7579: + case 7580: + case 7581: + case 7582: + case 7583: + case 7584: + case 7585: + case 7586: + case 7587: + case 7588: + case 7589: + case 7590: + case 7591: + case 7592: + case 7593: + case 7594: + case 7595: + case 7596: + case 7597: + case 7598: + case 7599: + case 7600: + case 7601: + case 7602: + case 7603: + case 7604: + case 7605: + case 7606: + case 7607: + case 7608: + case 7609: + case 7610: + case 7611: + case 7612: + case 7613: + case 7614: + case 7615: + case 7616: + case 7617: + case 7618: + case 7619: + case 7620: + case 7621: + case 7622: + case 7623: + case 7624: + case 7625: + case 7626: + case 7627: + case 7628: + case 7629: + case 7630: + case 7631: + case 7632: + case 7633: + case 7634: + case 7635: + case 7636: + case 7637: + case 7638: + case 7639: + case 7640: + case 7641: + case 7642: + case 7643: + case 7644: + case 7645: + case 7646: + case 7647: + case 7648: + case 7649: + case 7650: + case 7651: + case 7652: + case 7653: + case 7654: + case 7655: + case 7656: + case 7657: + case 7658: + case 7659: + case 7660: + case 7661: + case 7662: + case 7663: + case 7664: + case 7665: + case 7666: + case 7667: + case 7668: + case 7669: + case 7670: + case 7671: + case 7672: + case 7673: + case 7674: + case 7675: + case 7676: + case 7677: + case 7678: + case 7679: + case 7680: + case 7681: + case 7682: + case 7683: + case 7684: + case 7685: + case 7686: + case 7687: + case 7688: + case 7689: + case 7690: + case 7691: + case 7692: + case 7693: + case 7694: + case 7695: + case 7696: + case 7697: + case 7698: + case 7699: + case 7700: + case 7701: + case 7702: + case 7703: + case 7704: + case 7705: + case 7706: + case 7707: + case 7708: + case 7709: + case 7710: + case 7711: + case 7712: + case 7713: + case 7714: + case 7715: + case 7716: + case 7717: + case 7718: + case 7719: + case 7720: + case 7721: + case 7722: + case 7723: + case 7724: + case 7725: + case 7726: + case 7727: + case 7728: + case 7729: + case 7730: + case 7731: + case 7732: + case 7733: + case 7734: + case 7735: + case 7736: + case 7737: + case 7738: + case 7739: + case 7740: + case 7741: + case 7742: + case 7743: + case 7744: + case 7745: + case 7746: + case 7747: + case 7748: + case 7749: + case 7750: + case 7751: + case 7752: + case 7753: + case 7754: + case 7755: + case 7756: + case 7757: + case 7758: + case 7759: + case 7760: + case 7761: + case 7762: + case 7763: + case 7764: + case 7765: + case 7766: + case 7767: + case 7768: + case 7769: + case 7770: + case 7771: + case 7772: + case 7773: + case 7774: + case 7775: + case 7776: + case 7777: + case 7778: + case 7779: + case 7780: + case 7781: + case 7782: + case 7783: + case 7784: + case 7785: + case 7786: + case 7787: + case 7788: + case 7789: + case 7790: + case 7791: + case 7792: + case 7793: + case 7794: + case 7795: + case 7796: + case 7797: + case 7798: + case 7799: + case 7800: + case 7801: + case 7802: + case 7803: + case 7804: + case 7805: + case 7806: + case 7807: + case 7808: + case 7809: + case 7810: + case 7811: + case 7812: + case 7813: + case 7814: + case 7815: + case 7816: + case 7817: + case 7818: + case 7819: + case 7820: + case 7821: + case 7822: + case 7823: + case 7824: + case 7825: + case 7826: + case 7827: + case 7828: + case 7829: + case 7830: + case 7831: + case 7832: + case 7833: + case 7834: + case 7835: + case 7836: + case 7837: + case 7838: + case 7839: + case 7840: + case 7841: + case 7842: + case 7843: + case 7844: + case 7845: + case 7846: + case 7847: + case 7848: + case 7849: + case 7850: + case 7851: + case 7852: + case 7853: + case 7854: + case 7855: + case 7856: + case 7857: + case 7858: + case 7859: + case 7860: + case 7861: + case 7862: + case 7863: + case 7864: + case 7865: + case 7866: + case 7867: + case 7868: + case 7869: + case 7870: + case 7871: + case 7872: + case 7873: + case 7874: + case 7875: + case 7876: + case 7877: + case 7878: + case 7879: + case 7880: + case 7881: + case 7882: + case 7883: + case 7884: + case 7885: + case 7886: + case 7887: + case 7888: + case 7889: + case 7890: + case 7891: + case 7892: + case 7893: + case 7894: + case 7895: + case 7896: + case 7897: + case 7898: + case 7899: + case 7900: + case 7901: + case 7902: + case 7903: + case 7904: + case 7905: + case 7906: + case 7907: + case 7908: + case 7909: + case 7910: + case 7911: + case 7912: + case 7913: + case 7914: + case 7915: + case 7916: + case 7917: + case 7918: + case 7919: + case 7920: + case 7921: + case 7922: + case 7923: + case 7924: + case 7925: + case 7926: + case 7927: + case 7928: + case 7929: + case 7930: + case 7931: + case 7932: + case 7933: + case 7934: + case 7935: + case 7936: + case 7937: + case 7938: + case 7939: + case 7940: + case 7941: + case 7942: + case 7943: + case 7944: + case 7945: + case 7946: + case 7947: + case 7948: + case 7949: + case 7950: + case 7951: + case 7952: + case 7953: + case 7954: + case 7955: + case 7956: + case 7957: + case 7958: + case 7959: + case 7960: + case 7961: + case 7962: + case 7963: + case 7964: + case 7965: + case 7966: + case 7967: + case 7968: + case 7969: + case 7970: + case 7971: + case 7972: + case 7973: + case 7974: + case 7975: + case 7976: + case 7977: + case 7978: + case 7979: + case 7980: + case 7981: + case 7982: + case 7983: + case 7984: + case 7985: + case 7986: + case 7987: + case 7988: + case 7989: + case 7990: + case 7991: + case 7992: + case 7993: + case 7994: + case 7995: + case 7996: + case 7997: + case 7998: + case 7999: + case 8000: + case 8001: + case 8002: + case 8003: + case 8004: + case 8005: + case 8006: + case 8007: + case 8008: + case 8009: + case 8010: + case 8011: + case 8012: + case 8013: + case 8014: + case 8015: + case 8016: + case 8017: + case 8018: + case 8019: + case 8020: + case 8021: + case 8022: + case 8023: + case 8024: + case 8025: + case 8026: + case 8027: + case 8028: + case 8029: + case 8030: + case 8031: + case 8032: + case 8033: + case 8034: + case 8035: + case 8036: + case 8037: + case 8038: + case 8039: + case 8040: + case 8041: + case 8042: + case 8043: + case 8044: + case 8045: + case 8046: + case 8047: + case 8048: + case 8049: + case 8050: + case 8051: + case 8052: + case 8053: + case 8054: + case 8055: + case 8056: + case 8057: + case 8058: + case 8059: + case 8060: + case 8061: + case 8062: + case 8063: + case 8064: + case 8065: + case 8066: + case 8067: + case 8068: + case 8069: + case 8070: + case 8071: + case 8072: + case 8073: + case 8074: + case 8075: + case 8076: + case 8077: + case 8078: + case 8079: + case 8080: + case 8081: + case 8082: + case 8083: + case 8084: + case 8085: + case 8086: + case 8087: + case 8088: + case 8089: + case 8090: + case 8091: + case 8092: + case 8093: + case 8094: + case 8095: + case 8096: + case 8097: + case 8098: + case 8099: + case 8100: + case 8101: + case 8102: + case 8103: + case 8104: + case 8105: + case 8106: + case 8107: + case 8108: + case 8109: + case 8110: + case 8111: + case 8112: + case 8113: + case 8114: + case 8115: + case 8116: + case 8117: + case 8118: + case 8119: + case 8120: + case 8121: + case 8122: + case 8123: + case 8124: + case 8125: + case 8126: + case 8127: + case 8128: + case 8129: + case 8130: + case 8131: + case 8132: + case 8133: + case 8134: + case 8135: + case 8136: + case 8137: + case 8138: + case 8139: + case 8140: + case 8141: + case 8142: + case 8143: + case 8144: + case 8145: + case 8146: + case 8147: + case 8148: + case 8149: + case 8150: + case 8151: + case 8152: + case 8153: + case 8154: + case 8155: + case 8156: + case 8157: + case 8158: + case 8159: + case 8160: + case 8161: + case 8162: + case 8163: + case 8164: + case 8165: + case 8166: + case 8167: + case 8168: + case 8169: + case 8170: + case 8171: + case 8172: + case 8173: + case 8174: + case 8175: + case 8176: + case 8177: + case 8178: + case 8179: + case 8180: + case 8181: + case 8182: + case 8183: + case 8184: + case 8185: + case 8186: + case 8187: + case 8188: + case 8189: + case 8190: + case 8191: + case 8192: + case 8193: + case 8194: + case 8195: + case 8196: + case 8197: + case 8198: + case 8199: + case 8200: + case 8201: + case 8202: + case 8203: + case 8204: + case 8205: + case 8206: + case 8207: + case 8208: + case 8209: + case 8210: + case 8211: + case 8212: + case 8213: + case 8214: + case 8215: + case 8216: + case 8217: + case 8218: + case 8219: + case 8220: + case 8221: + case 8222: + case 8223: + case 8224: + case 8225: + case 8226: + case 8227: + case 8228: + case 8229: + case 8230: + case 8231: + case 8232: + case 8233: + case 8234: + case 8235: + case 8236: + case 8237: + case 8238: + case 8239: + case 8240: + case 8241: + case 8242: + case 8243: + case 8244: + case 8245: + case 8246: + case 8247: + case 8248: + case 8249: + case 8250: + case 8251: + case 8252: + case 8253: + case 8254: + case 8255: + case 8256: + case 8257: + case 8258: + case 8259: + case 8260: + case 8261: + case 8262: + case 8263: + case 8264: + case 8265: + case 8266: + case 8267: + case 8268: + case 8269: + case 8270: + case 8271: + case 8272: + case 8273: + case 8274: + case 8275: + case 8276: + case 8277: + case 8278: + case 8279: + case 8280: + case 8281: + case 8282: + case 8283: + case 8284: + case 8285: + case 8286: + case 8287: + case 8288: + case 8289: + case 8290: + case 8291: + case 8292: + case 8293: + case 8294: + case 8295: + case 8296: + case 8297: + case 8298: + case 8299: + case 8300: + case 8301: + case 8302: + case 8303: + case 8304: + case 8305: + case 8306: + case 8307: + case 8308: + case 8309: + case 8310: + case 8311: + case 8312: + case 8313: + case 8314: + case 8315: + case 8316: + case 8317: + case 8318: + case 8319: + case 8320: + case 8321: + case 8322: + case 8323: + case 8324: + case 8325: + case 8326: + case 8327: + case 8328: + case 8329: + case 8330: + case 8331: + case 8332: + case 8333: + case 8334: + case 8335: + case 8336: + case 8337: + case 8338: + case 8339: + case 8340: + case 8341: + case 8342: + case 8343: + case 8344: + case 8345: + case 8346: + case 8347: + case 8348: + case 8349: + case 8350: + case 8351: + case 8352: + case 8353: + case 8354: + case 8355: + case 8356: + case 8357: + case 8358: + case 8359: + case 8360: + case 8361: + case 8362: + case 8363: + case 8364: + case 8365: + case 8366: + case 8367: + case 8368: + case 8369: + case 8370: + case 8371: + case 8372: + case 8373: + case 8374: + case 8375: + case 8376: + case 8377: + case 8378: + case 8379: + case 8380: + case 8381: + case 8382: + case 8383: + case 8384: + case 8385: + case 8386: + case 8387: + case 8388: + case 8389: + case 8390: + case 8391: + case 8392: + case 8393: + case 8394: + case 8395: + case 8396: + case 8397: + case 8398: + case 8399: + case 8400: + case 8401: + case 8402: + case 8403: + case 8404: + case 8405: + case 8406: + case 8407: + case 8408: + case 8409: + case 8410: + case 8411: + case 8412: + case 8413: + case 8414: + case 8415: + case 8416: + case 8417: + case 8418: + case 8419: + case 8420: + case 8421: + case 8422: + case 8423: + case 8424: + case 8425: + case 8426: + case 8427: + case 8428: + case 8429: + case 8430: + case 8431: + case 8432: + case 8433: + case 8434: + case 8435: + case 8436: + case 8437: + case 8438: + case 8439: + case 8440: + case 8441: + case 8442: + case 8443: + case 8444: + case 8445: + case 8446: + case 8447: + case 8448: + case 8449: + case 8450: + case 8451: + case 8452: + case 8453: + case 8454: + case 8455: + case 8456: + case 8457: + case 8458: + case 8459: + case 8460: + case 8461: + case 8462: + case 8463: + case 8464: + case 8465: + case 8466: + case 8467: + case 8468: + case 8469: + case 8470: + case 8471: + case 8472: + case 8473: + case 8474: + case 8475: + case 8476: + case 8477: + case 8478: + case 8479: + case 8480: + case 8481: + case 8482: + case 8483: + case 8484: + case 8485: + case 8486: + case 8487: + case 8488: + case 8489: + case 8490: + case 8491: + case 8492: + case 8493: + case 8494: + case 8495: + case 8496: + case 8497: + case 8498: + case 8499: + case 8500: + case 8501: + case 8502: + case 8503: + case 8504: + case 8505: + case 8506: + case 8507: + case 8508: + case 8509: + case 8510: + case 8511: + case 8512: + case 8513: + case 8514: + case 8515: + case 8516: + case 8517: + case 8518: + case 8519: + case 8520: + case 8521: + case 8522: + case 8523: + case 8524: + case 8525: + case 8526: + case 8527: + case 8528: + case 8529: + case 8530: + case 8531: + case 8532: + case 8533: + case 8534: + case 8535: + case 8536: + case 8537: + case 8538: + case 8539: + case 8540: + case 8541: + case 8542: + case 8543: + case 8544: + case 8545: + case 8546: + case 8547: + case 8548: + case 8549: + case 8550: + case 8551: + case 8552: + case 8553: + case 8554: + case 8555: + case 8556: + case 8557: + case 8558: + case 8559: + case 8560: + case 8561: + case 8562: + case 8563: + case 8564: + case 8565: + case 8566: + case 8567: + case 8568: + case 8569: + case 8570: + case 8571: + case 8572: + case 8573: + case 8574: + case 8575: + case 8576: + case 8577: + case 8578: + case 8579: + case 8580: + case 8581: + case 8582: + case 8583: + case 8584: + case 8585: + case 8586: + case 8587: + case 8588: + case 8589: + case 8590: + case 8591: + case 8592: + case 8593: + case 8594: + case 8595: + case 8596: + case 8597: + case 8598: + case 8599: + case 8600: + case 8601: + case 8602: + case 8603: + case 8604: + case 8605: + case 8606: + case 8607: + case 8608: + case 8609: + case 8610: + case 8611: + case 8612: + case 8613: + case 8614: + case 8615: + case 8616: + case 8617: + case 8618: + case 8619: + case 8620: + case 8621: + case 8622: + case 8623: + case 8624: + case 8625: + case 8626: + case 8627: + case 8628: + case 8629: + case 8630: + case 8631: + case 8632: + case 8633: + case 8634: + case 8635: + case 8636: + case 8637: + case 8638: + case 8639: + case 8640: + case 8641: + case 8642: + case 8643: + case 8644: + case 8645: + case 8646: + case 8647: + case 8648: + case 8649: + case 8650: + case 8651: + case 8652: + case 8653: + case 8654: + case 8655: + case 8656: + case 8657: + case 8658: + case 8659: + case 8660: + case 8661: + case 8662: + case 8663: + case 8664: + case 8665: + case 8666: + case 8667: + case 8668: + case 8669: + case 8670: + case 8671: + case 8672: + case 8673: + case 8674: + case 8675: + case 8676: + case 8677: + case 8678: + case 8679: + case 8680: + case 8681: + case 8682: + case 8683: + case 8684: + case 8685: + case 8686: + case 8687: + case 8688: + case 8689: + case 8690: + case 8691: + case 8692: + case 8693: + case 8694: + case 8695: + case 8696: + case 8697: + case 8698: + case 8699: + case 8700: + case 8701: + case 8702: + case 8703: + case 8704: + case 8705: + case 8706: + case 8707: + case 8708: + case 8709: + case 8710: + case 8711: + case 8712: + case 8713: + case 8714: + case 8715: + case 8716: + case 8717: + case 8718: + case 8719: + case 8720: + case 8721: + case 8722: + case 8723: + case 8724: + case 8725: + case 8726: + case 8727: + case 8728: + case 8729: + case 8730: + case 8731: + case 8732: + case 8733: + case 8734: + case 8735: + case 8736: + case 8737: + case 8738: + case 8739: + case 8740: + case 8741: + case 8742: + case 8743: + case 8744: + case 8745: + case 8746: + case 8747: + case 8748: + case 8749: + case 8750: + case 8751: + case 8752: + case 8753: + case 8754: + case 8755: + case 8756: + case 8757: + case 8758: + case 8759: + case 8760: + case 8761: + case 8762: + case 8763: + case 8764: + case 8765: + case 8766: + case 8767: + case 8768: + case 8769: + case 8770: + case 8771: + case 8772: + case 8773: + case 8774: + case 8775: + case 8776: + case 8777: + case 8778: + case 8779: + case 8780: + case 8781: + case 8782: + case 8783: + case 8784: + case 8785: + case 8786: + case 8787: + case 8788: + case 8789: + case 8790: + case 8791: + case 8792: + case 8793: + case 8794: + case 8795: + case 8796: + case 8797: + case 8798: + case 8799: + case 8800: + case 8801: + case 8802: + case 8803: + case 8804: + case 8805: + case 8806: + case 8807: + case 8808: + case 8809: + case 8810: + case 8811: + case 8812: + case 8813: + case 8814: + case 8815: + case 8816: + case 8817: + case 8818: + case 8819: + case 8820: + case 8821: + case 8822: + case 8823: + case 8824: + case 8825: + case 8826: + case 8827: + case 8828: + case 8829: + case 8830: + case 8831: + case 8832: + case 8833: + case 8834: + case 8835: + case 8836: + case 8837: + case 8838: + case 8839: + case 8840: + case 8841: + case 8842: + case 8843: + case 8844: + case 8845: + case 8846: + case 8847: + case 8848: + case 8849: + case 8850: + case 8851: + case 8852: + case 8853: + case 8854: + case 8855: + case 8856: + case 8857: + case 8858: + case 8859: + case 8860: + case 8861: + case 8862: + case 8863: + case 8864: + case 8865: + case 8866: + case 8867: + case 8868: + case 8869: + case 8870: + case 8871: + case 8872: + case 8873: + case 8874: + case 8875: + case 8876: + case 8877: + case 8878: + case 8879: + case 8880: + case 8881: + case 8882: + case 8883: + case 8884: + case 8885: + case 8886: + case 8887: + case 8888: + case 8889: + case 8890: + case 8891: + case 8892: + case 8893: + case 8894: + case 8895: + case 8896: + case 8897: + case 8898: + case 8899: + case 8900: + case 8901: + case 8902: + case 8903: + case 8904: + case 8905: + case 8906: + case 8907: + case 8908: + case 8909: + case 8910: + case 8911: + case 8912: + case 8913: + case 8914: + case 8915: + case 8916: + case 8917: + case 8918: + case 8919: + case 8920: + case 8921: + case 8922: + case 8923: + case 8924: + case 8925: + case 8926: + case 8927: + case 8928: + case 8929: + case 8930: + case 8931: + case 8932: + case 8933: + case 8934: + case 8935: + case 8936: + case 8937: + case 8938: + case 8939: + case 8940: + case 8941: + case 8942: + case 8943: + case 8944: + case 8945: + case 8946: + case 8947: + case 8948: + case 8949: + case 8950: + case 8951: + case 8952: + case 8953: + case 8954: + case 8955: + case 8956: + case 8957: + case 8958: + case 8959: + case 8960: + case 8961: + case 8962: + case 8963: + case 8964: + case 8965: + case 8966: + case 8967: + case 8968: + case 8969: + case 8970: + case 8971: + case 8972: + case 8973: + case 8974: + case 8975: + case 8976: + case 8977: + case 8978: + case 8979: + case 8980: + case 8981: + case 8982: + case 8983: + case 8984: + case 8985: + case 8986: + case 8987: + case 8988: + case 8989: + case 8990: + case 8991: + case 8992: + case 8993: + case 8994: + case 8995: + case 8996: + case 8997: + case 8998: + case 8998: // DUPLICATE LABEL + actual += 'a'; + case 8999: + actual += 'b'; +} +expect = 'ab'; +addThis(); + + + +//--------------------------------------------------------------------------------- +test(); +//--------------------------------------------------------------------------------- + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-83532-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-83532-001.js new file mode 100644 index 0000000..8bde123 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-83532-001.js @@ -0,0 +1,48 @@ +/* +* 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): pschwartau@netscape.com +* Date: 01 June 2001 +* +* SUMMARY: Testing that we don't crash on switch case -1... +* See http://bugzilla.mozilla.org/show_bug.cgi?id=83532 +* +*/ +//------------------------------------------------------------------------------------------------- +var bug = 83532; +var summary = "Testing that we don't crash on switch case -1"; + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + // Just testing that we don't crash on these - + function f () {switch(1) {case -1:}} + function g(){switch(1){case (-1):}} + var h = function() {switch(1) {case -1:}} + f(); + g(); + h(); + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-83532-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-83532-002.js new file mode 100644 index 0000000..085eebf --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/regress-83532-002.js @@ -0,0 +1,51 @@ +/* +* 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): pschwartau@netscape.com +* Date: 01 June 2001 +* +* SUMMARY: Testing that we don't crash on switch case -1... +* See http://bugzilla.mozilla.org/show_bug.cgi?id=83532 +* +*/ +//------------------------------------------------------------------------------------------------- +var bug = 83532; +var summary = "Testing that we don't crash on switch case -1"; +var sToEval = ''; + +//------------------------------------------------------------------------------------------------- +test(); +//------------------------------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + // Just testing that we don't crash on these - + sToEval += 'function f () {switch(1) {case -1:}};'; + sToEval += 'function g(){switch(1){case (-1):}};'; + sToEval += 'var h = function() {switch(1) {case -1:}};' + sToEval += 'f();'; + sToEval += 'g();'; + sToEval += 'h();'; + eval(sToEval); + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/switch-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/switch-001.js new file mode 100644 index 0000000..5dd8b47 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Statements/switch-001.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 expressed +* 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): pschwartau@netscape.com +* Date: 07 May 2001 +* +* SUMMARY: Testing the switch statement +* +* See ECMA3 Section 12.11, "The switch Statement" +*/ +//------------------------------------------------------------------------------------------------- +var UBound = 0; +var bug = '(none)'; +var summary = 'Testing the switch statement'; +var cnMatch = 'Match'; +var cnNoMatch = 'NoMatch'; +var status = ''; +var statusitems = [ ]; +var actual = ''; +var actualvalues = [ ]; +var expect= ''; +var expectedvalues = [ ]; + + +status = 'Section A of test'; +actual = match(17, f(fInverse(17)), f, fInverse); +expect = cnMatch; +addThis(); + +status = 'Section B of test'; +actual = match(17, 18, f, fInverse); +expect = cnNoMatch; +addThis(); + +status = 'Section C of test'; +actual = match(1, 1, Math.exp, Math.log); +expect = cnMatch; +addThis(); + +status = 'Section D of test'; +actual = match(1, 2, Math.exp, Math.log); +expect = cnNoMatch; +addThis(); + +status = 'Section E of test'; +actual = match(1, 1, Math.sin, Math.cos); +expect = cnNoMatch; +addThis(); + + + +//--------------------------------------------------------------------------------- +test(); +//--------------------------------------------------------------------------------- + + + +/* + * If F,G are inverse functions and x==y, this should return cnMatch - + */ +function match(x, y, F, G) +{ + switch (x) + { + case F(G(y)): + return cnMatch; + + default: + return cnNoMatch; + } +} + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i = 0; i < UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} + + +function f(m) +{ + return 2*(m+1); +} + + +function fInverse(n) +{ + return (n-2)/2; +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/String/regress-104375.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/String/regress-104375.js new file mode 100644 index 0000000..42b5ce2 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/String/regress-104375.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.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): k.mike@gmx.net, pschwartau@netscape.com +* Date: 12 October 2001 +* +* SUMMARY: Regression test for string.replace bug 104375 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=104375 +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 104375; +var summary = 'Testing string.replace() with backreferences'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +/* + * Use the regexp to replace 'uid=31' with 'uid=15' + * + * In the second parameter of string.replace() method, + * "$1" refers to the first backreference: 'uid=' + */ +var str = 'uid=31'; +var re = /(uid=)(\d+)/; + +// try the numeric literal 15 +status = inSection(1); +actual = str.replace (re, "$1" + 15); +expect = 'uid=15'; +addThis(); + +// try the string literal '15' +status = inSection(2); +actual = str.replace (re, "$1" + '15'); +expect = 'uid=15'; +addThis(); + +// try a letter before the '15' +status = inSection(3); +actual = str.replace (re, "$1" + 'A15'); +expect = 'uid=A15'; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} + + diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/String/regress-189898.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/String/regress-189898.js new file mode 100644 index 0000000..e237152 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/String/regress-189898.js @@ -0,0 +1,152 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2003 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): igor@icesoft.no, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 21 January 2003 +* SUMMARY: Regression test for bug 189898 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=189898 +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 189898; +var summary = 'Regression test for bug 189898'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +status = inSection(1); +actual = 'XaXY'.replace('XY', '--') +expect = 'Xa--'; +addThis(); + +status = inSection(2); +actual = '$a$^'.replace('$^', '--') +expect = '$a--'; +addThis(); + +status = inSection(3); +actual = 'ababc'.replace('abc', '--') +expect = 'ab--'; +addThis(); + +status = inSection(4); +actual = 'ababc'.replace('abc', '^$') +expect = 'ab^$'; +addThis(); + + + +/* + * Same as above, but providing a regexp in the first parameter + * to String.prototype.replace() instead of a string. + * + * See http://bugzilla.mozilla.org/show_bug.cgi?id=83293 + * for subtleties on this issue - + */ +status = inSection(5); +actual = 'XaXY'.replace(/XY/, '--') +expect = 'Xa--'; +addThis(); + +status = inSection(6); +actual = 'XaXY'.replace(/XY/g, '--') +expect = 'Xa--'; +addThis(); + +status = inSection(7); +actual = '$a$^'.replace(/\$\^/, '--') +expect = '$a--'; +addThis(); + +status = inSection(8); +actual = '$a$^'.replace(/\$\^/g, '--') +expect = '$a--'; +addThis(); + +status = inSection(9); +actual = 'ababc'.replace(/abc/, '--') +expect = 'ab--'; +addThis(); + +status = inSection(10); +actual = 'ababc'.replace(/abc/g, '--') +expect = 'ab--'; +addThis(); + +status = inSection(11); +actual = 'ababc'.replace(/abc/, '^$') +expect = 'ab^$'; +addThis(); + +status = inSection(12); +actual = 'ababc'.replace(/abc/g, '^$') +expect = 'ab^$'; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/String/regress-83293.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/String/regress-83293.js new file mode 100644 index 0000000..02a7834 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/String/regress-83293.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.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): pschwartau@netscape.com, jim@jibbering.com +* Creation Date: 30 May 2001 +* Correction Date: 14 Aug 2001 +* +* SUMMARY: Regression test for bugs 83293, 103351 +* See http://bugzilla.mozilla.org/show_bug.cgi?id=83293 +* http://bugzilla.mozilla.org/show_bug.cgi?id=103351 +* http://bugzilla.mozilla.org/show_bug.cgi?id=92942 +* +* +* ******************** CORRECTION !!! ***************************** +* +* When I originally wrote this test, I thought this was true: +* str.replace(strA, strB) == str.replace(new RegExp(strA),strB). +* See ECMA-262 Final Draft, 15.5.4.11 String.prototype.replace +* +* However, in http://bugzilla.mozilla.org/show_bug.cgi?id=83293 +* Jim Ley points out the ECMA-262 Final Edition changed on this. +* String.prototype.replace (searchValue, replaceValue), if provided +* a searchValue that is not a RegExp, is NO LONGER to replace it with +* +* new RegExp(searchValue) +* but rather: +* String(searchValue) +* +* This puts the replace() method at variance with search() and match(), +* which continue to follow the RegExp conversion of the Final Draft. +* It also makes most of this testcase, as originally written, invalid. +********************************************************************** +*/ +//----------------------------------------------------------------------------- +var bug = 103351; // <--- (Outgrowth of original bug 83293) +var summ_OLD = 'Testing str.replace(strA, strB) == str.replace(new RegExp(strA),strB)'; +var summ_NEW = 'Testing String.prototype.replace(x,y) when x is a string'; +var summary = summ_NEW; +var status = ''; +var actual = ''; +var expect= ''; +var cnEmptyString = ''; +var str = 'abc'; +var strA = cnEmptyString; +var strB = 'Z'; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + +/* + * In this test, it's important to reportCompare() each other case + * BEFORE the last two cases are attempted. Don't store all results + * in an array and reportCompare() them at the end, as we usually do. + * + * When this bug was filed, str.replace(strA, strB) would return no value + * whatsoever if strA == cnEmptyString, and no error, either - + */ +function test() +{ + enterFunc ('test'); + printBugNumber (bug); + printStatus (summary); + +/******************* THESE WERE INCORRECT; SEE ABOVE ************************ + status = 'Section A of test'; + strA = 'a'; + actual = str.replace(strA, strB); + expect = str.replace(new RegExp(strA), strB); + reportCompare(expect, actual, status); + + status = 'Section B of test'; + strA = 'x'; + actual = str.replace(strA, strB); + expect = str.replace(new RegExp(strA), strB); + reportCompare(expect, actual, status); + + status = 'Section C of test'; + strA = undefined; + actual = str.replace(strA, strB); + expect = str.replace(new RegExp(strA), strB); + reportCompare(expect, actual, status); + + status = 'Section D of test'; + strA = null; + actual = str.replace(strA, strB); + expect = str.replace(new RegExp(strA), strB); + reportCompare(expect, actual, status); + + + * This example is from jim@jibbering.com (see Bugzilla bug 92942) + * It is a variation on the example below. + * + * Namely, we are using the regexp /$/ instead of the regexp //. + * The regexp /$/ means we should match the "empty string" at the + * end-boundary of the word, instead of the one at the beginning. + * + status = 'Section E of test'; + var strJim = 'aa$aa'; + strA = '$'; + actual = strJim.replace(strA, strB); // bug -> 'aaZaa' + expect = strJim.replace(new RegExp(strA), strB); // expect 'aa$aaZ' + reportCompare(expect, actual, status); + + + * + * Note: 'Zabc' is the result we expect for 'abc'.replace('', 'Z'). + * + * The string '' is supposed to be equivalent to new RegExp('') = //. + * The regexp // means we should match the "empty string" conceived of + * at the beginning boundary of the word, before the first character. + * + status = 'Section F of test'; + strA = cnEmptyString; + actual = str.replace(strA, strB); + expect = 'Zabc'; + reportCompare(expect, actual, status); + + status = 'Section G of test'; + strA = cnEmptyString; + actual = str.replace(strA, strB); + expect = str.replace(new RegExp(strA), strB); + reportCompare(expect, actual, status); + +************************* END OF INCORRECT CASES ****************************/ + + +////////////////////////// OK, LET'S START OVER ////////////////////////////// + + status = 'Section 1 of test'; + actual = 'abc'.replace('a', 'Z'); + expect = 'Zbc'; + reportCompare(expect, actual, status); + + status = 'Section 2 of test'; + actual = 'abc'.replace('b', 'Z'); + expect = 'aZc'; + reportCompare(expect, actual, status); + + status = 'Section 3 of test'; + actual = 'abc'.replace(undefined, 'Z'); + expect = 'abc'; // String(undefined) == 'undefined'; no replacement possible + reportCompare(expect, actual, status); + + status = 'Section 4 of test'; + actual = 'abc'.replace(null, 'Z'); + expect = 'abc'; // String(null) == 'null'; no replacement possible + reportCompare(expect, actual, status); + + status = 'Section 5 of test'; + actual = 'abc'.replace(true, 'Z'); + expect = 'abc'; // String(true) == 'true'; no replacement possible + reportCompare(expect, actual, status); + + status = 'Section 6 of test'; + actual = 'abc'.replace(false, 'Z'); + expect = 'abc'; // String(false) == 'false'; no replacement possible + reportCompare(expect, actual, status); + + status = 'Section 7 of test'; + actual = 'aa$aa'.replace('$', 'Z'); + expect = 'aaZaa'; // NOT 'aa$aaZ' as in ECMA Final Draft; see above + reportCompare(expect, actual, status); + + status = 'Section 8 of test'; + actual = 'abc'.replace('.*', 'Z'); + expect = 'abc'; // not 'Z' as in EMCA Final Draft + reportCompare(expect, actual, status); + + status = 'Section 9 of test'; + actual = 'abc'.replace('', 'Z'); + expect = 'Zabc'; // Still expect 'Zabc' for this + reportCompare(expect, actual, status); + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-001-n.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-001-n.js new file mode 100644 index 0000000..6527c16 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-001-n.js @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * 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): + * Rob Ginda rginda@netscape.com + */ + +test(); + +function test() +{ + enterFunc ("test"); + + printStatus ("Unicode Characters 1C-1F negative test."); + printBugNumber (23612); + + reportCompare ("error", eval ("'no'\u001C+' error'"), + "Unicode whitespace test (1C.)"); + reportCompare ("error", eval ("'no'\u001D+' error'"), + "Unicode whitespace test (1D.)"); + reportCompare ("error", eval ("'no'\u001E+' error'"), + "Unicode whitespace test (1E.)"); + reportCompare ("error", eval ("'no'\u001F+' error'"), + "Unicode whitespace test (1F.)"); + + exitFunc ("test"); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-001.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-001.js new file mode 100644 index 0000000..470e8bc --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-001.js @@ -0,0 +1,38 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * 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): + * Rob Ginda rginda@netscape.com + */ + +test(); + +function test() +{ + enterFunc ("test"); + + printStatus ("Unicode format-control character (Category Cf) test."); + printBugNumber (23610); + + reportCompare ("no error", eval('"no\u200E error"'), + "Unicode format-control character test (Category Cf.)"); + + exitFunc ("test"); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-002-n.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-002-n.js new file mode 100644 index 0000000..9c54a26 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-002-n.js @@ -0,0 +1,38 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * 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): + * Rob Ginda rginda@netscape.com + */ + +test(); + +function test() +{ + enterFunc ("test"); + + printStatus ("Non-character escapes in identifiers negative test."); + printBugNumber (23607); + + reportCompare ("error", eval("\u0020 = 5"), + "Non-character escapes in identifiers negative test."); + + exitFunc ("test"); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-002.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-002.js new file mode 100644 index 0000000..3b05d83 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-002.js @@ -0,0 +1,42 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * 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): + * Rob Ginda rginda@netscape.com + */ + +test(); + +function test() +{ + enterFunc ("test"); + + printStatus ("Unicode non-breaking space character test."); + printBugNumber (23613); + + reportCompare ("no error", eval("'no'\u00A0+ ' error'"), + "Unicode non-breaking space character test."); + + var str = "\u00A0foo"; + reportCompare (0, str.search(/^\sfoo$/), + "Unicode non-breaking space character regexp test."); + + exitFunc ("test"); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-003.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-003.js new file mode 100644 index 0000000..7004cf4 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-003.js @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * 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): + * Rob Ginda rginda@netscape.com + */ + +test(); + +function test() +{ + enterFunc ("test"); + + var \u0041 = 5; + var A\u03B2 = 15; + var c\u0061se = 25; + + printStatus ("Escapes in identifiers test."); + printBugNumber (23608); + printBugNumber (23607); + + reportCompare (5, eval("\u0041"), + "Escaped ASCII Identifier test."); + reportCompare (6, eval("++\u0041"), + "Escaped ASCII Identifier test"); + reportCompare (15, eval("A\u03B2"), + "Escaped non-ASCII Identifier test"); + reportCompare (16, eval("++A\u03B2"), + "Escaped non-ASCII Identifier test"); + reportCompare (25, eval("c\\u00" + "61se"), + "Escaped keyword Identifier test"); + reportCompare (26, eval("++c\\u00" + "61se"), + "Escaped keyword Identifier test"); + + exitFunc ("test"); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-004.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-004.js new file mode 100644 index 0000000..2518124 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-004.js @@ -0,0 +1,47 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * 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): + * Rob Ginda rginda@netscape.com + */ + +test(); + +function test() +{ + enterFunc ("test"); + + printStatus ("Unicode Characters 1C-1F with regexps test."); + printBugNumber (23612); + + var ary = ["\u001Cfoo", "\u001Dfoo", "\u001Efoo", "\u001Ffoo"]; + + for (var i in ary) + { + reportCompare (0, ary[Number(i)].search(/^\Sfoo$/), + "Unicode characters 1C-1F in regexps, ary[" + + i + "] did not match \\S test (it should not.)"); + reportCompare (-1, ary[Number(i)].search(/^\sfoo$/), + "Unicode characters 1C-1F in regexps, ary[" + + i + "] matched \\s test (it should not.)"); + } + + exitFunc ("test"); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-005.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-005.js new file mode 100644 index 0000000..5b1be03 --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/Unicode/uc-005.js @@ -0,0 +1,271 @@ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 +* +* 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 JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2002 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): rogerl@netscape.com, pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** +* +* +* Date: 15 July 2002 +* SUMMARY: Testing identifiers with double-byte names +* See http://bugzilla.mozilla.org/show_bug.cgi?id=58274 +* +* Here is a sample of the problem: +* +* js> function f\u02B1 () {} +* +* js> f\u02B1.toSource(); +* function f¦() {} +* +* js> f\u02B1.toSource().toSource(); +* (new String("function f\xB1() {}")) +* +* +* See how the high-byte information (the 02) has been lost? +* The same thing was happening with the toString() method: +* +* js> f\u02B1.toString(); +* +* function f¦() { +* } +* +* js> f\u02B1.toString().toSource(); +* (new String("\nfunction f\xB1() {\n}\n")) +* +*/ +//----------------------------------------------------------------------------- +var UBound = 0; +var bug = 58274; +var summary = 'Testing identifiers with double-byte names'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +/* + * Define a function that uses double-byte identifiers in + * "every possible way" + * + * Then recover each double-byte identifier via f.toString(). + * To make this easier, put a 'Z' token before every one. + * + * Our eval string will be: + * + * sEval = "function Z\u02b1(Z\u02b2, b) { + * try { Z\u02b3 : var Z\u02b4 = Z\u02b1; } + * catch (Z\u02b5) { for (var Z\u02b6 in Z\u02b5) + * {for (1; 1<0; Z\u02b7++) {new Array()[Z\u02b6] = 1;} };} }"; + * + * It will be helpful to build this string in stages: + */ +var s0 = 'function Z'; +var s1 = '\u02b1(Z'; +var s2 = '\u02b2, b) {try { Z'; +var s3 = '\u02b3 : var Z'; +var s4 = '\u02b4 = Z'; +var s5 = '\u02b1; } catch (Z' +var s6 = '\u02b5) { for (var Z'; +var s7 = '\u02b6 in Z'; +var s8 = '\u02b5){for (1; 1<0; Z'; +var s9 = '\u02b7++) {new Array()[Z'; +var s10 = '\u02b6] = 1;} };} }'; + + +/* + * Concatenate these and eval() to create the function Z\u02b1 + */ +var sEval = s0 + s1 + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10; +eval(sEval); + + +/* + * Recover all the double-byte identifiers via Z\u02b1.toString(). + * We'll recover the 1st one as arrID[1], the 2nd one as arrID[2], + * and so on ... + */ +var arrID = getIdentifiers(Z\u02b1); + + +/* + * Now check that we got back what we put in - + */ +status = inSection(1); +actual = arrID[1]; +expect = s1.charAt(0); +addThis(); + +status = inSection(2); +actual = arrID[2]; +expect = s2.charAt(0); +addThis(); + +status = inSection(3); +actual = arrID[3]; +expect = s3.charAt(0); +addThis(); + +status = inSection(4); +actual = arrID[4]; +expect = s4.charAt(0); +addThis(); + +status = inSection(5); +actual = arrID[5]; +expect = s5.charAt(0); +addThis(); + +status = inSection(6); +actual = arrID[6]; +expect = s6.charAt(0); +addThis(); + +status = inSection(7); +actual = arrID[7]; +expect = s7.charAt(0); +addThis(); + +status = inSection(8); +actual = arrID[8]; +expect = s8.charAt(0); +addThis(); + +status = inSection(9); +actual = arrID[9]; +expect = s9.charAt(0); +addThis(); + +status = inSection(10); +actual = arrID[10]; +expect = s10.charAt(0); +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +/* + * Goal: recover the double-byte identifiers from f.toString() + * by getting the very next character after each 'Z' token. + * + * The return value will be an array |arr| indexed such that + * |arr[1]| is the 1st identifier, |arr[2]| the 2nd, and so on. + * + * Note, however, f.toString() is implementation-independent. + * For example, it may begin with '\nfunction' instead of 'function'. + * + * Rhino uses a Unicode representation for f.toString(); whereas + * SpiderMonkey uses an ASCII representation, putting escape sequences + * for non-ASCII characters. For example, if a function is called f\u02B1, + * then in Rhino the toString() method will present a 2-character Unicode + * string for its name, whereas SpiderMonkey will present a 7-character + * ASCII string for its name: the string literal 'f\u02B1'. + * + * So we force the lexer to condense the string before we use it. + * This will give uniform results in Rhino and SpiderMonkey. + */ +function getIdentifiers(f) +{ + var str = condenseStr(f.toString()); + var arr = str.split('Z'); + + /* + * The identifiers are the 1st char of each split substring + * EXCEPT the first one, which is just ('\n' +) 'function '. + * + * Thus note the 1st identifier will be stored in |arr[1]|, + * the 2nd one in |arr[2]|, etc., making the indexing easy - + */ + for (i in arr) + arr[i] = arr[i].charAt(0); + return arr; +} + + +/* + * This function is the opposite of a functions like escape(), which take + * Unicode characters and return escape sequences for them. Here, we force + * the lexer to turn escape sequences back into single characters. + * + * Note we can't simply do |eval(str)|, since in practice |str| will be an + * identifier somewhere in the program (e.g. a function name); thus |eval(str)| + * would return the object that the identifier represents: not what we want. + * + * So we surround |str| lexicographically with quotes to force the lexer to + * evaluate it as a string. Have to strip out any linefeeds first, however - + */ +function condenseStr(str) +{ + /* + * You won't be able to do the next step if |str| has + * any carriage returns or linefeeds in it. For example: + * + * js> eval("'" + '\nHello' + "'"); + * 1: SyntaxError: unterminated string literal: + * 1: ' + * 1: ^ + * + * So replace them with the empty string - + */ + str = str.replace(/[\r\n]/g, '') + return eval("'" + str + "'") +} + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(bug); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_3/shell.js b/Source/JavaScriptCore/tests/mozilla/ecma_3/shell.js new file mode 100644 index 0000000..4fde9bc --- /dev/null +++ b/Source/JavaScriptCore/tests/mozilla/ecma_3/shell.js @@ -0,0 +1,180 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * 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): + * Rob Ginda rginda@netscape.com + */ + +var FAILED = "FAILED!: "; +var STATUS = "STATUS: "; +var BUGNUMBER = "BUGNUMBER: "; +var SECT_PREFIX = 'Section '; +var SECT_SUFFIX = ' of test -'; +var VERBOSE = false; +var callStack = new Array(); + +/* + * The test driver searches for such a phrase in the test output. + * If such phrase exists, it will set n as the expected exit code. + */ +function expectExitCode(n) +{ + + print('--- NOTE: IN THIS TESTCASE, WE EXPECT EXIT CODE ' + n + ' ---'); + +} + +/* + * Statuses current section of a test + */ +function inSection(x) +{ + + return SECT_PREFIX + x + SECT_SUFFIX; + +} + +/* + * Some tests need to know if we are in Rhino as opposed to SpiderMonkey + */ +function inRhino() +{ + return (typeof defineClass == "function"); +} + +/* + * Report a failure in the 'accepted' manner + */ +function reportFailure (msg) +{ + var lines = msg.split ("\n"); + var l; + var funcName = currentFunc(); + var prefix = (funcName) ? "[reported from " + funcName + "] ": ""; + + for (var i=0; i<lines.length; i++) + print (FAILED + prefix + lines[i]); + +} + +/* + * Print a non-failure message. + */ +function printStatus (msg) +{ + var lines = msg.split ("\n"); + var l; + + for (var i=0; i<lines.length; i++) + print (STATUS + lines[i]); + +} + +/* + * Print a bugnumber message. + */ +function printBugNumber (num) +{ + + print (BUGNUMBER + num); + +} + +/* + * Compare expected result to actual result, if they differ (in value and/or + * type) report a failure. If description is provided, include it in the + * failure report. + */ +function reportCompare (expected, actual, description) +{ + var expected_t = typeof expected; + var actual_t = typeof actual; + var output = ""; + + if ((VERBOSE) && (typeof description != "undefined")) + printStatus ("Comparing '" + description + "'"); + + if (expected_t != actual_t) + output += "Type mismatch, expected type " + expected_t + + ", actual type " + actual_t + "\n"; + else if (VERBOSE) + printStatus ("Expected type '" + actual_t + "' matched actual " + + "type '" + expected_t + "'"); + + if (expected != actual) + output += "Expected value '" + expected + "', Actual value '" + actual + + "'\n"; + else if (VERBOSE) + printStatus ("Expected value '" + actual + "' matched actual " + + "value '" + expected + "'"); + + if (output != "") + { + if (typeof description != "undefined") + reportFailure (description); + reportFailure (output); + } + +} + +/* + * Puts funcName at the top of the call stack. This stack is used to show + * a function-reported-from field when reporting failures. + */ +function enterFunc (funcName) +{ + + if (!funcName.match(/\(\)$/)) + funcName += "()"; + + callStack.push(funcName); + +} + +/* + * Pops the top funcName off the call stack. funcName is optional, and can be + * used to check push-pop balance. + */ +function exitFunc (funcName) +{ + var lastFunc = callStack.pop(); + + if (funcName) + { + if (!funcName.match(/\(\)$/)) + funcName += "()"; + + if (lastFunc != funcName) + reportFailure ("Test driver failure, expected to exit function '" + + funcName + "' but '" + lastFunc + "' came off " + + "the stack"); + } + +} + +/* + * Peeks at the top of the call stack. + */ +function currentFunc() +{ + + return callStack[callStack.length - 1]; + +} |