-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests various gv files with problems
- Loading branch information
Showing
2 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# 0503_GvIssues | ||
|
||
tests various graphviz network files that should raise warnings or errors | ||
|
||
## tests | ||
|
||
- 1D, network, transport | ||
- appropriate warning for an empty network file | ||
- appropriate warning for a network file without edges | ||
- appropriate warning for test a network file with repeated edges | ||
- ensure that repeated edges are added exactly once to model | ||
- appropriate warning for a network file with non-numeric nodes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/bin/bash | ||
|
||
# work out our folder name | ||
test=${PWD##*/} # to assign to a variable | ||
test=${test:-/} # to correct for the case where PWD=/ | ||
|
||
fail=0 | ||
|
||
# test an empty network file | ||
../../sbmodelr -t G -n ../sources/empty.gv -o t.cps ../sources/GeneExpressionUnit.cps 2 > output | ||
|
||
# check that the correct warning is issued | ||
if ! grep -q " Warning: ../sources/empty.gv did not contain any valid edges, no connections added" output; then | ||
printf 'FAIL %s\n' "${test}" | ||
let "fail = 1" | ||
fi | ||
|
||
# test a network file without edges | ||
../../sbmodelr -t G -n ../sources/no-edges.gv -o t.cps ../sources/GeneExpressionUnit.cps 2 > output | ||
|
||
# check that the correct warning is issued | ||
if ! grep -q " Warning: ../sources/no-edges.gv did not contain any valid edges, no connections added" output; then | ||
printf 'FAIL %s\n' "${test}" | ||
let "fail = $fail + 2" | ||
fi | ||
|
||
# test a network file with repeated edges | ||
../../sbmodelr -t G -n ../sources/duplicates.gv -o t.cps ../sources/GeneExpressionUnit.cps 4 > output | ||
|
||
# check that the correct warning is issued | ||
if ! grep -q " Warning: duplicate entry for connection 1 to 3, ignored" output; then | ||
printf 'FAIL %s\n' "${test}" | ||
let "fail = $fail + 4" | ||
fi | ||
|
||
# create model summary | ||
../model_report.py t.cps >/dev/null | ||
if ! [[ $? = 0 ]]; then | ||
printf 'FAIL %s\n' "${test}" | ||
exit -1 | ||
fi | ||
|
||
# check that there is exactly one transport reaction 1->3 (the duplicate) | ||
n=$(grep -Pc "^t_G_1-3\s+G_1 = G_3\s+Mass action" t.summary.txt ) | ||
if ((n != 1)) ; then | ||
printf 'FAIL %s\n' "${test}" | ||
let "fail = $fail + 8" | ||
fi | ||
|
||
# test a network file with non-numeric nodes | ||
../../sbmodelr -t G -n ../sources/non-numeric-nodes.gv -o t.cps ../sources/GeneExpressionUnit.cps 3 > output | ||
|
||
# check that the correct warning is issued | ||
if ! grep -q " Warning: ../sources/non-numeric-nodes.gv did not contain any valid edges, no connections added" output; then | ||
printf 'FAIL %s\n' "${test}" | ||
let "fail = $fail + 16" | ||
fi | ||
|
||
if [ "$fail" = 0 ] ; then | ||
printf 'PASS %s\n' "${test}" | ||
rm t.summary.txt output *.cps | ||
fi | ||
|
||
exit $fail |