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
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#!perl -w
use strict;
use XS::APItest;
use Test::More;
# Some addresses for testing.
my $a = [];
my $h = {};
my $c = sub {};
my $t1 = XS::APItest::PtrTable->new();
isa_ok($t1, 'XS::APItest::PtrTable');
my $t2 = XS::APItest::PtrTable->new();
isa_ok($t2, 'XS::APItest::PtrTable');
cmp_ok($t1, '!=', $t2, 'Not the same object');
undef $t2;
# Still here? :-)
isa_ok($t1, 'XS::APItest::PtrTable');
is($t1->fetch($a), 0, 'Not found');
is($t1->fetch($h), 0, 'Not found');
is($t1->fetch($c), 0, 'Not found');
$t1->store($a, $h);
cmp_ok($t1->fetch($a), '==', $h, 'Found');
is($t1->fetch($h), 0, 'Not found');
is($t1->fetch($c), 0, 'Not found');
$t1->split();
cmp_ok($t1->fetch($a), '==', $h, 'Found');
is($t1->fetch($h), 0, 'Not found');
is($t1->fetch($c), 0, 'Not found');
$t1->clear();
is($t1->fetch($a), 0, 'Not found');
is($t1->fetch($h), 0, 'Not found');
is($t1->fetch($c), 0, 'Not found');
done_testing();
|