You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This would probably be tough to implement, but code coverage for FORM programs might be useful. For example, consider a FORM program with many id statements. In such cases, debugging can be difficult unless we can see which rules are actually applied to a given input. Print "%t" and similar tricks can help, but that is cumbersome.
For now, let's focus on coverage for executable statements. Other statements such as declarations are easier to track. One possible design is the following.
We could support line coverage and branch coverage. When a term survives to the end of a module, the corresponding line and branch counters are incremented based on the path taken by the term. Terms discarded before the end of the module would not count towards coverage, because they do not affect the final result of the module. At the very least, FORM should support such a coverage mode. Such discarded terms may be arbitrarily wrong without affecting the final result, as in (correct terms) + 0 * (wrong terms) = (correct terms).
A typical id statement should be treated as a kind of conditional branch: one branch where the pattern matches and rewriting occurs, and another where no rewrite occurs.
To avoid overhead in normal execution, the FORM compiler could insert additional virtual-machine instructions only when coverage is enabled (say, -cov or On Coverage). The recorded coverage data should then be exportable to a standard format such as LCOV, so that existing tools can be used to visualise the results.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
This would probably be tough to implement, but code coverage for FORM programs might be useful. For example, consider a FORM program with many
idstatements. In such cases, debugging can be difficult unless we can see which rules are actually applied to a given input.Print "%t"and similar tricks can help, but that is cumbersome.For now, let's focus on coverage for executable statements. Other statements such as declarations are easier to track. One possible design is the following.
We could support line coverage and branch coverage. When a term survives to the end of a module, the corresponding line and branch counters are incremented based on the path taken by the term. Terms discarded before the end of the module would not count towards coverage, because they do not affect the final result of the module. At the very least, FORM should support such a coverage mode. Such discarded terms may be arbitrarily wrong without affecting the final result, as in
(correct terms) + 0 * (wrong terms) = (correct terms).A typical
idstatement should be treated as a kind of conditional branch: one branch where the pattern matches and rewriting occurs, and another where no rewrite occurs.To avoid overhead in normal execution, the FORM compiler could insert additional virtual-machine instructions only when coverage is enabled (say,
-covorOn Coverage). The recorded coverage data should then be exportable to a standard format such as LCOV, so that existing tools can be used to visualise the results.Beta Was this translation helpful? Give feedback.
All reactions