PropertyDamage.Differential.Result (PropertyDamage v0.2.0)

View Source

Result from differential testing.

Contains comparison results, divergences, and performance metrics.

Summary

Functions

Get the number of divergences found.

Check if the result indicates divergence was found.

Check if the result indicates all targets are equivalent.

Format the result for display.

Get metrics for a specific target.

Types

divergence()

@type divergence() :: %{
  :seed => integer(),
  :command => struct(),
  :step => non_neg_integer(),
  :reference_result => term(),
  :results => map(),
  optional(:divergent_target) => String.t(),
  optional(:divergent_result) => term(),
  optional(:run_index) => non_neg_integer(),
  optional(:reference_name) => String.t()
}

metrics()

@type metrics() :: %{
  optional(:latency_p50) => float(),
  optional(:latency_p95) => float(),
  optional(:latency_p99) => float(),
  optional(:latency_mean) => float(),
  optional(:latency_min) => float(),
  optional(:latency_max) => float(),
  optional(:total_commands) => non_neg_integer(),
  optional(:error_count) => non_neg_integer(),
  optional(:error_rate) => float(),
  optional(:error) => atom(),
  optional(:reason) => term()
}

t()

@type t() :: %PropertyDamage.Differential.Result{
  baseline: String.t() | nil,
  divergences: [divergence()],
  execution: :interleaved | :sequential,
  metrics: %{required(String.t()) => metrics()},
  mode: :correctness | :performance | :both,
  reference: String.t() | nil,
  runs: non_neg_integer(),
  seed: integer(),
  status: :equivalent | :divergent | :complete,
  targets: [String.t()]
}

Functions

divergence_count(result)

@spec divergence_count(t()) :: non_neg_integer()

Get the number of divergences found.

divergent?(result)

@spec divergent?(t()) :: boolean()

Check if the result indicates divergence was found.

equivalent?(result)

@spec equivalent?(t()) :: boolean()

Check if the result indicates all targets are equivalent.

format(result, opts \\ [])

@spec format(
  t(),
  keyword()
) :: String.t()

Format the result for display.

metrics_for(result, target_name)

@spec metrics_for(t(), String.t()) :: metrics() | nil

Get metrics for a specific target.