blob: f73d630ab7a82d8e9a3e20b7f603a6345ab99a66 [file] [log] [blame]
function foo(x) {
switch (x) {
case "a": return 1;
case "ab": return 2;
case "abc": return 3;
case "abcd": return 4;
default: return 10;
}
}
var strings = ["a", "ab", "abc", "abcd", "abcde"];
var result = 0;
for (var i = 0; i < 1000000; ++i)
result += foo(strings[i % strings.length]);
if (result != 4000000)
throw "Bad result: " + result;