1 <p>Test for overflow when negating the largest negative signed int.
</p>
2 <p>If the test passes, you'll see a series of PASS messages below.
</p>
4 <pre id=
"console"></pre>
9 return document
.getElementById(id
);
14 $("console").appendChild(document
.createTextNode(s
+ "\n"));
17 function shouldBe(aDescription
, a
, b
)
20 log("PASS: " + aDescription
+ " should be " + b
+ " and is.");
22 log("FAIL: " + aDescription
+ " should be " + b
+ " but instead is " + a
+ ".");
27 if (window
.testRunner
)
28 testRunner
.dumpAsText();
30 // Can be constant-folded by the parser.
31 var x
= -(-2147483648);
32 shouldBe("x", x
, 2147483648);
34 // Can't be constant-folded without dataflow analysis.
37 shouldBe("y", y
, 2147483648);