| 1 |
#!perl -w |
| 2 |
use strict; |
| 3 |
|
| 4 |
use XS::APItest; |
| 5 |
use Test::More; |
| 6 |
|
| 7 |
# Some addresses for testing. |
| 8 |
my $a = []; |
| 9 |
my $h = {}; |
| 10 |
my $c = sub {}; |
| 11 |
|
| 12 |
my $t1 = XS::APItest::PtrTable->new(); |
| 13 |
isa_ok($t1, 'XS::APItest::PtrTable'); |
| 14 |
my $t2 = XS::APItest::PtrTable->new(); |
| 15 |
isa_ok($t2, 'XS::APItest::PtrTable'); |
| 16 |
cmp_ok($t1, '!=', $t2, 'Not the same object'); |
| 17 |
|
| 18 |
undef $t2; |
| 19 |
|
| 20 |
# Still here? :-) |
| 21 |
isa_ok($t1, 'XS::APItest::PtrTable'); |
| 22 |
|
| 23 |
is($t1->fetch($a), 0, 'Not found'); |
| 24 |
is($t1->fetch($h), 0, 'Not found'); |
| 25 |
is($t1->fetch($c), 0, 'Not found'); |
| 26 |
|
| 27 |
$t1->store($a, $h); |
| 28 |
|
| 29 |
cmp_ok($t1->fetch($a), '==', $h, 'Found'); |
| 30 |
is($t1->fetch($h), 0, 'Not found'); |
| 31 |
is($t1->fetch($c), 0, 'Not found'); |
| 32 |
|
| 33 |
$t1->split(); |
| 34 |
|
| 35 |
cmp_ok($t1->fetch($a), '==', $h, 'Found'); |
| 36 |
is($t1->fetch($h), 0, 'Not found'); |
| 37 |
is($t1->fetch($c), 0, 'Not found'); |
| 38 |
|
| 39 |
done_testing(); |