Assert |
LRM §8.2, §9.4. |
A statement that checks that a specified condition is true and reports an error if it is not.
[ label: ] assert condition [ report string_expression ] [ severity expression ];
The assertion statement has three optional fields and usually all three are used.
The condition specified in an assertion statement must evaluate to a Boolean value (true or false). If it is false, it is said that an assertion violation occurred.
The expression specified in the report clause must be of predefined type String and is a message to be reported when assertion violation occurred.
If the severity clause is present, it must specify an expression of predefined type Severity_Level, which determines the severity level of the assertion violation. The Severity_Level type is specified in the Standard package and contains the following values: Note, Warning, Error, and Failure. If the severity clause is omitted it is implicitly assumed to be Error.
assert not (Reset = '0' and Set = '0') report "set-reset conflict" severity Failure; assert result = ExpectedResults report "results differ from expected results" severity Warning;