assert

Syntax

assert <expr>

or

assert <subCase>, <expr>

Parameters

subCase is a string. It can be specified without quotes.

expr is a Boolean value or expression.

Details

Mainly used for unit testing. It prints testing result only if the testing case fails.

Examples

@testing: case = "inner product 1"
assert [1,2,3]**[4,5,6]==32;
// pass

@testing: case = "inner product 2"
assert [1,2,3]**[4,5,6]==33;
// Testing case inner product 2 failed

@testing: case = "adhocTesting"
assert 1==2;
// Testing case adhocTesting failed

@testing: case = "equal"
assert "one", 1==2
assert "two", 3==4
// Testing case equal_one failed