Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tuning of behavior with/without params
- Loading branch information
Showing
1 changed file
with
27 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,54 +1,61 @@ | |||
#!/usr/bin/perl | #!/usr/bin/perl | ||
use strict; | use strict; | ||
use Test::More tests => 10; | use Test::More tests => 15; | ||
|
|
||
use Text::Password::Pronounceable; | use Text::Password::Pronounceable; | ||
|
|
||
{ | { | ||
my $pp = Text::Password::Pronounceable->new(6,10); | my $pp = Text::Password::Pronounceable->new(6,10); | ||
|
|||
isa_ok($pp, 'Text::Password::Pronounceable'); | isa_ok($pp, 'Text::Password::Pronounceable'); | ||
|
|
||
my $str = $pp->generate; | my $str = $pp->generate; | ||
ok(length($str) >= 6 && length($str) <= 10); | |||
|
|
||
ok(length($str) <= 10 && length($str) >= 6); | my $str2 = $pp->generate(5); | ||
|
ok(length($str2) == 5); | ||
$str = $pp->generate(3,4); | |||
|
|
||
ok(length($str) <= 4 && length($str) >= 3); | my $str3 = $pp->generate(3,4); | ||
ok(length($str3) >= 3 && length($str3) <= 4); | |||
} | } | ||
|
|
||
{ | { | ||
my $pp = Text::Password::Pronounceable->new(6); | my $pp = Text::Password::Pronounceable->new(6); | ||
|
|||
isa_ok($pp, 'Text::Password::Pronounceable'); | isa_ok($pp, 'Text::Password::Pronounceable'); | ||
|
|
||
my $str = $pp->generate; | my $str = $pp->generate; | ||
|
|||
ok(length($str) == 6); | ok(length($str) == 6); | ||
|
|
||
$str = $pp->generate(3,4); | my $str2 = $pp->generate(8); | ||
|
ok(length($str2) == 8); | ||
ok(length($str) <= 4 && length($str) >= 3); | |||
|
|
||
$str = $pp->generate(5); | my $str3 = $pp->generate(3,4); | ||
ok(length($str3) >= 3 && length($str3) <= 4); | |||
|
|
||
ok(length($str) == 5); | |||
} | } | ||
|
|
||
{ | { | ||
# testing generate as a class method | my $pp = Text::Password::Pronounceable->new; | ||
isa_ok($pp, 'Text::Password::Pronounceable'); | |||
|
|
||
my $str = Text::Password::Pronounceable->generate(6, 10); | my $str = $pp->generate; | ||
is($str, q[], 'no lengths, no password'); | |||
|
|
||
ok(length($str) <= 10 && length($str) >= 6); | my $str2 = $pp->generate(10); | ||
ok(length($str2) == 10); | |||
|
|
||
$str = Text::Password::Pronounceable->generate(3, 4); | my $str3 = $pp->generate(4,8); | ||
ok(length($str3) >= 4 && length($str3) <= 8); | |||
} | |||
{ | |||
# testing generate as a class method | |||
|
|
||
ok(length($str) <= 4 && length($str) >= 3); | my $str = Text::Password::Pronounceable->generate(6, 10); | ||
ok(length($str) <= 10 && length($str) >= 6); | |||
|
|
||
$str = Text::Password::Pronounceable->generate(5); | my $str2 = Text::Password::Pronounceable->generate(3, 4); | ||
ok(length($str2) <= 4 && length($str2) >= 3); | |||
|
|
||
ok(length($str) == 5); | my $str3 = Text::Password::Pronounceable->generate(5); | ||
ok(length($str3) == 5); | |||
} | } | ||
|
|