3 # This program tests the PRINT transformation
5 TEMPDIR=/tmp/pspp-tst-$$
9 # ensure that top_srcdir is absolute
10 cd $top_srcdir; top_srcdir=`pwd`
12 export STAT_CONFIG_PATH=$top_srcdir/config
48 # Copy this file --- it's shared with another test
49 activity="create data"
50 cp $here/data-list.data $TEMPDIR
51 if [ $? -ne 0 ] ; then no_result ; fi
54 activity="create program"
55 cat > $TEMPDIR/print.stat <<EOF_print
56 title 'Test PRINT transformation'.
59 ----------------------------------------------------------------------
60 There is no test for DATA LIST FIXED since it is imagined that the
61 rest of the tests give it a pretty good workout.
62 ----------------------------------------------------------------------
65 ----------------------------------------------------------------------
66 Testing use of DATA LIST FREE.
67 ----------------------------------------------------------------------
69 data list free table file='$TEMPDIR/data-list.data'/A B C D.
70 print outfile="foo" table/A(f8.2) '/' B(e8.2) '/' C(n10) '/' D(rbhex16) '/'.
72 print outfile="foo" /a b c d.
76 ----------------------------------------------------------------------
77 Testing use of DATA LIST LIST.
78 ----------------------------------------------------------------------
80 data list list table file='$TEMPDIR/data-list.data'/A B C D.
85 if [ $? -ne 0 ] ; then no_result ; fi
88 activity="run program"
89 $here/../src/pspp -o raw-ascii --testing-mode $TEMPDIR/print.stat > $TEMPDIR/errs
90 # Note vv --- there are errors in input. Therefore, the command must FAIL
91 if [ $? -eq 0 ] ; then fail ; fi
93 activity="compare error messages"
94 diff -w $TEMPDIR/errs - <<EOF
95 $TEMPDIR/data-list.data:1: error: (columns 1-5, field type F8.0) Field does not form a valid floating-point constant.
96 $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.
97 $TEMPDIR/data-list.data:2: error: (columns 1-8, field type F8.0) Field does not form a valid floating-point constant.
98 $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.
99 $TEMPDIR/data-list.data:4: error: (columns 3-12, field type F8.0) Field does not form a valid floating-point constant.
100 $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.
101 $TEMPDIR/data-list.data:1: error: (columns 1-5, field type F8.0) Field does not form a valid floating-point constant.
102 $TEMPDIR/data-list.data:2: error: (columns 1-8, field type F8.0) Field does not form a valid floating-point constant.
103 $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.
104 $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.
105 $TEMPDIR/data-list.data:4: error: (columns 3-12, field type F8.0) Field does not form a valid floating-point constant.
106 $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.
107 $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.
108 $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.
110 if [ $? -ne 0 ] ; then fail ; fi
112 cp $TEMPDIR/pspp.list /tmp/out
113 activity="compare output"
114 diff -b -B $TEMPDIR/pspp.list - << EOF
115 ----------------------------------------------------------------------
116 There is no test for DATA LIST FIXED since it is imagined that the
117 rest of the tests give it a pretty good workout.
118 ----------------------------------------------------------------------
120 ----------------------------------------------------------------------
121 Testing use of DATA LIST FREE.
122 ----------------------------------------------------------------------
124 1.1 DATA LIST. Reading free-form data from file
134 2.1 PRINT. Writing 1 records to file "foo".
135 +--------+------+-------+-------+
136 |Variable|Record|Columns| Format|
137 #========#======#=======#=======#
140 |B | 1| 10- 17|E8.2 |
141 |"/" | 1| 18- 18|A1 |
142 |C | 1| 19- 28|N10.0 |
143 |"/" | 1| 29- 29|A1 |
144 |D | 1| 30- 45|RBHEX16|
145 |"/" | 1| 46- 46|A1 |
146 +--------+------+-------+-------+
150 -------- -------- -------- --------
157 ----------------------------------------------------------------------
158 Testing use of DATA LIST LIST.
159 ----------------------------------------------------------------------
161 3.1 DATA LIST. Reading free-form data from file
171 4.1 PRINT. Writing 1 records to the listing file.
172 +--------+------+-------+------+
173 |Variable|Record|Columns|Format|
174 #========#======#=======#======#
176 |B | 1| 10- 17|F8.2 |
177 |C | 1| 19- 26|F8.2 |
178 |D | 1| 28- 35|F8.2 |
179 +--------+------+-------+------+
183 -------- -------- -------- --------
196 if [ $? -ne 0 ] ; then fail ; fi
199 activity="compare print out"
200 diff $TEMPDIR/foo - << EOF
201 . /2.00E+00/0000000003/0000000000001040/
203 . /6.00E+00/0000000007/0000000000002040/
205 . /1.00E+01/0000000011/0000000000002840/
208 if [ $? -ne 0 ] ; then fail ; fi