Pi: Refactoring and removing sexy tabs in favour of kludgy spaces

master
Rob 2016-05-23 12:47:42 +01:00
parent 34ff108ac1
commit 29741fd6fe
2 changed files with 19 additions and 20 deletions

View File

@ -11,9 +11,9 @@ triggers startend => "pi","π";
my $PI = '3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679'.
'8214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196'.
'4428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273'.
'724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609';
'8214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196'.
'4428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273'.
'724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609';
my $PI_max_digits = length($PI);
@ -26,7 +26,7 @@ handle query_raw => sub {
return $answer, structured_answer => {
data => {
title => $answer,
subtitle => "First ".$+{decimal}." digits of Pi"
subtitle => "First $+{decimal} digits of Pi"
},
templates => {
group => 'text'

31
t/Pi.t
View File

@ -11,31 +11,30 @@ zci answer_type => "pi";
zci is_cached => 1;
sub build_test {
my ($answer, $input) = @_;
return test_zci($answer, structured_answer => {
data => {
title => $answer,
subtitle=> "First $input digits of Pi"
},
templates => {
group => 'text'
}
})
my ($answer, $input) = @_;
return test_zci($answer, structured_answer => {
data => {
title => $answer,
subtitle=> "First $input digits of Pi"
},
templates => {
group => 'text'
}
})
}
ddg_goodie_test(
[qw( DDG::Goodie::Pi )],
'pi 23' => build_test("3.14159265358979323846264",23),
'π 8' => build_test("3.14159265", 8),
'12 digits of pi' => build_test("3.141592653589", 12),
'pi 23' => build_test("3.14159265358979323846264",23),
'π 8' => build_test("3.14159265", 8),
'12 digits of pi' => build_test("3.141592653589", 12),
'12 digits of π' => build_test("3.141592653589", 12),
'pi to 6 digits' => build_test("3.141592", 6),
'π to 6 digits' => build_test("3.141592", 6),
'pi ff' => undef,
'pi 3f2' => undef
'pi ff' => undef,
'pi 3f2' => undef
);
done_testing;