genJSON returns a valid JSON document generated from the grammar. The output is always valid JSON per RFC 8259 (the corpus-sanity test asserts json.Valid on every generated document). Depth controls recursion: at depth >= maxGenDepth the generator emits only scalars to bound the output size and str
(r *rand.Rand, depth int)
| 154 | // Depth controls recursion: at depth >= maxGenDepth the generator emits |
| 155 | // only scalars to bound the output size and stress the base cases. |
| 156 | func genJSON(r *rand.Rand, depth int) []byte { |
| 157 | var buf []byte |
| 158 | genValue(r, depth, &buf) |
| 159 | return buf |
| 160 | } |
| 161 | |
| 162 | // genValue appends one JSON value to buf, chosen from a weighted |
| 163 | // distribution that favors containers at shallow depth (to exercise |
no test coverage detected