3 # test the MULTICALL macros
4 # Note: as of Oct 2010, there are not yet comprehensive tests
10 use Test::More tests => 6;
16 sub add { $sum += $_++ }
19 XS::APItest::multicall_each \&add, @a;
20 is($sum, 6, "sum okay");
21 is($a[0], 2, "a[0] okay");
22 is($a[1], 3, "a[1] okay");
23 is($a[2], 4, "a[2] okay");
27 # multicall using a sub that aleady has CvDEPTH > 1 caused sub
28 # to be prematurely freed
32 sub REC::DESTROY { $destroyed = 1 }
40 XS::APItest::multicall_each \&$sub, 1,2,3;
45 is($destroyed, 0, "f not yet destroyed");
47 is($destroyed, 1, "f now destroyed");