updated tests and goodies
This commit is contained in:
parent
87c37c3d4f
commit
ca83e76e1e
1
dist.ini
1
dist.ini
@ -2,6 +2,7 @@ name = DDG-GoodieBundle-OpenSourceDuckDuckGo
|
|||||||
author = Gabriel Weinberg <yegg@duckduckgo.com>
|
author = Gabriel Weinberg <yegg@duckduckgo.com>
|
||||||
author = Torsten Raudssus <getty@duckduckgo.com>
|
author = Torsten Raudssus <getty@duckduckgo.com>
|
||||||
author = Michael Smith <crazedpsyc@duckduckgo.com>
|
author = Michael Smith <crazedpsyc@duckduckgo.com>
|
||||||
|
author = Hunter Lang <hunter@duckduckgo.com>
|
||||||
license = Perl_5
|
license = Perl_5
|
||||||
copyright_holder = DuckDuckGo, Inc. L<http://duckduckgo.com/>
|
copyright_holder = DuckDuckGo, Inc. L<http://duckduckgo.com/>
|
||||||
copyright_year = 2011
|
copyright_year = 2011
|
||||||
|
@ -14,7 +14,7 @@ handle remainder => sub {
|
|||||||
return $garbledAnswer;
|
return $garbledAnswer;
|
||||||
};
|
};
|
||||||
|
|
||||||
zci is_cached => 1;
|
zci is_cached => 0;
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
||||||
|
@ -8,8 +8,8 @@ triggers start => "roman", "arabic";
|
|||||||
zci is_cached => 1;
|
zci is_cached => 1;
|
||||||
zci answer_type => "roman_numeral_conversion";
|
zci answer_type => "roman_numeral_conversion";
|
||||||
handle remainder => sub {
|
handle remainder => sub {
|
||||||
return uc(roman($_)) . '(roman numeral conversion)' if /^\d+$/ && roman($_);
|
return uc(roman($_)) . ' (roman numeral conversion)' if /^\d+$/ && roman($_);
|
||||||
return arabic $_ . '(roman numeral conversion)' if lc($_) =~ /^[mdclxvi]+$/ && arabic($_);
|
return arabic $_ . ' (roman numeral conversion)' if lc($_) =~ /^[mdclxvi]+$/ && arabic($_);
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ use DDG::Goodie;
|
|||||||
|
|
||||||
triggers start => 'sigfigs', 'sigdigs', 'sf', 'sd', 'significant';
|
triggers start => 'sigfigs', 'sigdigs', 'sf', 'sd', 'significant';
|
||||||
zci answer_type => "sig_figs";
|
zci answer_type => "sig_figs";
|
||||||
|
zci is_cached => 1;
|
||||||
handle remainder => sub {
|
handle remainder => sub {
|
||||||
$_ =~ s/^(figures|digits)\s*//g;
|
$_ =~ s/^(figures|digits)\s*//g;
|
||||||
return unless /^-?\d+(?:\.(?:\d+)?)?$/;
|
return unless /^-?\d+(?:\.(?:\d+)?)?$/;
|
||||||
|
@ -52,8 +52,8 @@ ddg_goodie_test(
|
|||||||
'throw dice' => test_zci(qr/\d \d/, answer_type => 'dice_roll', is_cached => 0),
|
'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),
|
'%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),
|
'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;
|
done_testing;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user