API

This is the application programming interface for TcUnit.

FB_Assert

This function block is responsible for providing all the assert-methods for asserting different data types. Only failed assertions are recorded.

Method summary
AssertArrayEquals_BOOL(Expecteds : ARRAY[*] OF BOOL, Actuals : ARRAY[*] OF BOOL, Message : Tc2_System.T_MaxString)
---- Asserts that two BOOL arrays are equal.
AssertArrayEquals_BYTE(Expecteds : ARRAY[*] OF BYTE, Actuals : ARRAY[*] OF BYTE, Message : Tc2_System.T_MaxString)
---- Asserts that two BYTE arrays are equal.
AssertArrayEquals_DINT(Expecteds : ARRAY[*] OF DINT, Actuals : ARRAY[*] OF DINT, Message : Tc2_System.T_MaxString)
---- Asserts that two DINT arrays are equal.
AssertArrayEquals_DWORD(Expecteds : ARRAY[*] OF DWORD, Actuals : ARRAY[*] OF DWORD, Message : Tc2_System.T_MaxString)
---- Asserts that two DWORD arrays are equal.
AssertArrayEquals_INT(Expecteds : ARRAY[*] OF INT, Actuals : ARRAY[*] OF INT, Message : Tc2_System.T_MaxString)
---- Asserts that two INT arrays are equal.
AssertArrayEquals_LINT(Expecteds : ARRAY[*] OF LINT, Actuals : ARRAY[*] OF LINT, Message : Tc2_System.T_MaxString)
---- Asserts that two LINT arrays are equal.
AssertArrayEquals_LWORD(Expecteds : ARRAY[*] OF LWORD, Actuals : ARRAY[*] OF LWORD, Message : Tc2_System.T_MaxString)
---- Asserts that two LWORD arrays are equal.
AssertArrayEquals_SINT(Expecteds : ARRAY[*] OF SINT, Actuals : ARRAY[*] OF SINT, Message : Tc2_System.T_MaxString)
---- Asserts that two SINT arrays are equal.
AssertArrayEquals_UDINT(Expecteds : ARRAY[*] OF UDINT, Actuals : ARRAY[*] OF UDINT, Message : Tc2_System.T_MaxString)
---- Asserts that two UDINT arrays are equal.
AssertArrayEquals_UINT(Expecteds : ARRAY[*] OF UINT, Actuals : ARRAY[*] OF UINT, Message : Tc2_System.T_MaxString)
---- Asserts that two UINT arrays are equal.
AssertArrayEquals_ULINT(Expecteds : ARRAY[*] OF ULINT, Actuals : ARRAY[*] OF ULINT, Message : Tc2_System.T_MaxString)
---- Asserts that two ULINT arrays are equal.
AssertArrayEquals_USINT(Expecteds : ARRAY[*] OF USINT, Actuals : ARRAY[*] OF USINT, Message : Tc2_System.T_MaxString)
---- Asserts that two USINT arrays are equal.
AssertArrayEquals_WORD(Expecteds : ARRAY[*] OF WORD, Actuals : ARRAY[*] OF WORD, Message : Tc2_System.T_MaxString)
---- Asserts that two WORD arrays are equal.
AssertEquals(Expected : ANY, Actual : ANY, Message : Tc2_System.T_MaxString)
---- Asserts that two objects (of any type) are equal.
AssertEquals_BOOL(Expected : BOOL, Actual : BOOL, Message : Tc2_System.T_MaxString)
---- Asserts that two BOOLs are equal.
AssertEquals_BYTE(Expected : BYTE, Actual : BYTE, Message : Tc2_System.T_MaxString)
---- Asserts that two BYTEs are equal.
AssertEquals_DATE(Expected : DATE, Actual : DATE, Message : Tc2_System.T_MaxString)
---- Asserts that two DATEs are equal.
AssertEquals_DATE_AND_TIME(Expected : DATE_AND_TIME, Actual : DATE_AND_TIME, Message : Tc2_System.T_MaxString)
---- Asserts that two DATE_AND_TIMEs are equal.
AssertEquals_DINT(Expected : DINT, Actual : DINT, Message : Tc2_System.T_MaxString)
---- Asserts that two DINTs are equal.
AssertEquals_DWORD(Expected : DWORD, Actual : DWORD, Message : Tc2_System.T_MaxString)
---- Asserts that two DWORDs are equal.
AssertEquals_INT(Expected : INT, Actual : INT, Message : Tc2_System.T_MaxString)
---- Asserts that two INTs are equal.
AssertEquals_LINT(Expected : LINT, Actual : LINT, Message : Tc2_System.T_MaxString)
---- Asserts that two LINTs are equal.
AssertEquals_LREAL(Expected : LREAL, Actual : LREAL, Delta : LREAL, Message : Tc2_System.T_MaxString)
---- Asserts that two LREALs are equal to within a positive delta.
AssertEquals_LTIME(Expected : LTIME, Actual : LTIME, Message : Tc2_System.T_MaxString)
---- Asserts that two LTIMEs are equal.
AssertEquals_LWORD(Expected : LWORD, Actual : LWORD, Message : Tc2_System.T_MaxString)
---- Asserts that two LWORDs are equal.
AssertEquals_REAL(Expected : REAL, Actual : REAL, Delta : REAL, Message : Tc2_System.T_MaxString)
---- Asserts that two REALs are equal to within a positive delta.
AssertEquals_SINT(Expected : SINT, Actual : SINT, Message : Tc2_System.T_MaxString)
---- Asserts that two SINTs are equal.
AssertEquals_STRING(Expected : Tc2_System.T_MaxString, Actual : Tc2_System.T_MaxString, Message : Tc2_System.T_MaxString)
---- Asserts that two STRINGs are equal.
AssertEquals_TIME(Expected : TIME, Actual : TIME, Message : Tc2_System.T_MaxString)
---- Asserts that two TIMEs are equal.
AssertEquals_TIME_OF_DAY(Expected : TIME_OF_DAY, Actual : TIME_OF_DAY, Message : Tc2_System.T_MaxString)
---- Asserts that two TIME_OF_DAYs are equal.
AssertEquals_UDINT(Expected : UDINT, Actual : UDINT, Message : Tc2_System.T_MaxString)
---- Asserts that two UDINTs are equal.
AssertEquals_UINT(Expected : UINT, Actual : UINT, Message : Tc2_System.T_MaxString)
---- Asserts that two UINTs are equal.
AssertEquals_ULINT(Expected : ULINT, Actual : ULINT, Message : Tc2_System.T_MaxString)
---- Asserts that two ULINTs are equal.
AssertEquals_USINT(Expected : USINT, Actual : USINT, Message : Tc2_System.T_MaxString)
---- Asserts that two USINTs are equal.
AssertEquals_WORD(Expected : WORD, Actual : WORD, Message : Tc2_System.T_MaxString)
---- Asserts that two WORDs are equal.
AssertFalse(Condition : BOOL, Message : Tc2_System.T_MaxString)
---- Asserts that a condition is false.
AssertTrue(Condition : BOOL, Message : Tc2_System.T_MaxString)
---- Asserts that a condition is true.
Method detail


AssertArrayEquals_BOOL

METHOD PUBLIC AssertArrayEquals_BOOL
VAR_IN_OUT
    Expecteds : ARRAY[*] OF BOOL;
    Actuals : ARRAY[*] OF BOOL;
END_VAR
VAR_INPUT
    Message : Tc2_System.T_MaxString;
END_VAR

Asserts that two BOOL arrays are equal. If they are not, an assertion error is created.

Parameters:
    Expecteds – BOOL array with expected values
    Actuals – BOOL array with actual values
    Message – The identifying message for the assertion error

Positive example:

VAR
    a : ARRAY[1..5] OF BOOL := [TRUE, FALSE, TRUE, FALSE, TRUE];
    b : ARRAY[1..5] OF BOOL := [TRUE, FALSE, TRUE, FALSE, TRUE];
END_VAR

TEST('Test_BOOL_Array_Equals');
Assert.AssertArrayEquals_BOOL(Expecteds := a,
                              Actuals := b,
                              Message := 'Arrays differ');

Failing example #1:

VAR
    a : ARRAY[1..6] OF BOOL := [TRUE, TRUE, TRUE, TRUE, TRUE, TRUE];
    b : ARRAY[1..4] OF BOOL := [TRUE, TRUE, TRUE, TRUE];
END_VAR

TEST('Test_BYTE_Array_DiffersInSize');
Assert.AssertArrayEquals_BOOL(Expecteds := a,
                              Actuals := b,
                              Message := 'Arrays differ');

Failing example #2:

VAR
    a : ARRAY[0..5] OF BOOL := [TRUE, TRUE, FALSE, TRUE, FALSE, TRUE];
    b : ARRAY[0..5] OF BOOL := [TRUE, TRUE, TRUE, TRUE, FALSE, FALSE];
END_VAR

TEST('Test_BYTE_Array_DiffersInContent');
Assert.AssertArrayEquals_BOOL(Expecteds := a,
                              Actuals := b,
                              Message := 'Arrays differ');


AssertArrayEquals_BYTE

METHOD PUBLIC AssertArrayEquals_BYTE
VAR_IN_OUT
    Expecteds : ARRAY[*] OF BYTE;
    Actuals : ARRAY[*] OF BYTE;
END_VAR
VAR_INPUT
    Message : Tc2_System.T_MaxString;
END_VAR

Asserts that two BYTE arrays are equal. If they are not, an assertion error is created.

Parameters:
    Expecteds – BYTE array with expected values
    Actuals – BYTE array with actual values
    Message – The identifying message for the assertion error

Positive example:

VAR
    a : ARRAY[1..3] OF BYTE := [16#FD, 16#34, 16#9E];
    b : ARRAY[1..3] OF BYTE := [16#FD, 16#34, 16#9E];
END_VAR

TEST('Test_BYTE_Array_Equals');
Assert.AssertArrayEquals_BYTE(Expecteds := a,
                              Actuals := b,
                              Message := 'Arrays differ');

Failing example #1:

VAR
    a : ARRAY[1..2] OF BYTE := [16#AB, 16#CD];
    b : ARRAY[1..5] OF BYTE := [16#AB, 16#CD, 16#EF, 16#01, 16#23];
END_VAR

TEST('Test_BYTE_Array_DiffersInSize');
Assert.AssertArrayEquals_BYTE(Expecteds := a,
                              Actuals := b,
                              Message := 'Arrays differ');

Failing example #2:

VAR
    a : ARRAY[0..3] OF BYTE := [16#AB, 16#AA, 16#BB, 16#89];
    b : ARRAY[0..3] OF BYTE := [16#AB, 16#CD, 16#BB, 16#89];
END_VAR

TEST('Test_BYTE_Array_DiffersInContent');
Assert.AssertArrayEquals_BYTE(Expecteds := a,
                              Actuals := b,
                              Message := 'Arrays differ');


AssertArrayEquals_DINT

METHOD PUBLIC AssertArrayEquals_DINT
VAR_IN_OUT
    Expecteds : ARRAY[*] OF DINT;
    Actuals : ARRAY[*] OF DINT;
END_VAR
VAR_INPUT
    Message : Tc2_System.T_MaxString;
END_VAR

Asserts that two DINT arrays are equal. If they are not, an assertion error is created.

Parameters:
    Expecteds – DINT array with expected values
    Actuals – DINT array with actual values
    Message – The identifying message for the assertion error

Positive example:

VAR
    a : ARRAY[2..7] OF DINT := [64, 98, 2147483647, -2147483648, 0, -63987538];
    b : ARRAY[2..7] OF DINT := [64, 98, 2147483647, -2147483648, 0, -63987538];
END_VAR

TEST('Test_DINT_Array_Equals');
Assert.AssertArrayEquals_DINT(Expecteds := a,
                              Actuals := b,
                              Message := 'Arrays differ');

Failing example #1:

VAR
    a : ARRAY[3..4] OF DINT := [-11, 2147483647];
    b : ARRAY[4..6] OF DINT := [-11, 2147483647, 0];
END_VAR

TEST('Test_DINT_Array_DifferInSize');
Assert.AssertArrayEquals_DINT(Expecteds := a,
                              Actuals := b,
                              Message := 'Arrays differ');

Failing example #2:

VAR
    a : ARRAY[3..5] OF DINT := [-4746, -2147483645, 0];
    b : ARRAY[3..5] OF DINT := [-4746, -2147483641, 0];
END_VAR

TEST('Test_DINT_Array_DifferInContent');
Assert.AssertArrayEquals_DINT(Expecteds := a,
                              Actuals := b,
                              Message := 'Arrays differ');


AssertArrayEquals_DWORD

METHOD PUBLIC AssertArrayEquals_DWORD
VAR_IN_OUT
    Expecteds : ARRAY[*] OF DWORD;
    Actuals : ARRAY[*] OF DWORD;
END_VAR
VAR_INPUT
    Message : Tc2_System.T_MaxString;
END_VAR

Asserts that two DWORD arrays are equal. If they are not, an assertion error is created.

Parameters:
    Expecteds – DWORD array with expected values
    Actuals – DWORD array with actual values
    Message – The identifying message for the assertion error

Positive example:

VAR
    a : ARRAY[2..3] OF DWORD := [16#6789ABCD, 16#EF012345];
    b : ARRAY[1..2] OF DWORD := [16#6789ABCD, 16#EF012345];
END_VAR

TEST('Test_DWORD_Array_Equals');
Assert.AssertArrayEquals_DWORD(Expecteds := a,
                               Actuals := b,
                               Message := 'Arrays differ');

Failing example #1:

VAR
    a : ARRAY[-2..1] OF DWORD := [16#6789ABCD, 16#EF012345, 16#67890ABC, 16#DDDDDDDD];
    b : ARRAY[-3..-2] OF DWORD := [16#6789ABCD, 16#EF012345];
END_VAR

TEST('Test_DWORD_Array_DifferInSize');
Assert.AssertArrayEquals_DWORD(Expecteds := a,
                               Actuals := b,
                               Message := 'Arrays differ');

Failing example #2:

VAR
    a : ARRAY[-2..1] OF DWORD := [16#6789ABCD, 16#EFAA2346, 16#ABABABAB, 16#EEEEEEEE];
    b : ARRAY[-2..1] OF DWORD := [16#6789ABCD, 16#EF012345, 16#ABABABAB, 16#EEEEEEEE];
END_VAR

TEST('Test_DWORD_Array_DifferInContent');
Assert.AssertArrayEquals_DWORD(Expecteds := a,
                               Actuals := b,
                               Message := 'Arrays differ');


AssertArrayEquals_INT

METHOD PUBLIC AssertArrayEquals_INT
VAR_IN_OUT
    Expecteds : ARRAY[*] OF INT;
    Actuals : ARRAY[*] OF INT;
END_VAR
VAR_INPUT
    Message : Tc2_System.T_MaxString;
END_VAR

Asserts that two INT arrays are equal. If they are not, an assertion error is created.

Parameters:
    Expecteds – INT array with expected values
    Actuals – INT array with actual values
    Message – The identifying message for the assertion error

Positive example:

VAR
    a : ARRAY[-5..1] OF INT := [64, 98, -32768, 32767, 5478, -378, 42];
    b : ARRAY[1..7] OF INT := [64, 98, -32768, 32767, 5478, -378, 42];
END_VAR

TEST('Test_INT_Array_Equals');
Assert.AssertArrayEquals_INT(Expecteds := a,
                             Actuals := b,
                             Message := 'Arrays differ');

Failing example #1:

VAR
    a : ARRAY[-4..3] OF INT := [64, 98, -32768, 32767, 5478, -378, 42, 6234];
    b : ARRAY[1..5] OF INT := [64, 98, -32768, 32767, 5478];
END_VAR

TEST('Test_INT_Array_DifferInSize');
Assert.AssertArrayEquals_INT(Expecteds := a,
                             Actuals := b,
                             Message := 'Arrays differ');

Failing example #2:

VAR
    a : ARRAY[-8..-6] OF INT := [42, -23, -32768];
    b : ARRAY[1..3] OF INT := [42, 24, -32768];
END_VAR

TEST('Test_INT_Array_DifferInContent');
Assert.AssertArrayEquals_INT(Expecteds := a,
                             Actuals := b,
                             Message := 'Arrays differ');


AssertArrayEquals_LINT

METHOD PUBLIC AssertArrayEquals_LINT
VAR_IN_OUT
    Expecteds : ARRAY[*] OF LINT;
    Actuals : ARRAY[*] OF LINT;
END_VAR
VAR_INPUT
    Message : Tc2_System.T_MaxString;
END_VAR

Asserts that two LINT arrays are equal. If they are not, an assertion error is created.

Parameters:
    Expecteds – LINT array with expected values
    Actuals – LINT array with actual values
    Message – The identifying message for the assertion error

Positive example:

VAR
    a : ARRAY[-1..0] OF LINT := [9_223_372_036_854_775_807, -9_223_372_036_854_775_808];
    b : ARRAY[4..5] OF LINT := [9_223_372_036_854_775_807, -9_223_372_036_854_775_808];
END_VAR

TEST('Test_LINT_Array_Equals');
Assert.AssertArrayEquals_LINT(Expecteds := a,
                              Actuals := b,
                              Message := 'Arrays differ');

Failing example #1:

VAR
    a : ARRAY[-1..1] OF LINT := [9_223_372_036_854_775_807, -9_223_372_036_854_775_808, 55];
    b : ARRAY[4..5] OF LINT := [9_223_372_036_854_775_807, -9_223_372_036_854_775_808];
END_VAR

TEST('Test_LINT_Array_DifferInSize');
Assert.AssertArrayEquals_LINT(Expecteds := a,
                              Actuals := b,
                              Message := 'Arrays differ');

Failing example #2:

VAR
    a : ARRAY[-1..1] OF LINT := [9_223_372_036_854_775_807, -9_223_372_036_853_775_808, 55];
    b : ARRAY[4..6] OF LINT := [9_223_372_036_854_775_807, -9_223_372_036_854_775_808, 55];
END_VAR

TEST('Test_LINT_Array_DifferInContent');
Assert.AssertArrayEquals_LINT(Expecteds := a,
                              Actuals := b,
                              Message := 'Arrays differ');


AssertArrayEquals_LWORD

METHOD PUBLIC AssertArrayEquals_LWORD
VAR_IN_OUT
    Expecteds : ARRAY[*] OF LWORD;
    Actuals : ARRAY[*] OF LWORD;
END_VAR
VAR_INPUT
    Message : Tc2_System.T_MaxString;
END_VAR

Asserts that two LWORD arrays are equal. If they are not, an assertion error is created.

Parameters:
    Expecteds – LWORD array with expected values
    Actuals – LWORD array with actual values
    Message – The identifying message for the assertion error

Positive example:

VAR
    a : ARRAY[1..2] OF LWORD := [16#01234567890ABCDE, 16#EDCBA09876543210];
    b : ARRAY[1..2] OF LWORD := [16#01234567890ABCDE, 16#EDCBA09876543210];
END_VAR

TEST('Test_LWORD_Array_Equals');
Assert.AssertArrayEquals_LWORD(Expecteds := a,
                               Actuals := b,
                               Message := 'Arrays differ');

Failing example #1:

VAR
    a : ARRAY[1..1] OF LWORD := [16#EDCBA09876543210];
    b : ARRAY[1..2] OF LWORD := [16#01234567890ABCDE, 16#EDCBA09876543210];
END_VAR

TEST('Test_LWORD_Array_DifferInSize');
Assert.AssertArrayEquals_LWORD(Expecteds := a,
                               Actuals := b,
                               Message := 'Arrays differ');

Failing example #2:

VAR
    a : ARRAY[1..1] OF LWORD := [16#EDCBA09876543210];
    b : ARRAY[1..1] OF LWORD := [16#01234567890ABCDE];
END_VAR

TEST('Test_LWORD_Array_DifferInContent');
Assert.AssertArrayEquals_LWORD(Expecteds := a,
                               Actuals := b,
                               Message := 'Arrays differ');


AssertArrayEquals_SINT

METHOD PUBLIC AssertArrayEquals_SINT
VAR_IN_OUT
    Expecteds : ARRAY[*] OF SINT;
    Actuals : ARRAY[*] OF SINT;
END_VAR
VAR_INPUT
    Message : Tc2_System.T_MaxString;
END_VAR

Asserts that two SINT arrays are equal. If they are not, an assertion error is created.

Parameters:
    Expecteds – SINT array with expected values
    Actuals – SINT array with actual values
    Message – The identifying message for the assertion error

Positive example:

VAR
    a : ARRAY[0..3] OF SINT := [-128, 127, -34, 62];
    b : ARRAY[0..3] OF SINT := [-128, 127, -34, 62];
END_VAR

TEST('Test_SINT_Array_Equals');
Assert.AssertArrayEquals_SINT(Expecteds := a,
                              Actuals := b,
                              Message := 'Arrays differ');

Failing example #1:

VAR
    a : ARRAY[0..0] OF SINT := [-128];
    b : ARRAY[0..1] OF SINT := [-128, 127];
END_VAR

TEST('Test_SINT_Array_DifferInSize');
Assert.AssertArrayEquals_SINT(Expecteds := a,
                              Actuals := b,
                              Message := 'Arrays differ');

Failing example #2:

VAR
    a : ARRAY[0..0] OF SINT := [-128];
    b : ARRAY[0..0] OF SINT := [127];
END_VAR

TEST('Test_SINT_Array_DifferInContent');
Assert.AssertArrayEquals_SINT(Expecteds := a,
                              Actuals := b,
                              Message := 'Arrays differ');


AssertArrayEquals_UDINT

METHOD PUBLIC AssertArrayEquals_UDINT
VAR_IN_OUT
    Expecteds : ARRAY[*] OF UDINT;
    Actuals : ARRAY[*] OF UDINT;
END_VAR
VAR_INPUT
    Message : Tc2_System.T_MaxString;
END_VAR

Asserts that two UDINT arrays are equal. If they are not, an assertion error is created.

Parameters:
    Expecteds – UDINT array with expected values
    Actuals – UDINT array with actual values
    Message – The identifying message for the assertion error

Positive example:

VAR
    a : ARRAY[1..3] OF UDINT := [0, 4294967295, 5000];
    b : ARRAY[1..3] OF UDINT := [0, 4294967295, 5000];
END_VAR

TEST('Test_UDINT_Array_Equals');
Assert.AssertArrayEquals_UDINT(Expecteds := a,
                               Actuals := b,
                               Message := 'Arrays differ');

Failing example #1:

VAR
    a : ARRAY[-5..-4] OF UDINT := [4294967295, 0];
    b : ARRAY[0..2] OF UDINT := [4294967295, 0, 5000];
END_VAR

TEST('Test_UDINT_Array_DifferInSize');
Assert.AssertArrayEquals_UDINT(Expecteds := a,
                               Actuals := b,
                               Message := 'Arrays differ');

Failing example #2:

VAR
    a : ARRAY[-5..-4] OF UDINT := [4294967295, 5];
    b : ARRAY[0..1] OF UDINT := [4294967295, 4];
END_VAR

TEST('Test_UDINT_Array_DifferInContent');
Assert.AssertArrayEquals_UDINT(Expecteds := a,
                               Actuals := b,
                               Message := 'Arrays differ');


AssertArrayEquals_UINT

METHOD PUBLIC AssertArrayEquals_UINT
VAR_IN_OUT
    Expecteds : ARRAY[*] OF UINT;
    Actuals : ARRAY[*] OF UINT;
END_VAR
VAR_INPUT
    Message : Tc2_System.T_MaxString;
END_VAR

Asserts that two UINT arrays are equal. If they are not, an assertion error is created.

Parameters:
    Expecteds – UINT array with expected values
    Actuals – UINT array with actual values
    Message – The identifying message for the assertion error

Positive example:

VAR
    a : ARRAY[0..4] OF UINT := [0, 65535, 2000, 34123, 59];
    b : ARRAY[0..4] OF UINT := [0, 65535, 2000, 34123, 59];
END_VAR

TEST('Test_UINT_Array_Equals');
Assert.AssertArrayEquals_UINT(Expecteds := a,
                              Actuals := b,
                              Message := 'Arrays differ');

Failing example #1:

VAR
    a : ARRAY[0..2] OF UINT := [0, 4, 8];
    b : ARRAY[0..3] OF UINT := [0, 4, 8, 12];
END_VAR

TEST('Test_UINT_Array_DifferInSize');
Assert.AssertArrayEquals_UINT(Expecteds := a,
                              Actuals := b,
                              Message := 'Arrays differ');

Failing example #2:

VAR
    a : ARRAY[0..3] OF UINT := [0, 4, 8, 99];
    b : ARRAY[0..3] OF UINT := [0, 4, 8, 12];
END_VAR

TEST('Test_UINT_Array_DifferInContent');
Assert.AssertArrayEquals_UINT(Expecteds := a,
                              Actuals := b,
                              Message := 'Arrays differ');


AssertArrayEquals_ULINT

METHOD PUBLIC AssertArrayEquals_ULINT
VAR_IN_OUT
    Expecteds : ARRAY[*] OF ULINT;
    Actuals : ARRAY[*] OF ULINT;
END_VAR
VAR_INPUT
    Message : Tc2_System.T_MaxString;
END_VAR

Asserts that two ULINT arrays are equal. If they are not, an assertion error is created.

Parameters:
    Expecteds – ULINT array with expected values
    Actuals – ULINT array with actual values
    Message – The identifying message for the assertion error

Positive example:

VAR
    a : ARRAY[0..3] OF ULINT := [0, 18_446_744_073_709_551_615, 9_400_000_000_000, 3_213_000_444_000];
    b : ARRAY[0..3] OF ULINT := [0, 18_446_744_073_709_551_615, 9_400_000_000_000, 3_213_000_444_000];
END_VAR

TEST('Test_ULINT_Array_Equals');
Assert.AssertArrayEquals_ULINT(Expecteds := a,
                               Actuals := b,
                               Message := 'Arrays differ');

Failing example #1:

VAR
    a : ARRAY[0..1] OF ULINT := [0, 9_400_000_000_000];
    b : ARRAY[0..0] OF ULINT := [0];
END_VAR

TEST('Test_ULINT_Array_DifferInSize');
Assert.AssertArrayEquals_ULINT(Expecteds := a,
                               Actuals := b,
                               Message := 'Arrays differ');

Failing example #2:

VAR
    a : ARRAY[0..1] OF ULINT := [3_213_000_444_000, 9_400_000_000_000];
    b : ARRAY[0..1] OF ULINT := [3_213_000_444_000, 18_446_744_073_709_551_615];
END_VAR

TEST('Test_ULINT_Array_DifferInContent');
Assert.AssertArrayEquals_ULINT(Expecteds := a,
                               Actuals := b,
                               Message := 'Arrays differ');


AssertArrayEquals_USINT

METHOD PUBLIC AssertArrayEquals_USINT
VAR_IN_OUT
    Expecteds : ARRAY[*] OF USINT;
    Actuals : ARRAY[*] OF USINT;
END_VAR
VAR_INPUT
    Message : Tc2_System.T_MaxString;
END_VAR

Asserts that two USINT arrays are equal. If they are not, an assertion error is created.

Parameters:
    Expecteds – USINT array with expected values
    Actuals – USINT array with actual values
    Message – The identifying message for the assertion error

Positive example:

VAR
    a : ARRAY[0..100] OF USINT := [42, 100(33)];
    b : ARRAY[0..100] OF USINT := [42, 100(33)];
END_VAR

TEST('Test_USINT_Array_Equals');
Assert.AssertArrayEquals_USINT(Expecteds := a,
                               Actuals := b,
                               Message := 'Arrays differ');

Failing example #1:

VAR
    a : ARRAY[0..100] OF USINT := [101(42)];
    b : ARRAY[0..70] OF USINT := [71(42)];
END_VAR

TEST('Test_USINT_Array_DifferInSize');
Assert.AssertArrayEquals_USINT(Expecteds := a,
                               Actuals := b,
                               Message := 'Arrays differ');

Failing example #2:

VAR
    a : ARRAY[0..10] OF USINT := [0,1,2,3,6(4),5];
    b : ARRAY[0..10] OF USINT := [0,1,2,3,6(5),6];
END_VAR

TEST('Test_USINT_Array_DifferInContent');
Assert.AssertArrayEquals_USINT(Expecteds := a,
                               Actuals := b,
                               Message := 'Arrays differ');


AssertArrayEquals_WORD

METHOD PUBLIC AssertArrayEquals_WORD
VAR_IN_OUT
    Expecteds : ARRAY[*] OF WORD;
    Actuals : ARRAY[*] OF WORD;
END_VAR
VAR_INPUT
    Message : Tc2_System.T_MaxString;
END_VAR

Asserts that two WORD arrays are equal. If they are not, an assertion error is created.

Parameters:
    Expecteds – WORD array with expected values
    Actuals – WORD array with actual values
    Message – The identifying message for the assertion error

Positive example:

VAR
    a : ARRAY[1..5] OF WORD := [16#AAAA, 16#BBBB, 16#CCCC, 16#DDDD, 16#EEEE];
    b : ARRAY[1..5] OF WORD := [16#AAAA, 16#BBBB, 16#CCCC, 16#DDDD, 16#EEEE];
END_VAR

TEST('Test_WORD_Array_Equals');
Assert.AssertArrayEquals_WORD(Expecteds := a,
                              Actuals := b,
                              Message := 'Arrays differ');

Failing example #1:

VAR
    a : ARRAY[1..5] OF WORD := [16#0000, 16#3333, 16#5555, 16#7777, 16#BBBB];
    b : ARRAY[1..7] OF WORD := [16#0000, 16#3333, 16#5555, 16#7777, 16#BBBB, 16#FFFF, 16#1122];
END_VAR

TEST('Test_WORD_Array_DifferInSize');
Assert.AssertArrayEquals_WORD(Expecteds := a,
                              Actuals := b,
                              Message := 'Arrays differ');

Failing example #2:

VAR
    a : ARRAY[1..7] OF WORD := [16#2323, 16#876A, 16#4CD4, 16#F3DC, 16#BBBB, 16#FFFF, 16#1133];
    b : ARRAY[1..7] OF WORD := [16#2323, 16#876A, 16#4CD4, 16#F3DC, 16#BBBB, 16#FFFF, 16#1122];
END_VAR

TEST('Test_WORD_Array_DifferInContent');
Assert.AssertArrayEquals_WORD(Expecteds := a,
                              Actuals := b,
                              Message := 'Arrays differ');


AssertEquals

METHOD PUBLIC AssertEquals
VAR_INPUT
    Expected : ANY;
    Actual : ANY;
    Message : Tc2_System.T_MaxString;
END_VAR

Asserts that two objects (of any type) are equal. If they are not, an assertion error is created.
For REAL and LREAL it’s recommended to use the AssertEquals_REAL or AssertEquals_LREAL respectively as these give the possibility to specify a delta between the expected and actual value.

Parameters:
    Expected – Expected value
    Actual – Actual value
    Message – The identifying message for the assertion error

Positive example:

VAR
    a : INT := 5;
    b : INT := 5;
END_VAR

TEST('Test_ANY_Equals');
Assert.AssertEquals(Expected := a,
                    Actual := b,
                    Message := 'Values differ');

Failing example:

VAR
    a : INT := 5;
    b : UINT := 5;
END_VAR

TEST('Test_ANY_Differ_DataType');
Assert.AssertEquals(Expected := a,
                    Actual := b,
                    Message := 'Values differ');


AssertEquals_BOOL

METHOD PUBLIC AssertEquals_BOOL
VAR_INPUT
    Expected : BOOL;
    Actual : BOOL;
    Message : Tc2_System.T_MaxString;
END_VAR

Asserts that two BOOLs are equal. If they are not, an assertion error is created.

Parameters:
    Expected – BOOL expected value
    Actual – BOOL actual value
    Message – The identifying message for the assertion error

Positive example:

VAR
    a : BOOL := TRUE;
    b : BOOL := TRUE;
END_VAR

TEST('Test_BOOL_Equals');
Assert.AssertEquals_BOOL(Expected := a,
                         Actual := b,
                         Message := 'Bools differ');

Failing example:

VAR
    a : BOOL := TRUE;
    b : BOOL := FALSE;
END_VAR

TEST('Test_BOOL_Differ');
Assert.AssertEquals_BOOL(Expected := a,
                         Actual := b,
                         Message := 'Bools differ');


AssertEquals_BYTE

METHOD PUBLIC AssertEquals_BYTE
VAR_INPUT
    Expected : BYTE;
    Actual : BYTE;
    Message : Tc2_System.T_MaxString;
END_VAR

Asserts that two BYTEs are equal. If they are not, an assertion error is created.

Parameters:
    Expected – BYTE expected value
    Actual – BYTE actual value
    Message – The identifying message for the assertion error

Positive example:

VAR
    a : BYTE := 16#CD;
    b : BYTE := 16#CD;
END_VAR

TEST('Test_BYTE_Equals');
Assert.AssertEquals_BYTE(Expected := a,
                         Actual := b,
                         Message := 'Values differ');

Failing example:

VAR
    a : BYTE := 16#AB;
    b : BYTE := 16#CD;
END_VAR

TEST('Test_BYTE_Differ');
Assert.AssertEquals_BYTE(Expected := a,
                         Actual := b,
                         Message := 'Values differ');


AssertEquals_DATE

METHOD PUBLIC AssertEquals_DATE
VAR_INPUT
    Expected : DATE;
    Actual : DATE;
    Message : Tc2_System.T_MaxString;
END_VAR

Asserts that two DATEs are equal. If they are not, an assertion error is created.

Parameters:
    Expected – DATE expected value
    Actual – DATE actual value
    Message – The identifying message for the assertion error

Positive example:

VAR
    a : DATE := DATE#1996-05-06;
    b : DATE := DATE#1996-05-06;
END_VAR

TEST('Test_DATE_Equals');
Assert.AssertEquals_DATE(Expected := a,
                         Actual := b,
                         Message := 'Values differ');

Failing example:

VAR
    a : DATE := DATE#1996-05-06;
    b : DATE := DATE#2019-01-20;
END_VAR

TEST('Test_DATE_Differ');
Assert.AssertEquals_DATE(Expected := a,
                         Actual := b,
                         Message := 'Values differ');


AssertEquals_DATE_AND_TIME

METHOD PUBLIC AssertEquals_DATE_AND_TIME
VAR_INPUT
    Expected : DATE_AND_TIME;
    Actual : DATE_AND_TIME;
    Message : Tc2_System.T_MaxString;
END_VAR

Asserts that two DATE_AND_TIMEs are equal. If they are not, an assertion error is created.

Parameters:
    Expected – DATE_AND_TIME expected value
    Actual – DATE_AND_TIME actual value
    Message – The identifying message for the assertion error

Positive example:

VAR
    a : DATE_AND_TIME := DATE_AND_TIME#2019-01-20-13:54:30;
    b : DATE_AND_TIME := DATE_AND_TIME#2019-01-20-13:54:30;
END_VAR

TEST('Test_DATE_AND_TIME_Equals');
Assert.AssertEquals_DATE_AND_TIME(Expected := a,
                                  Actual := b,
                                  Message := 'Values differ');

Failing example:

VAR
    a : DATE_AND_TIME := DATE_AND_TIME#1996-05-06-15:36:30;
    b : DATE_AND_TIME := DATE_AND_TIME#1972-03-29-00:00:00;
END_VAR

TEST('Test_DATE_AND_TIME_Differ');
Assert.AssertEquals_DATE_AND_TIME(Expected := a,
                                  Actual := b,
                                  Message := 'Values differ');


AssertEquals_DINT

METHOD PUBLIC AssertEquals_DINT
VAR_INPUT
    Expected : DINT;
    Actual : DINT;
    Message : Tc2_System.T_MaxString;
END_VAR

Asserts that two DINTs are equal. If they are not, an assertion error is created.

Parameters:
    Expected – BYTE expected value
    Actual – BYTE actual value
    Message – The identifying message for the assertion error

Positive example:

VAR
    a : DINT := -80000;
    b : DINT := -80000;
END_VAR

TEST('Test_DINT_Equals');
Assert.AssertEquals_DINT(Expected := a,
                         Actual := b,
                         Message := 'Values differ');

Failing example:

VAR
    a : DINT := -55555;
    b : DINT := 70000;
END_VAR

TEST('Test_DINT_Differ');
Assert.AssertEquals_DINT(Expected := a,
                         Actual := b,
                         Message := 'Values differ');


AssertEquals_DWORD

METHOD PUBLIC AssertEquals_DWORD
VAR_INPUT
    Expected : DWORD;
    Actual : DWORD;
    Message : Tc2_System.T_MaxString;
END_VAR

Asserts that two DWORDs are equal. If they are not, an assertion error is created.

Parameters:
    Expected – DWORD expected value
    Actual – DWORD actual value
    Message – The identifying message for the assertion error

Positive example:

VAR
    a : DWORD := 16#7890ABCD;
    b : DWORD := 16#7890ABCD;
END_VAR

TEST('Test_DWORD_Equals');
Assert.AssertEquals_DWORD(Expected := a,
                          Actual := b,
                          Message := 'Values differ');

Failing example:

VAR
    a : DWORD := 16#12345678;
    b : DWORD := 16#90ABCDEF;
END_VAR

TEST('Test_DWORD_Differ');
Assert.AssertEquals_DWORD(Expected := a,
                          Actual := b,
                          Message := 'Values differ');


AssertEquals_INT

METHOD PUBLIC AssertEquals_INT
VAR_INPUT
    Expected : INT;
    Actual : INT;
    Message : Tc2_System.T_MaxString;
END_VAR

Asserts that two INTs are equal. If they are not, an assertion error is created.

Parameters:
    Expected – INT expected value
    Actual – INT actual value
    Message – The identifying message for the assertion error

Positive example:

VAR
    a : INT := -12345;
    b : INT := -12345;
END_VAR

TEST('Test_INT_Equals');
Assert.AssertEquals_INT(Expected := a,
                        Actual := b,
                        Message := 'Values differ');

Failing example:

VAR
    a : INT := -32000;
    b : INT := 15423;
END_VAR

TEST('Test_INT_Differ');
Assert.AssertEquals_INT(Expected := a,
                        Actual := b,
                        Message := 'Values differ');


AssertEquals_LINT

METHOD PUBLIC AssertEquals_LINT
VAR_INPUT
    Expected : LINT;
    Actual : LINT;
    Message : Tc2_System.T_MaxString;
END_VAR

Asserts that two LINTs are equal. If they are not, an assertion error is created.

Parameters:
    Expected – LINT expected value
    Actual – LINT actual value
    Message – The identifying message for the assertion error

Positive example:

VAR
    a : LINT := -123456789;
    b : LINT := -123456789;
END_VAR

TEST('Test_LINT_Equals');
Assert.AssertEquals_LINT(Expected := a,
                         Actual := b,
                         Message := 'Values differ');

Failing example:

VAR
    a : LINT := -451416345;
    b : LINT := 589532453;
END_VAR

TEST('Test_LINT_Differ');
Assert.AssertEquals_LINT(Expected := a,
                         Actual := b,
                         Message := 'Values differ');


AssertEquals_LREAL

METHOD PUBLIC AssertEquals_LREAL
VAR_INPUT
    Expected : LREAL;
    Actual : LREAL;
    Delta : LREAL;
    Message : Tc2_System.T_MaxString;
END_VAR

Asserts that two LREALs are equal to within a positive delta. If they are not, an assertion error is created.

Parameters:
    Expected – LREAL expected value
    Actual – LREAL actual value
    Delta – The maximum delta between the absolute value of expected and actual for which both numbers are still considered equal
    Message – The identifying message for the assertion error

Positive example:

VAR
    a : LREAL := 1234567.89;
    b : LREAL := 1234567.76;
END_VAR

TEST('Test_LREAL_Equals');
Assert.AssertEquals_LREAL(Expected := a,
                          Actual := b,
                          Delta := 0.2,
                          Message := 'Values differ');

Failing example:

VAR
    a : LREAL := 1234567.89;
    b : LREAL := 1234567.76;
END_VAR

TEST('Test_LREAL_Differ');
Assert.AssertEquals_LREAL(Expected := a,
                          Actual := b,
                          Delta := 0.1,
                          Message := 'Values differ');


AssertEquals_LTIME

METHOD PUBLIC AssertEquals_LTIME
VAR_INPUT
    Expected : LTIME;
    Actual : LTIME;
    Message : Tc2_System.T_MaxString;
END_VAR

Asserts that two LTIMEs are equal. If they are not, an assertion error is created.

Parameters:
    Expected – LTIME expected value
    Actual – LTIME actual value
    Message – The identifying message for the assertion error

Positive example:

VAR
    a : LTIME := LTIME#213503D23H34M33S709MS551US615NS;
    b : LTIME := LTIME#213503D23H34M33S709MS551US615NS;
END_VAR

TEST('Test_LTIME_Equals');
Assert.AssertEquals_LTIME(Expected := a,
                          Actual := b,
                          Message := 'Values differ');

Failing example:

VAR
    a : LTIME := LTIME#213503D23H34M33S709MS551US615NS;
    b : LTIME := LTIME#1000D15H23M12S34MS2US44NS;
END_VAR

TEST('Test_LTIME_Differ');
Assert.AssertEquals_LTIME(Expected := a,
                          Actual := b,
                          Message := 'Values differ');


AssertEquals_LWORD

METHOD PUBLIC AssertEquals_LWORD
VAR_INPUT
    Expected : LWORD;
    Actual : LWORD;
    Message : Tc2_System.T_MaxString;
END_VAR

Asserts that two LWORDs are equal. If they are not, an assertion error is created.

Parameters:
    Expected – LWORD expected value
    Actual – LWORD actual value
    Message – The identifying message for the assertion error

Positive example:

VAR
    a : LWORD := 16#0123456789ABCDEF;
    b : LWORD := 16#0123456789ABCDEF;
END_VAR

TEST('Test_LWORD_Equals');
Assert.AssertEquals_LWORD(Expected := a,
                          Actual := b,
                          Message := 'Values differ');

Failing example:

VAR
    a : LWORD := 16#0123656789ABCBEC;
    b : LWORD := 16#0123256789ABCAEE;
END_VAR

TEST('Test_LWORD_Differ');
Assert.AssertEquals_LWORD(Expected := a,
                          Actual := b,
                          Message := 'Values differ');


AssertEquals_REAL

METHOD PUBLIC AssertEquals_REAL
VAR_INPUT
    Expected : REAL;
    Actual : REAL;
    Delta : REAL;
    Message : Tc2_System.T_MaxString;
END_VAR

Asserts that two REALs are equal to within a positive delta. If they are not, an assertion error is created.

Parameters:
    Expected – REAL expected value
    Actual – REAL actual value
    Delta – The maximum delta between the absolute value of expected and actual for which both numbers are still considered equal
    Message – The identifying message for the assertion error

Positive example:

VAR
    a : REAL := 1234.5;
    b : REAL := 1234.4;
END_VAR

TEST('Test_REAL_Equals');
Assert.AssertEquals_REAL(Expected := a,
                         Actual := b,
                         Delta := 0.1,
                         Message := 'Values differ');

Failing example:

VAR
    a : REAL := 1234.5;
    b : REAL := 1234.4;
END_VAR

TEST('Test_REAL_Differ');
Assert.AssertEquals_REAL(Expected := a,
                         Actual := b,
                         Delta := 0.05,
                         Message := 'Values differ');


AssertEquals_SINT

METHOD PUBLIC AssertEquals_SINT
VAR_INPUT
    Expected : SINT;
    Actual : SINT;
    Message : Tc2_System.T_MaxString;
END_VAR

Asserts that two SINTs are equal. If they are not, an assertion error is created.

Parameters:
    Expected – SINT expected value
    Actual – SINT actual value
    Message – The identifying message for the assertion error

Positive example:

VAR
    a : SINT := -128;
    b : SINT := -128;
END_VAR

TEST('Test_SINT_Equals');
Assert.AssertEquals_SINT(Expected := a,
                         Actual := b,
                         Message := 'Values differ');

Failing example:

VAR
    a : SINT := 127;
    b : SINT := -30;
END_VAR

TEST('Test_SINT_Differ');
Assert.AssertEquals_SINT(Expected := a,
                         Actual := b,
                         Message := 'Values differ');


AssertEquals_STRING

METHOD PUBLIC AssertEquals_STRING
VAR_INPUT
    Expected : Tc2_System.T_MaxString;
    Actual : Tc2_System.T_MaxString;
    Message : Tc2_System.T_MaxString;
END_VAR

Asserts that two STRINGs are equal. If they are not, an assertion error is created.

Parameters:
    Expected – STRING expected value
    Actual – STRING actual value
    Message – The identifying message for the assertion error

Positive example:

VAR
    a : STRING := 'Hello there';
    b : STRING := 'Hello there';
END_VAR

TEST('Test_STRING_Equals');
Assert.AssertEquals_STRING(Expected := a,
                           Actual := b,
                           Message := 'Values differ');

Failing example:

VAR
    a : STRING := 'This is a string';
    b : STRING := 'This is another string';
END_VAR

TEST('Test_STRING_Differ');
Assert.AssertEquals_STRING(Expected := a,
                           Actual := b,
                           Message := 'Values differ');


AssertEquals_TIME

METHOD PUBLIC AssertEquals_TIME
VAR_INPUT
    Expected : TIME;
    Actual : TIME;
    Message : Tc2_System.T_MaxString;
END_VAR

Asserts that two TIMEs are equal. If they are not, an assertion error is created.

Parameters:
    Expected – TIME expected value
    Actual – TIME actual value
    Message – The identifying message for the assertion error

Positive example:

VAR
    a : TIME := T#11H34M13S244MS;
    b : TIME := T#11H34M13S244MS;
END_VAR

TEST('Test_TIME_Equals');
Assert.AssertEquals_TIME(Expected := a,
                         Actual := b,
                         Message := 'Values differ');

Failing example:

VAR
    a : TIME := T#12H34M15S10MS;
    b : TIME := T#11H34M13S244MS;
END_VAR

TEST('Test_TIME_Differ');
Assert.AssertEquals_TIME(Expected := a,
                         Actual := b,
                         Message := 'Values differ');


AssertEquals_TIME_OF_DAY

METHOD PUBLIC AssertEquals_TIME_OF_DAY
VAR_INPUT
    Expected : TIME_OF_DAY;
    Actual : TIME_OF_DAY;
    Message : Tc2_System.T_MaxString;
END_VAR

Asserts that two TIME_OF_DAYs are equal. If they are not, an assertion error is created.

Parameters:
    Expected – TIME_OF_DAY expected value
    Actual – TIME_OF_DAY actual value
    Message – The identifying message for the assertion error

Positive example:

VAR
    a : TIME_OF_DAY := TIME_OF_DAY#06:21:11.492;
    b : TIME_OF_DAY := TIME_OF_DAY#06:21:11.492;
END_VAR

TEST('Test_TIME_OF_DAY_Equals');
Assert.AssertEquals_TIME_OF_DAY(Expected := a,
                                Actual := b,
                                Message := 'Values differ');

Failing example:

VAR
    a : TIME_OF_DAY := TIME_OF_DAY#15:36:30.123;
    b : TIME_OF_DAY := TIME_OF_DAY#06:21:11.492;
END_VAR

TEST('Test_TIME_OF_DAY_Differ');
Assert.AssertEquals_TIME_OF_DAY(Expected := a,
                                Actual := b,
                                Message := 'Values differ');


AssertEquals_UDINT

METHOD PUBLIC AssertEquals_UDINT
VAR_INPUT
    Expected : UDINT;
    Actual : UDINT;
    Message : Tc2_System.T_MaxString;
END_VAR

Asserts that two UDINTs are equal. If they are not, an assertion error is created.

Parameters:
    Expected – UDINT expected value
    Actual – UDINT actual value
    Message – The identifying message for the assertion error

Positive example:

VAR
    a : UDINT := 21845123;
    b : UDINT := 21845123;
END_VAR

TEST('Test_UDINT_Equals');
Assert.AssertEquals_UDINT(Expected := a,
                          Actual := b,
                          Message := 'Values differ');

Failing example:

VAR
    a : UDINT := 34124214;
    b : UDINT := 52343244;
END_VAR

TEST('Test_UDINT_Differ');
Assert.AssertEquals_UDINT(Expected := a,
                          Actual := b,
                          Message := 'Values differ');


AssertEquals_UINT

METHOD PUBLIC AssertEquals_UINT
VAR_INPUT
    Expected : UINT;
    Actual : UINT;
    Message : Tc2_System.T_MaxString;
END_VAR

Asserts that two UINTs are equal. If they are not, an assertion error is created.

Parameters:
    Expected – UINT expected value
    Actual – UINT actual value
    Message – The identifying message for the assertion error

Positive example:

VAR
    a : UINT := 65535;
    b : UINT := 65535;
END_VAR

TEST('Test_UINT_Equals');
Assert.AssertEquals_UINT(Expected := a,
                         Actual := b,
                         Message := 'Values differ');

Failing example:

VAR
    a : UINT := 64322;
    b : UINT := 32312;
END_VAR

TEST('Test_UINT_Differ');
Assert.AssertEquals_UINT(Expected := a,
                         Actual := b,
                         Message := 'Values differ');


AssertEquals_ULINT

METHOD PUBLIC AssertEquals_ULINT
VAR_INPUT
    Expected : ULINT;
    Actual : ULINT;
    Message : Tc2_System.T_MaxString;
END_VAR

Asserts that two ULINTs are equal. If they are not, an assertion error is created.

Parameters:
    Expected – ULINT expected value
    Actual – ULINT actual value
    Message – The identifying message for the assertion error

Positive example:

VAR
    a : ULINT := 45683838383;
    b : ULINT := 45683838383;
END_VAR

TEST('Test_ULINT_Equals');
Assert.AssertEquals_ULINT(Expected := a,
                          Actual := b,
                          Message := 'Values differ');

Failing example:

VAR
    a : ULINT := 10000;
    b : ULINT := 53685437234;
END_VAR

TEST('Test_ULINT_Differ');
Assert.AssertEquals_ULINT(Expected := a,
                          Actual := b,
                          Message := 'Values differ');


AssertEquals_USINT

METHOD PUBLIC AssertEquals_USINT
VAR_INPUT
    Expected : USINT;
    Actual : USINT;
    Message : Tc2_System.T_MaxString;
END_VAR

Asserts that two USINTs are equal. If they are not, an assertion error is created.

Parameters:
    Expected – USINT expected value
    Actual – USINT actual value
    Message – The identifying message for the assertion error

Positive example:

VAR
    a : USINT := 5;
    b : USINT := 5;
END_VAR

TEST('Test_USINT_Equals');
Assert.AssertEquals_USINT(Expected := a,
                          Actual := b,
                          Message := 'Values differ');

Failing example:

VAR
    a : USINT := 3;
    b : USINT := 7;
END_VAR

TEST('Test_USINT_Differ');
Assert.AssertEquals_USINT(Expected := a,
                          Actual := b,
                          Message := 'Values differ');


AssertEquals_WORD

METHOD PUBLIC AssertEquals_WORD
VAR_INPUT
    Expected : WORD;
    Actual : WORD;
    Message : Tc2_System.T_MaxString;
END_VAR

Asserts that two WORDs are equal. If they are not, an assertion error is created.

Parameters:
    Expected – WORD expected value
    Actual – WORD actual value
    Message – The identifying message for the assertion error

Positive example:

VAR
    a : WORD := 16#ABCD;
    b : WORD := 16#ABCD;
END_VAR

TEST('Test_WORD_Equals');
Assert.AssertEquals_WORD(Expected := a,
                         Actual := b,
                         Message := 'Values differ');

Failing example:

VAR
    a : WORD := 16#EF01;
    b : WORD := 16#2345;
END_VAR

TEST('Test_WORD_Differ');
Assert.AssertEquals_WORD(Expected := a,
                         Actual := b,
                         Message := 'Values differ');


AssertFalse

METHOD PUBLIC AssertFalse
VAR_INPUT
    Condition: BOOL;
    Message : Tc2_System.T_MaxString;
END_VAR

Asserts that a condition is false. If it is not, an assertion error is created.

Parameters:
    Condition – Condition to be checked
    Message – The identifying message for the assertion error

Positive example:

VAR
    a : INT := -33;
    b : INT := -44;
END_VAR

TEST('AssertThatINTsAreNotEqual');
Assert.AssertFalse(Condition := (a = b),
                   Message := 'INTs are equal');

Failing example:

VAR
    a : INT := -33;
    b : INT := -44;
END_VAR

TEST('AssertThatINTsAreEqual');
Assert.AssertFalse(Condition := (a <> b),
                   Message := 'INTs are equal');


AssertTrue

METHOD PUBLIC AssertTrue
VAR_INPUT
    Condition: BOOL;
    Message : Tc2_System.T_MaxString;
END_VAR

Asserts that a condition is true. If it is not, an assertion error is created.

Parameters:
    Condition – Condition to be checked
    Message – The identifying message for the assertion error

Positive example:

VAR
    a : WORD := 16#ABCD;
    b : WORD := 16#0123;
END_VAR

TEST('AssertThatWORDsAreNotEqual');
Assert.AssertTrue(Condition := (a <> b),
                  Message := 'WORDs are equal');

Failing example:

VAR
    a : WORD := 16#ABCD;
    b : WORD := 16#0123;
END_VAR

TEST('AssertThatWORDsAreEqual');
Assert.AssertTrue(Condition := (a = b),
                  Message := 'WORDs are not equal');

Last Updated on