blob: 5338042d8b9c2f1360ed0ce75b57267a1ac70c0a [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<script>
description("This test checks toString() round-trip decompilation for binary and unary operators.");
var tests = [
"x + + y",
"x + - y",
"x - + y",
"x - - y",
"x * + y",
"x * - y",
"x / + y",
"x / - y",
"x % + y",
"x % - y",
"x++ + y",
"x++ - y",
"x++ * y",
"x++ / y",
"x-- + y",
"x-- - y",
"x-- * y",
"x-- / y",
"x + ++y",
"x - ++y",
"x * ++y",
"x / ++y",
"x + --y",
"x - --y",
"x * --y",
"x / --y",
"x++ + ++y",
"x++ - ++y",
"x++ * ++y",
"x++ / ++y",
"x-- + ++y",
"x-- - ++y",
"x-- * ++y",
"x-- / ++y",
"x++ + --y",
"x++ - --y",
"x++ * --y",
"x++ / --y",
"x-- + --y",
"x-- - --y",
"x-- * --y",
"x-- / --y",
"+ + x",
"+ - x",
"- + x",
"- - x",
"1",
"-1",
"- -1",
"- - 0",
"- - NaN"
];
for (test in tests) {
var decompiledFunction = eval("(function () { " + tests[test] + ";})").toString().replace(/\n/g, "");
shouldBe("decompiledFunction", "'function () { " + tests[test] + ";}'");
}
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>