typelift/SwiftCheck

Possible flaw in `Double.shrink` (never ends for property)

griotspeak opened this issue · 1 comments

Version

e30300f

Environment

macOS 10.12.1 (16B2555)

Description

shrink will, effectively, never successfully yield an end result for this property.

Steps To Reproduce

reportProperty("odd shrink case") <- forAll { (n : Double) in
    let left = pow(n, 0.5)
    let right = sqrt(n)
    return left == right
}

Expected Result

In a not IEEE 754 world, they should be equal. I suspect that floating point tomfoolery means that the property doesn't hold in most cases but regardless of all of that, the testing the property should end in a reasonable amount of time.

Actual Result

The property 'never' finishes testing if it hits a failing case.

Interestingly it seems QuickCheck itself has moved on from shrinking with an unfold the way I've got it now. I think that might be the way to go.