1
1
mirror of https://github.com/github/semantic.git synced 2024-12-24 23:42:31 +03:00
semantic/prototype/DoubtTests/RangedTerm.swift

25 lines
523 B
Swift
Raw Normal View History

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
var stripped: UnannotatedTerm {
return UnannotatedTerm(term: term.map(const(())))
}
}
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 19:28:49 +03:00
@testable import Doubt
import Prelude
2015-10-16 19:28:49 +03:00
import SwiftCheck