2014-07-24 13:13:54 -07:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
use Test::More;
|
|
|
|
use DDG::Test::Goodie;
|
|
|
|
|
|
|
|
zci answer_type => 'pw';
|
2014-10-07 06:22:02 -07:00
|
|
|
zci is_cached => 0;
|
2014-07-24 13:13:54 -07:00
|
|
|
|
|
|
|
ddg_goodie_test(
|
2014-10-07 06:22:02 -07:00
|
|
|
[qw( DDG::Goodie::Password)],
|
|
|
|
'pw 15 average' => test_zci(
|
|
|
|
qr/.{15} \(random password\)/,
|
|
|
|
structured_answer => {
|
|
|
|
input => ['15 characters', 'average strength'],
|
2015-01-09 00:46:54 -08:00
|
|
|
operation => 'Random password',
|
2014-10-07 06:22:02 -07:00
|
|
|
result => qr/^.{15}$/
|
|
|
|
}
|
|
|
|
),
|
|
|
|
'password normal 15' => test_zci(
|
|
|
|
qr/.{15} \(random password\)/,
|
|
|
|
structured_answer => {
|
|
|
|
input => ['15 characters', 'average strength'],
|
2015-01-09 00:46:54 -08:00
|
|
|
operation => 'Random password',
|
2014-10-07 06:22:02 -07:00
|
|
|
result => qr/^.{15}$/
|
|
|
|
}
|
|
|
|
),
|
|
|
|
'random pw 15 AVG' => test_zci(
|
|
|
|
qr/.{15} \(random password\)/,
|
|
|
|
structured_answer => {
|
|
|
|
input => ['15 characters', 'average strength'],
|
2015-01-09 00:46:54 -08:00
|
|
|
operation => 'Random password',
|
2014-10-07 06:22:02 -07:00
|
|
|
result => qr/^.{15}$/
|
|
|
|
}
|
|
|
|
),
|
|
|
|
'pwgen strong 25' => test_zci(
|
|
|
|
qr/.{25} \(random password\)/,
|
|
|
|
structured_answer => {
|
|
|
|
input => ['25 characters', 'high strength'],
|
2015-01-09 00:46:54 -08:00
|
|
|
operation => 'Random password',
|
2014-10-07 06:22:02 -07:00
|
|
|
result => qr/^.{25}$/
|
|
|
|
}
|
|
|
|
),
|
|
|
|
'password 25 hard' => test_zci(
|
|
|
|
qr/.{25} \(random password\)/,
|
|
|
|
structured_answer => {
|
|
|
|
input => ['25 characters', 'high strength'],
|
2015-01-09 00:46:54 -08:00
|
|
|
operation => 'Random password',
|
2014-10-07 06:22:02 -07:00
|
|
|
result => qr/^.{25}$/
|
|
|
|
}
|
|
|
|
),
|
|
|
|
'Password High 25' => test_zci(
|
|
|
|
qr/.{25} \(random password\)/,
|
|
|
|
structured_answer => {
|
|
|
|
input => ['25 characters', 'high strength'],
|
2015-01-09 00:46:54 -08:00
|
|
|
operation => 'Random password',
|
2014-10-07 06:22:02 -07:00
|
|
|
result => qr/^.{25}$/
|
|
|
|
}
|
|
|
|
),
|
|
|
|
# Example queries
|
|
|
|
'random password' => test_zci(
|
|
|
|
qr/.{8} \(random password\)/,
|
|
|
|
structured_answer => {
|
|
|
|
input => ['8 characters', 'average strength'],
|
2015-01-09 00:46:54 -08:00
|
|
|
operation => 'Random password',
|
2014-10-07 06:22:02 -07:00
|
|
|
result => qr/^.{8}$/
|
|
|
|
}
|
|
|
|
),
|
|
|
|
'random password strong 15' => test_zci(
|
|
|
|
qr/.{15} \(random password\)/,
|
|
|
|
structured_answer => {
|
|
|
|
input => ['15 characters', 'high strength'],
|
2015-01-09 00:46:54 -08:00
|
|
|
operation => 'Random password',
|
2014-10-07 06:22:02 -07:00
|
|
|
result => qr/^.{15}$/
|
|
|
|
}
|
|
|
|
),
|
2014-11-24 04:08:36 -08:00
|
|
|
'password 15' => test_zci(
|
|
|
|
qr/.{15} \(random password\)/,
|
|
|
|
structured_answer => {
|
|
|
|
input => ['15 characters', 'average strength'],
|
2015-01-09 00:46:54 -08:00
|
|
|
operation => 'Random password',
|
2014-11-24 04:08:36 -08:00
|
|
|
result => qr/^.{15}$/
|
|
|
|
}
|
|
|
|
),
|
2014-12-14 08:44:53 -08:00
|
|
|
'password 33' => test_zci(
|
|
|
|
qr/.{33} \(random password\)/,
|
|
|
|
structured_answer => {
|
|
|
|
input => ['33 characters', 'average strength'],
|
2015-01-09 00:46:54 -08:00
|
|
|
operation => 'Random password',
|
2014-12-14 08:44:53 -08:00
|
|
|
result => qr/^.{33}$/
|
|
|
|
}
|
|
|
|
),
|
|
|
|
'password 65' => undef,
|
2015-07-16 08:56:58 -07:00
|
|
|
'random password weak 5' => undef,
|
|
|
|
'password 5 EaSy' => undef,
|
|
|
|
'password low 5' => undef,
|
2014-07-24 13:13:54 -07:00
|
|
|
);
|
2014-10-07 06:22:02 -07:00
|
|
|
|
2014-07-24 13:13:54 -07:00
|
|
|
done_testing
|