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/>.
19 AT_SETUP([LIST plain cases])
20 AT_DATA([data.txt], [dnl
33 AT_DATA([list.sps], [dnl
34 DATA LIST FILE='data.txt'/avar 1-5 bvar 6-10.
38 AT_CHECK([pspp -o pspp.csv list.sps])
39 AT_CHECK([cat pspp.csv], [0], [dnl
40 Table: Reading 1 record from `data.txt'.
41 Variable,Record,Columns,Format
61 AT_SETUP([LIST numbered cases])
62 AT_DATA([data.txt], [dnl
75 AT_DATA([list.sps], [dnl
76 DATA LIST FILE='data.txt'/avar 1-5 bvar 6-10.
79 LIST/FORMAT NUMBERED/CASES FROM 2 TO 9 BY 2.
81 AT_CHECK([pspp -o pspp.csv list.sps])
82 AT_CHECK([cat pspp.csv], [0], [dnl
83 Table: Reading 1 record from `data.txt'.
84 Variable,Record,Columns,Format
103 Case Number,avar,bvar
111 # Checks for a crash when LIST did not include the variables from SPLIT
112 # FILE in the same positions (bug #30684).
113 AT_SETUP([LIST with split file])
114 AT_DATA([data.txt], [dnl
122 AT_DATA([list.sps], [dnl
123 DATA LIST LIST NOTABLE FILE='data.txt'/s (a1) n.
127 AT_CHECK([pspp -o pspp.csv list.sps])
128 AT_CHECK([cat pspp.csv], [0], [dnl
158 AT_SETUP([LIST lots of variables])
159 AT_DATA([data.txt], [dnl
160 767532466348513789073483106409
161 888693089424177542378334186760
162 492611507909187152726427852242
163 819848892023195875879332001491
164 452777898709563729845541516650
165 239961967077732760663525115073
167 AT_DATA([list.sps], [dnl
168 DATA LIST FILE='data.txt' NOTABLE/x01 to x30 1-30.
171 AT_CHECK([pspp -o pspp.csv list.sps])
172 AT_CHECK([cat pspp.csv], [0], [dnl
174 x01,x02,x03,x04,x05,x06,x07,x08,x09,x10,x11,x12,x13,x14,x15,x16,x17,x18,x19,x20,x21,x22,x23,x24,x25,x26,x27,x28,x29,x30
175 7,6,7,5,3,2,4,6,6,3,4,8,5,1,3,7,8,9,0,7,3,4,8,3,1,0,6,4,0,9
176 8,8,8,6,9,3,0,8,9,4,2,4,1,7,7,5,4,2,3,7,8,3,3,4,1,8,6,7,6,0
177 4,9,2,6,1,1,5,0,7,9,0,9,1,8,7,1,5,2,7,2,6,4,2,7,8,5,2,2,4,2
178 8,1,9,8,4,8,8,9,2,0,2,3,1,9,5,8,7,5,8,7,9,3,3,2,0,0,1,4,9,1
179 4,5,2,7,7,7,8,9,8,7,0,9,5,6,3,7,2,9,8,4,5,5,4,1,5,1,6,6,5,0
180 2,3,9,9,6,1,9,6,7,0,7,7,7,3,2,7,6,0,6,6,3,5,2,5,1,1,5,0,7,3
184 AT_SETUP([LIST selected cases])
185 AT_DATA([data.txt], [dnl
212 AT_DATA([list.sps], [dnl
213 DATA LIST FILE='data.txt' NOTABLE/x0 to x9 1-10.
214 LIST /CASES=FROM 6 TO 20 BY 5.
220 AT_CHECK([pspp -o pspp.csv list.sps])
221 AT_CHECK([cat pspp.csv], [0], [dnl
223 x0,x1,x2,x3,x4,x5,x6,x7,x8,x9
229 x0,x1,x2,x3,x4,x5,x6,x7,x8,x9
236 x0,x1,x2,x3,x4,x5,x6,x7,x8,x9
242 x0,x1,x2,x3,x4,x5,x6,x7,x8,x9
246 x0,x1,x2,x3,x4,x5,x6,x7,x8,x9
250 dnl This program tests for a bug which caused a buffer overflow
251 dnl when the list command attempted to write very long strings.
252 AT_SETUP([LIST very long string])
253 AT_DATA([list.sps], [dnl
256 + COMPUTE foo=CONCAT(RPAD('A',1999,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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxZ
281 AT_SETUP([LIST crash on invalid input])
283 AT_DATA([list.sps], [dnl
294 AT_CHECK([pspp -o pspp.csv list.sps], [1], [ignore])
298 dnl This is an example from doc/tutorial.texi
299 dnl So if the results of this have to be changed in any way,
300 dnl make sure to update that file.
301 AT_SETUP([LIST tutorial example])
302 AT_DATA([list.sps], [dnl
303 data list list /forename (A12) height.
311 list /format=numbered.
313 AT_CHECK([pspp -o pspp.csv -o pspp.txt list.sps])
314 AT_CHECK([cat pspp.csv], [0], [dnl
315 Table: Reading free-form data from INLINE.
321 Case Number,forename,height
329 AT_SETUP([LIST syntax errors])
330 AT_DATA([list.sps], [dnl
331 DATA LIST LIST NOTABLE /x.
335 LIST CASES=FROM 5 TO 4.
339 AT_CHECK([pspp -O format=csv list.sps], [1], [dnl
340 "list.sps:2.16-2.17: error: LIST: Syntax error expecting variable name.
341 2 | LIST VARIABLES=**.
344 "list.sps:3.13-3.14: error: LIST: Syntax error expecting NUMBERED or UNNUMBERED.
348 "list.sps:4.17-4.18: error: LIST: Syntax error expecting positive integer for FROM.
349 4 | LIST CASES=FROM -1.
352 "list.sps:5.22: error: LIST: Syntax error expecting integer 5 or greater for TO.
353 5 | LIST CASES=FROM 5 TO 4.
356 "list.sps:6.15: error: LIST: Syntax error expecting positive integer for TO.
360 "list.sps:7.6-7.7: error: LIST: Syntax error expecting variable name.