Jump to content

SOM Expect: Difference between revisions

From EDM2
Created page with "This macro asserts that a boolean condition is expected to be true. ==Syntax== <PRE> boolean condition; SOM_Expect(condition); </PRE> ==Parameters== ; condition(boolean) ..."
 
Ak120 (talk | contribs)
mNo edit summary
Line 1: Line 1:
This macro asserts that a boolean condition is expected to be true.  
This macro asserts that a boolean condition is expected to be true.
==Syntax==
==Syntax==
<PRE>
<PRE>
Line 7: Line 7:


==Parameters==
==Parameters==
; condition(boolean) : A boolean expression that is expected to be TRUE (nonzero).  
; condition(boolean) : A boolean expression that is expected to be TRUE (nonzero).
 
==Return Code==


==Remarks==
==Remarks==
The [[SOM_Expect]] macro is used to place boolean assertions that are expected to be true into a program:  
The SOM_Expect macro is used to place boolean assertions that are expected to be true into a program:
* If condition is FALSE and [[SOM_WarnLevel]] is set to be greater than zero, then a warning message is output.  
* If condition is FALSE and SOM_WarnLevel is set to be greater than zero, then a warning message is output.
* If condition is TRUE and [[SOM_AssertLevel]] is set to be greater than zero, then an informational message is output.  
* If condition is TRUE and SOM_AssertLevel is set to be greater than zero, then an informational message is output.


==Expansion==
==Expansion==
If condition is FALSE and SOM_WarnLevel is set to be greater than zero, then a warning message is output. If condition is TRUE and SOM_AssertLevel is set to be greater than zero, then an information message is output
If condition is FALSE and SOM_WarnLevel is set to be greater than zero, then a warning message is output. If condition is TRUE and SOM_AssertLevel is set to be greater than zero, then an information message is output.


==Example Code==
==Example Code==
<PRE>
SOM_Expect(2==2);
SOM_Expect(2==2);
</PRE>


==Related==
==Related==
===Macros===
===Macros===
* [[SOM_Assert]]  
* [[SOM_Assert]]
* [[SOM_Test]]  
* [[SOM_Test]]
* [[SOM_TestC]]
* [[SOM_TestC]]
 
[[Category:SOM Kernel]]
[[Category:SOM Kernel]]

Revision as of 23:29, 16 October 2017

This macro asserts that a boolean condition is expected to be true.

Syntax

boolean    condition;
SOM_Expect(condition);

Parameters

condition(boolean)
A boolean expression that is expected to be TRUE (nonzero).

Remarks

The SOM_Expect macro is used to place boolean assertions that are expected to be true into a program:

  • If condition is FALSE and SOM_WarnLevel is set to be greater than zero, then a warning message is output.
  • If condition is TRUE and SOM_AssertLevel is set to be greater than zero, then an informational message is output.

Expansion

If condition is FALSE and SOM_WarnLevel is set to be greater than zero, then a warning message is output. If condition is TRUE and SOM_AssertLevel is set to be greater than zero, then an information message is output.

Example Code

SOM_Expect(2==2);

Related

Macros