Skip to main content

Module assertion_coverage

Module assertion_coverage 

Source
Expand description

Assertions coverage: which executed statements a test would catch breaking.

A statement counts as asserted when changing it makes at least one passing test that executes it fail. The change follows the statement: an if has its condition inverted (each direction), return x returns undefined, a declaration’s value becomes undefined, an expression point evaluates to undefined, and any other statement is skipped. Imports, declarations without a value, and function, class and type declarations are not assessed.

Supercov does not decide this itself. For each test it renders what the test ran (its code, its helpers, and the source it executed) and asks Jev, one yes/no question per statement, whether the test would fail. This module owns the population, the change rules and the rendering; the CLI owns the requests, the answer cache and the output. What Jev sees for one statement and one test is also the cache key, so an answer is reused only when the question would be asked with exactly the same text.

Structs§

AssessmentInput
The executed statements of a run and the tests that ran them. sources are the run’s source files, verified against the run. What assessing a run reads from its analysis: the passing view’s tests, and its measured statements and executed decisions with the tests that ran them. Publication stores it, so an assessment does not analyse the run’s evidence again (4.4 s of supergateway’s 7.6 s of planning).
InputPoint
A statement or decision, with the tests that ran it as indexes into AssessmentInput::tests.
InputTest
Population
Statement
TestRef

Enums§

Change
Language
The languages whose statements and tests this module can read.

Constants§

FIRST_TESTS
Tests asked about a statement before it may be called unchecked, then the wider set asked before it is (measured: more tests remove false “unchecked” flags, and 25 tests was no better than 15).
INSTRUCTIONS
LAST_TESTS
Asked last, when none of those is judged to fail: the tests most likely written for the statement.
MAX_QUESTIONS
MAX_TESTS
The most tests one statement is asked of.
MODEL
MORE_TESTS
THRESHOLD
A statement is asserted when some test’s answer is at least this.

Functions§

assessment_input
load_snapshot
Read files written by save_snapshot.
population
population_from
save_snapshot
Write files’ text, compressed, to path.