Module: Jfuzz

Defined in:
lib/jfuzz.rb,
lib/jfuzz/version.rb,
lib/jfuzz/configuration.rb,
lib/jfuzz/schema_fuzzer.rb,
lib/jfuzz/property_fuzzer.rb,
lib/jfuzz/generators/generator.rb,
lib/jfuzz/generators/enum_generator.rb,
lib/jfuzz/generators/array_generator.rb,
lib/jfuzz/generators/number_generator.rb,
lib/jfuzz/generators/object_generator.rb,
lib/jfuzz/generators/string_generator.rb,
lib/jfuzz/generators/boolean_generator.rb,
lib/jfuzz/generators/integer_generator.rb

Defined Under Namespace

Classes: ArrayGenerator, BooleanGenerator, Configuration, EnumGenerator, Generator, IntegerGenerator, NumberGenerator, ObjectGenerator, PropertyFuzzer, SchemaFuzzer, StringGenerator

Constant Summary collapse

VERSION =
"0.2.0"

Class Method Summary collapse

Class Method Details

.configurationObject



17
18
19
# File 'lib/jfuzz.rb', line 17

def self.configuration
  @configuration ||= Configuration.new
end

.fuzz(schema_path) ⇒ Object



21
22
23
# File 'lib/jfuzz.rb', line 21

def self.fuzz(schema_path)
  SchemaFuzzer.new(schema_path).fuzz
end

.register_default_generatorsObject



65
66
67
68
69
70
71
72
73
# File 'lib/jfuzz.rb', line 65

def self.register_default_generators
  register_generator(BooleanGenerator)
  register_generator(IntegerGenerator)
  register_generator(NumberGenerator)
  register_generator(EnumGenerator)
  register_generator(ObjectGenerator)
  register_generator(ArrayGenerator)
  register_generator(StringGenerator)
end

.register_generator(generator_klass) ⇒ Object



36
37
38
39
# File 'lib/jfuzz.rb', line 36

def self.register_generator(generator_klass)
  type = generator_klass.type
  generators[type] = generator_klass
end

.set_defaultsObject



75
76
77
78
79
80
81
82
83
84
# File 'lib/jfuzz.rb', line 75

def self.set_defaults
  set_nil_probability(0.2)
  set_true_probability(0.5)
  set_min_integer(-9999999)
  set_max_integer(9999999)
  set_min_array_length(1)
  set_max_array_length(100)

  register_default_generators
end

.set_max_array_length(val) ⇒ Object



61
62
63
# File 'lib/jfuzz.rb', line 61

def self.set_max_array_length(val)
  configuration.max_array_length = val
end

.set_max_integer(val) ⇒ Object



53
54
55
# File 'lib/jfuzz.rb', line 53

def self.set_max_integer(val)
  configuration.max_integer = val
end

.set_min_array_length(val) ⇒ Object



57
58
59
# File 'lib/jfuzz.rb', line 57

def self.set_min_array_length(val)
  configuration.min_array_length = val
end

.set_min_integer(val) ⇒ Object



49
50
51
# File 'lib/jfuzz.rb', line 49

def self.set_min_integer(val)
  configuration.min_integer = val
end

.set_nil_probability(val) ⇒ Object



41
42
43
# File 'lib/jfuzz.rb', line 41

def self.set_nil_probability(val)
  configuration.nil_probability = val
end

.set_true_probability(val) ⇒ Object



45
46
47
# File 'lib/jfuzz.rb', line 45

def self.set_true_probability(val)
  configuration.true_probability = val
end