Expr.test.in 1.22 KB
Newer Older
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1
2
3
4
5
6
#! @SHELL@
echo 1..2 # Number of tests to be executed.
#
test -n "$CDO"      || CDO=cdo
test -n "$DATAPATH" || DATAPATH=./data
#
7
8
CDOOUT=cout$$
CDOERR=cerr$$
Uwe Schulzweida's avatar
Uwe Schulzweida committed
9
10
11
12
13
14
15
FORMAT="-f srv -b 32"
#
IFILE=$DATAPATH/pl_data
NTEST=1
#
FINSTR=finstr
#
16
testfunc()
Uwe Schulzweida's avatar
Uwe Schulzweida committed
17
{
Uwe Schulzweida's avatar
Uwe Schulzweida committed
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
  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
Uwe Schulzweida's avatar
Uwe Schulzweida committed
54
55
}
#
56
INSTR="_clev=clev(var130);pottemp=var130*((100000/_clev)^0.287);"
Uwe Schulzweida's avatar
Uwe Schulzweida committed
57
58
59
60
testfunc
#
INSTR="var1=(var129>0)?(var130-273.15):var152;"
testfunc
Uwe Schulzweida's avatar
Uwe Schulzweida committed
61
62
63
64
#
rm -f $CDOOUT $CDOERR
#
exit 0