Method: Fuzzer#fuzz
- Defined in:
- lib/gems/json_pure-1.1.3/tools/fuzz.rb
#fuzz(current = nil) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/gems/json_pure-1.1.3/tools/fuzz.rb', line 54 def fuzz(current = nil) if @n > 0 case current when nil @n -= 1 current = fuzz [ Hash, Array ][rand(2)].new when Array while @n > 0 @n -= 1 current << case p = make_pick when Array, Hash fuzz(p) else p end end when Hash while @n > 0 @n -= 1 current[random_string] = case p = make_pick when Array, Hash fuzz(p) else p end end end end current end |