From a7bbb072be7ffc208bb8e39203f16d4bed75cc1c Mon Sep 17 00:00:00 2001 From: Harry Moffat Date: Tue, 24 Mar 2009 23:12:58 +0000 Subject: [PATCH] Added test for this example. --- Cantera/python/examples/misc/.cvsignore | 10 ++ Cantera/python/examples/misc/Makefile.in | 23 ++- Cantera/python/examples/misc/cleanup | 5 + .../python/examples/misc/output_blessed_0.txt | 0 Cantera/python/examples/misc/rp_blessed_0.txt | 155 ++++++++++++++++++ Cantera/python/examples/misc/runtest.in | 45 +++++ 6 files changed, 232 insertions(+), 6 deletions(-) create mode 100755 Cantera/python/examples/misc/cleanup create mode 100644 Cantera/python/examples/misc/output_blessed_0.txt create mode 100644 Cantera/python/examples/misc/rp_blessed_0.txt create mode 100755 Cantera/python/examples/misc/runtest.in diff --git a/Cantera/python/examples/misc/.cvsignore b/Cantera/python/examples/misc/.cvsignore index f3c7a7c5d..06f9a2eba 100644 --- a/Cantera/python/examples/misc/.cvsignore +++ b/Cantera/python/examples/misc/.cvsignore @@ -1 +1,11 @@ Makefile +runtest +buildlog +ct2ctml.log +diff_out_0.txt +diff_rp.txt +gri30.xml +h2o2.xml +output_0.txt +rp.txt +rxnpath.log diff --git a/Cantera/python/examples/misc/Makefile.in b/Cantera/python/examples/misc/Makefile.in index 9a7cf3fdf..c1b96cf52 100644 --- a/Cantera/python/examples/misc/Makefile.in +++ b/Cantera/python/examples/misc/Makefile.in @@ -1,16 +1,27 @@ #!/bin/sh -PY_DEMOS = rxnpath1.py +INST_DIR=@ct_demodir@/python/misc + PYTHON_CMD = @PYTHON_CMD@ run: - @(for py in $(PY_DEMOS) ; do \ - echo "running $${py}..."; \ - $(PYTHON_CMD) "$${py}"; \ - done) + $(PYTHON_CMD) rxnpath1.py + +test: + ./runtest + +install: + @INSTALL@ -d $(INST_DIR) + @INSTALL@ -c -m ug+rw,o+r Makefile $(INST_DIR) + @INSTALL@ -c -m ug+rw,o+r rxnpath1.py $(INST_DIR) + @INSTALL@ -c runtest $(INST_DIR) + @INSTALL@ -c cleanup $(INST_DIR) + @INSTALL@ -c -m ug+rw,o+r output_blessed_0.txt $(INST_DIR) + @INSTALL@ -c -m ug+rw,o+r rp_blessed_0.txt $(INST_DIR) + clean: - rm -f *.log *.csv *.xml + ./cleanup # end of file diff --git a/Cantera/python/examples/misc/cleanup b/Cantera/python/examples/misc/cleanup new file mode 100755 index 000000000..40e1dbd9e --- /dev/null +++ b/Cantera/python/examples/misc/cleanup @@ -0,0 +1,5 @@ +#!/bin/sh +# +/bin/rm -rf equilibrate_log*.html +/bin/rm -rf .cttmp* ct2ctml.log transport_log.xml vcs_equilibrate_res*.csv \ + catcomb.csv output_0.txt diff* diff --git a/Cantera/python/examples/misc/output_blessed_0.txt b/Cantera/python/examples/misc/output_blessed_0.txt new file mode 100644 index 000000000..e69de29bb diff --git a/Cantera/python/examples/misc/rp_blessed_0.txt b/Cantera/python/examples/misc/rp_blessed_0.txt new file mode 100644 index 000000000..6b1af7274 --- /dev/null +++ b/Cantera/python/examples/misc/rp_blessed_0.txt @@ -0,0 +1,155 @@ +reaction path diagram following N +N N2 NO N2O NO2 NH HNO NH2 NNH CN NCO HCN HOCN HNCO H2CN HCNN HCNO NH3 +N N2 0.00104026 -2.38217e-21 +N NO 0.00151206 -1.02988e-11 +N N2O 0 -0 +N NO2 0 -0 +N NH 5.16804e-14 -3.95673e-05 +N HNO 0 -0 +N NH2 0 -0 +N NNH 0 -0 +N CN 2.43676e-36 -4.3908e-09 +N NCO 1.25836e-08 -2.93822e-27 +N HCN 1.06476e-17 -2.21016e-58 +N HOCN 0 -0 +N HNCO 0 -0 +N H2CN 6.86689e-17 -1.43981e-29 +N HCNN 0 -0 +N HCNO 0 -0 +N NH3 0 -0 +N2 NO 4.69799e-30 -0.00106523 +N2 N2O 1.22881e-10 -1.84291e-09 +N2 NO2 0 -0 +N2 NH 1.44133e-39 -2.48382e-05 +N2 HNO 0 -0 +N2 NH2 0 -0 +N2 NNH 1.74573e-05 -0.0119939 +N2 CN 1.22948e-29 -2.46168e-13 +N2 NCO 2.8537e-59 -1.42027e-07 +N2 HCN 2.38217e-21 -1.37092e-20 +N2 HOCN 0 -0 +N2 HNCO 0 -0 +N2 H2CN 1.51751e-45 -6.27665e-18 +N2 HCNN 5.25203e-13 -8.62786e-16 +N2 HCNO 0 -0 +N2 NH3 0 -0 +NO N2O 0.000107092 -1.47204e-13 +NO NO2 0.0940287 -0.0140354 +NO NH 2.7569e-26 -5.82741e-05 +NO HNO 0.0186433 -0.000907044 +NO NH2 0 -0 +NO NNH 8.06187e-10 -1.71577e-05 +NO CN 6.32055e-12 -5.71529e-22 +NO NCO 3.94462e-06 -2.11219e-07 +NO HCN 1.13412e-12 -2.8629e-38 +NO HOCN 0 -0 +NO HNCO 4.22158e-13 -1.14191e-44 +NO H2CN 1.21327e-23 -1.73567e-19 +NO HCNN 1.39685e-59 -2.9749e-18 +NO HCNO 5.95204e-14 -2.94842e-21 +NO NH3 0 -0 +N2O NO2 6.38469e-51 -5.24626e-11 +N2O NH 1.23193e-16 -0.000106943 +N2O HNO 0 -0 +N2O NH2 0 -0 +N2O NNH 0 -0 +N2O CN 0 -0 +N2O NCO 1.06252e-28 -1.49001e-07 +N2O HCN 0 -0 +N2O HOCN 0 -0 +N2O HNCO 0 -0 +N2O H2CN 0 -0 +N2O HCNN 0 -0 +N2O HCNO 0 -0 +N2O NH3 0 -0 +NO2 NH 0 -0 +NO2 HNO 0 -0 +NO2 NH2 0 -0 +NO2 NNH 0 -0 +NO2 CN 0 -0 +NO2 NCO 0 -0 +NO2 HCN 0 -0 +NO2 HOCN 0 -0 +NO2 HNCO 0 -0 +NO2 H2CN 0 -0 +NO2 HCNN 0 -0 +NO2 HCNO 0 -0 +NO2 NH3 0 -0 +NH HNO 0.000115502 -4.98247e-08 +NH NH2 1.19415e-10 -2.31562e-06 +NH NNH 8.06187e-10 -1.71577e-05 +NH CN 0 -0 +NH NCO 1.23977e-16 -2.00204e-07 +NH HCN 4.59818e-24 -1.31698e-12 +NH HOCN 0 -0 +NH HNCO 1.56376e-08 -4.66539e-12 +NH H2CN 0 -0 +NH HCNN 0 -0 +NH HCNO 0 -0 +NH NH3 0 -0 +HNO NH2 2.19605e-15 -9.06636e-06 +HNO NNH 0 -0 +HNO CN 0 -0 +HNO NCO 0 -0 +HNO HCN 0 -0 +HNO HOCN 0 -0 +HNO HNCO 9.32896e-39 -5.87324e-27 +HNO H2CN 0 -0 +HNO HCNN 0 -0 +HNO HCNO 0 -0 +HNO NH3 0 -0 +NH2 NNH 0 -0 +NH2 CN 0 -0 +NH2 NCO 0 -0 +NH2 HCN 3.73704e-23 -1.76069e-15 +NH2 HOCN 0 -0 +NH2 HNCO 2.83399e-12 -5.83816e-10 +NH2 H2CN 0 -0 +NH2 HCNN 0 -0 +NH2 HCNO 1.05191e-41 -2.98008e-15 +NH2 NH3 9.1441e-08 -2.75785e-07 +NNH CN 0 -0 +NNH NCO 0 -0 +NNH HCN 0 -0 +NNH HOCN 0 -0 +NNH HNCO 0 -0 +NNH H2CN 0 -0 +NNH HCNN 0 -0 +NNH HCNO 0 -0 +NNH NH3 0 -0 +CN NCO 1.64222e-08 -2.96648e-13 +CN HCN 5.43066e-10 -1.59654e-13 +CN HOCN 0 -0 +CN HNCO 0 -0 +CN H2CN 0 -0 +CN HCNN 0 -0 +CN HCNO 0 -0 +CN NH3 0 -0 +NCO HCN 2.97308e-14 -5.27313e-12 +NCO HOCN 0 -0 +NCO HNCO 7.7348e-10 -1.51694e-09 +NCO H2CN 0 -0 +NCO HCNN 0 -0 +NCO HCNO 0 -0 +NCO NH3 0 -0 +HCN HOCN 5.52607e-15 -1.02675e-11 +HCN HNCO 1.02745e-13 -3.32551e-19 +HCN H2CN 2.05133e-10 -7.9188e-19 +HCN HCNN 1.39685e-59 -2.9749e-18 +HCN HCNO 5.52908e-34 -3.32464e-15 +HCN NH3 0 -0 +HOCN HNCO 8.06191e-11 -1.4044e-19 +HOCN H2CN 0 -0 +HOCN HCNN 0 -0 +HOCN HCNO 0 -0 +HOCN NH3 0 -0 +HNCO H2CN 0 -0 +HNCO HCNN 0 -0 +HNCO HCNO 2.99521e-38 -5.56443e-14 +HNCO NH3 0 -0 +H2CN HCNN 0 -0 +H2CN HCNO 0 -0 +H2CN NH3 0 -0 +HCNN HCNO 0 -0 +HCNN NH3 0 -0 +HCNO NH3 0 -0 diff --git a/Cantera/python/examples/misc/runtest.in b/Cantera/python/examples/misc/runtest.in new file mode 100755 index 000000000..e765456ce --- /dev/null +++ b/Cantera/python/examples/misc/runtest.in @@ -0,0 +1,45 @@ +#!/bin/sh +# +# +temp_success="1" +/bin/rm -f output_0.txt diff_csv.txt diff_out_0.txt + +########################################################################## +PYTHON_CMD=@PYTHON_CMD@ +prog=rxnpath1.py +if test ! -f $prog ; then + echo $prog ' does not exist' + exit -1 +fi +################################################################# +# +CANTERA_DATA=${CANTERA_DATA:=../../../data/inputs}; export CANTERA_DATA +CANTERA_BIN=${CANTERA_BIN:=../../../bin} + +################################################################# + +$PYTHON_CMD $prog >output_0.txt +retnStat=$? +if [ $retnStat != "0" ] +then + temp_success="0" + echo "$prog returned with bad status, $retnStat, check output" +fi + +diff -w output_blessed_0.txt output_0.txt > diff_out_0.txt +retnStat_0=$? + +retnTotal=1 +if test $retnStat_0 = "0" +then + retnTotal=0 +fi + + +if test $retnTotal = "0" +then + echo "Successful test comparison on "`pwd` +else + echo "Unsuccessful test comparison of txt files on "`pwd` " test" +fi +