SOM_Test

From EDM2
Jump to: navigation, search

This macro tests whether a boolean condition is true; if not, a fatal error is raised.

Syntax

boolean    expression;
SOM_Test(expression);

Parameters

expression (boolean) 
The boolean expression to test.

Return Code

rc

Remarks

The SOM_Test macro tests the specified boolean expression:

  • If the expression is TRUE and SOM_AssertLevel is set to a value greater than zero, then an information message is output.
  • If the expression is FALSE, an error message is output and the process is terminated.
Note
The SOM_TestC macro is similar, except that it only outputs a warning message in this situation.

External (Global) Data

  long SOM_AssertLevel;  /* default is 0 */

Expansion

The SOM_Test macro tests the specified boolean expression. If the expression is TRUE and SOM_AssertLevel is set to a value greater than zero, then an information message is output. If the expression is FALSE, an error message is output and the process is terminate.

Example Code

#include <som.h>
main()
{
   SOM_AssertLevel = 1;
   SOM_Test(1=1);
}

Related

Macros

  • SOM_Expect
  • SOM_Assert
  • SOM_TestC