1
1
mirror of https://github.com/github/semantic.git synced 2025-01-06 15:40:02 +03:00
semantic/prototype/DoubtTests/RangedDiff.swift

26 lines
550 B
Swift
Raw Normal View History

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