FB_AssertCountExceedsMaxNumber  Function Block

Extends TcUnit.FB_TestSuite

This test-suite runs several asserts with the same parameters (same expected, actual, message), calling the asserts in different cycles and using the same test. On top of this, we will call new asserts (though with same parameters) in later cycles. The reason we want the framework to support this is that theoretically the user could want to do an assert with the same message, using the same test with the same data values for both expected and actual, and splitting the asserts on different cycles.


Methods

Assert_SameArrayEntryInOneCycle PRIVATE
Implementation
TEST('Assert_SameArrayEntryInOneCycle');

// Only checks if PLC crashes
FOR i := 1 TO MAX_INDEX DO
	AssertArrayEquals_DWORD(Expecteds := a,
						   	Actuals := a,
						   	Message := 'Values differ');
END_FOR;

AssertEquals_UINT(Expected := GVL_Param_TcUnit.MaxNumberOfAssertsForEachTestSuite,
		          Actual := AssertArrayResults.TotalArrayAsserts,
		          Message := 'AssertArrayResults.TotalArrayAsserts invalid');

TEST_FINISHED();
Assert_SameEntryInOneCycle PRIVATE
Implementation
TEST('Assert_SameEntryInOneCycle');

// Only checks if PLC crashes
FOR i := 1 TO MAX_INDEX DO
	AssertEquals_DWORD(Expected := a,
					   Actual := a,
					   Message := 'Values differ');
END_FOR;

AssertEquals_UINT(Expected := GVL_Param_TcUnit.MaxNumberOfAssertsForEachTestSuite,
		          Actual := AssertResults.TotalAsserts,
		          Message := 'AssertResults.TotalAsserts invalid');

TEST_FINISHED();

Used by

Declaration source
(*
    This test-suite runs several asserts with the same parameters (same expected, actual, message), calling the asserts
    in different cycles and using the same test.
    On top of this, we will call new asserts (though with same parameters) in later cycles.
    The reason we want the framework to support this is that theoretically the user could want to do an assert with the
    same message, using the same test with the same data values for both expected and actual, and splitting the asserts
    on different cycles.
*)
FUNCTION_BLOCK FB_AssertCountExceedsMaxNumber EXTENDS TcUnit.FB_TestSuite
VAR
END_VAR