]> git.vpit.fr Git - perl/modules/autovivification.git/blob - samples/stress_realloc.pl
Assert that ops reallocated are handled correctly
[perl/modules/autovivification.git] / samples / stress_realloc.pl
1 #!perl
2
3 use strict;
4 use warnings;
5 use blib;
6
7 my $n = 1_000;
8 my $p = 100;
9
10 my $test = <<'TEST';
11  my $e = $x->{foo}[0]{bar};
12  delete $x->{a}[1]{b};
13  exists $x->{x}[2]{y};
14 TEST
15
16 for (1 .. $n) {
17  my $x;
18  my $r = eval <<" CODE";
19   no autovivification;
20   $test
21  CODE
22  die $@ if $@ or defined $x;
23  for (1 .. $p) {
24   my $x;
25   my $r = eval $test;
26   die $@ if $@;
27  }
28 }