Module: Minitest::Proptest

Defined in:
lib/minitest/proptest.rb,
lib/minitest/proptest/gen.rb,
lib/minitest/proptest/status.rb,
lib/minitest/proptest/version.rb,
lib/minitest/proptest/property.rb,
lib/minitest/proptest/gen/value_generator.rb

Defined Under Namespace

Classes: Gen, Property, Status

Constant Summary collapse

DEFAULT_RANDOM =
Random.method(:new)
DEFAULT_MAX_SUCCESS =
100
DEFAULT_MAX_DISCARD_RATIO =
10
DEFAULT_MAX_SIZE =
0x100
DEFAULT_MAX_SHRINKS =
(((1 << (1.size * 8)) - 1) / 2)
DEFAULT_DB_LOCATION =
File.join(Dir.pwd, '.proptest_failures.yml')
VERSION =
'0.3.0'

Class Method Summary collapse

Class Method Details

.max_discard_ratioObject



110
111
112
# File 'lib/minitest/proptest.rb', line 110

def self.max_discard_ratio
  self.instance_variable_get(:@_max_discard_ratio)
end

.max_discard_ratio=(discards) ⇒ Object



82
83
84
# File 'lib/minitest/proptest.rb', line 82

def self.max_discard_ratio=(discards)
  self.instance_variable_set(:@_max_discard_ratio, discards)
end

.max_shrinksObject



118
119
120
# File 'lib/minitest/proptest.rb', line 118

def self.max_shrinks
  self.instance_variable_get(:@_max_shrinks)
end

.max_shrinks=(shrinks) ⇒ Object



90
91
92
# File 'lib/minitest/proptest.rb', line 90

def self.max_shrinks=(shrinks)
  self.instance_variable_set(:@_max_shrinks, shrinks)
end

.max_sizeObject



114
115
116
# File 'lib/minitest/proptest.rb', line 114

def self.max_size
  self.instance_variable_get(:@_max_size)
end

.max_size=(size) ⇒ Object



86
87
88
# File 'lib/minitest/proptest.rb', line 86

def self.max_size=(size)
  self.instance_variable_set(:@_max_size, size)
end

.max_successObject



106
107
108
# File 'lib/minitest/proptest.rb', line 106

def self.max_success
  self.instance_variable_get(:@_max_success)
end

.max_success=(success) ⇒ Object



78
79
80
# File 'lib/minitest/proptest.rb', line 78

def self.max_success=(success)
  self.instance_variable_set(:@_max_success, success)
end

.record_failure(file, classname, methodname, generated) ⇒ Object



130
131
132
133
# File 'lib/minitest/proptest.rb', line 130

def self.record_failure(file, classname, methodname, generated)
  self.instance_variable_get(:@_results)
      .record_failure(file, classname, methodname, generated)
end

.reporterObject



140
141
142
143
144
145
146
147
# File 'lib/minitest/proptest.rb', line 140

def self.reporter
  return self.instance_variable_get(:@_results) if self.instance_variable_defined?(:@_results)

  reporter = Minitest::ResultsDatabase.new(result_db)
  self.instance_variable_set(:@_results, reporter)

  reporter
end

.result_dbObject



122
123
124
# File 'lib/minitest/proptest.rb', line 122

def self.result_db
  self.instance_variable_get(:@_result_db)
end

.result_db=(location) ⇒ Object



94
95
96
# File 'lib/minitest/proptest.rb', line 94

def self.result_db=(location)
  self.instance_variable_set(:@_result_db, File.expand_path(location))
end

.seedObject



102
103
104
# File 'lib/minitest/proptest.rb', line 102

def self.seed
  self.instance_variable_get(:@_random_seed)
end

.set_seed(seed) ⇒ Object



74
75
76
# File 'lib/minitest/proptest.rb', line 74

def self.set_seed(seed)
  self.instance_variable_set(:@_random_seed, seed)
end

.strike_failure(file, classname, methodname) ⇒ Object



135
136
137
138
# File 'lib/minitest/proptest.rb', line 135

def self.strike_failure(file, classname, methodname)
  self.instance_variable_get(:@_results)
      .strike_failure(file, classname, methodname)
end

.use_db!(use = true) ⇒ Object



98
99
100
# File 'lib/minitest/proptest.rb', line 98

def self.use_db!(use = true)
  self.instance_variable_set(:@_use_db, use)
end

.use_db?Boolean

Returns:

  • (Boolean)


126
127
128
# File 'lib/minitest/proptest.rb', line 126

def self.use_db?
  self.instance_variable_get(:@_use_db)
end