Checks constraint to return true value for random generated input parameters with Arbitrary template.
checkConstraint!((int a, int b) => a + b == b + a); assertThrown!Error(checkConstraint!((int a, int b) => abs(a) < 100 && abs(b) < 100)); assertThrown!Error(checkConstraint!((bool a, bool b) => a && !b));
Subject to the terms of the MIT license, as written in the included LICENSE file.
© 2014 Anton Gushcha
Module defines routines for checking constraints in automated mode.
To perform automated check user should define a delegate, that takes some arguments and by design should return always true. The checkConstraint function generates arguments via Arbitrary!T template and checks the delegate to be true.
If constrained returned false, checkConstraint function tries to shrink input parameters to find minimum fail case (of course, it shrink function of corresponding Arbitrary template is properly defined).