Jump to content

SOM TestC: Difference between revisions

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


==Syntax==
==Syntax==
<PRE>
boolean    expression;
boolean    expression;
SOM_TestC (expression);
SOM_TestC(expression);
</PRE>


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


==Return Code==
==Return Code==
Line 14: Line 13:


==Remarks==
==Remarks==
The SOM_TestC macro tests the specified boolean expression:  
The SOM_TestC 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 and SOM_WarnLevel is set to a value greater than zero, then a warning message is output.  
* If the expression is FALSE and SOM_WarnLevel is set to a value greater than zero, then a warning message is output.


'''Note:''' The SOM_Test macro is similar, except that it raises a fatal error in this situation.  
;Note: The SOM_Test macro is similar, except that it raises a fatal error in this situation.


'''External (Global) Data'''  
'''External (Global) Data'''
   long SOM_AssertLevel;  /* default is 0 */
   long SOM_AssertLevel;  /* default is 0 */
   long SOM_WarnLevel;    /* default is 0 */
   long SOM_WarnLevel;    /* default is 0 */
Line 39: Line 38:
==Related==
==Related==
===Macros===
===Macros===
* SOM_Expect  
* SOM_Expect
* SOM_Assert  
* SOM_Assert
* SOM_Test
* SOM_Test


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

Latest revision as of 01:47, 6 May 2020

This macro tests whether a boolean condition is true; if not, a warning message is output.

Syntax

boolean    expression;
SOM_TestC (expression);

Parameters

expression (boolean)
The boolean expression to test.

Return Code

rc

Remarks

The SOM_TestC 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 and SOM_WarnLevel is set to a value greater than zero, then a warning message is output.
Note
The SOM_Test macro is similar, except that it raises a fatal error in this situation.

External (Global) Data

  long SOM_AssertLevel;  /* default is 0 */
  long SOM_WarnLevel;    /* default is 0 */

Expansion

The SOM_TestC 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 and SOM_WarnLevel is set to a value greater than zero, a warning message is output

Example Code

#include <som.h>
main()
{
   SOM_WarnLevel = 1;
   SOM_TestC(1=1);
}

Related

Macros

  • SOM_Expect
  • SOM_Assert
  • SOM_Test