#!/usr/bin/perl


print "\n"x24,
    "\033[2;26H",
    "\033[30;1m[\033[36;1mTestador de Laboratórios\033[30;1m]\033[0m",
    "\033[4;0H";


$entrada  = `ls -1 arq[0-9].tes --color=never`;
@entrada = split("\n",$entrada);

$lab = `ls -1 prova[0-9]AB --color=never`;
($lab,) = split("\n",$lab);

foreach $i (@entrada) {
    ($i,) = split(/\./,$i); 
    print "\033[0;1mTeste: \033[0m$i.tes   ";
    system("./".$lab." < $i.tes > $i.my");
    if (`diff $i.res $i.my`) {
	print "\033[31mERRADO!\033[0m\n";
    } else {
	print "\033[32mCERTO!\033[0m\n";
    }
}

print "\npor \033[1mGustavo S. Barbieri\033[0m -- \033[36;1mhttp://www.ic.unicamp.br/~ra008849\033[0m\n\n";

