~ubuntu-branches/ubuntu/raring/chemeq/raring

« back to all changes in this revision

Viewing changes to tests/chemtest.pl

  • Committer: Bazaar Package Importer
  • Author(s): Georges Khaznadar
  • Date: 2003-04-14 12:04:35 UTC
  • Revision ID: james.westby@ubuntu.com-20030414120435-osewh7q6iw8pqx3g
Tags: 1.2-1
* added the -M switch; features molecular weights calculation
* corrected the references to endl (using std::endl instead)
  closes: Bug#188906
  other incorrect references to cin, cout and cerr are due to a bad
  behavior of flex when used in c++ mode.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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/tmp.1");
 
13
        system @args;
 
14
        open (TMP,'/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
 
 
36
system ("(cd /tmp; rm -f tmp.1)");
 
37
 
 
38