Added tests for Base64, Dice, EmToPx, FlipText, GoldenRatio, Guid, Periemeter, Roman, SigFigs, TitleCase, Unicode
2012-04-15 16:17:12 -07:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
use Test::More;
|
|
|
|
use DDG::Test::Goodie;
|
|
|
|
|
2012-05-29 15:40:32 -07:00
|
|
|
zci answer_type => 'base64_conversion';
|
2014-10-06 04:29:25 -07:00
|
|
|
zci is_cached => 1;
|
|
|
|
|
2015-03-14 19:39:57 -07:00
|
|
|
my @foo_encoded = test_zci(
|
2014-10-06 04:29:25 -07:00
|
|
|
'Base64 encoded: Zm9v',
|
|
|
|
structured_answer => {
|
|
|
|
input => ['foo'],
|
2015-01-09 00:46:54 -08:00
|
|
|
operation => 'Base64 encode',
|
2014-10-06 04:29:25 -07:00
|
|
|
result => 'Zm9v'
|
|
|
|
});
|
2015-03-14 19:39:57 -07:00
|
|
|
|
|
|
|
my @this_text_encoded = test_zci(
|
|
|
|
'Base64 encoded: dGhpcyB0ZXh0',
|
|
|
|
structured_answer => {
|
|
|
|
input => ['this text'],
|
|
|
|
operation => 'Base64 encode',
|
|
|
|
result => 'dGhpcyB0ZXh0'
|
|
|
|
});
|
|
|
|
|
|
|
|
my @dGhpcyB0ZXh0_decoded = test_zci(
|
2014-10-06 04:29:25 -07:00
|
|
|
'Base64 decoded: this text',
|
|
|
|
structured_answer => {
|
|
|
|
input => ['dGhpcyB0ZXh0'],
|
2015-01-09 00:46:54 -08:00
|
|
|
operation => 'Base64 decode',
|
2014-10-06 04:29:25 -07:00
|
|
|
result => 'this text'
|
|
|
|
});
|
Added tests for Base64, Dice, EmToPx, FlipText, GoldenRatio, Guid, Periemeter, Roman, SigFigs, TitleCase, Unicode
2012-04-15 16:17:12 -07:00
|
|
|
|
|
|
|
ddg_goodie_test(
|
2014-10-06 04:29:25 -07:00
|
|
|
[qw( DDG::Goodie::Base64)],
|
2015-03-14 19:39:57 -07:00
|
|
|
# It encodes
|
|
|
|
'base64 encode foo' => @foo_encoded,
|
|
|
|
'base64 ENCoDE foo' => @foo_encoded,
|
|
|
|
'base64 foo' => @foo_encoded,
|
|
|
|
"base64 encode this text" => @this_text_encoded,
|
|
|
|
|
|
|
|
# It decodes
|
|
|
|
"base64 decode dGhpcyB0ZXh0" => @dGhpcyB0ZXh0_decoded,
|
|
|
|
"base64 dECoDE dGhpcyB0ZXh0" => @dGhpcyB0ZXh0_decoded,
|
|
|
|
|
|
|
|
# It ignores 'base64' at end of query
|
|
|
|
"python base64" => undef,
|
|
|
|
|
|
|
|
# It ignores incomplete requests to process
|
|
|
|
"base64" => undef,
|
|
|
|
"base64 encode" => undef,
|
|
|
|
"base64 decode" => undef,
|
Added tests for Base64, Dice, EmToPx, FlipText, GoldenRatio, Guid, Periemeter, Roman, SigFigs, TitleCase, Unicode
2012-04-15 16:17:12 -07:00
|
|
|
);
|
|
|
|
|
|
|
|
done_testing;
|