← Tools

cpl stress

run against a brute on random inputs; shrink the failure

usage: cpl stress <file.cp> [options]

Runs the solution and a brute on random inputs made from the file's
`read()` types, stops at the first case they disagree on, shrinks it, and
saves it to <file>.tests/ as a regression test.

The brute, the checker and the interactor are the file's own `@brute(main)`
(or `@alt(program)`), `@checker` (or `@check`) and `@interactor` fns unless
an option names a program: a .cpp file (built with g++), a .py file, or an
executable.

options:
  --brute PROG       the slow, obviously right solution to compare with
  --fast PROG        run this instead of building the file
  --gen PROG         make inputs with `PROG <seed> <size>` instead of from the
                     file's `@gen fn` or its types; such a case is not shrunk
  --checker PROG     judge with `PROG <input> <output> <answer>`; exit 0 accepts
  --interactor PROG  judge by talking to `PROG <input>`; exit 0 accepts
  --cases N          how many cases to run (default 1000)
  --size N           the largest size (n, q) a case uses (default 8)
  --seed N           the first seed (default 1)
  --time-limit MS    per run, in milliseconds (default 5000)
  --jobs N           cases run at once (default: one per core)
  --trace            on a failure, run the solution and the brute on the
                     shrunk case in the debug interpreter and save the two
                     traces side by side as <file>.tests/stress-<seed>.trace.html
                     (the solution's alone, when a `@checker` is the judge)
  --explain          on a failure, run the solution and its `@brute(main)` on
                     the shrunk case in the debug interpreter and name the
                     first value they give a variable differently, with its line
  --format json      print the result as JSON, for an editor

Generated from cpl 0.2.2 (dev, a0d0078e).