Assert
The Assert function allows adding run-time checks to assert the validity of predicates that should hold true in a function’s processing.
Whenever the condition specified in an Assert fails, an error will occur to indicate the fact and the function’s processing will halt.
Properties
Section titled “Properties”Assertion
Section titled “Assertion”The type of assertion to evaluate.
See the list of Assertions below describing specific additional properties relevant to each type of assertion.
Message
Section titled “Message”The message to include in the error when the assertion fails.
Assertions
Section titled “Assertions”Are equal
Section titled “Are equal”Verifies that the two values specified are equal.
- Expected: The expected value.
- Actual: The actual value.
- Tolerance: Optional. In case the values are numeric, this specifies the maximum acceptable difference between the expected and actual values.
Are not equal
Section titled “Are not equal”Verifies that the two items specified hold different values.
- Expected: The expected value.
- Actual: The actual value.
Contains
Section titled “Contains”Asserts that the specified item is contained in the given list.
- Item: The item to look for in the list.
- List: The list to search in for the specified item.
Greater
Section titled “Greater”Verifies that the first value is greater than the second value.
- X: The first value, expected to be greater.
- Y: The second value, expected to be less than the first.
Greater or equal
Section titled “Greater or equal”Verifies that the first value is greater than or equal to the second value.
- X: The first value, expected to be greater or equal.
- Y: The second value, expected to be less than or equal to the first.
Verifies that the first value is less than the second value.
- X: The first value, expected to be less.
- Y: The second value, expected to be greater than the first.
Less or equal
Section titled “Less or equal”Verifies that the first value is less than or equal to the second value.
- X: The first value, expected to be less than or equal.
- Y: The second value, expected to be greater than or equal to the first.
Is true
Section titled “Is true”Asserts that a condition is true.
- Condition: The condition to evaluate.
Is false
Section titled “Is false”Asserts that a condition is false.
- Condition: The condition to evaluate.
Is null
Section titled “Is null”Verifies that the item provided holds a null value.
- Item: The item to test for null.
Is not null
Section titled “Is not null”Verifies that the item provided does hold a value and is not null.
- Item: The item to test for null.
Is empty
Section titled “Is empty”Asserts that a list or string is empty.
- Item: The list or string to test for.
Is not empty
Section titled “Is not empty”Asserts that a list or string is not empty.
- Item: The list or string to test for.
Fails unconditionally.
Use to verify that a specific part of a function’s processing never executes.