2015-10-17 00:17:48 +03:00
|
|
|
struct RangedDiff {
|
|
|
|
typealias Term = RangedTerm.Term
|
|
|
|
typealias Diff = Free<String, Patch<Term>>
|
|
|
|
|
2015-10-17 00:21:45 +03:00
|
|
|
let a: Term
|
|
|
|
let b: Term
|
2015-10-17 00:17:48 +03:00
|
|
|
let diff: Diff
|
|
|
|
}
|
|
|
|
|
2015-10-17 00:21:45 +03:00
|
|
|
extension RangedDiff: Arbitrary {
|
|
|
|
static let interpreter = Interpreter<Term>(equal: ==, comparable: const(true), cost: Diff.sum(Patch.difference))
|
|
|
|
|
|
|
|
static var arbitrary: Gen<RangedDiff> {
|
|
|
|
return RangedTerm.arbitrary.bind { a in
|
|
|
|
RangedTerm.arbitrary.fmap { b in
|
|
|
|
RangedDiff(a: a.term, b: b.term, diff: interpreter.run(a.term, b.term))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-17 00:17:48 +03:00
|
|
|
|
|
|
|
import Doubt
|
2015-10-17 00:21:45 +03:00
|
|
|
import Prelude
|
|
|
|
import SwiftCheck
|