Class: Watobo::FuzzCounter
- Inherits:
-
FuzzGenerator
- Object
- FuzzGenerator
- Watobo::FuzzCounter
- Defined in:
- lib/watobo/core/fuzz_gen.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#start ⇒ Object
readonly
Returns the value of attribute start.
-
#step ⇒ Object
readonly
Returns the value of attribute step.
-
#stop ⇒ Object
readonly
Returns the value of attribute stop.
Attributes inherited from FuzzGenerator
#actions, #genType, #info, #name, #numRequests
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(fuzzer_tag, prefs) ⇒ FuzzCounter
constructor
A new instance of FuzzCounter.
Methods inherited from FuzzGenerator
#addAction, #is_generator?, #removeAction, #run
Constructor Details
#initialize(fuzzer_tag, prefs) ⇒ FuzzCounter
Returns a new instance of FuzzCounter.
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/watobo/core/fuzz_gen.rb', line 141 def initialize(fuzzer_tag, prefs) super(fuzzer_tag) @genType = "Counter" @start = prefs[:start] @stop = prefs[:stop] @count = prefs[:count] || 0 @step = ( prefs[:step] and prefs[:step] != 0 ) ? prefs[:step] : 1 if @stop < @start and @step > 0 then @step = @step * -1 end @info = "start=#{@start}/stop=#{@stop}/step=#{@step}" @numRequests = (( @stop - @start ) / @step).abs end |
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
123 124 125 |
# File 'lib/watobo/core/fuzz_gen.rb', line 123 def count @count end |
#start ⇒ Object (readonly)
Returns the value of attribute start.
123 124 125 |
# File 'lib/watobo/core/fuzz_gen.rb', line 123 def start @start end |
#step ⇒ Object (readonly)
Returns the value of attribute step.
123 124 125 |
# File 'lib/watobo/core/fuzz_gen.rb', line 123 def step @step end |
#stop ⇒ Object (readonly)
Returns the value of attribute stop.
123 124 125 |
# File 'lib/watobo/core/fuzz_gen.rb', line 123 def stop @stop end |
Instance Method Details
#generate ⇒ Object
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/watobo/core/fuzz_gen.rb', line 125 def generate return false if @start.nil? return false if @stop.nil? and @count.nil? if @stop == 0 and @count > 0 then @stop = @start + @count end return 0 if @start == @stop @start.step(@stop, @step) do |i| yield i.to_s end end |