TEST_ORDERED
Function
This function declares a new ordered test (if it has not been already declared in an earlier cycle). The test declared by this function will run in the order it is called, so if we have two tests: TEST_ORDERED('Test_1') TEST_ORDERED('Test_2') All asserts of Test_2 will be ignored until Test_1 is declared with TEST_FINISHED(). The function returns TRUE if it's time to run this test (and thus asserts can be made) The function returns FALSE if it's not time to run this test (because a previous test has not been finished) If the function returns FALSE (and it's thus not time to run the test), any eventual asserts done for this test will be ignored. It thus makes sense to call this function in a manner like: IF TEST_ORDERED('Testname') THEN fbFunctionBlockUnderTest(); AssertEquals(Expected := 'SomeValue', Actual := fbFunctionBlockUnderTest.Out, Message := 'Test failed'); TEST_FINISHED(); END_IF
Inputs
| Name |
Type |
Description |
TestName |
T_MaxString |
|
Variables
| Name |
Type |
Description |
CounterTestSuiteAddress |
UINT |
|
Test |
REFERENCE TO FB_Test |
|
Declaration source
(* This function declares a new ordered test (if it has not been already declared in an earlier cycle).
The test declared by this function will run in the order it is called, so if we have two tests:
TEST_ORDERED('Test_1')
TEST_ORDERED('Test_2')
All asserts of Test_2 will be ignored until Test_1 is declared with TEST_FINISHED().
The function returns TRUE if it's time to run this test (and thus asserts can be made)
The function returns FALSE if it's not time to run this test (because a previous test has not been finished)
If the function returns FALSE (and it's thus not time to run the test), any eventual asserts done for this
test will be ignored. It thus makes sense to call this function in a manner like:
IF TEST_ORDERED('Testname') THEN
fbFunctionBlockUnderTest();
AssertEquals(Expected := 'SomeValue',
Actual := fbFunctionBlockUnderTest.Out,
Message := 'Test failed');
TEST_FINISHED();
END_IF
*)
FUNCTION TEST_ORDERED : BOOL
VAR_INPUT
TestName : T_MaxString;
END_VAR
VAR
CounterTestSuiteAddress : UINT;
Test : REFERENCE TO FB_Test;
END_VAR