CUI

Components / Developer tools

Coverage

Test coverage as a tree built from the files' paths.

Functions: cui_coverage

Coverage

Usage

static const cui_coverage_file files[] = {
    { "src/core/layout.c", 1840, 1702, 620, 541, 88, 86 },   /* lines, hit; branches, hit; functions, hit */
    { "src/render/gl.c", 1300, 410, 260, 60, 70, 22 },
};
cui_coverage_result r = cui_coverage(ui, "coverage", files, 2);
if (r.activated >= 0) open_file(files[r.activated].path);

Each folder sums up what it holds, and a row for all files sits on top. Lines show as a bar and a percentage, with branches and functions beside them. They are colored red below low (50%), amber below high (80%) and green above. A click on a column's title sorts by it, and a second click reverses the order; folders stay above files. A click on a folder folds it. Up and Down move the selection, Left and Right fold and unfold a folder, and Enter folds a folder or, on a file, reports activated, as a double click does. A hover shows the counts behind the percentages. On a phone only the lines column is shown.

Keyboard

  • Up and Down move the selection, Left and Right fold and unfold a folder, and Enter folds a folder or, on a file, reports activated, as a double click does.

Options of cui_coverage

OptionTypeDefaultDescription
.widthcui_sizeWidth: CUI_FILL, CUI_FIT, CUI_PX(n) or CUI_PCT(n); unset uses the component's own.
.heightfloatHeight in points; 0 uses the component's own.
.lowfloat50 and 80percent; default 50 and 80
.highfloat50 and 80percent; default 50 and 80

cui_coverage_file

FieldTypeDescription
pathconst char *"src/core/layout.c"
linesintlines that can be covered
lines_hitintlines the tests ran
branchesint0 branches: not measured
branches_hitint0 branches: not measured
functionsintfunctions in the file
functions_hitintfunctions the tests called

cui_coverage_result

FieldTypeDescription
activatedintfile opened this frame (Enter or a double-click), or -1
linesfloatpercent of all lines covered

Related

  • Blame: Source with who last changed each line.
  • Time histogram: Event counts over time, stacked by series, as above a log search, with a legend that shows each series' total.
  • Feature flags: Flags against environments, edited in place.
  • Uptime bars: A status page: each service's current state and a bar for each day of its history.