zeroclickinfo-goodies/t/Rc4.t

37 lines
853 B
Perl
Raw Normal View History

2015-02-23 10:19:45 -08:00
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
use Test::Deep;
2015-02-23 10:19:45 -08:00
use DDG::Test::Goodie;
zci answer_type => "rc4";
zci is_cached => 1;
2016-05-18 12:57:34 -07:00
sub build_test {
2016-05-23 05:00:46 -07:00
my ($direction, $input, $key, $answer) = @_;
return test_zci("RC4 $direction: $input, with key: $key is $answer", structured_answer => {
2016-05-18 12:57:34 -07:00
data => {
2016-05-23 05:00:46 -07:00
title => $answer,
subtitle => "RC4 $direction: $input, Key: $key"
2016-05-18 12:57:34 -07:00
},
templates => {
group => 'text'
}
});
}
2015-02-23 10:19:45 -08:00
ddg_goodie_test(
[qw(
DDG::Goodie::Rc4
)],
2016-05-23 05:00:46 -07:00
'rc4 en mysecretkey hello' => build_test("Encrypt", "hello", "mysecretkey", "grYU1K8="),
2016-05-24 09:40:46 -07:00
'rc4 de duck yWrJniG/nNg=' => build_test("Decrypt", "yWrJniG/nNg=", "duck", "DdgRocks"),
2015-02-23 10:19:45 -08:00
'rc4 ' => undef,
'rc4 enc missing' => undef,
'rc4 no operation' => undef
);
2016-05-16 06:18:04 -07:00
done_testing;