5 if ($ENV{'PERL_CORE'}){
7 unshift @INC, '../lib';
10 if (! $Config{'useithreads'}) {
11 print("1..0 # Skip: Perl not compiled with 'useithreads'\n");
16 use Test::More (tests => 53);
18 ### Start of Testing ###
26 is(keys %hash, 0, "hash empty");
28 is(keys %hash,1, "Assign grows hash");
29 is($hash{0},$val[0],"Value correct");
31 is(keys %hash,2, "Assign grows hash");
32 is($hash{0},$val[0],"Value correct");
33 is($hash{2},$val[2],"Value correct");
35 is(keys %hash,3,"Size correct");
36 my @keys = keys %hash;
37 is(join(',',sort @keys),'0,1,2',"Keys correct");
38 my @hval = @hash{0,1,2};
39 is(join(',',@hval),join(',',@val),"Values correct");
40 my $val = delete $hash{1};
41 is($val,$val[1],"Delete value correct");
42 is(keys %hash,2,"Size correct");
43 while (my ($k,$v) = each %hash) {
44 is($v,$val[$k],"each works");
47 is(keys %hash,0,"Clear hash");
53 is(@array, 0, "array empty");
55 is(@array,1, "Assign grows array");
56 is($array[0],$val[0],"Value correct");
57 unshift(@array,$val[2]);
58 is($array[0],$val[2],"Unshift worked");
59 is($array[-1],$val[0],"-ve index");
61 is($array[-1],$val[1],"Push worked");
62 is(@array,3,"Size correct");
63 is(shift(@array),$val[2],"Shift worked");
64 is(@array,2,"Size correct");
65 is(pop(@array),$val[1],"Pop worked");
66 is(@array,1,"Size correct");
68 is(@array,0,"Clear array");
71 ok((require threads::shared),"Require module");
73 if ($threads::shared::VERSION && ! exists($ENV{'PERL_CORE'})) {
74 diag('Testing threads::shared ' . $threads::shared::VERSION);
77 array(24, [], 'Thing');
78 hash(24, [], 'Thing');
80 import threads::shared;
83 array(24, 42, 'Thing');
86 hash(24, 42, 'Thing');