Skip to content

Commit 0ccaaf5

Browse files
committedFeb 20, 2016
print percentages not just raw numbers
1 parent d724672 commit 0ccaaf5

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed
 

‎bin/coverage.pl

+14-9
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535
}
3636
}
3737
close $FH;
38-
print "We are aware of " . scalar(keys %countries) . " territories \n";
38+
my $total_countries = scalar(keys %countries);
39+
print "We are aware of " . $total_countries . " territories \n";
3940

4041

4142
# which countries have tests?
@@ -50,7 +51,10 @@
5051
$f = uc($f);
5152
$test_countries{$f} = 1;
5253
}
53-
print "We have tests for " . scalar(keys %test_countries) . " territories \n";
54+
my $test_countries = scalar(keys %test_countries);
55+
my $test_perc = int(100 * $test_countries / $total_countries );
56+
print "We have tests for " . $test_countries . ' ('
57+
. $test_perc . '%) territories' . "\n";
5458
if ($details){
5559
print "We need tests for:\n";
5660
foreach my $cc (sort keys %countries){
@@ -70,7 +74,11 @@
7074
}
7175
}
7276
close $RFH;
73-
print "We have rules for " . scalar(keys %rules) . " territories \n";
77+
my $rules_countries = scalar(keys %rules);
78+
my $rules_perc = int(100 * $rules_countries / $total_countries );
79+
print "We have rules for " . $rules_countries . ' ('
80+
. $rules_perc . '%) territories' . "\n";
81+
7482
if ($details){
7583
print "We need rules for:\n";
7684
foreach my $cc (sort keys %countries){
@@ -79,15 +87,16 @@
7987
}
8088
}
8189

82-
8390
# find territories without rules or tests
8491
my %neither;
8592
foreach my $cc (sort keys %countries){
8693
next if (defined($rules{$cc}));
8794
next if (defined($test_countries{$cc}));
8895
$neither{$cc} = 1;
8996
}
90-
print scalar(keys %neither) . " territories have neither rules nor tests\n";
97+
my $neither_countries = scalar(keys %neither);
98+
my $neither_perc = int(100 * $neither_countries / $total_countries );
99+
print $neither_countries . ' (' . $neither_perc . '%) territories have neither rules nor tests' . "\n";
91100
if ($details){
92101
print "Territories with no test and no rules:\n";
93102
foreach my $cc (sort keys %neither){
@@ -96,10 +105,6 @@
96105
}
97106

98107

99-
100-
101-
102-
103108
sub usage {
104109
print "\tHow many territories have formatting rules and tests?\n";
105110
print "\tBy default prints just a high level summary\n";

0 commit comments

Comments
 (0)
Please sign in to comment.