4 case "fooab": return 2;
5 case "fooabc": return 3;
6 case "fooabcd": return 4;
7 case "fooabcde": return 5;
8 case "fooabcdef": return 6;
9 case "fooabcdefg": return 7;
10 case "fooabcdefgh": return 8;
11 case "fooabcdefghi": return 9;
12 case "fooabcdefghij": return 10;
13 case "fooabcdefghijk": return 11;
14 case "fooabcdefghijkl": return 12;
15 case "fooabcdefghijklm": return 13;
16 case "fooabcdefghijklmn": return 14;
21 var strings = ["a", "ab", "abc", "abcd", "abcde", "abcdef", "abcdefg", "abcdefgh", "abcdefghi", "abcdefghij", "abcdefghijk", "abcdefghijkl", "abcdefghijklm", "abcdefghijklmn", "abcdefghijklmno"];
22 for (var i = 0; i < strings.length; ++i)
23 strings[i] = "foo" + strings[i];
26 for (var i = 0; i < 1000000; ++i)
27 result += foo(strings[i % strings.length]);
29 if (result != 7999975)
30 throw "Bad result: " + result;