2 ms·
The dmd D compiler has a built in coverage analyzer, while not quite what you describe, comes close: |bool foo(bool i, bool j) { 2| return i ||
by WalterBright 12y ago
The dmd D compiler has a built in coverage analyzer, while not quite what you describe, comes close:
|bool foo(bool i, bool j) {
2| return i ||
1| j;
|}
|
|void main() {
1| foo(true, false);
1| foo(false, false);
|}
It'll give an execution count on each statement, and logical expression operands count as separate statements. I've found that when this is used in conjunction with a test suite to ensure that the tests cause every code path to be executed, the code becomes remarkably free of bugs.