summaryrefslogtreecommitdiffstats
path: root/funtools/funtest/tevread
blob: 407953c78945aa5339612deb5fa9ac49a76161a9 (plain)
1
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/sh

if [ ! -x evread ]; then
  echo "making evread ..."
  make evread
fi

PRE=foo
S=${HOME}/data/snr.ev
PROG=./evread
X=504
Y=512

while [ x"$1" != x ]; do
  case $1 in
  -P)
    PROG=./evread.pure
    shift
    continue;;
  -f)
    shift
    S=$1
    shift
    S=$1
    shift
    continue;;
  -x)
    shift
    X=$1
    shift
    continue;;
  -y)
    shift
    Y=$1
    shift
    continue;;
  *)
    shift
    continue;;
  esac
done

X2=`echo "$X + 10" | bc`
Y2=`echo "$Y + 10" | bc`
X3=`echo "$X + 20" | bc`
Y3=$Y
X4=`echo "$X + 10" | bc`
Y4=`echo "$Y - 10" | bc`

echo "${PRE}: array of structs, funtools alloc ..."
echo "${PRE}1: array of structs, user alloc ..."
echo "${PRE}2: struct of arrays, funtools alloc ..."
echo "${PRE}3: struct of arrays, user alloc ..."
echo "${PRE}4: struct of pointers, funtools alloc ..."
echo "${PRE}5: struct of pointers, user alloc ..."
echo "${PRE}6: array of pointers, funtools alloc ..."
echo "${PRE}7: array of pointers, user alloc ..."

IFS="	"
while read ARG1 ARG2 ARG3; do
  if [ x"$ARG1" = x ]; then
    continue
  fi
  if [ x`echo $ARG1 | sed 's/^#.*/YES/g'` = x"YES" ]; then
    continue
  fi
  eval "E=\"[$ARG2]\""
  echo FILE $S"$E" 
  ${PROG} -w ${PRE}.fits $S"$E" > ${PRE}.ls
  ${PROG} -u -w ${PRE}1.fits $S"$E" > ${PRE}1.ls
  ${PROG} -a -w ${PRE}2.fits $S"$E" > ${PRE}2.ls
  ${PROG} -a -u -w ${PRE}3.fits $S"$E" > ${PRE}3.ls
  ${PROG} -p -w ${PRE}4.fits $S"$E" > ${PRE}4.ls
  ${PROG} -p -u -w ${PRE}5.fits $S"$E" > ${PRE}5.ls
  ${PROG} -e -w ${PRE}6.fits $S"$E" > ${PRE}6.ls
  ${PROG} -e -u -w ${PRE}7.fits $S"$E" > ${PRE}7.ls
  for i in 1 2 3 4 5 6 7
  do
    echo "EXACT ${PRE} and ${PRE}${i} ..."
    cmp ${PRE}.fits ${PRE}${i}.fits
#    if [ $? != 0 ]; then
#      exit
#    fi
    diff ${PRE}.ls ${PRE}${i}.ls
#    if [ $? != 0 ]; then
#      exit
#    fi
  done
  rm -f ${PRE}*.fits
  rm -f ${PRE}*.ls

done