Commit 91cc4c7e authored by sgjesse@chromium.org's avatar sgjesse@chromium.org

Modify test using string slices

With slices string string type removed generating a large amount of sub-strings takes more time. Change a test to avoid timeout in debug mode.
Review URL: http://codereview.chromium.org/385006

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3260 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 851b9b2f
...@@ -30,9 +30,7 @@ ...@@ -30,9 +30,7 @@
* cause stack overflows. * cause stack overflows.
*/ */
var depth = 110000; function newdeep(start, depth) {
function newdeep(start) {
var d = start; var d = start;
for (var i = 0; i < depth; i++) { for (var i = 0; i < depth; i++) {
d = d + "f"; d = d + "f";
...@@ -40,23 +38,27 @@ function newdeep(start) { ...@@ -40,23 +38,27 @@ function newdeep(start) {
return d; return d;
} }
var deep = newdeep("foo"); var default_depth = 110000;
var deep = newdeep("foo", default_depth);
assertEquals('f', deep[0]); assertEquals('f', deep[0]);
var cmp1 = newdeep("a"); var cmp1 = newdeep("a", default_depth);
var cmp2 = newdeep("b"); var cmp2 = newdeep("b", default_depth);
assertEquals(-1, cmp1.localeCompare(cmp2), "ab"); assertEquals(-1, cmp1.localeCompare(cmp2), "ab");
var cmp2empty = newdeep("c"); var cmp2empty = newdeep("c", default_depth);
assertTrue(cmp2empty.localeCompare("") > 0, "c"); assertTrue(cmp2empty.localeCompare("") > 0, "c");
var cmp3empty = newdeep("d"); var cmp3empty = newdeep("d", default_depth);
assertTrue("".localeCompare(cmp3empty) < 0), "d"; assertTrue("".localeCompare(cmp3empty) < 0), "d";
var slicer = newdeep("slice"); var slicer_depth = 1100;
var slicer = newdeep("slice", slicer_depth);
for (i = 0; i < depth + 4; i += 2) { for (i = 0; i < slicer_depth + 4; i += 2) {
slicer = slicer.slice(1, -1); slicer = slicer.slice(1, -1);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment