Expr.test.in 1.22 KB
Newer Older
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1
2
3
4
5
6
7
8
9
10
11
12
13
#! @SHELL@
echo 1..2 # Number of tests to be executed.
#
test -n "$CDO"      || CDO=cdo
test -n "$DATAPATH" || DATAPATH=./data
#
CDOOUT=cout
CDOERR=cerr
FORMAT="-f srv -b 32"
#
IFILE=$DATAPATH/pl_data
NTEST=1
#
14
INSETS="_clev=var130.z;pottemp=var130*((100000/_clev)^0.287);"
Uwe Schulzweida's avatar
Uwe Schulzweida committed
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
INSETS="$INSETS  var1=(var129>0)?(var130-273.15):var152;"
FINSTR=finstr
#
for INSTR in $INSETS; do

  RSTAT=0

  CDOTEST="instruction set $NTEST"
  echo "Running test: $NTEST - $CDOTEST"

  for EXPR in expr aexpr; do
    RFILE=$DATAPATH/${EXPR}${NTEST}_ref
    OFILE=${EXPR}${NTEST}_res

    for FILE in "" "f"; do

      if [ "$FILE" = "f" ] ; then
        echo $INSTR > $FINSTR
        CDOCOMMAND="$CDO $FORMAT $EXPR${FILE},$FINSTR $IFILE $OFILE"
      else
        CDOCOMMAND="$CDO $FORMAT $EXPR,$INSTR $IFILE $OFILE"
      fi
      
      echo "$CDOCOMMAND"

      $CDOCOMMAND
      test $? -eq 0 || let RSTAT+=1

      $CDO diff $RFILE $OFILE > $CDOOUT 2> $CDOERR
      test $? -eq 0 || let RSTAT+=1
      test -s $CDOOUT && let RSTAT+=1
      cat $CDOOUT $CDOERR

      rm -f $OFILE $FINSTR
    done
  done

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

  let NTEST+=1

done
#
rm -f $CDOOUT $CDOERR
#
exit 0