SwiftCheck now has a new in-library pseudo-RNG that enables tests to be replayed argument-for-argument with just two seed values.
For example, given this property:
property("Obviously wrong") <- forAll { (x : Int, y : Int, c : Int) in (x > y) ==> x + c < y + c }
SwiftCheck takes care of printing all the nitty-gritty details.
So all you have to do is feed those values back into the testing loop:
let (seedl, seedr) = (618383975, 8314)
let replayArgs = CheckerArguments(replay: .Some(StdGen(seedl, seedr), 1))
property("Obviously wrong", arguments: replayArgs) <- forAll { (x : Int, y : Int, c : Int) in (x > y) ==> x + c < y + c }.verbose
In addition, this release comes with a number of bug fixes and improvements:
- SwiftCheck now uses the
@exported
attribute withXCTest
so you can justimport SwiftCheck
without needing toimport XCTest
. - Test cases that throw exceptions now also print counterexamples. Whoops!
- The
CheckerArguments
structure is now easier to create and use (h/t @kballard). - The
StdGen
structure is now public.