Skip to contents

Compare the result produced by an edited replay project with the original result captured by unpack_call(). The comparison distinguishes exact identity, equality within all.equal() tolerance, structural differences, and values that are not meaningfully comparable.

Usage

compare_call(
  custom_result,
  original_result,
  ignore = character(),
  tolerance = sqrt(.Machine$double.eps)
)

Arguments

custom_result

The result produced by the customized replay call.

original_result

The original result captured by unpack_call().

ignore

Character vector of top-level list element names to remove from both results before comparison, when both results are lists.

tolerance

Relative-difference tolerance used both by the overall all.equal() comparison and by the per-element numeric-difference summary, so a customization that only introduces floating-point noise (different BLAS, different summation order, ...) is not counted the same as one that meaningfully changes the result. Defaults to sqrt(.Machine$double.eps), matching all.equal.numeric()'s default.

Value

An insider_comparison object with status, message, details, and ignore fields.

Examples

compare_call(c(1, 2), c(1, 2))
#> 
#> ── insideR comparison ──────────────────────────────────────────────────────────
#> Status: identical
#> custom_result and original_result are identical.
#> 
#> ── Details ──
#> 
#> • No differences detected by identical().
compare_call(
  list(value = 1, date = Sys.time()),
  list(value = 1, date = Sys.time() + 1),
  ignore = "date"
)
#> 
#> ── insideR comparison ──────────────────────────────────────────────────────────
#> Status: identical
#> custom_result and original_result are identical.
#> Ignored top-level field: date
#> 
#> ── Details ──
#> 
#> • No differences detected by identical().