
@ARGV = <*.pl> unless @ARGV;

for $p (@ARGV) {
  open P, "perl -MTestFudge $p |" or die $!;
  open O, ">", "RESULTS/$p" or die $!;
  my @pound;
  my $tests = 0;
  my $good = 0;
  while (<P>) {
    push @pound, $_ if /^#/;
    if (/^not ok (\d+)/) {
      print O @pound, $_;
      $tests++;
      @pound = () if $1 % 4 == 0;
    } elsif (/^ok (\d+)/) {
      $good++;
      $tests++;
      @pound = () if $1 % 4 == 0;
    }
  }
  printf "%15s: %3d/%3d\n", $p, $good, $tests;
}
