Module: Pbt
- Defined in:
- lib/pbt.rb,
lib/pbt/version.rb,
lib/pbt/check/case.rb,
lib/pbt/check/tosser.rb,
lib/pbt/check/property.rb,
lib/pbt/stateful/property.rb,
lib/pbt/arbitrary/constant.rb,
lib/pbt/arbitrary/arbitrary.rb,
lib/pbt/check/configuration.rb,
lib/pbt/check/runner_methods.rb,
lib/pbt/reporter/run_details.rb,
lib/pbt/check/runner_iterator.rb,
lib/pbt/reporter/run_execution.rb,
lib/pbt/arbitrary/map_arbitrary.rb,
lib/pbt/arbitrary/array_arbitrary.rb,
lib/pbt/arbitrary/tuple_arbitrary.rb,
lib/pbt/arbitrary/choose_arbitrary.rb,
lib/pbt/arbitrary/filter_arbitrary.rb,
lib/pbt/arbitrary/one_of_arbitrary.rb,
lib/pbt/arbitrary/arbitrary_methods.rb,
lib/pbt/arbitrary/integer_arbitrary.rb,
lib/pbt/arbitrary/constant_arbitrary.rb,
lib/pbt/reporter/run_details_reporter.rb,
lib/pbt/arbitrary/fixed_hash_arbitrary.rb
Defined Under Namespace
Modules: Arbitrary, Check, Reporter, Stateful Classes: InvalidConfiguration, PropertyFailure
Constant Summary collapse
- VERSION =
"0.7.0"
Class Method Summary collapse
-
.property(*args, **kwargs, &predicate) ⇒ Property
Create a property-based test with arbitraries.
-
.stateful(model:, sut:, max_steps: 20) ⇒ Pbt::Stateful::Property
Create a stateful property-based test backed by a model and a SUT factory.
Methods included from Arbitrary::ArbitraryMethods
alphanumeric_char, alphanumeric_string, array, ascii_char, ascii_string, boolean, char, choose, constant, date, fixed_hash, float, future_date, future_time, hash, hexa, hexa_string, integer, nat, nil, one_of, past_date, past_time, printable_ascii_char, printable_ascii_string, printable_char, printable_string, set, symbol, time, tuple
Methods included from Check::RunnerMethods
Methods included from Check::Tosser
Methods included from Check::ConfigurationMethods
Class Method Details
.property(*args, **kwargs, &predicate) ⇒ Property
Create a property-based test with arbitraries. To run the test, pass the returned value to Pbt.assert method.
Be aware that using both positional and keyword arguments is not supported.
43 44 45 46 |
# File 'lib/pbt.rb', line 43 def self.property(*args, **kwargs, &predicate) arb = to_arbitrary(args, kwargs) Check::Property.new(arb, &predicate) end |
.stateful(model:, sut:, max_steps: 20) ⇒ Pbt::Stateful::Property
Create a stateful property-based test backed by a model and a SUT factory.
The returned object is compatible with Pbt.assert / Pbt.check.
The model object is expected to provide:
initial_statecommands(state)-> Array of command objects
Each command object is expected to provide:
namearguments(an arbitrary) orarguments(state)applicable?(state)-> bool orapplicable?(state, args)-> boolnext_state(state, args)run!(sut, args)-> resultverify!(before_state:, after_state:, args:, result:, sut:)
67 68 69 |
# File 'lib/pbt.rb', line 67 def self.stateful(model:, sut:, max_steps: 20) Stateful::Property.new(model:, sut:, max_steps:) end |