Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
10 | reyssat | 1 | #!/usr/local/bin/perl |
2 | |||
3 | $lignes_de_reponse = 5; |
||
4 | |||
5 | while(chomp($essai = <STDIN>)){ |
||
6 | if(length($essai) != 0 && substr($essai,0,1) ne "#"){ |
||
7 | for ($i=0; $i < $lignes_de_reponse; $i++){ |
||
8 | chomp($tmp=<STDIN>); @reponse[$i]=$tmp; |
||
9 | } |
||
10 | $essai_ = $essai; |
||
11 | $essai_ =~ s/\'/\\\'/g; |
||
12 | @args = ("echo \"$essai_\" | chemeq > tmp.1"); |
||
13 | system @args; |
||
14 | open (TMP,'tmp.1'); |
||
15 | $ok=1; |
||
16 | for ($i=0; $i < $lignes_de_reponse; $i++){ |
||
17 | chomp($tmp=<TMP>); @result[$i]=$tmp; |
||
18 | if (@result[$i] ne @reponse[$i]){$ok=0;} |
||
19 | } |
||
20 | if ($ok){print "OK\t\t$essai\n";} |
||
21 | else{ |
||
22 | print "***ERREUR***\t$essai\n"; |
||
23 | for ($i=0; $i < $lignes_de_reponse; $i++){ |
||
24 | if(@result[$i] ne @reponse[$i]){ |
||
25 | print "ligne $i : on attendait\n"; |
||
26 | print "\t\"@reponse[$i]\"\n"; |
||
27 | print "on a trouvé\n"; |
||
28 | print "\t\"@result[$i]\"\n"; |
||
29 | } |
||
30 | } |
||
31 | } |
||
32 | } |
||
33 | |||
34 | } |
||
35 |