activity="run program"
-$here/../src/pspp -o raw-ascii $TEMPDIR/print.stat > $TEMPDIR/errs
+$here/../src/pspp -o raw-ascii --testing-mode $TEMPDIR/print.stat > $TEMPDIR/errs
# Note vv --- there are errors in input. Therefore, the command must FAIL
if [ $? -eq 0 ] ; then fail ; fi
activity="compare error messages"
-diff -w -b -B $TEMPDIR/errs - <<EOF
+diff -w $TEMPDIR/errs - <<EOF
$TEMPDIR/data-list.data:1: error: (columns 1-5, field type F8.0) Field does not form a valid floating-point constant.
-$TEMPDIR/data-list.data:1: warning: LIST: The expression on PRINT SPACE evaluated to -2147483648. It's not possible to PRINT SPACE a
- negative number of lines.
+$TEMPDIR/data-list.data:1: warning: LIST: The expression on PRINT SPACE evaluated to -2147483648. It's not possible to PRINT SPACE a negative number of lines.
$TEMPDIR/data-list.data:2: error: (columns 1-8, field type F8.0) Field does not form a valid floating-point constant.
-$TEMPDIR/data-list.data:4: warning: LIST: The expression on PRINT SPACE evaluated to -2147483648. It's not possible to PRINT SPACE a
- negative number of lines.
+$TEMPDIR/data-list.data:4: warning: LIST: The expression on PRINT SPACE evaluated to -2147483648. It's not possible to PRINT SPACE a negative number of lines.
$TEMPDIR/data-list.data:4: error: (columns 3-12, field type F8.0) Field does not form a valid floating-point constant.
-$TEMPDIR/data-list.data:6: warning: LIST: The expression on PRINT SPACE evaluated to -2147483648. It's not possible to PRINT SPACE a
- negative number of lines.
+$TEMPDIR/data-list.data:6: warning: LIST: The expression on PRINT SPACE evaluated to -2147483648. It's not possible to PRINT SPACE a negative number of lines.
$TEMPDIR/data-list.data:1: error: (columns 1-5, field type F8.0) Field does not form a valid floating-point constant.
$TEMPDIR/data-list.data:2: error: (columns 1-8, field type F8.0) Field does not form a valid floating-point constant.
-$TEMPDIR/data-list.data:2: warning: LIST: Missing value(s) for all variables from C onward. These will be filled with the system-
- missing value or blanks, as appropriate.
-$TEMPDIR/data-list.data:3: warning: LIST: Missing value(s) for all variables from B onward. These will be filled with the system-
- missing value or blanks, as appropriate.
+$TEMPDIR/data-list.data:2: warning: LIST: Missing value(s) for all variables from C onward. These will be filled with the system-missing value or blanks, as appropriate.
+$TEMPDIR/data-list.data:3: warning: LIST: Missing value(s) for all variables from B onward. These will be filled with the system-missing value or blanks, as appropriate.
$TEMPDIR/data-list.data:4: error: (columns 3-12, field type F8.0) Field does not form a valid floating-point constant.
-$TEMPDIR/data-list.data:4: warning: LIST: Missing value(s) for all variables from C onward. These will be filled with the system-
- missing value or blanks, as appropriate.
-$TEMPDIR/data-list.data:5: warning: LIST: Missing value(s) for all variables from C onward. These will be filled with the system-
- missing value or blanks, as appropriate.
-$TEMPDIR/data-list.data:6: warning: LIST: Missing value(s) for all variables from B onward. These will be filled with the system-
- missing value or blanks, as appropriate.
+$TEMPDIR/data-list.data:4: warning: LIST: Missing value(s) for all variables from C onward. These will be filled with the system-missing value or blanks, as appropriate.
+$TEMPDIR/data-list.data:5: warning: LIST: Missing value(s) for all variables from C onward. These will be filled with the system-missing value or blanks, as appropriate.
+$TEMPDIR/data-list.data:6: warning: LIST: Missing value(s) for all variables from B onward. These will be filled with the system-missing value or blanks, as appropriate.
EOF
if [ $? -ne 0 ] ; then fail ; fi
--- /dev/null
+#!/bin/sh
+
+# This program tests the sort command
+
+TEMPDIR=/tmp/pspp-tst-$$
+
+here=`pwd`;
+
+# ensure that top_srcdir is absolute
+cd $top_srcdir; top_srcdir=`pwd`
+
+export STAT_CONFIG_PATH=$top_srcdir/config
+
+
+cleanup()
+{
+ 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="generate stat program"
+cat > $TEMPDIR/sort.stat <<EOF
+title 'Test SORT procedure'.
+
+data list file='$here/sort.data' notable /X000 to X126 1-127(a).
+sort by X000 to x005.
+print /X000 to X005.
+execute.
+EOF
+if [ $? -ne 0 ] ; then no_result ; fi
+
+activity="run program"
+$here/../src/pspp -o raw-ascii $TEMPDIR/sort.stat
+if [ $? -ne 0 ] ; then no_result ; fi
+
+# Now there should be some sorted data in $TEMPDIR/pspp.list
+# We have to do some checks on it.
+
+# 1. Is it sorted ?
+
+activity="check sorted"
+sort $TEMPDIR/pspp.list > $TEMPDIR/sortsort
+if [ $? -ne 0 ] ; then no_result ; fi
+
+diff -B -b $TEMPDIR/sortsort $TEMPDIR/pspp.list
+if [ $? -ne 0 ] ; then fail ; fi
+
+# 2. It should be six elements wide
+activity="check data width"
+awk '!/^\ *$/{if (NF!=6) exit 1}' $TEMPDIR/pspp.list
+if [ $? -ne 0 ] ; then fail ; fi
+
+
+pass;