File: 01basic.t

package info (click to toggle)
libtext-password-pronounceable-perl 0.30-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 168 kB
  • sloc: perl: 1,459; makefile: 2
file content (61 lines) | stat: -rw-r--r-- 1,307 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/perl
use strict;
use Test::More tests => 15;

use Text::Password::Pronounceable;

{
my $pp = Text::Password::Pronounceable->new(6,10);
isa_ok($pp, 'Text::Password::Pronounceable');

my $str = $pp->generate;
ok(length($str) >= 6 && length($str) <= 10);

my $str2 = $pp->generate(5);
ok(length($str2) == 5);

my $str3 = $pp->generate(3,4);
ok(length($str3) >= 3 && length($str3) <= 4);
}

{
my $pp = Text::Password::Pronounceable->new(6);
isa_ok($pp, 'Text::Password::Pronounceable');

my $str = $pp->generate;
ok(length($str) == 6);

my $str2 = $pp->generate(8);
ok(length($str2) == 8);

my $str3 = $pp->generate(3,4);
ok(length($str3) >= 3 && length($str3) <= 4);

}

{
my $pp = Text::Password::Pronounceable->new;
isa_ok($pp, 'Text::Password::Pronounceable');

my $str = $pp->generate;
is($str, q[], 'no lengths, no password');

my $str2 = $pp->generate(10);
ok(length($str2) == 10);

my $str3 = $pp->generate(4,8);
ok(length($str3) >= 4 && length($str3) <= 8);
}
{
# testing generate as a class method

my $str = Text::Password::Pronounceable->generate(6, 10);
ok(length($str) <= 10 && length($str) >= 6);

my $str2 = Text::Password::Pronounceable->generate(3, 4);
ok(length($str2) <= 4 && length($str2) >= 3);

my $str3 = Text::Password::Pronounceable->generate(5);
ok(length($str3) == 5);
}