blob: b34d31370e590b32f846a144b0429f4dde1e728e [file] [log] [blame]
sbarati@apple.com545d2c82016-05-23 22:46:41 +00001function assert(b) {
2 if (!b)
3 throw new Error("bad assertion!");
4}
5
6
7function test() {
8 let cases = [
9 ["/", 1],
10 ["*", 1],
11 ["+", 2],
12 ["-", 0],
13 [">>", 0],
14 [">>>", 0],
15 ["<<", 2],
16 ["^", 0],
17 ["&", 1],
18 ];
19
20 for (let [op, result] of cases) {
21 let program = `for (let i = 0; i < 500; i++) { assert((1,1)${op}1 === ${result}); }`;
22 eval(program);
23 }
24}
25test();