Skip to content

VerificationTest ​

Evaluates input and compares it with expected, returning a TestResultObject.

✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram LanguageVerificationTest!
VerificationTest(input)Success whenever input evaluates without erroring or aborting.
VerificationTest(input, expected)compares against expected by structural sameness (SameTest's default).
VerificationTest(input, expected, SameTest -> f, TimeConstraint -> t, MemoryConstraint -> b, TestID -> "…")options as trailing rules, Wolfram's OptionsPattern way.
Typed signatures
TypePackageApplies
(any*) time -> expression<TestResultObject>evaluationalways

Domain: Controlling evaluation

Details
  • Held: input does not evaluate until the constraints (TimeConstraint, MemoryConstraint) are in place around it.
  • Outcome is one of "Success", "Failure", "Error" (input raised, or a constraint was requested this process cannot honor) or "Aborted" (TimeConstraint fired).
  • MemoryConstraint in-process reports Error rather than silently skipping the check — real enforcement needs the isolated evaluator, where it comes from the worker's own resourceLimits.
  • TestResultObject's operands are rules — Outcome, Input, ExpectedOutput, ActualOutput, AbsoluteTimeUsed (seconds, rounded to the millisecond), and TestID when given — the same rule spelling @enumeratio/engine's optionsOf/ruleOf read elsewhere in this codebase.

Examples

Basic #

input matches expected

live ↗

input evaluates but does not match expected

live ↗

one argument: a predicate that evaluates to True

live ↗
Scope #

a symbolic computation checked against its expected form

live ↗

a TestID is carried into the result

live ↗

a SameTest with a tolerance: ∣22/7−3.14∣<0.01|22/7 - 3.14| < 0.01 passes

live ↗
Possible issues #

MemoryConstraint in-process is an Error, not a silently-ignored option

live ↗

one argument succeeds whenever input evaluates without an error

live ↗

the default comparison is structural: mathematically equal but differently written is a Failure

live ↗
About
Examples12
Checked againstWolfram Language 10 differ2 unevaluated
CrosswalkWolfram Language