Test
Test[description,expression,expectedValue]⟹test
returns an executable test which will evaluate expression and determine if it matches expectedValue.
Details
- The following Options MUST be specified as RuleDelayed: Messages,SetUp,TearDown,Variables,Stubs.
- The function definitions specified in the Stubs Options list are only applicable during the execution of the test. During the execution of the test, all previously specified definitions for the stubbed out symbols will be ignored and after the test is executed the stubbed out definitions will be forgotten.
- The 'Stubs' Options differentiates between Set & SetDelayed calls. A SetDelayed call will clear all definitions for the symbol before applying the Stub definition, whereas a Set call will prepend the definition to the existing DownValues for the symbol.
- The 'Set' Stubs (which prepend DownValues) works by copying all the DownValues/OwnValues/UpValues/Options/Attributes for a symbol during a test and as a result will not work with built in Mathematica symbols whose DownValues, OwnValues, etc., are not exposed. However, The SetDelayed method for clearing the symbol will always work.
-
HoldRest
Input
Output
General Options