Previous: , Up: Exception Handling   [Contents][Index]


14.15.5 assert

The assert statement allows you test if a condition is true, if not, the program will raise an exception with code EC_assert.

assert (condition)
assert (condition, message)

The optional message will be part of the msg field of raised Exception to explain the situation.

assert (1 == 1);
assert (0 == 0, ``Zero is equal to zero'');

assert is useful for writing unit tests.