mirror of
https://github.com/github/semantic.git
synced 2024-12-27 17:05:33 +03:00
Add a generator for symbols.
Right now just _<hex digit>
This commit is contained in:
parent
d413f24e57
commit
057a847f30
@ -76,6 +76,7 @@ struct UnannotatedTerm {
|
|||||||
|
|
||||||
extension UnannotatedTerm: Arbitrary {
|
extension UnannotatedTerm: Arbitrary {
|
||||||
static var arbitrary: Gen<UnannotatedTerm> {
|
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 leaf: Gen<Term> = String.arbitrary.fmap { Term((), .Leaf($0)) }
|
||||||
let indexed: Gen<Term> = Gen.sized { n in
|
let indexed: Gen<Term> = Gen.sized { n in
|
||||||
Gen<Int>.choose((0, n)).bind { n in
|
Gen<Int>.choose((0, n)).bind { n in
|
||||||
|
Loading…
Reference in New Issue
Block a user