#!/usr/bin/perl
# Compare all files enlisted in "FILES". Return 1 if everything checks,
# 0 otherwise.
# Part of "NRG Ljubljana".
# Rok Zitko, rok.zitko@ijs.si, Aug, Dec 2006
# $Id: compare 24 2006-12-20 13:45:53Z zitko $

my $error = 0;

open(FILES, "<FILES") or die "Can't open FILES\n";

while (<FILES>) {
  chomp;
  my $f = $_;

  # -b : ignore whitespace
  # -I <regex> : ignore changes that just insert or delete lines that match regex.
  # Lines starting with # are ignored (comments!).
    
#    print "$f\n";
#    system("diff -b -I ^# $f $f.test");
    $return = system("../mycomp.pl $f $f.test");
    
    if ($return != 0) {
	$error = 1;
    }
}

if ($error == 0) {
    print "PASSED.\n";
} else {
    print "FAILED.\n";
}

exit($error);
