Skip to content

Commit

Permalink
Update example with new code and new ref bindump
Browse files Browse the repository at this point in the history
  • Loading branch information
smoretti committed Feb 4, 2022
1 parent 2463b2f commit f78677d
Show file tree
Hide file tree
Showing 10 changed files with 10,536 additions and 10,441 deletions.
44 changes: 22 additions & 22 deletions examples/ECOLI/bigg_iML1515/mapped/chemicals.tsv

Large diffs are not rendered by default.

13,258 changes: 6,677 additions & 6,581 deletions examples/ECOLI/bigg_iML1515/mapped/convert_log.yaml

Large diffs are not rendered by default.

4,442 changes: 2,221 additions & 2,221 deletions examples/ECOLI/bigg_iML1515/mapped/enzymes.tsv

Large diffs are not rendered by default.

3,030 changes: 1,515 additions & 1,515 deletions examples/ECOLI/bigg_iML1515/mapped/peptides.tsv

Large diffs are not rendered by default.

142 changes: 71 additions & 71 deletions examples/ECOLI/bigg_iML1515/mapped/reactions.tsv

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions test/ALLTESTS.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

export TMP=/tmp/MNXtools_test/$USER/tests/$$ # scratch dir
mkdir -p $TMP
export MNX_DEFAULT_CACHE=../cache/ChemSpace.bindump

for PERL in perl;
do
Expand Down
3 changes: 1 addition & 2 deletions test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ Principles:

* Tests are stored in `*.test` files.
* Every test consists in a single UNIX command, that must start with `TEST=<test-name>`
* A test is succesful if the exit code is zero.
* A test is successful if the exit code is zero.

In addition to `TEST`, a couple of environment variables are used to write the tests.
These are documented and initialised in `./ALLTESTS.sh` and used in the `*.test` files.


3 changes: 1 addition & 2 deletions test/convert.test
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
TEST=CONVERT
$PERL ../bin/convert_mnet.pl $MNET/unmapped $TMP \
$PERL ../bin/convert_mnet.pl -V ${MNX_CACHE:=$MNX_DEFAULT_CACHE} $MNET/unmapped $TMP \
&& $PERL ./mnet_diff.pl $MNET/mapped $TMP \
&& diff $MNET/mapped/convert_log.yaml $TMP/convert_log.yaml


16 changes: 8 additions & 8 deletions test/run_test.pl
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,20 @@
next if /^\s*$/;
if( /^TEST=(.+)/ ){
$rank++;
$test_id = $1;
$tb->die( "Duplicated test: $test_id" ) if exists $test_info{$test_id};
$test_info{$test_id} = {
rank => $rank,
cmd => '',
}
}
$test_id = $1;
$tb->die( "Duplicated test: $test_id" ) if exists $test_info{$test_id};
$test_info{$test_id} = {
rank => $rank,
cmd => '',
}
}
else{
$tb->die( "Not test defined yet: $_" ) unless $test_id;
while( /\$(\w+)/g ){
$tb->die( "Environment variable '$1' not set in line: $_" ) unless exists $ENV{$1};
}
$test_info{$test_id}{cmd} .= $_;
}
}
}

foreach my $test_id ( sort { $test_info{$a}{rank} <=> $test_info{$b}{rank} } keys %test_info ){
Expand Down
38 changes: 19 additions & 19 deletions test/tab_diff.pl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
options: -h this help
-t <real> tolerance (absolute value) for real number
comparison (1e-6 by default)
comparison (1e-6 by default)
-z Zombie mode: do not die on error!
In addition the environment variable
Expand Down Expand Up @@ -47,22 +47,22 @@
my $L = @$tsv_1;
$tb->die( "The two input files have a different number of lines!" ) unless $L == @$tsv_2;
foreach my $i ( 0 .. @format -1 ){
if( $format[$i] eq 's' ){ # string comparison
foreach( 0 .. $L - 1 ){
if( $format[$i] eq 's' ){ # string comparison
foreach( 0 .. $L - 1 ){
$tsv_1->[$_][$i] =~ s/_(B|LR|RL)$//;
$tsv_2->[$_][$i] =~ s/_(B|LR|RL)$//;
unless( $tsv_1->[$_][$i] eq $tsv_2->[$_][$i] ){
msg(
unless( $tsv_1->[$_][$i] eq $tsv_2->[$_][$i] ){
msg(
"Strings differ: $tsv_1->[$_][$i] vs $tsv_2->[$_][$i] at line "
. ( $_ + 1 )
. ', col '
. ($i + 1 )
);
}
}
}
elsif( $format[$i] eq 'i' ){ # integer comparison
foreach( 0 .. $L - 1 ){
}
}
}
elsif( $format[$i] eq 'i' ){ # integer comparison
foreach( 0 .. $L - 1 ){
unless( $tsv_1->[$_][$i] == $tsv_2->[$_][$i] ){
msg(
"Numbers not equal: $tsv_1->[$_][$i] vs $tsv_2->[$_][$i] at line "
Expand All @@ -72,9 +72,9 @@
);
}
}
}
elsif( $format[$i] eq 'r' ){ # real comparison (with some tolerance)
foreach my $j ( 0 .. $L - 1 ){
}
elsif( $format[$i] eq 'r' ){ # real comparison (with some tolerance)
foreach my $j ( 0 .. $L - 1 ){
if( abs( $tsv_1->[$j][$i] - $tsv_2->[$j][$i] ) > $opt{t} ) {
msg(
"Numbers differ too much: $tsv_1->[$j][$i] vs $tsv_2->[$j][$i] at line "
Expand All @@ -84,13 +84,13 @@
);
}
}
}
elsif( $format[$i] eq '.' ){ # skip that column
}
elsif( $format[$i] eq '.' ){ # skip that column

}
else{
$tb->die( "Unsupported column format: $format[$i]" );
}
}
else{
$tb->die( "Unsupported column format: $format[$i]" );
}
}

sub msg{
Expand Down

0 comments on commit f78677d

Please sign in to comment.