Runstat.test.in 846 Bytes
Newer Older
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1
#! @BASH@
Uwe Schulzweida's avatar
Uwe Schulzweida committed
2
echo 1..10 # Number of tests to be executed.
Uwe Schulzweida's avatar
Uwe Schulzweida committed
3
4
5
6
7
8
9
#
test -n "$CDO"      || CDO=cdo
test -n "$DATAPATH" || DATAPATH=./data
#
CDOOUT=cout$$
CDOERR=cerr$$
TYPE=run
Uwe Schulzweida's avatar
Uwe Schulzweida committed
10
STATS="min max range sum avg mean std std1 var var1"
Uwe Schulzweida's avatar
Uwe Schulzweida committed
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
NTEST=1
#
IFILE=$DATAPATH/ts_mm_5years
#
for STAT in $STATS; do
  RSTAT=0
  RFILE=$DATAPATH/${TYPE}${STAT}_ref
  OFILE=${TYPE}${STAT}_res

  CDOTEST="${TYPE}$STAT"
  CDOCOMMAND="$CDO ${TYPE}${STAT},12 $IFILE $OFILE"

  echo "Running test: $NTEST"
  echo "$CDOCOMMAND"

  $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

  test $RSTAT -eq 0 && echo "ok $NTEST - $CDOTEST"
  test $RSTAT -eq 0 || echo "not ok $NTEST - $CDOTEST"

  let NTEST+=1
  rm -f $OFILE
done
#
rm -f $CDOOUT $CDOERR
#
exit 0