Functional coverage tree: Difference between revisions
m
→{{header|Perl 6}}: tweak, tweak, and restore comments
SqrtNegInf (talk | contribs) m (→{{header|Perl 6}}: more idiomatic: matching, string formatting) |
SqrtNegInf (talk | contribs) m (→{{header|Perl 6}}: tweak, tweak, and restore comments) |
||
Line 1,740:
sub walktree ($data) {
my (@parts, $cnt);
while ($data ~~ m:nth(
$<body>=[[$0 \s+ \N+\n]*]/ ) { # next sub-level is 'body' (defined by extra depth of indentation)
my ($head, $body) = ($<head>, $<body>);
$head ~~ /^.*? \|
my $weight = ($0 ne '' ?? $0 !! 1).fmt('%-8s');▼
my $coverage = ($1 ne '' ?? $1 !! 0).fmt('%-10s');▼
my ($w, $wsum) = (0, 0);
Line 1,756 ⟶ 1,754:
for walktree( $body );
my $
!! ($wsum/$w) .fmt('%-10.2g');
@parts.push: [$head.subst(/\|\N+/, "|$weight|$coverage|"), $weight, $coverage ];
}
|