Assert

Support for simple assert() routines.

In the current implementation, these asserts never become no-ops. That is, using them will always incur execution-time checks.

Note

All Chapel programs automatically use this module by default. An explicit use statement is not necessary.

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