updated tests and goodies

master
hunterlang 2012-03-24 14:05:13 -04:00
parent 87c37c3d4f
commit ca83e76e1e
5 changed files with 7 additions and 5 deletions

View File

@ -2,6 +2,7 @@ name = DDG-GoodieBundle-OpenSourceDuckDuckGo
author = Gabriel Weinberg <yegg@duckduckgo.com>
author = Torsten Raudssus <getty@duckduckgo.com>
author = Michael Smith <crazedpsyc@duckduckgo.com>
author = Hunter Lang <hunter@duckduckgo.com>
license = Perl_5
copyright_holder = DuckDuckGo, Inc. L<http://duckduckgo.com/>
copyright_year = 2011

View File

@ -14,7 +14,7 @@ handle remainder => sub {
return $garbledAnswer;
};
zci is_cached => 1;
zci is_cached => 0;
1;

View File

@ -8,8 +8,8 @@ triggers start => "roman", "arabic";
zci is_cached => 1;
zci answer_type => "roman_numeral_conversion";
handle remainder => sub {
return uc(roman($_)) . '(roman numeral conversion)' if /^\d+$/ && roman($_);
return arabic $_ . '(roman numeral conversion)' if lc($_) =~ /^[mdclxvi]+$/ && arabic($_);
return uc(roman($_)) . ' (roman numeral conversion)' if /^\d+$/ && roman($_);
return arabic $_ . ' (roman numeral conversion)' if lc($_) =~ /^[mdclxvi]+$/ && arabic($_);
return;
};

View File

@ -4,6 +4,7 @@ use DDG::Goodie;
triggers start => 'sigfigs', 'sigdigs', 'sf', 'sd', 'significant';
zci answer_type => "sig_figs";
zci is_cached => 1;
handle remainder => sub {
$_ =~ s/^(figures|digits)\s*//g;
return unless /^-?\d+(?:\.(?:\d+)?)?$/;

View File

@ -52,8 +52,8 @@ ddg_goodie_test(
'throw dice' => test_zci(qr/\d \d/, answer_type => 'dice_roll', is_cached => 0),
'%err 45.125 44.992' => test_zci(qr/Error:/, html => qr/Error:/, answer_type => 'percent_error', is_cached => 1),
'chars hello' => test_zci('Chars: 5', answer_type => 'chars', is_cached => 1),
'md5 this' => test_zci('9e925e9341b490bfd3b4c4ca3b0c1ef2', answer_type => 'conversion', is_cached => 1),
'that to binary' => test_zci('01110100011010000110000101110100', answer_type => 'binary_conversion', is_cached => 1),
'uuid' => test_zci(qr/\(randomly generated\)/, answer_type => 'guid', is_cached => 0),
);
done_testing;