diff --git a/Rakefile b/Rakefile
index 7fb47ba..f1b3abb 100644
--- a/Rakefile
+++ b/Rakefile
@@ -3,4 +3,11 @@ require "minitest/test_task"
Minitest::TestTask.create(:test)
+namespace :test do
+ desc "Run tests on Ruby file changes"
+ task :watch do
+ sh "fd .*.rb | entr -d rake test"
+ end
+end
+
task :default => :test
diff --git a/lib/minitest/thesis.rb b/lib/minitest/thesis.rb
index 7560336..ae42463 100644
--- a/lib/minitest/thesis.rb
+++ b/lib/minitest/thesis.rb
@@ -46,7 +46,7 @@ module Minitest
prev_failure = database[name]
- unless prev_failure.nil?
+ if prev_failure
choices = prev_failure.unpack("Q>*")
state.test_function(TestCase.for_choices(choices))
end
@@ -101,13 +101,10 @@ module Minitest
# Return True with probability `p`.
def weighted(p)
- if p.zero? || p.negative?
- result = forced_choice(0)
- elsif p >= 1
- result = forced_choice(1)
- else
- result = make_choice(1) { (@random.rand <= p) ? 1 : 0 }
- end
+ result = if p <= 0 then forced_choice(0)
+ elsif p >= 1 then forced_choice(1)
+ else make_choice(1) { (@random.rand <= p) ? 1 : 0 }
+ end
puts "weighted(#{p}): #{result}" if should_print?
@@ -118,7 +115,6 @@ module Minitest
# choice() had returned `n`. You almost never need this, but sometimes it
# can be a useful hint to the shrinker.
def forced_choice(n)
-
raise RangeError.new("Invalid choice #{n}") if n.bit_length > 64 || n.negative?
raise Frozen unless @status.nil?