c3a9dbe7bd4df1de77aa72cd8bff3f6324d1d926
[pspp] / list.at
1 AT_BANNER([LIST])
2
3 AT_SETUP([LIST plain cases])
4 AT_DATA([data.txt], [dnl
5    18    1
6    19    7
7    20   26
8    21   76
9    22   57
10    23   58
11    24   38
12    25   38
13    26   30
14    27   21
15    28   23
16 ])
17 AT_DATA([list.sps], [dnl
18 DATA LIST FILE='data.txt'/avar 1-5 bvar 6-10.
19 WEIGHT BY bvar.
20 LIST.
21 ])
22 AT_CHECK([pspp -o pspp.csv list.sps])
23 AT_CHECK([cat pspp.csv], [0], [dnl
24 Table: Reading 1 record from `data.txt'.
25 Variable,Record,Columns,Format
26 avar,1,1-  5,F5.0
27 bvar,1,6- 10,F5.0
28
29 Table: Data List
30 avar,bvar
31 18,1
32 19,7
33 20,26
34 21,76
35 22,57
36 23,58
37 24,38
38 25,38
39 26,30
40 27,21
41 28,23
42 ])
43 AT_CLEANUP
44
45 AT_SETUP([LIST numbered cases])
46 AT_DATA([data.txt], [dnl
47    18    1
48    19    7
49    20   26
50    21   76
51    22   57
52    23   58
53    24   38
54    25   38
55    26   30
56    27   21
57    28   23
58 ])
59 AT_DATA([list.sps], [dnl
60 DATA LIST FILE='data.txt'/avar 1-5 bvar 6-10.
61 WEIGHT BY bvar.
62 LIST/FORMAT NUMBERED.
63 ])
64 AT_CHECK([pspp -o pspp.csv list.sps])
65 AT_CHECK([cat pspp.csv], [0], [dnl
66 Table: Reading 1 record from `data.txt'.
67 Variable,Record,Columns,Format
68 avar,1,1-  5,F5.0
69 bvar,1,6- 10,F5.0
70
71 Table: Data List
72 Case Number,avar,bvar
73 1,18,1
74 2,19,7
75 3,20,26
76 4,21,76
77 5,22,57
78 6,23,58
79 7,24,38
80 8,25,38
81 9,26,30
82 10,27,21
83 11,28,23
84 ])
85 AT_CLEANUP
86
87 # Checks for a crash when LIST did not include the variables from SPLIT
88 # FILE in the same positions (bug #30684).
89 AT_SETUP([LIST with split file])
90 AT_DATA([data.txt], [dnl
91 a 1
92 a 2
93 a 3
94 b 1
95 c 4
96 c 5
97 ])
98 AT_DATA([list.sps], [dnl
99 DATA LIST LIST NOTABLE FILE='data.txt'/s (a1) n.
100 SPLIT FILE BY s.
101 LIST n.
102 ])
103 AT_CHECK([pspp -o pspp.csv list.sps])
104 AT_CHECK([cat pspp.csv], [0], [dnl
105 Variable,Value,Label
106 s,a,
107
108 Table: Data List
109 n
110 1.00
111 2.00
112 3.00
113
114 Variable,Value,Label
115 s,b,
116
117 Table: Data List
118 n
119 1.00
120
121 Variable,Value,Label
122 s,c,
123
124 Table: Data List
125 n
126 4.00
127 5.00
128 ])
129 AT_CLEANUP
130
131 AT_SETUP([LIST lots of variables])
132 AT_DATA([data.txt], [dnl
133 767532466348513789073483106409
134 888693089424177542378334186760
135 492611507909187152726427852242
136 819848892023195875879332001491
137 452777898709563729845541516650
138 239961967077732760663525115073
139 ])
140 AT_DATA([list.sps], [dnl
141 DATA LIST FILE='data.txt' NOTABLE/x01 to x30 1-30.
142 LIST.
143 ])
144 AT_CHECK([pspp -o pspp.csv list.sps])
145 AT_CHECK([cat pspp.csv], [0], [dnl
146 Table: Data List
147 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
148 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
149 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
150 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
151 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
152 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
153 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
154 ])
155 AT_CLEANUP
156
157 AT_SETUP([LIST selected cases])
158 AT_DATA([data.txt], [dnl
159 7675324663
160 8886930894
161 4926115079
162 8198488920
163 4527778987
164 2399619670
165 1667799691
166 1623914684
167 3681393233
168 6418731145
169 2284534083
170 6617637452
171 9865713582
172 1163234537
173 9981663637
174 6821567746
175 0952774952
176 1641790193
177 3763182871
178 2046820753
179 7970620091
180 4841176017
181 6949973797
182 1396285996
183 0700489524
184 ])
185 AT_DATA([list.sps], [dnl
186 DATA LIST FILE='data.txt' NOTABLE/x0 to x9 1-10.
187 LIST /CASES=FROM 6 TO 20 BY 5.
188 ])
189 AT_CHECK([pspp -o pspp.csv list.sps])
190 AT_CHECK([cat pspp.csv], [0], [dnl
191 Table: Data List
192 x0,x1,x2,x3,x4,x5,x6,x7,x8,x9
193 2,3,9,9,6,1,9,6,7,0
194 2,2,8,4,5,3,4,0,8,3
195 6,8,2,1,5,6,7,7,4,6
196 ])
197 AT_CLEANUP
198
199 dnl This program tests for a bug which caused a buffer overflow
200 dnl when the list command attempted to write very long strings.
201 AT_SETUP([LIST very long string])
202 AT_DATA([list.sps], [dnl
203 INPUT PROGRAM.
204 STRING foo (a2000).
205 + COMPUTE foo=CONCAT(RPAD('A',1999, 'x'), 'Z').
206 END CASE.
207 END FILE.
208 END INPUT PROGRAM.
209
210 EXECUTE.
211
212 DISPLAY VARIABLES.
213
214 LIST.
215 ])
216 AT_CHECK([pspp -o pspp.csv list.sps])
217 AT_CHECK([cat pspp.csv], [0], [dnl
218 Variable,Description,,Position
219 foo,Format: A2000,,1
220 ,Measure: Nominal,,
221 ,Display Alignment: Left,,
222 ,Display Width: 32,,
223
224 Table: Data List
225 foo
226 Axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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