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 -o pspp.csv $TESTFILE
91 if [ $? -ne 0 ] ; then no_result ; fi
94 activity="compare output 1"
95 diff -c $TEMPDIR/pspp.csv - <<EOF
96 Variable,Description,,Position
97 VAR001,Format: F8.2,,1
99 ,Display Alignment: Right,,
103 ,Display Alignment: Left,,
105 VAR003,Format: F8.2,,3
107 ,Display Alignment: Right,,
118 Variable,Description,,Position
121 ,Display Alignment: Right,,
125 ,Display Alignment: Left,,
127 VAR001,Format: F8.2,,3
129 ,Display Alignment: Right,,
140 Variable,Description,,Position
143 ,Display Alignment: Left,,
147 ,Display Alignment: Right,,
149 height,Format: F8.2,,3
151 ,Display Alignment: Right,,
161 Variable,Description,,Position
164 ,Display Alignment: Right,,
168 ,Display Alignment: Right,,
172 ,Display Alignment: Left,,
176 ,Display Alignment: Right,,
184 if [ $? -ne 0 ] ; then fail ; fi
187 activity="create program 2"
188 cat > $TESTFILE <<EOF
189 * This sheet is empty
190 GET DATA /TYPE=gnm /FILE='$TEMPDIR/Book1.gnumeric' /SHEET=name 'Empty'.
193 * This sheet doesnt exist
194 GET DATA /TYPE=gnm /FILE='$TEMPDIR/Book1.gnumeric' /SHEET=name 'foobarxx'.
197 if [ $? -ne 0 ] ; then no_result ; fi
199 activity="run program 2"
200 $SUPERVISOR $PSPP -o pspp.csv $TESTFILE > /dev/null
201 if [ $? -ne 0 ] ; then fail ; fi
203 activity="compare output 2"
204 diff -c $TEMPDIR/pspp.csv - <<EOF
205 "warning: Selected sheet or range of spreadsheet ""$TEMPDIR/Book1.gnumeric"" is empty."
207 "warning: Selected sheet or range of spreadsheet ""$TEMPDIR/Book1.gnumeric"" is empty."
209 if [ $? -ne 0 ] ; then fail ; fi