2013-02-07 17:26:39 -08:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
use Test::More;
|
|
|
|
use DDG::Test::Goodie;
|
|
|
|
|
2014-09-27 06:42:57 -07:00
|
|
|
zci answer_type => 'random_passphrase';
|
2014-02-07 17:13:07 -08:00
|
|
|
zci is_cached => 0;
|
2013-02-07 17:26:39 -08:00
|
|
|
|
|
|
|
ddg_goodie_test(
|
2014-02-07 17:13:07 -08:00
|
|
|
[qw( DDG::Goodie::Passphrase )],
|
2014-10-06 02:15:23 -07:00
|
|
|
'random passphrase 1 word' => test_zci(count_words(1)),
|
|
|
|
'passphrase 1 word' => test_zci(count_words(1)),
|
|
|
|
'passphrase 2 random word' => test_zci(count_words(2)),
|
|
|
|
'passphrase 2 word' => test_zci(count_words(2)),
|
|
|
|
'passphrase 3 words random' => test_zci(count_words(3)),
|
|
|
|
'pass phrase 3 random words' => test_zci(count_words(3)),
|
|
|
|
'pass phrase 3 words random' => test_zci(count_words(3)),
|
|
|
|
'3 word passphrase' => test_zci(count_words(3)),
|
|
|
|
'3 word pass phrase random' => test_zci(count_words(3)),
|
|
|
|
'4 word random passphrase' => test_zci(count_words(4)),
|
|
|
|
'generate 4 word random passphrase' => test_zci(count_words(4)),
|
|
|
|
'10 word passphrase random' => test_zci(count_words(10)),
|
2015-12-25 02:18:33 -08:00
|
|
|
'passphrase' => test_zci(count_words(4)),
|
2014-10-06 02:15:23 -07:00
|
|
|
'random passphrase' => test_zci(count_words(4)),
|
2015-12-25 02:18:33 -08:00
|
|
|
'random pass phrase' => test_zci(count_words(4)),
|
|
|
|
'passphrase random' => test_zci(count_words(4)),
|
|
|
|
'pass phrase random' => test_zci(count_words(4)),
|
|
|
|
'generate random passphrase' => test_zci(count_words(4)),
|
2014-10-06 02:15:23 -07:00
|
|
|
'create random passphrase' => test_zci(count_words(4)),
|
2015-12-25 02:18:33 -08:00
|
|
|
'create passphrase random' => test_zci(count_words(4)),
|
2014-10-06 02:15:23 -07:00
|
|
|
'3 random words passphrase' => test_zci(count_words(3)),
|
|
|
|
'random 3 word pass phrase' => test_zci(count_words(3)),
|
|
|
|
'pass phrase 3 words' => test_zci(count_words(3)),
|
2014-02-09 22:24:25 -08:00
|
|
|
'pass phrase 0 words' => undef,
|
|
|
|
'passphrase 11 words' => undef,
|
|
|
|
'passphrase 3' => undef,
|
|
|
|
'pass phrase 3 chars' => undef,
|
|
|
|
'random generate 3 word passphrase' => undef,
|
2013-02-07 17:26:39 -08:00
|
|
|
);
|
|
|
|
|
2014-10-06 02:15:23 -07:00
|
|
|
sub count_words {
|
|
|
|
my $count = shift;
|
|
|
|
|
|
|
|
my $words_re = qr/(?:\s?\b[a-z]+\b){$count}/;
|
|
|
|
|
|
|
|
return (
|
|
|
|
qr/^random passphrase: $words_re$/,
|
|
|
|
structured_answer => {
|
|
|
|
input => [($count > 1) ? $count . ' words' : '1 word'],
|
2015-01-09 00:46:54 -08:00
|
|
|
operation => 'Random passphrase',
|
2014-10-06 02:15:23 -07:00
|
|
|
result => qr/^$words_re$/,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2013-02-07 17:26:39 -08:00
|
|
|
done_testing;
|