Permalink
Browse files

Clean up bold in Average.

I think bold should be generally reserved for matching words, because
otherwise it is confusing with the organic links.

However, I can see a case for bolding the actual answer, and so tried that.

Also moved | to ;, which makes it easier to read.

We could move to three lines and do the Mean: to <i>Mean:</i> like we've
been doing with other plugins.
  • Loading branch information...
1 parent 64c8345 commit f7d944641a5358ef381a406851898d19122c0eb9 yegg committed Jun 2, 2012
Showing with 7 additions and 7 deletions.
  1. +1 −1 lib/DDG/Goodie/Average.pm
  2. +6 −6 t/Average.t
@@ -44,7 +44,7 @@ handle query => sub {
$rms += ($_ ** 2) for @nums;
$rms /= $len;
$rms = sqrt $rms;
- return "Mean: $mean | Median: $med | Root Mean Square: $rms", html => "<b>Mean:</b> $mean | <b>Median:</b> $med | <b>Root Mean Square:</b> $rms";
+ return "Mean: $mean; Median: $med; Root Mean Square: $rms", html => "Mean: <b>$mean</b>; Median: <b>$med</b>; Root Mean Square: <b>$rms</b>";
};
1;
View
@@ -12,12 +12,12 @@ ddg_goodie_test(
[qw(
DDG::Goodie::Average
)],
- '1 2 3 avg' => test_zci("Mean: 2 | Median: 2 | Root Mean Square: 2.16024689946929", html => qr/<b>Mean:<\/b>/),
- 'mean 1, 2, 3' => test_zci("Mean: 2 | Median: 2 | Root Mean Square: 2.16024689946929", html => qr/<b>Mean:<\/b>/),
- 'root mean square 1,2,3' => test_zci("Mean: 2 | Median: 2 | Root Mean Square: 2.16024689946929", html => qr/<b>Mean:<\/b>/),
- "average 12 45 78 1234.12" => test_zci("Mean: 342.28 | Median: 61.5 | Root Mean Square: 618.72958034993", html => qr/<b>Mean:<\/b>/),
- "average 12, 45, 78, 1234.12" => test_zci("Mean: 342.28 | Median: 61.5 | Root Mean Square: 618.72958034993", html => qr/<b>Mean:<\/b>/),
- "average 12;45;78;1234.12" => test_zci("Mean: 342.28 | Median: 61.5 | Root Mean Square: 618.72958034993", html => qr/<b>Mean:<\/b>/),
+ '1 2 3 avg' => test_zci("Mean: 2; Median: 2; Root Mean Square: 2.16024689946929", html => qr/Mean:/),
+ 'mean 1, 2, 3' => test_zci("Mean: 2; Median: 2; Root Mean Square: 2.16024689946929", html => qr/Mean:/),
+ 'root mean square 1,2,3' => test_zci("Mean: 2; Median: 2; Root Mean Square: 2.16024689946929", html => qr/Mean:/),
+ "average 12 45 78 1234.12" => test_zci("Mean: 342.28; Median: 61.5; Root Mean Square: 618.72958034993", html => qr/Mean:/),
+ "average 12, 45, 78, 1234.12" => test_zci("Mean: 342.28; Median: 61.5; Root Mean Square: 618.72958034993", html => qr/Mean:/),
+ "average 12;45;78;1234.12" => test_zci("Mean: 342.28; Median: 61.5; Root Mean Square: 618.72958034993", html => qr/Mean:/),
);
done_testing;

0 comments on commit f7d9446

Please sign in to comment.