#!/usr/bin/perl
BEGIN {
$| = 1;
$^W = 1;
}
use_ok(
'Data::GUID'
);
use_ok(
'Params::Util'
,
':ALL'
);
use_ok(
'PITA::Guest::Storage'
);
{
my
@good_uuids
= (
'4162F712-1DD2-11B2-B17E-C09EFE1DC403'
,
Data::GUID->new->as_string,
Data::GUID->new->as_string,
Data::GUID->new,
);
foreach
my
$good
(
@good_uuids
) {
my
$rv
=
eval
{ Data::GUID->from_string(
$good
) };
is( $@,
''
,
"->from_string($good) does not throw an error"
);
isa_ok(
$rv
,
'Data::GUID'
);
}
foreach
my
$good
(
@good_uuids
) {
isa_ok( PITA::Guest::Storage::_GUID(
$good
),
'Data::GUID'
);
}
my
@bad_uuids
= (
undef
,
''
,
' '
, 1,
'a'
,
'abcd'
, \
""
,
\
"foo"
, [], {}, (
sub
{ 1 }),
*foo
,
*foo
,
'4162F712-1DD2-11B2-B17E-C09EFE1D'
,
);
foreach
my
$bad
(
@bad_uuids
) {
is( PITA::Guest::Storage::_GUID(
$bad
),
undef
,
"_UUID(bad) returns undef"
);
}
}
1;