Skip to content

Commit

Permalink
renamed
Browse files Browse the repository at this point in the history
  • Loading branch information
pmendes committed May 18, 2024
1 parent 99c63cd commit 7cc6ef7
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/0502_GvSelfTransport/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 0502_GvSelfTransport

tries to create a set of 2 units of the Selkov-Wolf-Heinrich model where the graphviz file has a self connection

## tests

- 1D, network, directed
- file reads well
- gv file reads well
- issues a warning that the slef connection will be ignored
- produces no other warning or error (ignores bad node)
- tests -o option to name output file
- checks that the self connection was ignored
56 changes: 56 additions & 0 deletions tests/0502_GvSelfTransport/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash

# work out our folder name
test=${PWD##*/} # to assign to a variable
test=${test:-/} # to correct for the case where PWD=/

# run sbmodelr
../../sbmodelr -t X -n ../sources/self.gv -o ISC.cps ../sources/Selkov-Wolf-Heinrich.cps 2 > output

fail=0

# compare output and target
difference=$(diff output target_stdout)
if [[ $difference ]]; then
printf 'FAIL %s\n' "${test}"
fail=1
fi

# test -o option by checking if output file was created
if ! [ -f ISC.cps ]; then
printf 'FAIL %s\n' "${test}"
let "fail = $fail + 2"
fi

# create model summary
../model_report.py ISC.cps >/dev/null
if ! [[ $? = 0 ]]; then
printf 'FAIL %s\n' "${test}"
exit -1
fi

# check that there is a transport reaction 1->2
if ! grep -Pq "t_X_1-2\s+X_1 -> X_2" ISC.summary.txt; then
printf 'FAIL %s\n' "${test}"
let "fail = $fail + 2"
fi

# check that there is no transport reaction 2->2
if grep -Pq "t_X_2-2\s+X_2 -> X_2" ISC.summary.txt; then
printf 'FAIL %s\n' "${test}"
let "fail = $fail + 4"
fi

# check that there is only one transport constant
n=$(grep -Pc "^k_.+_transport\s+fixed" ISC.summary.txt )
if ((n != 1)) ; then
printf 'FAIL %s\n' "${test}"
let "fail = $fail + 8"
fi

if [ "$fail" = 0 ] ; then
printf 'PASS %s\n' "${test}"
rm ISC.summary.txt output *.cps
fi

exit $fail
10 changes: 10 additions & 0 deletions tests/0502_GvSelfTransport/target_stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Processing ../sources/Selkov-Wolf-Heinrich.cps
Reactions: 3
Species: 2 (Reactions: 2, Fixed: 0, Assignment: 0, ODE: 0)
Compartments: 1 (Fixed: 1, Assignment: 0, ODE: 0)
Global quantities: 2 (Fixed: 2, Assignment: 0, ODE: 0)
Events: 0 (Only time-dependent: 0, variable-dependent: 0)
Network: directed (Nodes: 2, Edges: 2)
Warning: transport on the same unit not allowed, ignoring 2 -> 2
created new model ISC.cps with a set of 2 replicas of ../sources/Selkov-Wolf-Heinrich.cps

0 comments on commit 7cc6ef7

Please sign in to comment.