File: Catmandu-IdGenerator-UUID.t

package info (click to toggle)
libcatmandu-perl 1.2024-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,552 kB
  • sloc: perl: 17,037; makefile: 24; sh: 1
file content (29 lines) | stat: -rw-r--r-- 496 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
#!/usr/bin/env perl

use strict;
use warnings;
use Test::More;
use Test::Exception;

my $pkg;

BEGIN {
    $pkg = 'Catmandu::IdGenerator::UUID';
    use_ok $pkg;
}
require_ok $pkg;

my $id_generator = $pkg->new;
isa_ok $id_generator, $pkg;
ok $id_generator->does("Catmandu::IdGenerator"),
    "An object of class '$pkg' does 'Catmandu::Id::Generator'";

my %uuids;

for my $i (0 .. 99) {
    $uuids{$id_generator->generate} = 1;
}

is scalar(keys %uuids), 100, 'uuids are unique';

done_testing;