EasyLocalAPI reference iolab-uniud/easylocal

easylocal::testing

Types

NameDescription
check_failure A failed check: its name and what went wrong.
check_options The options of the contract checks: how many moves and solutions they try, the seed of their random draws and the tolerance of their comparisons.
check_report The outcome of the checks on a subject: how many ran and which failed.
deterministic_rng A random bit generator that cycles through a fixed list of values, for unit tests that script the random draws.
fixture The data every component check runs on: an Input, a valid Solution and the SolutionManager built on the Input.

Type Aliases

NameDescription
approximately The comparison of the checks: values equal within a relative and an absolute tolerance, approximately{.relative = 1e-6, .absolute = 1e-9} (see cost::tolerance).

Functions

NameDescription
check_cost_component The same, with the component built from the fixture Input.
check_cost_component A cost component evaluates the fixture Solution, and evaluating it twice gives equivalent values; an exception of evaluate() is a failure.
check_delta_cost_component The same, with every object built from the fixture; omit Delta for a co-located delta.
check_delta_cost_component Checks the component's own delta_evaluate (co-located): for the valid moves of the fixture Solution and of the random solutions of the options, value + delta equals the component's value after the move.
check_delta_cost_component Checks a separate delta cost component: for the valid moves of the fixture Solution and of the random solutions of the options (enumerated, or sampled when the neighborhood cannot enumerate), value + delta equals the component's value after the move.
check_neighborhood The same, with the NeighborhoodExplorer built on the fixture's SolutionManager.
check_neighborhood Enumerated and sampled moves of the fixture Solution and of random solutions are valid, and applying them keeps the Solution valid.
check_solution_manager The fixture's SolutionManager: bound to the fixture Input, and the fixture, initial and random solutions are valid.
print_report Prints report to out: the number of checks passed, or the failures grouped by check, in the order of their first failure, each with its count and the messages of its first three.
run_checks Prints the reports to std::cerr and returns EXIT_SUCCESS when all passed, EXIT_FAILURE otherwise.
run_checks Prints the reports to out, separated by blank lines, and returns EXIT_SUCCESS when all passed, EXIT_FAILURE otherwise.

Concepts

NameDescription
check_fixture A testing::fixture, whatever its SolutionManager and comparison.
printable_report A report of checks: a check_report, or the report of check(app) (an app_check_report), which print_report() writes and passed() sums up.