3 # This program tests the PRINT transformation
5 TEMPDIR=/tmp/pspp-tst-$$
6 TESTFILE=$TEMPDIR/`basename $0`.sps
8 # ensure that top_builddir are absolute
9 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
10 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
11 top_builddir=`cd $top_builddir; pwd`
13 # ensure that top_srcdir is absolute
14 top_srcdir=`cd $top_srcdir; pwd`
16 STAT_CONFIG_PATH=$top_srcdir/config
17 export STAT_CONFIG_PATH
54 # Copy this file --- it's shared with another test
55 activity="create data"
56 cp $top_srcdir/tests/data-list.data $TEMPDIR
57 if [ $? -ne 0 ] ; then no_result ; fi
60 activity="create program"
61 cat > $TEMPDIR/print.stat << foobar
62 title 'Test PRINT transformation'.
64 data list free table file='$TEMPDIR/data-list.data'/A B C D.
65 print outfile="foo" table/A(f8.2) '/' B(e8.2) '/' C(n10) '/'.
67 print outfile="foo" /a b c d.
70 data list list table file='$TEMPDIR/data-list.data'/A B C D.
75 if [ $? -ne 0 ] ; then no_result ; fi
78 activity="run program"
79 $SUPERVISOR $top_builddir/src/pspp --testing-mode -o raw-ascii --testing-mode $TEMPDIR/print.stat > $TEMPDIR/errs
80 # Note vv --- there are errors in input. Therefore, the command must FAIL
81 if [ $? -eq 0 ] ; then fail ; fi
83 activity="compare error messages"
84 diff -w $TEMPDIR/errs - <<EOF
85 $TEMPDIR/data-list.data:1: error: (columns 1-5, field type F8.0) Field does not form a valid floating-point constant.
86 $TEMPDIR/data-list.data:1: warning: LIST: The expression on PRINT SPACE evaluated to the system-missing value.
87 $TEMPDIR/data-list.data:2: error: (columns 1-8, field type F8.0) Field does not form a valid floating-point constant.
88 $TEMPDIR/data-list.data:4: warning: LIST: The expression on PRINT SPACE evaluated to the system-missing value.
89 $TEMPDIR/data-list.data:4: error: (columns 3-12, field type F8.0) Field does not form a valid floating-point constant.
90 $TEMPDIR/data-list.data:6: warning: LIST: The expression on PRINT SPACE evaluated to the system-missing value.
91 $TEMPDIR/data-list.data:1: error: (columns 1-5, field type F8.0) Field does not form a valid floating-point constant.
92 $TEMPDIR/data-list.data:2: error: (columns 1-8, field type F8.0) Field does not form a valid floating-point constant.
93 $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.
94 $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.
95 $TEMPDIR/data-list.data:4: error: (columns 3-12, field type F8.0) Field does not form a valid floating-point constant.
96 $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.
97 $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.
98 $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.
100 if [ $? -ne 0 ] ; then fail ; fi
103 activity="compare output"
104 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
105 diff -b $TEMPDIR/pspp.list - << EOF
106 1.1 DATA LIST. Reading free-form data from "$TEMPDIR/data-list.data".
115 2.1 PRINT. Writing 1 record to "foo".
116 +--------+------+-------+------+
117 |Variable|Record|Columns|Format|
118 #========#======#=======#======#
121 |B | 1| 10- 17|E8.2 |
122 |"/" | 1| 18- 18|A1 |
123 |C | 1| 19- 28|N10.0 |
124 |"/" | 1| 29- 29|A1 |
125 +--------+------+-------+------+
127 -------- -------- -------- --------
131 3.1 DATA LIST. Reading free-form data from "$TEMPDIR/data-list.data".
140 4.1 PRINT. Writing 1 record.
141 +--------+------+-------+------+
142 |Variable|Record|Columns|Format|
143 #========#======#=======#======#
145 |B | 1| 10- 17|F8.2 |
146 |C | 1| 19- 26|F8.2 |
147 |D | 1| 28- 35|F8.2 |
148 +--------+------+-------+------+
151 -------- -------- -------- --------
164 if [ $? -ne 0 ] ; then fail ; fi
167 activity="compare print out"
168 diff $TEMPDIR/foo - << EOF
169 . /2.00E+00/0000000003/
171 . /6.00E+00/0000000007/
173 . /1.00E+01/0000000011/
176 if [ $? -ne 0 ] ; then fail ; fi