Comp.test.in 914 Bytes
Newer Older
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1
#! @BASH@
2
3
4
5
6
7
8
9
10
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
44
45
46
echo 1..6 # 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"
STATS="eq ne le lt ge gt"
CONST=300
#
IFILE=$DATAPATH/comptest.srv
NTEST=1
CFILE=constdata
$CDO $FORMAT const,${CONST},${IFILE} $CFILE
#
for STAT in $STATS; do
  RSTAT=0
  RFILE=$DATAPATH/comp_${STAT}c_ref
  OFILE=comp_${STAT}_res

  CDOTEST="$STAT"
  CDOCOMMAND="$CDO $FORMAT ${STAT} $IFILE $CFILE $OFILE"

  echo "Running test: $NTEST - $CDOTEST"
  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 $CFILE
#
exit 0