ohbarye / pbt

Property-Based Testing tool for Ruby, supporting multiple concurrency methods (Ractor, multiprocesses, multithreads).
https://rubygems.org/gems/pbt
MIT License
207 stars 4 forks source link

Add tuple arbitrary #6

Closed ohbarye closed 6 months ago

ohbarye commented 6 months ago

Change

This pull request adds TupleArbitrary to handle a tuple of several arbitraries as one object.

Besides, this allows to pass multiple arbitraries to Pbt.property and its predicate method.

Pbt.assert do
  Pbt.property(Pbt.integer, Pbt.integer) do |x, y|
    raise if PbtTestTarget.biggest([x, y]) != [x, y].max
  end
end