Class: DFuzz::Fudge

Inherits:
Generator
  • Object
show all
Defined in:
lib/ruckus/dfuzz.rb

Overview

Generate Xi-F…Xi+F for each Xi in boundaries and fudge_factor F

Direct Known Subclasses

Byte, Integer, Long, Short

Instance Method Summary collapse

Constructor Details

#initialize(boundaries, fudge_factor, mask = nil) ⇒ Fudge

Returns a new instance of Fudge.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/ruckus/dfuzz.rb', line 21

def initialize(boundaries, fudge_factor, mask = nil)
    super() { |g|
        boundaries.each {|b|
            0.upto(fudge_factor) { |f|
                if (mask)
                    g.yield((b+f) & mask)
                    g.yield((b-f) & mask)
                else
                    g.yield b+f
                    g.yield b-f
                end
            }
        }
    }
end