Provides a runtime test for error conditions. If the test returns true, the assert passes and does nothing. If the test returns false, the script terminates and an assertion failure is reported along with any number of additional arguments supplied to the assert statement after the test.
The additional arguments can be any string or value that can be printed, similar to the print command.
System
assert booleanExpression [optionalMessage1] [optionalMessage2] ... |
Name | Type | Required | Comments |
---|---|---|---|
booleanExpression | boolean | yes | The condition to check for. If this condition evaluates to false, then the assert will fire and your script will fail. |
None
void
int $i; // Do something intelligent to set the value of i $i = 400; // Check to make sure $i was set properly assert( $i == 400, "i was improperly set to ", $i ); |