1 dnl PSPP - a program for statistical analysis.
2 dnl Copyright (C) 2017 Free Software Foundation, Inc.
4 dnl This program is free software: you can redistribute it and/or modify
5 dnl it under the terms of the GNU General Public License as published by
6 dnl the Free Software Foundation, either version 3 of the License, or
7 dnl (at your option) any later version.
9 dnl This program is distributed in the hope that it will be useful,
10 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 dnl GNU General Public License for more details.
14 dnl You should have received a copy of the GNU General Public License
15 dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
17 AT_BANNER([INPUT PROGRAM])
19 dnl Tests for a bug which caused a crash when
20 dnl reading invalid INPUT PROGRAM syntax.
21 AT_SETUP([INPUT PROGRAM invalid syntax crash])
22 AT_DATA([input-program.sps], [dnl
24 DATA LIST NOTABLE /a 1-9.
30 AT_CHECK([pspp -O format=csv input-program.sps], [1], [dnl
31 "input-program.sps:3.1-3.10: error: BEGIN DATA: BEGIN DATA is not allowed inside INPUT PROGRAM.
37 dnl Tests for bug #21108, a crash when
38 dnl reading invalid INPUT PROGRAM syntax.
39 AT_SETUP([INPUT PROGRAM invalid syntax crash])
40 AT_DATA([input-program.sps], [dnl
42 DATA LIST LIST NOTABLE /x.
48 AT_CHECK([pspp -O format=csv input-program.sps], [1], [dnl
49 error: DESCRIPTIVES: At end of input: Syntax error expecting BEGIN.
53 dnl Tests for bug #38782, an infinite loop processing an empty input program.
54 AT_SETUP([INPUT PROGRAM infinite loop])
55 AT_DATA([input-program.sps], [dnl
57 STRING firstname lastname (a24) / address (a80).
61 AT_CHECK([pspp -O format=csv input-program.sps], [1], [dnl
62 input-program.sps:3: error: INPUT PROGRAM: Input program must contain DATA LIST or END FILE.
64 "input-program.sps:4.1-4.7: error: EXECUTE: EXECUTE is allowed only after the active dataset has been defined.
70 dnl Tests for bug #39097, a bug when an INPUT PROGRAM used VECTOR, was
71 dnl followed immediately by a call to proc_execute() (here via DATASET
72 dnl COPY), and then the input was actually used.
73 AT_SETUP([INPUT PROGRAM with VECTOR and EXECUTE])
74 AT_DATA([input-program.sps], [dnl
88 AT_CHECK([pspp -O format=csv input-program.sps], [0], [dnl
90 vec1,vec2,vec3,vec4,vec5
91 1.00,2.00,3.00,4.00,5.00
92 1.00,2.00,3.00,4.00,5.00
93 1.00,2.00,3.00,4.00,5.00
94 1.00,2.00,3.00,4.00,5.00
95 1.00,2.00,3.00,4.00,5.00
96 1.00,2.00,3.00,4.00,5.00
97 1.00,2.00,3.00,4.00,5.00
98 1.00,2.00,3.00,4.00,5.00
99 1.00,2.00,3.00,4.00,5.00
100 1.00,2.00,3.00,4.00,5.00
104 AT_SETUP([INPUT PROGRAM taking shorter of two files])
105 AT_DATA([input-program.sps], [dnl
107 DATA LIST NOTABLE FILE='a.txt'/X 1-10.
108 DATA LIST NOTABLE FILE='b.txt'/Y 1-10.
112 AT_DATA([short.txt], [dnl
117 AT_DATA([long.txt], [dnl
126 AT_CHECK([pspp -O format=csv input-program.sps], 0, [dnl
136 AT_CHECK([pspp -O format=csv input-program.sps], 0, [dnl
145 AT_SETUP([INPUT PROGRAM taking longer of two files])
146 AT_DATA([input-program.sps], [dnl
151 DATA LIST NOTABLE END=#A FILE='a.txt'/X 1-10.
154 DATA LIST NOTABLE END=#B FILE='b.txt'/Y 1-10.
163 AT_DATA([short.txt], [dnl
168 AT_DATA([long.txt], [dnl
178 AT_CHECK([pspp -O format=csv input-program.sps], 0, [dnl
190 AT_CHECK([pspp -O format=csv input-program.sps], 0, [dnl
201 AT_SETUP([INPUT PROGRAM concatenating two files - version 1])
202 AT_DATA([input-program.sps], [dnl
207 DATA LIST NOTABLE END=#B FILE='b.txt'/X 1-10.
214 DATA LIST NOTABLE END=#A FILE='a.txt'/X 1-10.
222 AT_DATA([a.txt], [dnl
227 AT_DATA([b.txt], [dnl
235 AT_CHECK([pspp -O format=csv input-program.sps], 0, [dnl
249 AT_SETUP([INPUT PROGRAM concatenating two files - version 2])
250 AT_DATA([input-program.sps], [dnl
255 DATA LIST NOTABLE END=#EOF FILE='a.txt'/X 1-10.
263 DATA LIST NOTABLE END=#EOF FILE='b.txt'/X 1-10.
273 AT_DATA([a.txt], [dnl
278 AT_DATA([b.txt], [dnl
286 AT_CHECK([pspp -O format=csv input-program.sps], 0, [dnl
300 AT_SETUP([INPUT PROGRAM generating data])
301 AT_DATA([input-program.sps], [dnl
312 AT_CHECK([pspp -O format=csv input-program.sps], 0, [dnl
328 AT_SETUP([INPUT PROGRAM unexpected end of file])
329 AT_DATA([input-program.sps], [dnl
332 AT_CHECK([pspp input-program.sps], 1, [dnl
333 error: INPUT PROGRAM: Unexpected end-of-file within INPUT PROGRAM.
338 AT_SETUP([INPUT PROGRAM no variables])
339 AT_DATA([input-program.sps], [dnl
344 AT_CHECK([pspp input-program.sps], 1, [dnl
345 input-program.sps:3: error: INPUT PROGRAM: Input program did not create any