1
import Bow
2
import SwiftCheck
3

4
// MARK: Generator for Property-based Testing
5

6
extension Function1: Arbitrary where I: CoArbitrary & Hashable, O: Arbitrary {
7 1
    public static var arbitrary: Gen<Function1<I, O>> {
8 1
        return ArrowOf<I, O>.arbitrary.map { arrow in Function1(arrow.getArrow) }
9
    }
10
}
11

12
// MARK: Instance of `ArbitraryK` for `Function1`
13

14
extension Function1Partial: ArbitraryK where I: CoArbitrary & Hashable {
15 1
    public static func generate<A: Arbitrary>() -> Kind<Function1Partial<I>, A> {
16 1
        return Function1.arbitrary.generate
17
    }
18
}

Read our documentation on viewing source code .

Loading