From 7cc6ef7b20569b261688102713c3379940d63567 Mon Sep 17 00:00:00 2001 From: Pedro Mendes Date: Sat, 18 May 2024 14:56:22 -0400 Subject: [PATCH] renamed --- tests/0502_GvSelfTransport/README.md | 13 ++++++ tests/0502_GvSelfTransport/run.sh | 56 ++++++++++++++++++++++++ tests/0502_GvSelfTransport/target_stdout | 10 +++++ 3 files changed, 79 insertions(+) create mode 100644 tests/0502_GvSelfTransport/README.md create mode 100755 tests/0502_GvSelfTransport/run.sh create mode 100644 tests/0502_GvSelfTransport/target_stdout diff --git a/tests/0502_GvSelfTransport/README.md b/tests/0502_GvSelfTransport/README.md new file mode 100644 index 0000000..2fff5c8 --- /dev/null +++ b/tests/0502_GvSelfTransport/README.md @@ -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 diff --git a/tests/0502_GvSelfTransport/run.sh b/tests/0502_GvSelfTransport/run.sh new file mode 100755 index 0000000..6070da0 --- /dev/null +++ b/tests/0502_GvSelfTransport/run.sh @@ -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 diff --git a/tests/0502_GvSelfTransport/target_stdout b/tests/0502_GvSelfTransport/target_stdout new file mode 100644 index 0000000..d7a8036 --- /dev/null +++ b/tests/0502_GvSelfTransport/target_stdout @@ -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 +