Class: PropCheck::Property::Configuration
- Inherits:
-
Struct
- Object
- Struct
- PropCheck::Property::Configuration
- Defined in:
- lib/prop_check/property/configuration.rb
Overview
Configure PropCheck
Configurations can be set globally, but also overridden on a per-generator basis. c.f. PropCheck.configure, PropCheck.configuration and PropCheck::Property#with_config
## Available options
-
‘verbose:` When true, shows detailed options of the data generation and shrinking process. (Default: false)
-
‘n_runs:` The amount of iterations each `forall` is being run.
-
‘max_generate_attempts:` The amount of times the library tries a generator in total
before raising `Errors::GeneratorExhaustedError`. c.f. `PropCheck::Generator#where`. (Default: 10_000)
-
‘max_shrink_steps:` The amount of times shrinking is attempted. (Default: 10_000)
-
‘max_consecutive_attempts:`
-
‘max_consecutive_attempts:` The amount of times the library tries a filtered generator consecutively
again before raising `Errors::GeneratorExhaustedError`. c.f. `PropCheck::Generator#where`. (Default: 10_000)
-
‘default_epoch:` The ’base’ value to use for date/time generators like
`PropCheck::Generators#date` `PropCheck::Generators#future_date` `PropCheck::Generators#time`, etc. (Default: `DateTime.now`)
-
‘resize_function` A proc that can be used to resize all generators.
Takes the current size as integer and should return a new integer.
(Default: ‘proc { |size| size }`)
Instance Attribute Summary collapse
-
#default_epoch ⇒ Object
Returns the value of attribute default_epoch.
-
#max_consecutive_attempts ⇒ Object
Returns the value of attribute max_consecutive_attempts.
-
#max_generate_attempts ⇒ Object
Returns the value of attribute max_generate_attempts.
-
#max_shrink_steps ⇒ Object
Returns the value of attribute max_shrink_steps.
-
#n_runs ⇒ Object
Returns the value of attribute n_runs.
-
#resize_function ⇒ Object
Returns the value of attribute resize_function.
-
#verbose ⇒ Object
Returns the value of attribute verbose.
Instance Method Summary collapse
-
#initialize(verbose: false, n_runs: 100, max_generate_attempts: 10_000, max_shrink_steps: 10_000, max_consecutive_attempts: 30, default_epoch: DateTime.now, resize_function: proc { |size| size }) ⇒ Configuration
constructor
A new instance of Configuration.
- #merge(other) ⇒ Object
Constructor Details
#initialize(verbose: false, n_runs: 100, max_generate_attempts: 10_000, max_shrink_steps: 10_000, max_consecutive_attempts: 30, default_epoch: DateTime.now, resize_function: proc { |size| size }) ⇒ Configuration
Returns a new instance of Configuration.
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/prop_check/property/configuration.rb', line 34 def initialize( verbose: false, n_runs: 100, max_generate_attempts: 10_000, max_shrink_steps: 10_000, max_consecutive_attempts: 30, default_epoch: DateTime.now, resize_function: proc { |size| size } ) super end |
Instance Attribute Details
#default_epoch ⇒ Object
Returns the value of attribute default_epoch
24 25 26 |
# File 'lib/prop_check/property/configuration.rb', line 24 def default_epoch @default_epoch end |
#max_consecutive_attempts ⇒ Object
Returns the value of attribute max_consecutive_attempts
24 25 26 |
# File 'lib/prop_check/property/configuration.rb', line 24 def max_consecutive_attempts @max_consecutive_attempts end |
#max_generate_attempts ⇒ Object
Returns the value of attribute max_generate_attempts
24 25 26 |
# File 'lib/prop_check/property/configuration.rb', line 24 def max_generate_attempts @max_generate_attempts end |
#max_shrink_steps ⇒ Object
Returns the value of attribute max_shrink_steps
24 25 26 |
# File 'lib/prop_check/property/configuration.rb', line 24 def max_shrink_steps @max_shrink_steps end |
#n_runs ⇒ Object
Returns the value of attribute n_runs
24 25 26 |
# File 'lib/prop_check/property/configuration.rb', line 24 def n_runs @n_runs end |
#resize_function ⇒ Object
Returns the value of attribute resize_function
24 25 26 |
# File 'lib/prop_check/property/configuration.rb', line 24 def resize_function @resize_function end |
#verbose ⇒ Object
Returns the value of attribute verbose
24 25 26 |
# File 'lib/prop_check/property/configuration.rb', line 24 def verbose @verbose end |
Instance Method Details
#merge(other) ⇒ Object
46 47 48 |
# File 'lib/prop_check/property/configuration.rb', line 46 def merge(other) Configuration.new(**to_h.merge(other.to_h)) end |