zeroclickinfo-goodies/t/Rot13.t

33 lines
767 B
Perl
Raw Permalink Normal View History

2012-05-05 10:43:57 -07:00
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
use Test::Deep;
2012-05-05 10:43:57 -07:00
use DDG::Test::Goodie;
zci answer_type => 'rot13';
2014-10-15 01:04:07 -07:00
zci is_cached => 1;
2012-05-05 10:43:57 -07:00
2016-05-18 15:23:28 -07:00
sub build_answer {
my ($text, $input, $answer) = @_;
return test_zci($text, structured_answer => {
data => {
title => $answer,
subtitle => "ROT13: $input"
},
templates => {
group => 'text'
}
});
}
2012-05-05 10:43:57 -07:00
ddg_goodie_test(
2014-10-15 01:04:07 -07:00
[qw( DDG::Goodie::Rot13 )],
2016-05-18 15:23:28 -07:00
'rot13 This is a test' => build_answer('ROT13: Guvf vf n grfg', 'This is a test', 'Guvf vf n grfg'),
'rot13 thirteen' => build_answer('ROT13: guvegrra', 'thirteen', 'guvegrra'),
'rot13 guvegrra' => build_answer('ROT13: thirteen', 'guvegrra', 'thirteen'),
2012-05-05 10:43:57 -07:00
);
2016-05-16 06:18:04 -07:00
done_testing;