Skip to content

Commit

Permalink
Make assertion level a parameter expression
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikt-ma committed Nov 2, 2020
1 parent 322373c commit 6cb784b
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions chapters/equations.tex
Original file line number Diff line number Diff line change
Expand Up @@ -459,19 +459,22 @@ \subsection{assert}\label{assert}
assert(condition, message, assertionLevel);
assert(condition, message, level = assertionLevel);
\end{lstlisting}

is an assertion, where \lstinline!condition! is a Boolean expression, \lstinline!message! is a
string expression, and \lstinline!level! is a built-in enumeration with a default
value. It can be used in equation sections or algorithm sections.
string expression, and \lstinline!assertionLevel! is an optional parameter expression of the built-in enumeration type \lstinline!AssertionLevel!.
It can be used in equation sections or algorithm sections.

\begin{nonnormative}
This means that assert can be called as if it were a function with three formal parameters, the third formal parameter has the
name \lstinline!level! and the default value \lstinline!AssertionLevel.error!.
\end{nonnormative}

\begin{nonnormative}
A parameter expression is required for \lstinline!level! since it shall be evaluated at compile time.
\end{nonnormative}

If the \lstinline!condition! of an assertion is true, \lstinline!message! is not evaluated and
the procedure call is ignored. If the \lstinline!condition! evaluates to false
different actions are taken depending on the level input:
the procedure call is ignored. If the \lstinline!condition! evaluates to false,
different actions are taken depending on the \lstinline!level! input:
\begin{itemize}
\item
\lstinline!level = AssertionLevel.error!: The current evaluation is aborted. The
Expand Down

0 comments on commit 6cb784b

Please sign in to comment.