Module Mlang.Bir_instrumentation

Instrumentation of the interpreter to computer code coverage

Code coverage for a single run

For each variable, and for each code location where it is assigned, we record the value it has been assigned to during an interpreter run

val empty_code_coverage_result : code_coverage_result

The code coverage is stateful, it has to be initialized before the run with code_coverage_init and you can retrieve its results after with code_coverage_result.

val code_coverage_init : unit -> unit
val code_coverage_result : unit -> code_coverage_result

Code coverage for multiple runs

Code coverage is best measured for multiple runs of the interpreter on a set of test files.

type code_coverage_map_value = VarLiteralSet.t

The accumulated coverage is the set of distinct values a particular variable assignment has received in the tests runs so far

val merge_code_coverage_single_results_with_acc : code_coverage_result -> code_coverage_acc -> code_coverage_acc

merge_code_coverage_single_results_with_acc result acc merges the code coverage results of a single run result with the accumulated results over the tests so far acc

val merge_code_coverage_acc : code_coverage_acc -> code_coverage_acc -> code_coverage_acc

Merges two partial code coverage accumulator into a single, bigger one

Code locations

val get_code_locs : Bir.program -> code_locs

Returns all code locations in a program