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: error: BEGIN DATA: BEGIN DATA is not allowed inside INPUT PROGRAM.
35 dnl Tests for bug #21108, a crash when
36 dnl reading invalid INPUT PROGRAM syntax.
37 AT_SETUP([INPUT PROGRAM invalid syntax crash])
38 AT_DATA([input-program.sps], [dnl
40 DATA LIST LIST NOTABLE /x.
46 AT_CHECK([pspp -O format=csv input-program.sps], [1], [dnl
47 error: DESCRIPTIVES: Syntax error at end of input: expecting BEGIN.
51 dnl Tests for bug #38782, an infinite loop processing an empty input program.
52 AT_SETUP([INPUT PROGRAM infinite loop])
53 AT_DATA([input-program.sps], [dnl
55 STRING firstname lastname (a24) / address (a80).
59 AT_CHECK([pspp -O format=csv input-program.sps], [1], [dnl
60 input-program.sps:3: error: INPUT PROGRAM: Input program must contain DATA LIST or END FILE.
62 input-program.sps:4: error: EXECUTE: EXECUTE is allowed only after the active dataset has been defined.
66 dnl Tests for bug #39097, a bug when an INPUT PROGRAM used VECTOR, was
67 dnl followed immediately by a call to proc_execute() (here via DATASET
68 dnl COPY), and then the input was actually used.
69 AT_SETUP([INPUT PROGRAM with VECTOR and EXECUTE])
70 AT_DATA([input-program.sps], [dnl
84 AT_CHECK([pspp -O format=csv input-program.sps], [0], [dnl
86 vec1,vec2,vec3,vec4,vec5
87 1.00,2.00,3.00,4.00,5.00
88 1.00,2.00,3.00,4.00,5.00
89 1.00,2.00,3.00,4.00,5.00
90 1.00,2.00,3.00,4.00,5.00
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
100 AT_SETUP([INPUT PROGRAM taking shorter of two files])
101 AT_DATA([input-program.sps], [dnl
103 DATA LIST NOTABLE FILE='a.txt'/X 1-10.
104 DATA LIST NOTABLE FILE='b.txt'/Y 1-10.
108 AT_DATA([short.txt], [dnl
113 AT_DATA([long.txt], [dnl
122 AT_CHECK([pspp -O format=csv input-program.sps], 0, [dnl
132 AT_CHECK([pspp -O format=csv input-program.sps], 0, [dnl
141 AT_SETUP([INPUT PROGRAM taking longer of two files])
142 AT_DATA([input-program.sps], [dnl
147 DATA LIST NOTABLE END=#A FILE='a.txt'/X 1-10.
150 DATA LIST NOTABLE END=#B FILE='b.txt'/Y 1-10.
159 AT_DATA([short.txt], [dnl
164 AT_DATA([long.txt], [dnl
174 AT_CHECK([pspp -O format=csv input-program.sps], 0, [dnl
186 AT_CHECK([pspp -O format=csv input-program.sps], 0, [dnl
197 AT_SETUP([INPUT PROGRAM concatenating two files - version 1])
198 AT_DATA([input-program.sps], [dnl
203 DATA LIST NOTABLE END=#B FILE='b.txt'/X 1-10.
210 DATA LIST NOTABLE END=#A FILE='a.txt'/X 1-10.
218 AT_DATA([a.txt], [dnl
223 AT_DATA([b.txt], [dnl
231 AT_CHECK([pspp -O format=csv input-program.sps], 0, [dnl
245 AT_SETUP([INPUT PROGRAM concatenating two files - version 2])
246 AT_DATA([input-program.sps], [dnl
251 DATA LIST NOTABLE END=#EOF FILE='a.txt'/X 1-10.
259 DATA LIST NOTABLE END=#EOF FILE='b.txt'/X 1-10.
269 AT_DATA([a.txt], [dnl
274 AT_DATA([b.txt], [dnl
282 AT_CHECK([pspp -O format=csv input-program.sps], 0, [dnl
296 AT_SETUP([INPUT PROGRAM generating data])
297 AT_DATA([input-program.sps], [dnl
308 AT_CHECK([pspp -O format=csv input-program.sps], 0, [dnl
324 AT_SETUP([INPUT PROGRAM unexpected end of file])
325 AT_DATA([input-program.sps], [dnl
328 AT_CHECK([pspp input-program.sps], 1, [dnl
329 error: INPUT PROGRAM: Unexpected end-of-file within INPUT PROGRAM.
334 AT_SETUP([INPUT PROGRAM no variables])
335 AT_DATA([input-program.sps], [dnl
340 AT_CHECK([pspp input-program.sps], 1, [dnl
341 input-program.sps:3: error: INPUT PROGRAM: Input program did not create any