1
1
mirror of https://github.com/github/semantic.git synced 2024-12-26 00:12:29 +03:00

Add a generator for symbols.

Right now just _<hex digit>
This commit is contained in:
Rob Rix 2015-10-16 15:21:27 -04:00
parent d413f24e57
commit 057a847f30

View File

@ -76,6 +76,7 @@ struct UnannotatedTerm {
extension UnannotatedTerm: Arbitrary {
static var arbitrary: Gen<UnannotatedTerm> {
let symbol: Gen<String> = Gen<Int>.choose((0, 15)).fmap { "_\($0)" }
let leaf: Gen<Term> = String.arbitrary.fmap { Term((), .Leaf($0)) }
let indexed: Gen<Term> = Gen.sized { n in
Gen<Int>.choose((0, n)).bind { n in