module Forall::Matchers

Public Instance Methods

exhaustive(input) click to toggle source
# File lib/forall/matchers.rb, line 24
def exhaustive(input)
  Input.exhaustive(input)
end
forall(input) click to toggle source

@example:

describe "foo" do
  forall([1,2,3]).check                 {|x,c| c.skip if x.even?; (x*2+1).even? }
  forall(...).check(seed: 999)          {|x,c| c.skip if x.even?; (x*2+1).even? }
  forall(...).check(success_limit: 50)  {|x,c| c.skip if x.even?; (x*2+1).even? }
  forall(...).check(discard_limit: 0.10){|x,c| c.skip if x.even?; (x*2+1).even? }
  forall(...).check(shrink_limit: 10)   {|x,c| c.skip if x.even?; (x*2+1).even? }

  forall(lambda{|rnd, x| rnd.integer(x)}).
    check(0..9){|x,_| x.between?(0,9)}
end
# File lib/forall/matchers.rb, line 16
def forall(input)
  ForallMatcher.new(input)
end
sampled(input = nil, &block) click to toggle source
# File lib/forall/matchers.rb, line 20
def sampled(input = nil, &block)
  Input.sampled(input || block)
end