AB.PropertyRunner (AB v0.2.1)

View Source

Executes property-based tests for functions based on their typespecs.

This module handles the runtime execution of property tests, including:

  • Generating test inputs from type specifications
  • Executing functions with timeouts
  • Validating outputs against type specifications
  • Providing detailed failure information for typespec correction

Summary

Functions

Runs a property test for a function with the given spec.

Runs a property test and returns detailed failure information including actual values.

Functions

run_property_test(module, function_name, input_types, output_type, opts)

@spec run_property_test(module(), atom(), [any()], any(), keyword()) :: :ok

Runs a property test for a function with the given spec.

Returns :ok on success or raises an ExUnit assertion failure.

run_property_test_with_details(module, function_name, input_types, output_type, opts)

@spec run_property_test_with_details(module(), atom(), [any()], any(), keyword()) ::
  {:ok, integer()} | {:error, map()}

Runs a property test and returns detailed failure information including actual values.

This is used by the mix task to capture failure details for typespec suggestions. Returns {:ok, count} on success or {:error, failure_details} on failure.