TESTS_ENVIRONMENT += EXEEXT=$(EXEEXT)
dist_TESTS = \
- tests/command/no_case_size.sh \
tests/command/n_of_cases.sh \
tests/command/npar-binomial.sh \
tests/command/npar-chisquare.sh \
EXTRA_DIST += \
$(dist_TESTS) \
tests/weighting.data \
- tests/no_case_size.sav \
tests/coverage.sh tests/test_template \
tests/v13.sav tests/v14.sav \
tests/expressions/randist/beta.out \
TESTSUITE_AT = \
tests/data/calendar.at \
tests/data/data-in.at \
+ tests/data/sys-file.at \
tests/language/command.at \
tests/language/control/do-if.at \
tests/language/control/do-repeat.at \
+++ /dev/null
-#!/bin/sh
-
-# This program tests that system files can be read properly, even when the
-# case_size header value is -1 (Some 3rd party products do this)
-
-
-TEMPDIR=/tmp/pspp-tst-$$
-TESTFILE=$TEMPDIR/`basename $0`.sps
-
-# ensure that top_builddir are absolute
-if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
-if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
-top_builddir=`cd $top_builddir; pwd`
-PSPP=$top_builddir/src/ui/terminal/pspp$EXEEXT
-
-# ensure that top_srcdir is absolute
-top_srcdir=`cd $top_srcdir; pwd`
-
-STAT_CONFIG_PATH=$top_srcdir/config
-export STAT_CONFIG_PATH
-
-
-cleanup()
-{
- if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then
- echo "NOT cleaning $TEMPDIR"
- return ;
- fi
- cd /
- rm -rf $TEMPDIR
-}
-
-
-fail()
-{
- echo $activity
- echo FAILED
- cleanup;
- exit 1;
-}
-
-
-no_result()
-{
- echo $activity
- echo NO RESULT;
- cleanup;
- exit 2;
-}
-
-pass()
-{
- cleanup;
- exit 0;
-}
-
-mkdir -p $TEMPDIR
-
-cd $TEMPDIR
-
-activity="create program"
-cat <<EOF > $TESTFILE
-GET FILE='$top_srcdir/tests/no_case_size.sav'.
-DISPLAY DICTIONARY.
-LIST.
-EOF
-if [ $? -ne 0 ] ; then no_result ; fi
-
-
-activity="run program"
-$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
-if [ $? -ne 0 ] ; then no_result ; fi
-
-activity="compare output"
-diff -c pspp.csv - <<EOF
-Variable,Description,,Position
-cont,continents of the world,,1
-,Format: A32,,
-,Measure: Nominal,,
-,Display Alignment: Left,,
-,Display Width: 8,,
-size,sq km,,2
-,Format: F8.2,,
-,Measure: Nominal,,
-,Display Alignment: Left,,
-,Display Width: 8,,
-pop,population,,3
-,Format: F8.2,,
-,Measure: Nominal,,
-,Display Alignment: Left,,
-,Display Width: 8,,
-count,number of countries,,4
-,Format: F8.2,,
-,Measure: Nominal,,
-,Display Alignment: Left,,
-,Display Width: 8,,
-
-Table: Data List
-cont,size,pop,count
-Asia ,44579000,3.7E+009,44.00
-Africa ,30065000,7.8E+008,53.00
-North America ,24256000,4.8E+008,23.00
-South America ,17819000,3.4E+008,12.00
-Antarctica ,13209000,.00,.00
-Europe ,9938000,7.3E+008,46.00
-Australia/Oceania ,7687000,31000000,14.00
-EOF
-if [ $? -ne 0 ] ; then fail ; fi
-
-
-pass;
--- /dev/null
+AT_BANNER([system files])
+
+# Test that system files can be read properly, even when the case_size
+# header value is -1 (Some 3rd party products do this).
+AT_SETUP([system files with -1 case_size])
+AT_DATA([save.sps], [dnl
+DATA LIST LIST NOTABLE /cont (A32) size pop count.
+VAR LABEL
+ cont 'continents of the world'
+ size 'sq km'
+ pop 'population'
+ count 'number of countries'.
+SAVE OUTFILE='cont.sav'.
+BEGIN DATA.
+Asia, 44579000, 3.7E+009, 44.00
+Africa, 30065000, 7.8E+008, 53.00
+"North America", 24256000, 4.8E+008, 23.00
+"South America", 17819000, 3.4E+008, 12.00
+Antarctica, 13209000, .00, .00
+Europe, 9938000, 7.3E+008, 46.00
+Australia/Oceania, 7687000, 31000000, 14.00
+END DATA.
+])
+AT_CHECK([pspp -O format=csv save.sps])
+AT_CHECK([test -f cont.sav])
+
+dnl case_size is a 4-byte field at offset 68.
+dnl Make a new copy with its value changed to -1.
+AT_CHECK(
+ [(dd if=cont.sav bs=1 count=68;
+ printf '\377\377\377\377';
+ dd if=cont.sav bs=1 skip=72) > cont2.sav], [0], [], [ignore])
+AT_CHECK([cmp cont.sav cont2.sav], [1],
+ [cont.sav cont2.sav differ: char 69, line 1
+])
+
+AT_DATA([get.sps], [dnl
+GET FILE='cont2.sav'.
+DISPLAY LABELS.
+LIST.
+])
+AT_CHECK([pspp -o pspp.csv get.sps])
+AT_CHECK([cat pspp.csv], [0], [dnl
+Variable,Label,,Position
+cont,continents of the world,,1
+size,sq km,,2
+pop,population,,3
+count,number of countries,,4
+
+Table: Data List
+cont,size,pop,count
+Asia ,44579000,3.7E+009,44.00
+Africa ,30065000,7.8E+008,53.00
+North America ,24256000,4.8E+008,23.00
+South America ,17819000,3.4E+008,12.00
+Antarctica ,13209000,.00,.00
+Europe ,9938000,7.3E+008,46.00
+Australia/Oceania ,7687000,31000000,14.00
+])
+AT_CLEANUP