04e0cdc065c9f2757c3a8aa0c9fab62f32c267d2
[pspp-builds.git] / tests / formats / binhex-out.sh
1 #! /bin/sh
2
3 TEMPDIR=/tmp/pspp-tst-$$
4 mkdir -p $TEMPDIR
5 trap 'cd /; rm -rf $TEMPDIR' 0
6
7 # ensure that top_builddir  are absolute
8 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
9 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
10 top_builddir=`cd $top_builddir; pwd`
11 PSPP=$top_builddir/src/ui/terminal/pspp$EXEEXT
12
13 # ensure that top_srcdir is absolute
14 top_srcdir=`cd $top_srcdir; pwd`
15
16 STAT_CONFIG_PATH=$top_srcdir/config
17 export STAT_CONFIG_PATH
18
19 fail()
20 {
21     echo $activity
22     echo FAILED
23     exit 1;
24 }
25
26
27 no_result()
28 {
29     echo $activity
30     echo NO RESULT;
31     exit 2;
32 }
33
34 pass()
35 {
36     exit 0;
37 }
38
39 cd $TEMPDIR
40
41 activity="write pspp syntax"
42 cat > binhex-out.pspp <<EOF
43 set errors=none.
44 set mxwarns=10000000.
45 set wib=msbfirst.
46 data list /x 1-10.
47 begin data.
48
49 2
50 11
51 123
52 1234
53 913
54 3.14159
55 777
56 82
57 690
58 -2
59 -11
60 -123
61 -1234
62 -913
63 -3.14159
64 -777
65 -82
66 -690
67 -.1
68 -.5
69 -.9
70 9999.1
71 9999.5
72 9999.9
73 10000
74 18231237
75 -9999.1
76 -9999.5
77 -9999.9
78 -10000
79 -8231237
80 999.1
81 999.5
82 999.9
83 1000
84 8231237
85 -999.1
86 -999.5
87 -999.9
88 -1000
89 -8231237
90 99.1
91 99.5
92 99.9
93 100
94 821237
95 -99.1
96 -99.5
97 -99.9
98 -100
99 -831237
100 9.1
101 9.5
102 9.9
103 10
104 81237
105 -9.1
106 -9.5
107 -9.9
108 -10
109 -81237
110 1.1
111 -1.1
112 1.5
113 -1.5
114 1.9
115 -1.9
116 end data.
117 file handle output/name='binhex.out'/mode=image/lrecl=256.
118 write outfile=output/
119         x(p1.0) x(p2.0) x(p3.0) x(p4.0)         /* 000
120         x(p2.1) x(p3.1) x(p4.1)                 /* 00a
121         x(p3.2) x(p4.2)                         /* 013
122         x(p4.3)                                 /* 01a
123         x(pk1.0) x(pk2.0) x(pk3.0) x(pk4.0)     /* 01e
124         x(pk2.1) x(pk3.1) x(pk4.1)              /* 028
125         x(pk3.2) x(pk4.2)                       /* 031
126         x(pk4.3)                                /* 038
127         x(ib1.0) x(ib2.0) x(ib3.0) x(ib4.0)     /* 03c
128         x(ib1.1) x(ib2.1) x(ib3.1) x(ib4.1)     /* 046
129         x(ib1.2) x(ib2.2) x(ib3.2) x(ib4.2)     /* 050
130         x(ib1.3) x(ib2.3) x(ib3.3) x(ib4.3)     /* 05a
131         x(ib2.4) x(ib3.4) x(ib4.4)              /* 064
132         x(ib2.5) x(ib3.5) x(ib4.5)              /* 06d
133         x(ib3.6) x(ib4.6)                       /* 076
134         x(ib3.7) x(ib4.7)                       /* 07d
135         x(ib3.8) x(ib4.8)                       /* 084
136         x(ib4.9)                                /* 08b
137         x(ib4.10)                               /* 08f
138         x(pib1.0) x(pib2.0) x(pib3.0) x(pib4.0) /* 093
139         x(pib1.1) x(pib2.1) x(pib3.1) x(pib4.1) /* 09d
140         x(pib1.2) x(pib2.2) x(pib3.2) x(pib4.2) /* 0a7
141         x(pib1.3) x(pib2.3) x(pib3.3) x(pib4.3) /* 0b1
142         x(pib2.4) x(pib3.4) x(pib4.4)           /* 0bb
143         x(pib2.5) x(pib3.5) x(pib4.5)           /* 0c4
144         x(pib3.6) x(pib4.6)                     /* 0cd
145         x(pib3.7) x(pib4.7)                     /* 0d4
146         x(pib3.8) x(pib4.8)                     /* 0db
147         x(pib4.9)                               /* 0e2
148         x(pib4.10)                              /* 0e6
149         x(pibhex2) x(pibhex4)                   /* 0ea
150         x(pibhex6) x(pibhex8).                  /* 0f0
151                                                 /* 0fe
152 execute.
153 EOF
154 if [ $? -ne 0 ] ; then no_result ; fi
155
156 activity="run program"
157 $SUPERVISOR $PSPP -o pspp.csv binhex-out.pspp
158 if [ $? -ne 0 ] ; then no_result ; fi
159
160 activity="gunzip expected results"
161 gzip -cd < $top_srcdir/tests/formats/binhex-out.expected.gz > expected.out
162 if [ $? -ne 0 ] ; then no_result ; fi
163
164 activity="compare output"
165 cmp expected.out binhex.out
166 if [ $? -ne 0 ] ; then fail ; fi
167
168 pass