3 # This program tests the PRINT transformation
5 TEMPDIR=/tmp/pspp-tst-$$
6 TESTFILE=$TEMPDIR/`basename $0`.sps
10 # ensure that top_srcdir is absolute
11 cd $top_srcdir; top_srcdir=`pwd`
13 STAT_CONFIG_PATH=$top_srcdir/config
14 export STAT_CONFIG_PATH
51 # Copy this file --- it's shared with another test
52 activity="create data"
53 cp $top_srcdir/tests/data-list.data $TEMPDIR
54 if [ $? -ne 0 ] ; then no_result ; fi
57 activity="create program"
58 cat > $TEMPDIR/print.stat << foobar
59 title 'Test PRINT transformation'.
61 data list free table file='$TEMPDIR/data-list.data'/A B C D.
62 print outfile="foo" table/A(f8.2) '/' B(e8.2) '/' C(n10) '/'.
64 print outfile="foo" /a b c d.
67 data list list table file='$TEMPDIR/data-list.data'/A B C D.
72 if [ $? -ne 0 ] ; then no_result ; fi
75 activity="run program"
76 $SUPERVISOR $here/../src/pspp --testing-mode -o raw-ascii --testing-mode $TEMPDIR/print.stat > $TEMPDIR/errs
77 # Note vv --- there are errors in input. Therefore, the command must FAIL
78 if [ $? -eq 0 ] ; then fail ; fi
80 activity="compare error messages"
81 diff -w $TEMPDIR/errs - <<EOF
82 $TEMPDIR/data-list.data:1: error: (columns 1-5, field type F8.0) Field does not form a valid floating-point constant.
83 $TEMPDIR/data-list.data:1: warning: LIST: The expression on PRINT SPACE evaluated to the system-missing value.
84 $TEMPDIR/data-list.data:2: error: (columns 1-8, field type F8.0) Field does not form a valid floating-point constant.
85 $TEMPDIR/data-list.data:4: warning: LIST: The expression on PRINT SPACE evaluated to the system-missing value.
86 $TEMPDIR/data-list.data:4: error: (columns 3-12, field type F8.0) Field does not form a valid floating-point constant.
87 $TEMPDIR/data-list.data:6: warning: LIST: The expression on PRINT SPACE evaluated to the system-missing value.
88 $TEMPDIR/data-list.data:1: error: (columns 1-5, field type F8.0) Field does not form a valid floating-point constant.
89 $TEMPDIR/data-list.data:2: error: (columns 1-8, field type F8.0) Field does not form a valid floating-point constant.
90 $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.
91 $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.
92 $TEMPDIR/data-list.data:4: error: (columns 3-12, field type F8.0) Field does not form a valid floating-point constant.
93 $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.
94 $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.
95 $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.
97 if [ $? -ne 0 ] ; then fail ; fi
100 activity="compare output"
101 perl -pi -e s/^\s*\$//g $TEMPDIR/pspp.list
102 diff -b $TEMPDIR/pspp.list - << EOF | perl -e 's/^\s*$//g'
103 1.1 DATA LIST. Reading free-form data from file $TEMPDIR/data-list.data.
113 2.1 PRINT. Writing 1 record(s) to file foo.
114 +--------+------+-------+------+
115 |Variable|Record|Columns|Format|
116 #========#======#=======#======#
119 |B | 1| 10- 17|E8.2 |
120 |"/" | 1| 18- 18|A1 |
121 |C | 1| 19- 28|N10.0 |
122 |"/" | 1| 29- 29|A1 |
123 +--------+------+-------+------+
127 -------- -------- -------- --------
134 3.1 DATA LIST. Reading free-form data from file $TEMPDIR/data-list.data.
144 4.1 PRINT. Writing 1 record(s) to the listing file.
145 +--------+------+-------+------+
146 |Variable|Record|Columns|Format|
147 #========#======#=======#======#
149 |B | 1| 10- 17|F8.2 |
150 |C | 1| 19- 26|F8.2 |
151 |D | 1| 28- 35|F8.2 |
152 +--------+------+-------+------+
156 -------- -------- -------- --------
170 if [ $? -ne 0 ] ; then fail ; fi
173 activity="compare print out"
174 diff $TEMPDIR/foo - << EOF
175 . /2.00E+00/0000000003/
177 . /6.00E+00/0000000007/
179 . /1.00E+01/0000000011/
182 if [ $? -ne 0 ] ; then fail ; fi