PropertyDamage.Shrinker.Config (PropertyDamage v0.2.0)

View Source

Configuration for the shrinking process.

Controls shrinking behavior including thresholds, limits, and strategies.

Fields

  • :granularity_threshold - Minimum sequence length before switching from hierarchical to linear shrinking. Below this threshold, linear shrinking is more efficient. Default: 8

  • :max_iterations - Maximum number of shrink attempts before giving up. Prevents infinite loops in edge cases. Default: 1000

  • :max_time_ms - Maximum time in milliseconds for shrinking. Useful for large failing sequences. Default: 30000 (30 seconds)

  • :shrink_arguments - Whether to attempt argument shrinking after sequence shrinking. Can make failures more minimal but takes longer. Default: true

Example

config = %Config{
  granularity_threshold: 4,
  max_iterations: 500,
  max_time_ms: 10_000,
  shrink_arguments: false
}

Summary

Functions

Create a new config with defaults.

Create a new config with custom options.

Types

t()

@type t() :: %PropertyDamage.Shrinker.Config{
  granularity_threshold: pos_integer(),
  max_iterations: pos_integer(),
  max_time_ms: pos_integer(),
  shrink_arguments: boolean()
}

Functions

new()

@spec new() :: t()

Create a new config with defaults.

Examples

iex> config = PropertyDamage.Shrinker.Config.new()
iex> config.granularity_threshold
8

new(opts)

@spec new(keyword()) :: t()

Create a new config with custom options.

Options

See module documentation for available options.

Examples

iex> config = PropertyDamage.Shrinker.Config.new(max_iterations: 100)
iex> config.max_iterations
100