Jump to content

SOM Test: Difference between revisions

From EDM2
Created page with "This macro tests whether a boolean condition is true; if not, a fatal error is raised. ==Syntax== <PRE> boolean expression; SOM_Test(expression); </PRE> ==Parameters== ; e..."
 
Ak120 (talk | contribs)
mNo edit summary
 
Line 1: Line 1:
{{DISPLAYTITLE:SOM_Test}}
This macro tests whether a boolean condition is true; if not, a fatal error is raised.
This macro tests whether a boolean condition is true; if not, a fatal error is raised.
==Syntax==
==Syntax==
<PRE>
boolean    expression;
boolean    expression;
SOM_Test(expression);
SOM_Test(expression);
</PRE>


==Parameters==
==Parameters==
; expression (boolean) : The boolean expression to test.  
;expression (boolean) : The boolean expression to test.


==Return Code==
==Return Code==
rc  
rc


==Remarks==
==Remarks==
The SOM_Test macro tests the specified boolean expression:  
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 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.  
* 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.


'''Note:''' The SOM_TestC macro is similar, except that it only outputs a warning message in this situation.
'''External (Global) Data'''
 
'''External (Global) Data'''  
   long SOM_AssertLevel;  /* default is 0 */
   long SOM_AssertLevel;  /* default is 0 */


Line 25: Line 24:
The SOM_Test macro tests the specified boolean expression. If the expression is TRUE and  
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.
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==
==Example Code==
Line 39: Line 37:
==Related==
==Related==
===Macros===
===Macros===
* SOM_Expect  
* SOM_Expect
* SOM_Assert  
* SOM_Assert
* SOM_TestC  
* SOM_TestC


{{DISPLAYTITLE:SOM_Test}}
[[Category:SOM macro]]
[[Category:SOM Kernel]]

Latest revision as of 01:45, 6 May 2020

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