Advanced code coverage analysis

Basile B. b2.temp at gmx.com
Wed Dec 6 06:05:32 UTC 2017


On Wednesday, 6 December 2017 at 03:15:38 UTC, Walter Bright 
wrote:
> On 12/5/2017 2:55 AM, Basile B. wrote:
>> On Monday, 4 December 2017 at 20:33:56 UTC, thinwybk wrote:
>>> Hi everyone,
>>>
>>> as far as I know there is a statement coverage analyzer built 
>>> into DMD https://dlang.org/code_coverage.html . Are there 
>>> code coverage analyzers for D which support branch coverage 
>>> and other more advanced coverage metrics 
>>> https://en.wikipedia.org/wiki/Code_coverage ?
>>>
>>> Cheers,
>>> thinwybk
>> 
>> No, the compiler reports only statement coverage. Higher 
>> levels reports could be made by a tool that would use the LST 
>> file and the AST produced by libdparse.
>
> The wiki lists function coverage, statement coverage, branch 
> coverage, and condition coverage. The builtin coverage analyzer 
> does all of them.
>
> However, if you put multiple statements, conditions, etc., on 
> one line, you'll get the sum of the usage counts.

Indeed, but there's still some room for a tool. I'd add this to 
my IDE since for now coverage is not indicated in the code editor 
but in the messages (a message for each line that's not covered).

Anyway it's a two days project (at most), i've proposed it to 
D-Scanner:

https://github.com/dlang-community/D-Scanner/issues/540


More information about the Digitalmars-d mailing list