oaUnitAssertEqual()

The function checks if the checked value is equal to the expected value.

Synopsis

int oaUnitAssertEqual(string TC_ID, anytype checkedValue, anytype goodValue, [anytype userTcData]);

Parameter

Parameters Meaning
TC ID The test ID. Each test case must contain a test ID.
checkedValue The value that is tested.
goodVCalue The expected value.
userTcData Optional parameter. Test case specific data can be set for the test case.

Return Value

The error code. In case of wrong or missing parameters, the function returns -1 or -2. If the condition was fulfilled, meaning that the value is equal to the expected value, the function returns 0. If the condition was not fulfilled meaning that the value is unequal to the expected value, the function returns 1.

Error

The function returns the error code.

Description

The CTRL OA Unit CTRL extension contains a set of functions that can be used for testing purposes. The function checks if the checked value is equal to the expected value. The checked value and the expected value must be of the same variable type.

Example

The Following example is a simple unit test of the function strpos().

main()
{
  /* The function checks if the checked value is equal to the expected value. The function
  strpos returns the position of a "E" within "ABCDE...Z". The expected value is 5*/
  oaUnitAssertEqual("STRPOS-CHECK-E", strpos("ABCDE...Z", "E"), 5);
  oaUnitAssertEqual("STRPOS-CHECK-E-AS-STRING", (string)strpos("ABCDE...Z", "E"), "5");
  //The following condition does not work due to the different variable types
  oaUnitAssertEqual("STRPOS-CHECK-E-AS-STRING", strpos("ABCDE...Z", "E"), makeDynFloat(5));
}

Assignment

CTRL OA Unit DLL

Availability

CTRL

See also

CTRL OA Unit, Basics