3 # This program tests that pspp can read gnumeric files
5 TEMPDIR=/tmp/pspp-tst-$$
6 TESTFILE=$TEMPDIR/`basename $0`.sps
8 # ensure that top_srcdir and top_builddir are absolute
9 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
10 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
11 top_srcdir=`cd $top_srcdir; pwd`
12 top_builddir=`cd $top_builddir; pwd`
14 PSPP=$top_builddir/src/ui/terminal/pspp
16 STAT_CONFIG_PATH=$top_srcdir/config
17 export STAT_CONFIG_PATH
25 if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then
26 echo "NOT cleaning $TEMPDIR"
60 activity="zip the gnm file and place it in the test directory"
61 gzip -c $top_srcdir/tests/Book1.gnm.unzipped > $TEMPDIR/Book1.gnumeric
62 if [ $? -ne 0 ] ; then no_result ; fi
64 activity="create program 1"
66 GET DATA /TYPE=gnm /FILE='$TEMPDIR/Book1.gnumeric' /READNAMES=off /SHEET=name 'This' /CELLRANGE=range 'g9:i13' .
71 GET DATA /TYPE=gnm /FILE='$TEMPDIR/Book1.gnumeric' /READNAMES=on /SHEET=name 'This' /CELLRANGE=range 'g8:i13' .
76 GET DATA /TYPE=gnm /FILE='$TEMPDIR/Book1.gnumeric' /SHEET=index 3.
80 * This sheet has no data in one of its variables
81 GET DATA /TYPE=gnm /FILE='$TEMPDIR/Book1.gnumeric' /READNAMES=on /SHEET=index 5.
86 if [ $? -ne 0 ] ; then no_result ; fi
88 activity="run program 1"
89 $SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE
90 if [ $? -ne 0 ] ; then no_result ; fi
93 activity="compare output 1"
94 diff $TEMPDIR/pspp.list - <<EOF
96 +--------+-------------------------------------------+--------+
97 |Variable|Description |Position|
98 #========#===========================================#========#
99 |VAR001 |Format: F8.2 | 1|
100 | |Measure: Scale | |
101 | |Display Alignment: Right | |
102 | |Display Width: 8 | |
103 +--------+-------------------------------------------+--------+
104 |VAR002 |Format: A8 | 2|
105 | |Measure: Nominal | |
106 | |Display Alignment: Left | |
107 | |Display Width: 8 | |
108 +--------+-------------------------------------------+--------+
109 |VAR003 |Format: F8.2 | 3|
110 | |Measure: Scale | |
111 | |Display Alignment: Right | |
112 | |Display Width: 8 | |
113 +--------+-------------------------------------------+--------+
116 -------- -------- --------
124 +--------+-------------------------------------------+--------+
125 |Variable|Description |Position|
126 #========#===========================================#========#
127 |V1 |Format: F8.2 | 1|
128 | |Measure: Scale | |
129 | |Display Alignment: Right | |
130 | |Display Width: 8 | |
131 +--------+-------------------------------------------+--------+
133 | |Measure: Nominal | |
134 | |Display Alignment: Left | |
135 | |Display Width: 8 | |
136 +--------+-------------------------------------------+--------+
137 |VAR001 |Format: F8.2 | 3|
138 | |Measure: Scale | |
139 | |Display Alignment: Right | |
140 | |Display Width: 8 | |
141 +--------+-------------------------------------------+--------+
144 -------- -------- --------
152 +--------+-------------------------------------------+--------+
153 |Variable|Description |Position|
154 #========#===========================================#========#
155 |name |Format: A8 | 1|
156 | |Measure: Nominal | |
157 | |Display Alignment: Left | |
158 | |Display Width: 8 | |
159 +--------+-------------------------------------------+--------+
160 |id |Format: F8.2 | 2|
161 | |Measure: Scale | |
162 | |Display Alignment: Right | |
163 | |Display Width: 8 | |
164 +--------+-------------------------------------------+--------+
165 |height |Format: F8.2 | 3|
166 | |Measure: Scale | |
167 | |Display Alignment: Right | |
168 | |Display Width: 8 | |
169 +--------+-------------------------------------------+--------+
172 -------- -------- --------
179 +--------+-------------------------------------------+--------+
180 |Variable|Description |Position|
181 #========#===========================================#========#
182 |vone |Format: F8.2 | 1|
183 | |Measure: Scale | |
184 | |Display Alignment: Right | |
185 | |Display Width: 8 | |
186 +--------+-------------------------------------------+--------+
187 |vtwo |Format: F8.2 | 2|
188 | |Measure: Scale | |
189 | |Display Alignment: Right | |
190 | |Display Width: 8 | |
191 +--------+-------------------------------------------+--------+
192 |vthree |Format: A8 | 3|
193 | |Measure: Nominal | |
194 | |Display Alignment: Left | |
195 | |Display Width: 8 | |
196 +--------+-------------------------------------------+--------+
197 |v4 |Format: F8.2 | 4|
198 | |Measure: Scale | |
199 | |Display Alignment: Right | |
200 | |Display Width: 8 | |
201 +--------+-------------------------------------------+--------+
204 -------- -------- -------- --------
209 if [ $? -ne 0 ] ; then fail ; fi
212 activity="create program 2"
213 cat > $TESTFILE <<EOF
214 * This sheet is empty
215 GET DATA /TYPE=gnm /FILE='$TEMPDIR/Book1.gnumeric' /SHEET=name 'Empty'.
218 * This sheet doesnt exist
219 GET DATA /TYPE=gnm /FILE='$TEMPDIR/Book1.gnumeric' /SHEET=name 'foobarxx'.
222 if [ $? -ne 0 ] ; then no_result ; fi
224 activity="run program 2"
225 $SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE > /dev/null
226 if [ $? -ne 0 ] ; then fail ; fi
228 activity="compare output 2"
229 diff $TEMPDIR/pspp.list - <<EOF
230 warning: Selected sheet or range of spreadsheet "$TEMPDIR/Book1.gnumeric" is empty.
231 warning: Selected sheet or range of spreadsheet "$TEMPDIR/Book1.gnumeric" is empty.
234 if [ $? -ne 0 ] ; then fail ; fi