<p>This page tests branches that might cause interesting forms of expression folding in bytecode.</p>
<pre id="console"></pre>

<script>
if (window.testRunner)
    testRunner.dumpAsText();

function log(s)
{
    document.getElementById("console").appendChild(document.createTextNode(s + "\n"));
}

(function () {
    var count = 0;
    function fail()
    {
        log("FAIL on test " + count + ".");
    }

    var zero = 0;
    var one = 1;
    var two = 2;

    // bool vs bool
    ++count;
    if (true == (one == one)) {
    } else
        fail();

    ++count;
    if (false == (one != one)) {
    } else
        fail();

    ++count;
    if (true != (one != one)) {
    } else
        fail();

    ++count;
    if (false != (one == one)) {
    } else
        fail();

    ++count;
    if (true === (one == one)) {
    } else
        fail();

    ++count;
    if (false === (one != one)) {
    } else
        fail();

    ++count;
    if (true !== (one != one)) {
    } else
        fail();

    ++count;
    if (false !== (one == one)) {
    } else
        fail();


    // int vs bool
    ++count;
    if (1 == (one == one)) {
    } else
        fail();

    ++count;
    if (0 == (one != one)) {
    } else
        fail();

    ++count;
    if (2 != (one != one)) {
    } else
        fail();

    ++count;
    if (1 != (one != one)) {
    } else
        fail();

    ++count;
    if (0 != (one == one)) {
    } else
        fail();

    ++count;
    if (2 != (one == one)) {
    } else
        fail();

    ++count;
    if (1 !== (one == one)) {
    } else
        fail();

    ++count;
    if (0 !== (one != one)) {
    } else
        fail();

    ++count;
    if (2 !== (one != one)) {
    } else
        fail();

    ++count;
    if (1 !== (one != one)) {
    } else
        fail();

    ++count;
    if (0 !== (one == one)) {
    } else
        fail();

    ++count;
    if (2 !== (one == one)) {
    } else
        fail();



    // int vs int
    ++count;
    if (1 == (one | 0)) {
    } else
        fail();

    ++count;
    if (0 == (zero | 0)) {
    } else
        fail();

    ++count;
    if (2 != (one | 0)) {
    } else
        fail();

    ++count;
    if (1 != (zero | 0)) {
    } else
        fail();

    ++count;
    if (0 != (one | 0)) {
    } else
        fail();

    ++count;
    if (2 != (one | 0)) {
    } else
        fail();

    ++count;
    if (1 === (one | 0)) {
    } else
        fail();

    ++count;
    if (0 === (zero | 0)) {
    } else
        fail();

    ++count;
    if (2 !== (one | 0)) {
    } else
        fail();

    ++count;
    if (1 !== (two | 0)) {
    } else
        fail();

    ++count;
    if (0 !== (one | 0)) {
    } else
        fail();

    ++count;
    if (2 !== (one | 0)) {
    } else
        fail();

    ++count;
    if (false === (true && undefined))
        fail();

    log("tests completed: " + count);
})();
</script>
