Devel-Arena

 view release on metacpan or  search on metacpan

t/Devel-Arena.t  view on Meta::CPAN

  }
  ok ($fail, 0);
}
# Every IO is an object
ok($stats->{types}{PVGV}{objects}{IO}, $count{PVIO});

ok($stats->{types}{PVGV}{null_name}, qr/^\d+$/);
# Our exported subroutine should be in there somwhere.
ok($stats->{types}{PVGV}{names}{sv_stats}, qr/^\d+$/);
# As should Test's &ok
ok($stats->{types}{PVGV}{names}{ok}, qr/^\d+$/);

ok($stats->{types}{PVGV}{total}, qr/^\d+$/);
{
  my $null_gp;
  my $gps;
  my $fail = 0;
  while (my ($package, $count) = each %{$stats->{types}{PVGV}{null_gp}}) {
    if ($count !~ /^\d+$/) {
      $fail++;
      print STDERR "# '$package' => '$count'\n";
    }
    $null_gp += $count;
  }
  ok($fail, 0);

  $fail = 0;
  while (my ($gp_refcnt, $num_gv) = each %{$stats->{types}{PVGV}{gp_refcnt}}) {
    if ($gp_refcnt !~ /^\d+$/ or $num_gv !~ /^\d+$/) {
      $fail++;
      print STDERR "# '$gp_refcnt' => '$num_gv'\n";
    }
    $gps += $num_gv;
  }
  ok($fail, 0);

  ok($gps + $null_gp, $stats->{types}{PVGV}{total}, "GPs tally with GVs");

  BEGIN {*snap = \*spmamp; *gurgle = \*snap; $spmamp++}

  # There should be at least one GP with a refcnt of 3.
  ok($stats->{types}{PVGV}{gp_refcnt}{3});
}


ok(ref $stats->{PVX}, 'HASH');
foreach $type ('normal', $] >= 5.008 ? 'shared hash key' : ()) {
    print "# PVX $type\n";
    ok(ref $stats->{PVX}{$type}, 'HASH');
    foreach my $key (qw 'length allocated total') {
	ok($stats->{PVX}{$type}{$key}, qr/^\d+$/);
    }
}

ok($stats->{PVX}{normal}{allocated}
   > $stats->{PVX}{normal}{total} + $stats->{PVX}{normal}{'length'});
ok($stats->{PVX}{'shared hash key'}{allocated} == 0) if $] >= 5.008;

sub oryx () {
  # Our filename
  (caller)[1];
}
sub klortho ($@%) {
}

ok($stats->{types}{PVCV}{prototypes}{''}, qr/^\d+$/);
ok($stats->{types}{PVCV}{prototypes}{'$@%'}, qr/^\d+$/);

foreach my $type (qw(PVCV PVFM)) {
  ok(ref $stats->{types}{$type}{files}, 'HASH');
  my $fail = 0;
  my $total;
  while (my ($name, $count) = each %{$stats->{types}{$type}{files}}) {
    if ($count !~ /^\d+$/) {
      $fail++;
      print STDERR "# $type '$name' => '$count'\n";
    }
    $total += $count;
  }
  ok($fail, 0);

  my $null = $stats->{types}{$type}{"NULL files"};
  ok($null, qr/^\d+$/, "$type NULL files is a number");

  ok($total + $null, $stats->{types}{$type}{total}, "All $type accounted for");
}

# We define 2 subroutines
ok($stats->{types}{PVCV}{files}{&oryx}, 2);

format BLINK =
.

# And 1 format
ok($stats->{types}{PVFM}{files}{&oryx}, 1);

# For now this is Cut & Paste
# Also we don't have totals for GPs easily accessible.
{
  my $fail = 0;
  while (my ($name, $count) = each %{$stats->{"gp files"}}) {
    if ($count !~ /^\d+$/) {
      $fail++;
      print STDERR "# '$name' => '$count'\n";
    }
  }
  ok($fail, 0);

  my $null = $stats->{"gp NULL files"};
  ok($null, qr/^\d+$/, "gp NULL files is a number");

}


ok(ref $stats->{'shared string scalars'}, 'HASH');


ok(ref $stats->{magic}, 'HASH');
foreach my $type (qw (e s I)) {
  my $magic = $stats->{magic}{$type};
  print "# Magic $type\n";



( run in 1.791 second using v1.01-cache-2.11-cpan-d80b1682f3f )