/usr/share/doc/chemeq/tests/chemtest.pl is in chemeq 2.12-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | #!/usr/local/bin/perl
# -*- coding: utf-8 -*-
$lignes_de_reponse = 6;
while(chomp($essai = <STDIN>)){
if(length($essai) != 0 && substr($essai,0,1) ne "#"){
for ($i=0; $i < $lignes_de_reponse; $i++){
chomp($tmp=<STDIN>); @reponse[$i]=$tmp;
}
$essai_ = $essai;
$essai_ =~ s/\'/\\\'/g;
@args = ("echo \"$essai_\" | chemeq > /tmp/tmp.1");
system @args;
open (TMP,'/tmp/tmp.1');
$ok=1;
for ($i=0; $i < $lignes_de_reponse; $i++){
chomp($tmp=<TMP>); @result[$i]=$tmp;
if (@result[$i] ne @reponse[$i]){$ok=0;}
}
if ($ok){print "OK\t\t$essai\n";}
else{
print "***ERREUR***\t$essai\n";
for ($i=0; $i < $lignes_de_reponse; $i++){
if(@result[$i] ne @reponse[$i]){
print "ligne $i : on attendait\n";
print "\t\"@reponse[$i]\"\n";
print "on a trouvé\n";
print "\t\"@result[$i]\"\n";
}
}
}
} else {
if ($essai =~ /[a-zA-Z]/) {print "$essai\n";}
}
}
system ("(cd /tmp; rm -f tmp.1)");
|