Difference between revisions of "Extensions.Assertion.Assert"

From emotive
Jump to navigation Jump to search
(Created page with "{{DISPLAYTITLE:OTX '''Assert'''}}Category:Assertion == Classification == {{ClassificationActivity | Assert | Opens a (runtime-specific) file selection dialog. | [[Action]...")
 
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
{{DISPLAYTITLE:OTX '''Assert'''}}[[Category:Assertion]]
 
{{DISPLAYTITLE:OTX '''Assert'''}}[[Category:Assertion]]
 
== Classification ==
 
== Classification ==
{{ClassificationActivity | Assert | Opens a (runtime-specific) file selection dialog.  | [[Action]] | [[Extensions.CommonDialogs|OTX CommonDialogs extension]] | - | - | -}}
+
{{ClassificationActivity | Assert | - | [[Action]] | [[Extensions.Assertion|OTX Assertion extension]] | - | - | -}}
 +
 
 
== OTL Syntax ==
 
== OTL Syntax ==
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
Line 8: Line 9:
  
 
== Description ==
 
== Description ==
If the runtime is configured to evaluate assertions: Evaluates the given boolean expression.
+
If the runtime is configured to evaluate assertions: Evaluates the given [[Core.DataTypes.SimpleDataType.Boolean|boolean]] expression.
  
 
If the expression evaluates to true, nothing happens.
 
If the expression evaluates to true, nothing happens.
Line 14: Line 15:
 
If the expression evaluates to false, the execution of OTX procedure should be stopped (the exact runtime behaviour is unspecified), and the failed assertion is reported to the runtime system itself (out of OTX scope).
 
If the expression evaluates to false, the execution of OTX procedure should be stopped (the exact runtime behaviour is unspecified), and the failed assertion is reported to the runtime system itself (out of OTX scope).
  
If an exception occurs while evaluating the boolean expression, that exception will not be thrown. Instead, the assertion will fail.
+
If an exception occurs while evaluating the [[Core.DataTypes.SimpleDataType.Boolean|boolean]] expression, that exception will not be thrown. Instead, the assertion will fail.
  
If the runtime is configured not to evaluate this assertion: Does nothing. In particular, the boolean condition will not be evaluated.
+
If the runtime is configured not to evaluate this assertion: Does nothing. In particular, the [[Core.DataTypes.SimpleDataType.Boolean|boolean]] condition will not be evaluated.
  
 
== Properties ==
 
== Properties ==
Line 28: Line 29:
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
 
/// Local Declarations
 
/// Local Declarations
 
String String1;
 
  
 
/// Flow
 
/// Flow
  
CommonDialogs.FileSaveDialog("This is the Message", "This is the Title", "file:///D:/ReadFile/abc.txt", "txt,zip,pnj", true, String1);
+
Assertion.Assert(1 == 1, "the expression evaluates to true");
 +
Assertion.Assert(1 != 1, "the expression evaluates to false");
 +
Assertion.Assert((1/0) == 0, "an exception occurs while evaluating the boolean expression");
 
</syntaxhighlight>
 
</syntaxhighlight>
 
== See also ==
 
[[Extensions.CommonDialogs.FileOpenDialog|FileOpenDialog]] <br/>
 
[[Extensions.CommonDialogs.SelectDirectoryDialog|SelectDirectoryDialog]]
 

Latest revision as of 09:36, 23 September 2019

Classification

Name Assert
Short Description -
Class Action
Extension OTX Assertion extension
Group -
Exceptions -
Checker Rules -
Standard Compliant Yes

OTL Syntax

Assertion.Assert(BooleanTerm condition, StringTerm errorMessage);

Description

If the runtime is configured to evaluate assertions: Evaluates the given boolean expression.

If the expression evaluates to true, nothing happens.

If the expression evaluates to false, the execution of OTX procedure should be stopped (the exact runtime behaviour is unspecified), and the failed assertion is reported to the runtime system itself (out of OTX scope).

If an exception occurs while evaluating the boolean expression, that exception will not be thrown. Instead, the assertion will fail.

If the runtime is configured not to evaluate this assertion: Does nothing. In particular, the boolean condition will not be evaluated.

Properties

Name Data Type Class Default Cardinality Description
Condition Boolean Term - [1..1] The expression to evaluate.
ErrorMessage String Term - [0..1] An error message which may be included in the report to the runtime system, if the assertion fails.

OTL Examples

/// Local Declarations

/// Flow

Assertion.Assert(1 == 1, "the expression evaluates to true");
Assertion.Assert(1 != 1, "the expression evaluates to false");
Assertion.Assert((1/0) == 0, "an exception occurs while evaluating the boolean expression");