VerificationTest

VerificationTest[input]

runs a verification test to determine whether input evaluates to True, without issuing messages.

VerificationTest[input,expected]

tests whether input evaluates to expected, without issuing messages.

VerificationTest[input,expected,messages]

tests whether input evaluates to expected, generating the list of message names messages.

Details and Options

Examples

open allclose all

Basic Examples  (3)

Test whether the input evaluates to True:

Test whether the input evaluates to the expected output:

Input evaluates to the expected output but gives messages:

Add the expected message:

Scope  (2)

Basic Uses  (2)

Perform a test and present the results in a Dataset:

Test if the results of an NIntegrate are numerically equivalent to Integrate, by using an absolute tolerance:

This can also be done by using the SameTest option:

Options  (7)

MemoryConstraint  (1)

Run a test until a memory limit is exceeded:

SameTest  (4)

Test whether the input is an integer:

Test if the absolute precision of the input is at least 10-12:

Test if the relative precision is at least 10-5:

Test if two expressions are equivalent after simplification:

TestID  (1)

TimeConstraint  (1)

Terminate the test if it takes more than one second:

Possible Issues  (5)

The expected output is evaluated before comparison with the actual output:

Messages generated on evaluation of expected output are not accounted for in the expected messages:

If both actual and expected output encounter a time constraint or memory constraint, the test is reported to have succeeded:

This is because both the actual and expected output evaluated to a Failure:

If SameTest does not evaluate to True or False, an outcome of "Error" is reported:

Tests for functions that produce Graphics or special typesetting may produce unexpected results:

This is because the input expressions and the output are not SameQ:

Introduced in 2014
 (10.0)