Add a test case for trees.
authorAndreas Gal <gal@mozilla.com>
Fri, 25 Jul 2008 19:10:23 -0700
changeset 17836 3bf4ab9ba121c4c876e851a91530728c55bc6305
parent 17835 8841c613afe947a6330e7637540c83617443cad0
child 17837 f38fbde81ed186b3880bc39943cf9916c6958156
push id1452
push usershaver@mozilla.com
push dateFri, 22 Aug 2008 00:08:22 +0000
treeherderautoland@d13bb0868596 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone1.9.1a1pre
Add a test case for trees.
js/src/trace-test.js
--- a/js/src/trace-test.js
+++ b/js/src/trace-test.js
@@ -279,11 +279,22 @@ function testincops(n) {
   while (a[i]-- > 0);
   for (a[i] = 0; a[i] < n; ++a[i]);
   while (--a[i] >= 0);
 
   return [++o.p, ++a[i]].toString();
 }
 test("testincops", testincops(100), "0,0");
 
+function trees() {
+  var i = 0, o = [0,0,0];  
+  for (i = 0; i < 100; ++i) {
+    if ((i & 1) == 0) o[0]++;
+    else if ((i & 2) == 0) o[1]++;
+    else o[2]++;
+  }
+  return o;
+}
+test("trees", trees(), "50,25,25");
+
 /* Keep these at the end so that we can see the summary after the trace-debug spew. */
 print("pass:", passes.length ? passes.join(",") : "<none>");
 print("FAIL:", fails.length ? fails.join(",") : "<none>");