2015-10-16 19:28:16 +03:00
|
|
|
struct RangedTerm {
|
2015-10-16 22:05:01 +03:00
|
|
|
typealias Term = Cofree<String, Range<String.Index>>
|
2015-10-16 20:23:38 +03:00
|
|
|
let term: Term
|
2015-10-16 22:05:01 +03:00
|
|
|
let source: String
|
2015-10-19 18:37:13 +03:00
|
|
|
|
|
|
|
var stripped: UnannotatedTerm {
|
|
|
|
return UnannotatedTerm(term: term.map(const(())))
|
|
|
|
}
|
2015-10-16 19:28:16 +03:00
|
|
|
}
|
|
|
|
|
2015-10-16 22:06:27 +03:00
|
|
|
extension RangedTerm: Arbitrary {
|
|
|
|
static var arbitrary: Gen<RangedTerm> {
|
|
|
|
return UnannotatedTerm.arbitrary.fmap { $0.arranged }
|
|
|
|
}
|
2015-10-19 18:38:32 +03:00
|
|
|
|
|
|
|
static func shrink(term: RangedTerm) -> [RangedTerm] {
|
|
|
|
return UnannotatedTerm.shrink(term.stripped).map { $0.arranged }
|
|
|
|
}
|
2015-10-16 22:06:27 +03:00
|
|
|
}
|
|
|
|
|
2015-10-16 19:28:49 +03:00
|
|
|
|
2015-10-16 19:28:16 +03:00
|
|
|
@testable import Doubt
|
2015-10-16 21:26:46 +03:00
|
|
|
import Prelude
|
2015-10-16 19:28:49 +03:00
|
|
|
import SwiftCheck
|