1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is JavaScript Engine testing utilities.
17 * The Initial Developer of the Original Code is
18 * Netscape Communication Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
40 * File Name: RegExp/properties-002.js
41 * ECMA Section: 15.7.6.js
42 * Description: Based on ECMA 2 Draft 7 February 1999
44 * Author: christine@netscape.com
45 * Date: 19 February 1999
47 //-----------------------------------------------------------------------------
48 var SECTION = "RegExp/properties-002.js";
49 var VERSION = "ECMA_2";
50 var TITLE = "Properties of RegExp Instances";
51 var BUGNUMBER ="124339";
56 re_1.lastIndex = Math.pow(2,31);
57 AddRegExpCases( re_1, "\\cA?", true, false, false, Math.pow(2,31) );
60 re_2.lastIndex = Math.pow(2,32) -1;
61 AddRegExpCases( re_2, "\\w*", false, true, false, Math.pow(2,32)-1 );
64 re_3.lastIndex = Math.pow(2,31) -1;
65 AddRegExpCases( re_3, "\\*{0,80}", false, false, true, Math.pow(2,31) -1 );
68 re_4.lastIndex = Math.pow(2,30) -1;
69 AddRegExpCases( re_4, "^.", true, true, true, Math.pow(2,30) -1 );
72 re_5.lastIndex = Math.pow(2,30);
73 AddRegExpCases( re_5, "\\B", false, false, false, Math.pow(2,30) );
76 * Brendan: "need to test cases Math.pow(2,32) and greater to see
77 * whether they round-trip." Reason: thanks to the work done in
78 * http://bugzilla.mozilla.org/show_bug.cgi?id=124339, lastIndex
79 * is now stored as a double instead of a uint32 (unsigned integer).
81 * Note 2^32 -1 is the upper bound for uint32's, but doubles can go
82 * all the way up to Number.MAX_VALUE. So that's why we need cases
83 * between those two numbers.
87 re_6.lastIndex = Math.pow(2,32);
88 AddRegExpCases( re_6, "\\B", false, false, false, Math.pow(2,32) );
91 re_7.lastIndex = Math.pow(2,32) + 1;
92 AddRegExpCases( re_7, "\\B", false, false, false, Math.pow(2,32) + 1 );
95 re_8.lastIndex = Math.pow(2,32) * 2;
96 AddRegExpCases( re_8, "\\B", false, false, false, Math.pow(2,32) * 2 );
99 re_9.lastIndex = Math.pow(2,40);
100 AddRegExpCases( re_9, "\\B", false, false, false, Math.pow(2,40) );
103 re_10.lastIndex = Number.MAX_VALUE;
104 AddRegExpCases( re_10, "\\B", false, false, false, Number.MAX_VALUE );
108 //-----------------------------------------------------------------------------
110 //-----------------------------------------------------------------------------
114 function AddRegExpCases( re, s, g, i, m, l ){
116 AddTestCase( re + ".test == RegExp.prototype.test",
118 re.test == RegExp.prototype.test );
120 AddTestCase( re + ".toString == RegExp.prototype.toString",
122 re.toString == RegExp.prototype.toString );
124 AddTestCase( re + ".contructor == RegExp.prototype.constructor",
126 re.constructor == RegExp.prototype.constructor );
128 AddTestCase( re + ".compile == RegExp.prototype.compile",
130 re.compile == RegExp.prototype.compile );
132 AddTestCase( re + ".exec == RegExp.prototype.exec",
134 re.exec == RegExp.prototype.exec );
138 AddTestCase( re + ".source",
142 AddTestCase( re + ".toString()",
143 "/" + s +"/" + (g?"g":"") + (i?"i":"") +(m?"m":""),
146 AddTestCase( re + ".global",
150 AddTestCase( re + ".ignoreCase",
154 AddTestCase( re + ".multiline",
158 AddTestCase( re + ".lastIndex",