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"
61 activity="zip the gnm file and place it in the test directory"
62 gzip -c $top_srcdir/tests/Book1.gnm.unzipped > $TEMPDIR/Book1.gnumeric
63 if [ $? -ne 0 ] ; then no_result ; fi
65 activity="create program 1"
67 GET DATA /TYPE=gnm /FILE='$TEMPDIR/Book1.gnumeric' /READNAMES=off /SHEET=name 'This' /CELLRANGE=range 'g9:i13' .
72 GET DATA /TYPE=gnm /FILE='$TEMPDIR/Book1.gnumeric' /READNAMES=on /SHEET=name 'This' /CELLRANGE=range 'g8:i13' .
77 GET DATA /TYPE=gnm /FILE='$TEMPDIR/Book1.gnumeric' /SHEET=index 3.
81 * This sheet has no data in one of its variables
82 GET DATA /TYPE=gnm /FILE='$TEMPDIR/Book1.gnumeric' /READNAMES=on /SHEET=index 5.
87 if [ $? -ne 0 ] ; then no_result ; fi
89 activity="run program 1"
90 $SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE
91 if [ $? -ne 0 ] ; then no_result ; fi
94 activity="compare output 1"
95 diff $TEMPDIR/pspp.list - <<EOF
97 +--------+-------------------------------------------+--------+
98 |Variable|Description |Position|
99 #========#===========================================#========#
100 |VAR001 |Format: F8.2 | 1|
101 | |Measure: Scale | |
102 | |Display Alignment: Right | |
103 | |Display Width: 8 | |
104 +--------+-------------------------------------------+--------+
105 |VAR002 |Format: A8 | 2|
106 | |Measure: Nominal | |
107 | |Display Alignment: Left | |
108 | |Display Width: 8 | |
109 +--------+-------------------------------------------+--------+
110 |VAR003 |Format: F8.2 | 3|
111 | |Measure: Scale | |
112 | |Display Alignment: Right | |
113 | |Display Width: 8 | |
114 +--------+-------------------------------------------+--------+
117 -------- -------- --------
125 +--------+-------------------------------------------+--------+
126 |Variable|Description |Position|
127 #========#===========================================#========#
128 |V1 |Format: F8.2 | 1|
129 | |Measure: Scale | |
130 | |Display Alignment: Right | |
131 | |Display Width: 8 | |
132 +--------+-------------------------------------------+--------+
134 | |Measure: Nominal | |
135 | |Display Alignment: Left | |
136 | |Display Width: 8 | |
137 +--------+-------------------------------------------+--------+
138 |VAR001 |Format: F8.2 | 3|
139 | |Measure: Scale | |
140 | |Display Alignment: Right | |
141 | |Display Width: 8 | |
142 +--------+-------------------------------------------+--------+
145 -------- -------- --------
153 +--------+-------------------------------------------+--------+
154 |Variable|Description |Position|
155 #========#===========================================#========#
156 |name |Format: A8 | 1|
157 | |Measure: Nominal | |
158 | |Display Alignment: Left | |
159 | |Display Width: 8 | |
160 +--------+-------------------------------------------+--------+
161 |id |Format: F8.2 | 2|
162 | |Measure: Scale | |
163 | |Display Alignment: Right | |
164 | |Display Width: 8 | |
165 +--------+-------------------------------------------+--------+
166 |height |Format: F8.2 | 3|
167 | |Measure: Scale | |
168 | |Display Alignment: Right | |
169 | |Display Width: 8 | |
170 +--------+-------------------------------------------+--------+
173 -------- -------- --------
180 +--------+-------------------------------------------+--------+
181 |Variable|Description |Position|
182 #========#===========================================#========#
183 |vone |Format: F8.2 | 1|
184 | |Measure: Scale | |
185 | |Display Alignment: Right | |
186 | |Display Width: 8 | |
187 +--------+-------------------------------------------+--------+
188 |vtwo |Format: F8.2 | 2|
189 | |Measure: Scale | |
190 | |Display Alignment: Right | |
191 | |Display Width: 8 | |
192 +--------+-------------------------------------------+--------+
193 |vthree |Format: A8 | 3|
194 | |Measure: Nominal | |
195 | |Display Alignment: Left | |
196 | |Display Width: 8 | |
197 +--------+-------------------------------------------+--------+
198 |v4 |Format: F8.2 | 4|
199 | |Measure: Scale | |
200 | |Display Alignment: Right | |
201 | |Display Width: 8 | |
202 +--------+-------------------------------------------+--------+
205 -------- -------- -------- --------
210 if [ $? -ne 0 ] ; then fail ; fi
213 activity="create program 2"
214 cat > $TESTFILE <<EOF
215 * This sheet is empty
216 GET DATA /TYPE=gnm /FILE='$TEMPDIR/Book1.gnumeric' /SHEET=name 'Empty'.
219 * This sheet doesnt exist
220 GET DATA /TYPE=gnm /FILE='$TEMPDIR/Book1.gnumeric' /SHEET=name 'foobarxx'.
223 if [ $? -ne 0 ] ; then no_result ; fi
225 activity="run program 2"
226 $SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE > /dev/null
227 if [ $? -ne 0 ] ; then fail ; fi
229 activity="compare output 2"
230 diff $TEMPDIR/pspp.list - <<EOF
231 warning: Selected sheet or range of spreadsheet "$TEMPDIR/Book1.gnumeric" is empty.
232 warning: Selected sheet or range of spreadsheet "$TEMPDIR/Book1.gnumeric" is empty.
235 if [ $? -ne 0 ] ; then fail ; fi