File: factory.t

package info (click to toggle)
libcrypt-random-source-perl 0.14-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 360 kB
  • sloc: perl: 556; sh: 6; makefile: 2
file content (32 lines) | stat: -rw-r--r-- 756 bytes parent folder | download | duplicates (3)
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
use strict;
use warnings;

use Test::More 0.88;

use ok 'Crypt::Random::Source::Factory';

{
    my $f = Crypt::Random::Source::Factory->new;

    ok( $f->weak_source, "got a weak source" );

    ok( !$f->weak_source->is_strong, "weak is weak" );

    isa_ok( $f->get_weak, "Crypt::Random::Source::Weak" );

    SKIP: {
        skip "need a strong source", 2
            unless eval {
                require Crypt::Random::Source::Strong::devrandom;
                Crypt::Random::Source::Strong::devrandom->available;
            };

        ok( $f->strong_source, "got a strong source" );
        isa_ok( $f->get_strong, "Crypt::Random::Source::Strong" );
    }

    isa_ok( $f->get, "Crypt::Random::Source::Base" );
}

done_testing;
# ex: set sw=4 et: