1
1
mirror of https://github.com/github/semantic.git synced 2024-12-18 20:31:55 +03:00
semantic/prototype/DoubtTests/RangedTerm.swift
2015-10-19 11:38:32 -04:00

25 lines
523 B
Swift

struct RangedTerm {
typealias Term = Cofree<String, Range<String.Index>>
let term: Term
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 }
}
static func shrink(term: RangedTerm) -> [RangedTerm] {
return UnannotatedTerm.shrink(term.stripped).map { $0.arranged }
}
}
@testable import Doubt
import Prelude
import SwiftCheck