VADELIA |
||||
(B) (C) |
Caution: this order is used only in the context of a Java client generated VADELIA Batch unit test program.
User paragraph
Public test procedure
Syntax
ASSERT ExpectedValue TestedValue Message
or
ASSERT *FAIL Message
ExpectedValue: Constant | IdVar | IdArray
TestedValue: Constant | IdVar | IdArray
Message: Alphanumeric constant | Alphanumeric IdVar | nothing
Description
This order is used in a unit test program and verifies that the TestedValue is equal to the ExpectedValue.
If this is not the case, the test will fail. Execution of the test procedure will be stopped and an error message will be displayed in the test report. If a Message (optional parameter) is specified, its text will be included in the report error message.
ExpectedValue and TestedValue must have the same definition (same type and length) and if they are arrays, they must be of the same size.
if the ExpectedValue is a constant, its type must be compatible with the type of the TestedValue variable.
The variables or arrays used must be a simple Adelia type (ALPHA, NUM_BIN_2, NUM_BIN_4, NUM_BIN_8, NUM_E, NUM_P, DATE, TIME, TIMESTAMP), except for the IMAGE type which is not allowed.
The execution of the order with the *FAIL parameter systematically fails the test, stops execution of the procedure, and will display an error message in the test report.
If a Message (optional parameter) is specified, its text will be included in the report error message.
For example
RES = 128
ASSERT 128 RES 'number 1'
--> The test was successful
RES_ALPHA = 'test failed'
ASSERT 'my test' RES_ALPHA 'test number 2'
--> The test will fail
IF MyVariable < 100
WMESSAGE = 'the value '// &ALPHA_NUM(MyVariable) /// 'is too small'_
ASSERT *FAIL WMESSAGE
END