Debian Codegraph @

js/src/jit-test/tests/constant-compare/constant-compare-associativity.js

raw
1 load(libdir + "asserts.js");
2
3 function testConstantCompareIsLeftAssociative(intVal, boolVal) {
4 return 1 === intVal === boolVal;
5 }
6
7 assertEq(testConstantCompareIsLeftAssociative(1, true), true);
8 assertEq(testConstantCompareIsLeftAssociative(1, false), false);
9 assertEq(testConstantCompareIsLeftAssociative(0, true), false);
10 assertEq(testConstantCompareIsLeftAssociative(0, false), true);
11
12 function testConstantCompareMixedLeftAssociative(intVal, boolVal) {
13 return 1 !== intVal === true !== boolVal;
14 }
15
16 assertEq(testConstantCompareMixedLeftAssociative(1, true), true);
17 assertEq(testConstantCompareMixedLeftAssociative(1, false), false);
18 assertEq(testConstantCompareMixedLeftAssociative(0, true), false);
19 assertEq(testConstantCompareMixedLeftAssociative(0, false), true);