2012-03-18 14:39:50 -07:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
use Test::More;
|
|
|
|
use DDG::Test::Goodie;
|
|
|
|
|
|
|
|
zci answer_type => 'reverse';
|
2014-10-09 07:22:41 -07:00
|
|
|
zci is_cached => 1;
|
2012-03-18 14:39:50 -07:00
|
|
|
|
|
|
|
ddg_goodie_test(
|
2014-10-09 07:22:41 -07:00
|
|
|
[qw( DDG::Goodie::Reverse )],
|
2014-11-13 12:14:15 -08:00
|
|
|
# Primary example query
|
2014-10-09 07:22:41 -07:00
|
|
|
'reverse text esrever' => test_zci(
|
|
|
|
'Reversed "esrever": reverse',
|
|
|
|
structured_answer => {
|
|
|
|
input => ['esrever'],
|
2015-01-09 00:46:54 -08:00
|
|
|
operation => 'Reverse string',
|
2014-10-09 07:22:41 -07:00
|
|
|
result => 'reverse'
|
|
|
|
}
|
|
|
|
),
|
2014-11-13 12:14:15 -08:00
|
|
|
# Other queries
|
2014-10-09 07:22:41 -07:00
|
|
|
'reverse text bla' => test_zci(
|
|
|
|
'Reversed "bla": alb',
|
|
|
|
structured_answer => {
|
|
|
|
input => ['bla'],
|
2015-01-09 00:46:54 -08:00
|
|
|
operation => 'Reverse string',
|
2014-10-09 07:22:41 -07:00
|
|
|
result => 'alb'
|
|
|
|
}
|
|
|
|
),
|
|
|
|
'reverse text blabla' => test_zci(
|
|
|
|
'Reversed "blabla": albalb',
|
|
|
|
structured_answer => {
|
|
|
|
input => ['blabla'],
|
2015-01-09 00:46:54 -08:00
|
|
|
operation => 'Reverse string',
|
2014-10-09 07:22:41 -07:00
|
|
|
result => 'albalb'
|
|
|
|
}
|
|
|
|
),
|
|
|
|
'reverse' => undef,
|
2014-06-04 00:49:20 -07:00
|
|
|
|
2014-07-04 07:46:11 -07:00
|
|
|
#Should not trigger on a request for DNA/RNA reverse complement
|
2014-11-13 12:14:15 -08:00
|
|
|
'reverse complement of ATG-CTA-GGG-GCT' => undef,
|
2014-07-04 07:46:11 -07:00
|
|
|
'reverse complement gacuacgaucgagkmanscuag' => undef
|
2012-03-18 14:39:50 -07:00
|
|
|
);
|
|
|
|
|
|
|
|
done_testing;
|
|
|
|
|