| 1 |
use strict; |
| 2 |
use warnings; |
| 3 |
use MyTest; |
| 4 |
use UUID ':all'; |
| 5 |
|
| 6 |
ok 1, 'loaded'; |
| 7 |
|
| 8 |
{# correct usage |
| 9 |
my $u0 = '00000000-0000-0000-0000-000000000000'; |
| 10 |
my $b0 = 'original'; |
| 11 |
ok !parse($u0, $b0), 'parse ok'; |
| 12 |
ok defined($b0), 'parse defined'; |
| 13 |
is length($b0), 16, 'parse length'; |
| 14 |
ok is_null($b0), 'binary null'; |
| 15 |
} |
| 16 |
{# parse random |
| 17 |
my $u0 = 'random string'; |
| 18 |
ok parse($u0, my $b0), 'parse random fail'; |
| 19 |
ok !defined($b0), 'parse random undefined'; |
| 20 |
} |
| 21 |
{# parse empty |
| 22 |
my $u0 = ''; |
| 23 |
ok parse($u0, my $b0), 'parse empty fail'; |
| 24 |
ok !defined($b0), 'parse empty undefined'; |
| 25 |
} |
| 26 |
{# parse number |
| 27 |
my $u0 = 8675309; |
| 28 |
ok parse($u0, my $b0), 'parse number fail'; |
| 29 |
ok !defined($b0), 'parse number undefined'; |
| 30 |
} |
| 31 |
{# parse undef |
| 32 |
my $u0 = undef; |
| 33 |
ok parse($u0, my $b0), 'parse undef fail'; |
| 34 |
ok !defined($b0), 'parse undef undefined'; |
| 35 |
} |
| 36 |
|
| 37 |
done_testing; |