Commit 77999ab0 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Added test/Arith.test.in

parent adeca2d8
......@@ -9,65 +9,59 @@ CDOERR=cerr$$
FORMAT="-f srv -b 32"
STATS="add sub mul div"
#
IFILE=$DATAPATH/pl_data
NTEST=1
#
for STAT in $STATS; do
RSTAT=0
OFILE=stat${STAT}_res
RFILE=$DATAPATH/arith${STAT}_ref
for VAR in -777 -1 0 1 777; do
VAL=1
CFILE=constval
$CDO -f srv -b 64 const,$VAL,$IFILE $CFILE
CDOTEST="$STAT"
echo "Running test: $NTEST - $CDOTEST"
# stat var const
# stat vars mask
CDOTEST="$STAT"
CDOCOMMAND="$CDO $FORMAT ${STAT} $IFILE $CFILE $OFILE"
IFILE1=$DATAPATH/arith1.srv
IFILE2=$DATAPATH/arithmask.srv
OFILE=arith${STAT}_res
echo "Running test: $NTEST - $CDOTEST"
echo "$CDOCOMMAND"
CDOCOMMAND="$CDO $FORMAT ${STAT} $IFILE1 $IFILE2 $OFILE"
echo $CDOCOMMAND
$CDOCOMMAND
test $? -eq 0 || let RSTAT+=1
$CDOCOMMAND
test $? -eq 0 || let RSTAT+=1
# stat,const var
$CDO diff $OFILE $RFILE > $CDOOUT 2> $CDOERR
test $? -eq 0 || let RSTAT+=1
test -s $CDOOUT && let RSTAT+=1
cat $CDOOUT $CDOERR
OFILE2=stat${STAT}c_res
CDOCOMMAND="$CDO $FORMAT ${STAT}c,$VAL $IFILE $OFILE2"
rm -f $OFILE
$CDOCOMMAND
test $? -eq 0 || let RSTAT+=1
# expr,instr var
$CDO diff $OFILE $OFILE2 > $CDOOUT 2> $CDOERR
test $? -eq 0 || let RSTAT+=1
test -s $CDOOUT && let RSTAT+=1
cat $CDOOUT $CDOERR
OP=""
if [ "$STAT" = add ] ; then OP='+' ; fi
if [ "$STAT" = sub ] ; then OP='-' ; fi
if [ "$STAT" = mul ] ; then OP='*' ; fi
if [ "$STAT" = div ] ; then OP='/' ; fi
# expr,instr var
IFILE=$DATAPATH/expr1.srv
OFILE=expr${STAT}_res
INSTR="var215=var215${OP}var3;var216=var216${OP}var3;"
echo $INSTR
CDOCOMMAND="$CDO $FORMAT expr,$INSTR $IFILE $OFILE"
$CDOCOMMAND
test $? -eq 0 || let RSTAT+=1
$CDO diff $OFILE $RFILE > $CDOOUT 2> $CDOERR
test $? -eq 0 || let RSTAT+=1
test -s $CDOOUT && let RSTAT+=1
cat $CDOOUT $CDOERR
OP=""
if [ "$STAT" = add ] ; then OP='+' ; fi
if [ "$STAT" = sub ] ; then OP='-' ; fi
if [ "$STAT" = mul ] ; then OP='*' ; fi
if [ "$STAT" = div ] ; then OP='/' ; fi
OFILE3=expr${STAT}_res
INSTR="var130=var130${OP}${VAL};var152=var152${OP}${VAL};var129=var129${OP}${VAL};"
echo $INSTR
CDOCOMMAND="$CDO $FORMAT expr,$INSTR $IFILE $OFILE3"
$CDOCOMMAND
test $? -eq 0 || let RSTAT+=1
$CDO diff $OFILE $OFILE3 > $CDOOUT 2> $CDOERR
test $? -eq 0 || let RSTAT+=1
test -s $CDOOUT && let RSTAT+=1
cat $CDOOUT $CDOERR
rm -f $OFILE $OFILE2 $OFILE3 $CFILE
done
rm -f $OFILE
test $RSTAT -eq 0 && echo "ok $NTEST - $CDOTEST"
test $RSTAT -eq 0 || echo "not ok $NTEST - $CDOTEST"
......
......@@ -287,7 +287,7 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
INPUTDATA = ts_mm_5years hl_l19.grb t21_geosp_tsurf.grb bathy4.grb pl_data pl_data.grb detrend_data \
grib_testfile01.grb grib_testfile02.grb grib_testfile03.grb netcdf_testfile01.nc netcdf_testfile02.nc testfile01c.nc \
datar.nc datac.nc datau.nc datag.nc
datar.nc datac.nc datau.nc datag.nc arith1.srv expr1.srv arithmask.srv
FILE_REF = file_F32_srv_ref
GRIB_REF = grib_testfile01_sinfo_ref grib_testfile01_info_ref grib_testfile02_sinfo_ref grib_testfile02_info_ref grib_testfile03_sinfo_ref grib_testfile03_info_ref
......@@ -307,8 +307,9 @@ DETREND_REF = detrend_ref
EXPR_REF = expr1_ref aexpr1_ref expr2_ref aexpr2_ref
THREAD_REF = thread1_ref tsformat1_ref
GRADSDES_REF = pl_data.ctl pl_data.gmp
ARITH_REF = arithadd_ref arithsub_ref arithmul_ref arithdiv_ref
MAPREDUCE = r18x9_grid icon_cell_grid griddes.r18x9 griddes.icon_cell
EXTRA_DIST = $(INPUTDATA) $(FILE_REF) $(GRIB_REF) $(NETCDF_REF) $(YMONSTAT_REF) $(TIMSTAT_REF) $(FLDSTAT_REF) $(FLDPSTAT_REF) $(ENSPSTAT_REF) $(SPECTRAL_REF) $(VERTINT_REF) $(REMAP_REF) $(SELECT_REF) $(DETREND_REF) $(THREAD_REF) $(EXPR_REF) $(GRADSDES_REF) $(MAPREDUCE)
EXTRA_DIST = $(INPUTDATA) $(FILE_REF) $(GRIB_REF) $(NETCDF_REF) $(YMONSTAT_REF) $(TIMSTAT_REF) $(FLDSTAT_REF) $(FLDPSTAT_REF) $(ENSPSTAT_REF) $(SPECTRAL_REF) $(VERTINT_REF) $(REMAP_REF) $(SELECT_REF) $(DETREND_REF) $(THREAD_REF) $(EXPR_REF) $(GRADSDES_REF) $(ARITH_REF) $(MAPREDUCE)
all: all-am
.SUFFIXES:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment