Functional coverage tree: Difference between revisions

m
J: Clarify labelling of pieces of the implementation
(→‎{{header|Perl}}: tweaks to code, but mostly just reformatted for clarity)
m (J: Clarify labelling of pieces of the implementation)
Line 542:
=={{header|J}}==
 
Implementation part 1 of 4 (raw data):
 
<lang J>raw=: 0 :0
Line 590:
)</lang>
 
Implementation part 2 of 4 (unpacking raw data):
 
<lang J>labels=: {.<;._2;._2 raw
Line 610:
coverage fills in the blanks for coverage (0 if not otherwise specified).
 
Implementation part 3 of 4 (translation of leaf coverage to functional coverage):
 
<lang J>merge=: ;@(({.@[,(+}.)~)&.> [: +/\1,_1}.#@>)
Line 621:
Thus, <code>parent_cover</code> propagates coverage to parent nodes based on the weighted average of coverage at the children.
 
Task example part 4 of 4 (format and show result):
 
<lang J> 1 1 }._1 }.":labels,each ":each hier;(,.weight);,.weight parent_cover coverage
Line 685:
 
And, <code>weight parent_cover coverage</code> was the functional coverage for each node.
 
 
=={{header|JavaScript}}==
6,951

edits