$print "Assertions in progress..."

scope {
    assert !false
    assert true
    assert !!true
    assert false == 0
    assert false !== 0
    assert true == 1
    assert true !== 1
    assert !(0 - 8 + 7 + 1)
    assert !(0 - 8 + 7 + 1);
    assert null === null
    assert null !== undefined
    // currently false: assert null == undefined
    assert undefined === undefined
    assert undefined == undefined
    assert undefined !== null
    assert "1" == 1
    assert "1" !== 1
    assert "2.0" == 2.0
    assert "2.0" !== 2.0
    assert (6 === (3+0x01|0x02))
    assert 0x02 === 0xff & 2

}

scope {
    assert 1 < 3
    assert !(1 > 3)
    assert 3==3
    assert 3===3
    assert 3==3.0
    assert !(3===3.0);
    assert !(3!=3.3);
    assert 3!==3.3

    assert 0x10 === 16
    assert 0x10 == 16.0
    assert 0x10 === 020

}

scope {
    assert 1 && 3
    assert 1 && 1 && 1
    assert !(1 && 0)
    assert 3 === 0 || 3 || -1 || -2 || -5
    assert -1 === false || -1
    assert -1 === false || false || -1 || -2 || -5
    assert 7 === (1==3 || 7);
    assert true === (false || 2<3)
    assert 3 === 1 && 0 || 0 || 3
    assert true === (1>0||5)
    assert 5 === (1<0||5)
}

scope {}
eval {}

scope {
    assert "hi" == "hi"
    assert "hi" === "hi"
    assert "hi" != "bye"
    assert !("hi" == "bye")
    assert !("hi" === "bye")
    assert "hi" === (1, 2,3, "hi")
}

scope {
    assert !(false && 1+3)
    assert !(3-3.0)
    assert !  !	!false
    assert !!true
    assert false == !!''
    assert !''
    assert ! !(	!(false))
    assert true ? 1 : 0
    assert false ? 0 : true
    assert 83 === true ? 1+41*2
             : 17*
             3
    assert 17 === assert false || 17
}

scope {
    assert "string" === typename "hi"
    assert "integer" === (typename 3 * 9 % 7)
    assert "integer" === typename 3 * 9 % 7
    assert "undefined" === typename unknownIdentifier
    assert "function" === typename print
    assert 'string' === typename {}
}

scope {
    assert "one" === 1 ? "one" : false
    assert "one" === false ? 1 + 3 * 7 + 21 % 2 : "one"

    assert 2 === false ? "hi" : false ? "WRONG" : 2
    assert "hi" === true ? "hi" : false ? 1 : 2

    __sweep /* making sure that that refcount-0 interned strings
             don't get nuked, or that they get re-recreated. */
    assert "hi" === false ? "WRONG"
        : false ? 1 : "hi" 

    (assert {	subexpr 
        } === "subexpr")
}

eval {
    assert 3 === (1,2,3)
    //bug: this should also work:
    //assert 3 === (1 2 3)
}
__sweep

scope {
    $print (1, 2, 3)
    "BUG?"
    assert 4 === eval {
        $print "From inside an eval"
        32
        +2 * 2
    }
}

eval {
    $print "a" (1,2,3)
    "BUG nonono"
}
__sweep

eval {
    $print {hi, world} \
        {bye, world}
    [print {hi, world}
        {bye, world}]
}

__sweep

assert 17 === eval 17
assert 17 === scope 13 + 4
assert 17 === eval "19 - 2"
__sweep

$print "Done!"
{end of script #2}
