#!/bin/sh
# $Id: runtest.in,v 1.7 2006/03/03 15:33:56 hkmoffa Exp $
#
echo " "
echo "***************************************************"
echo "        Testing CK2CTI                             "
echo "***************************************************"
echo " "
BINDIR=@buildbin@
CK2CTI=$BINDIR/ck2cti
/bin/rm  -f gri30.cti gri30a.cti gri30b.cti
echo "...Test 1: Converting file gri30.inp..."
$CK2CTI -i ./gri30.inp -id gri30 -tr ./gri30_tran.dat 
#
# strip out variably dated stuff
#
cat gri30.cti | sed '1,5s/^#.*$/#/' > gri30a.cti
#
# Change all 3 character exponent expressions starting with 0
# into 2 character exponent expressions
# (MSVC++ defaults to 3, and I can't figure out how to change
#  this behavior).
#
../../bin/exp3to2.sh gri30a.cti > gri30b.cti
#
#
diff gri30b.cti gri30a_blessed.cti > diff_test.out
retnStat=$?
#
if [ $retnStat = "0" ]
then
  echo "Successful diff comparison on ck2cti test (gri30.inp)"
else
  echo "########################################################"
  echo "Unsuccessful diff comparison on ck2cti test (gri30.inp)"
  echo "   For more information, see files:"
  echo "       test_problems/ck2cti_test/diff_test.out"
  echo "       test_problems/ck2cti_test/gri30b.cti"
  echo "       test_problems/ck2cti_test/gri30a_blessed.cti"
  echo "########################################################"
fi
/bin/rm -f soot.cti soota.cti sootb.cti
echo 
echo "...Test 2: Converting file soot.inp..."
echo "   This tests handling of extensions to the Chemkin input file format"
echo "   to handle very large molecules and non-integral stoichiometric"
echo "   coefficients..."
echo 
$CK2CTI -i ./soot.inp -id soot -t ./therm_soot.dat 
#
# strip out variably dated stuff
#
cat soot.cti | sed '1,5s/^#.*$/#/' > soota.cti
#
# Change all 3 character exponent expressions starting with 0
# into 2 character exponent expressions
# (MSVC++ defaults to 3, and I can't figure out how to change
#  this behavior).
#
../../bin/exp3to2.sh soota.cti > sootb.cti
#
#
diff sootb.cti soot_blessed.cti > diff_soot.out
retnStat=$?
#
if [ $retnStat = "0" ]
then
  echo "successful diff comparison on ck2cti test (soot.inp)"
else
  echo "########################################################"
  echo "Unsuccessful diff comparison on ck2cti test (soot.inp)"
  echo "   For more information, see files:"
  echo "       test_problems/ck2cti_test/diff_soot.out"
  echo "       test_problems/ck2cti_test/sootb.cti"
  echo "       test_problems/ck2cti_test/soot_blessed.cti"
  echo "########################################################"
fi
echo 

