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
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
This macro asserts that a boolean condition is expected to be true.  
{{DISPLAYTITLE:SOM_Expect}}
This macro asserts that a boolean condition is expected to be true.
 
==Syntax==
==Syntax==
<PRE>
boolean    condition;
boolean    condition;
SOM_Expect(condition);
SOM_Expect(condition);
</PRE>


==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 macro]]

Latest revision as of 01:52, 6 May 2020

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