Assert¶
Usage
use Assert;
Support for simple assert() routines.
Note
All Chapel programs automatically use
this module by default.
An explicit use
statement is not necessary.
In the current implementation, these asserts never become no-ops. That is, using them will always incur execution-time checks.
-
proc
assert
(test: bool)¶ Assert that a boolean condition is true. If it is false, prints 'assert failed' and halts the program.
Arguments: test : bool -- the boolean condition
-
proc
assert
(test: bool, args ...?numArgs) Assert that a boolean condition is true. If it is false, prints 'assert failed - ' followed by all subsequent arguments, as though printed using
write()
.Arguments: - test : bool -- the boolean condition
- args -- other arguments to print