669ed5b9696c65a4c4c963ef8284f92995f4585b
[pspp] / tests / data / sys-file-reader.at
1 dnl PSPP - a program for statistical analysis.
2 dnl Copyright (C) 2017 Free Software Foundation, Inc.
3 dnl 
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.
8 dnl 
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.
13 dnl 
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/>.
16 dnl
17 AT_BANNER([system file reader - positive])
18
19 AT_SETUP([variable labels and missing values])
20 AT_KEYWORDS([sack synthetic system file positive])
21 AT_DATA([sys-file.sack], [dnl
22 dnl File header.
23 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
24 2; dnl Layout code
25 28; dnl Nominal case size
26 0; dnl Not compressed
27 0; dnl Not weighted
28 1; dnl 1 case.
29 100.0; dnl Bias.
30 "01 Jan 11"; "20:53:52";
31 "PSPP synthetic test file: "; i8 244; i8 245; i8 246; i8 248; s34 "";
32 i8 0 *3;
33
34 dnl Numeric variable, no label or missing values.
35 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
36
37 dnl Numeric variable, variable label.
38 2; 0; 1; 0; 0x050800 *2; s8 "NUM2";
39 32; "Numeric variable 2's label ("; i8 249; i8 250; i8 251; ")";
40
41 dnl Numeric variable, one missing value.
42 2; 0; 0; 1; 0x050800 *2; s8 "NUM3";
43 1.0;
44
45 dnl Numeric variable, variable label and missing value.
46 2; 0; 1; 1; 0x050800 *2; s8 "NUM4";
47 30; "Another numeric variable label"; i8 0 * 2;
48 1.0;
49
50 dnl Numeric variable, two missing values.
51 2; 0; 0; 2; 0x050800 *2; s8 "NUM5"; 1.0; 2.0;
52
53 dnl Numeric variable, three missing values.
54 2; 0; 0; 3; 0x050800 *2; s8 "NUM6"; 1.0; 2.0; 3.0;
55
56 dnl Numeric variable, range of missing values.
57 2; 0; 0; -2; 0x050800 *2; s8 "NUM7"; 1.0; 3.0;
58
59 dnl Numeric variables, range of missing values plus discrete value.
60 2; 0; 0; -3; 0x050800 *2; s8 "NUM8"; 1.0; 3.0; 5.0;
61 2; 0; 0; -3; 0x050800 *2; s8 "NUM9"; 1.0; HIGHEST; -5.0;
62 2; 0; 0; -3; 0x050800 *2; "NUM"; i8 192; i8 200; i8 204; i8 209; i8 210;
63 LOWEST; 1.0; 5.0;
64
65 dnl String variable, no label or missing values.
66 2; 4; 0; 0; 0x010400 *2; s8 "STR1";
67
68 dnl String variable, variable label.
69 2; 4; 1; 0; 0x010400 *2; s8 "STR2";
70 25; "String variable 2's label"; i8 0 * 3;
71
72 dnl String variable, one missing value.
73 2; 4; 0; 1; 0x010400 *2; s8 "STR3"; s8 "MISS";
74
75 dnl String variable, variable label and missing value.
76 2; 4; 1; 1; 0x010400 *2; s8 "STR4";
77 29; "Another string variable label"; i8 0 * 3;
78 s8 "OTHR";
79
80 dnl String variable, two missing values.
81 2; 4; 0; 2; 0x010400 *2; s8 "STR5"; s8 "MISS"; s8 "OTHR";
82
83 dnl String variable, three missing values.
84 2; 4; 0; 3; 0x010400 *2; s8 "STR6"; s8 "MISS"; s8 "OTHR"; s8 "MORE";
85
86 dnl Long string variable, one missing value.
87 dnl (This is not how SPSS represents missing values for long strings--it
88 dnl uses a separate record as shown later below--but old versions of PSPP
89 dnl did use this representation so we continue supporting it for backward
90 dnl compatibility.
91 2; 11; 0; 1; 0x010b00 *2; s8 "STR7"; "first8by";
92 2; -1; 0; 0; 0; 0; s8 "";
93
94 dnl Long string variables that will have missing values added with a
95 dnl later record.
96 2; 9; 0; 0; 0x010900 *2; s8 "STR8";
97 2; -1; 0; 0; 0; 0; s8 "";
98 2; 10; 0; 0; 0x010a00 *2; s8 "STR9";
99 2; -1; 0; 0; 0; 0; s8 "";
100 2; 11; 0; 0; 0x010b00 *2; s8 "STR10";
101 2; -1; 0; 0; 0; 0; s8 "";
102
103 dnl Long string variable, value label.
104 2; 25; 1; 0; 0x011900 *2; s8 "STR11"; 14; "25-byte string"; i8 0 * 2;
105 ( 2; -1; 0; 0; 0; 0; s8 ""; ) * 2;
106 dnl Variable label fields on continuation records have been spotted in system
107 dnl files created by "SPSS Power Macintosh Release 6.1".
108 2; -1; 1; 0; 0; 0; s8 ""; 20; "dummy variable label";
109
110 dnl Machine integer info record.
111 7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1252;
112
113 dnl Machine floating-point info record.
114 7; 4; 8; 3; SYSMIS; HIGHEST; LOWEST;
115
116 dnl Long string variable missing values record.
117 7; 22; 1; COUNT (
118 dnl One missing value for STR8.
119 COUNT("STR8"); i8 1; 8; "abcdefgh";
120
121 dnl Two missing values for STR9.
122 COUNT("STR9"); i8 2; 8; "abcdefgh"; 8; "01234567";
123
124 dnl Three missing values for STR9.
125 COUNT("STR10"); i8 3; 8; "abcdefgh"; 8; "01234567"; 8; "0       ";
126 );
127
128 dnl Character encoding record.
129 7; 20; 1; 12; "windows-1252";
130
131 dnl Dictionary termination record.
132 999; 0;
133
134 dnl Data.
135 1.0; 2.0; 3.0; 4.0; 5.0; 6.0; 7.0; 8.0; 9.0; 10.0;
136 s8 "abcd"; s8 "efgh"; s8 "ijkl"; s8 "mnop"; s8 "qrst"; s8 "uvwx";
137 s16 "yzABCDEFGHI"; s16 "JKLMNOPQR"; s16 "STUVWXYZ01";
138 s16 "23456789abc"; s32 "defghijklmnopqstuvwxyzABC";
139 ])
140 for variant in be le; do
141   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
142   AT_DATA([sys-file.sps], [dnl
143 GET FILE='sys-file.sav'.
144 DISPLAY FILE LABEL.
145 DISPLAY DICTIONARY.
146 LIST.
147 ])
148   AT_CHECK([pspp -o pspp.csv sys-file.sps])
149   AT_CHECK([cat pspp.csv], [0], [dnl
150 File label: PSPP synthetic test file: ôõöø
151
152 Variable,Description,Position
153 num1,Format: F8.0,1
154 num2,"Label: Numeric variable 2's label (ùúû)
155 Format: F8.0",2
156 num3,"Format: F8.0
157 Missing Values: 1",3
158 num4,"Label: Another numeric variable label
159 Format: F8.0
160 Missing Values: 1",4
161 num5,"Format: F8.0
162 Missing Values: 1; 2",5
163 num6,"Format: F8.0
164 Missing Values: 1; 2; 3",6
165 num7,"Format: F8.0
166 Missing Values: 1 THRU 3",7
167 num8,"Format: F8.0
168 Missing Values: 1 THRU 3; 5",8
169 num9,"Format: F8.0
170 Missing Values: 1 THRU HIGHEST; -5",9
171 numàèìñò,"Format: F8.0
172 Missing Values: LOWEST THRU 1; 5",10
173 str1,Format: A4,11
174 str2,"Label: String variable 2's label
175 Format: A4",12
176 str3,"Format: A4
177 Missing Values: ""MISS""",13
178 str4,"Label: Another string variable label
179 Format: A4
180 Missing Values: ""OTHR""",14
181 str5,"Format: A4
182 Missing Values: ""MISS""; ""OTHR""",15
183 str6,"Format: A4
184 Missing Values: ""MISS""; ""OTHR""; ""MORE""",16
185 str7,"Format: A11
186 Missing Values: ""first8by""",17
187 str8,"Format: A9
188 Missing Values: ""abcdefgh""",18
189 str9,"Format: A10
190 Missing Values: ""abcdefgh""; ""01234567""",19
191 str10,"Format: A11
192 Missing Values: ""abcdefgh""; ""01234567""; ""0       """,20
193 str11,"Label: 25-byte string
194 Format: A25",21
195
196 Table: Data List
197 num1,num2,num3,num4,num5,num6,num7,num8,num9,numàèìñò,str1,str2,str3,str4,str5,str6,str7,str8,str9,str10,str11
198 1,2,3,4,5,6,7,8,9,10,abcd,efgh,ijkl,mnop,qrst,uvwx,yzABCDEFGHI,JKLMNOPQR,STUVWXYZ01,23456789abc,defghijklmnopqstuvwxyzABC
199 ])
200 done
201 AT_CLEANUP
202
203 AT_SETUP([unspecified number of variable positions])
204 AT_KEYWORDS([sack synthetic system file positive])
205 AT_DATA([sys-file.sack], [dnl
206 dnl File header.
207 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
208 2; dnl Layout code
209 -1; dnl Nominal case size (unspecified)
210 0; dnl Not compressed
211 0; dnl Not weighted 
212 1; dnl 1 case.
213 100.0; dnl Bias.
214 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
215 i8 0 *3;
216
217 dnl Numeric variable, no label or missing values.
218 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
219
220 dnl Numeric variable, variable label.
221 2; 0; 1; 0; 0x050800 *2; s8 "NUM2";
222 26; "Numeric variable 2's label"; i8 0 *2;
223
224 dnl Character encoding record.
225 7; 20; 1; 12; "windows-1252";
226
227 dnl Dictionary termination record.
228 999; 0;
229
230 dnl Data.
231 1.0; 2.0; 
232 ])
233 for variant in be le; do
234   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
235   AT_DATA([sys-file.sps], [dnl
236 GET FILE='sys-file.sav'.
237 DISPLAY DICTIONARY.
238 LIST.
239 ])
240   AT_CHECK([pspp -o pspp.csv sys-file.sps])
241   AT_CHECK([cat pspp.csv], [0], [dnl
242 Variable,Description,Position
243 num1,Format: F8.0,1
244 num2,"Label: Numeric variable 2's label
245 Format: F8.0",2
246
247 Table: Data List
248 num1,num2
249 1,2
250 ])
251 done
252 AT_CLEANUP
253
254 AT_SETUP([wrong number of variable positions but version 13])
255 AT_KEYWORDS([sack synthetic system file positive])
256 AT_DATA([sys-file.sack], [dnl
257 dnl File header.
258 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
259 2; dnl Layout code
260 -1; dnl Nominal case size (unspecified)
261 0; dnl Not compressed
262 0; dnl Not weighted 
263 1; dnl 1 case.
264 100.0; dnl Bias.
265 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
266 i8 0 *3;
267
268 dnl Numeric variable, no label or missing values.
269 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
270
271 dnl Numeric variable, variable label.
272 2; 0; 1; 0; 0x050800 *2; s8 "NUM2";
273 26; "Numeric variable 2's label"; i8 0 *2;
274
275 dnl Machine integer info record (SPSS 13).
276 7; 3; 4; 8; 13; 2; 3; -1; 1; 1; ENDIAN; 1252;
277
278 dnl Character encoding record.
279 7; 20; 1; 12; "windows-1252";
280
281 dnl Dictionary termination record.
282 999; 0;
283
284 dnl Data.
285 1.0; 2.0; 
286 ])
287 for variant in be le; do
288   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
289   AT_DATA([sys-file.sps], [dnl
290 GET FILE='sys-file.sav'.
291 DISPLAY DICTIONARY.
292 LIST.
293 ])
294   AT_CHECK([pspp -o pspp.csv sys-file.sps])
295   AT_CHECK([cat pspp.csv], [0], [dnl
296 Variable,Description,Position
297 num1,Format: F8.0,1
298 num2,"Label: Numeric variable 2's label
299 Format: F8.0",2
300
301 Table: Data List
302 num1,num2
303 1,2
304 ])
305 done
306 AT_CLEANUP
307
308 AT_SETUP([value labels])
309 AT_KEYWORDS([sack synthetic system file positive])
310 AT_DATA([sys-file.sack], [dnl
311 dnl File header.
312 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
313 2; dnl Layout code
314 22; dnl Nominal case size
315 0; dnl Not compressed
316 0; dnl Not weighted 
317 1; dnl 1 case.
318 100.0; dnl Bias.
319 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
320 i8 0 *3;
321
322 dnl Numeric variables.
323 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
324 2; 0; 0; 0; 0x050800 *2; s8 "NUM2";
325 2; 0; 0; 0; 0x050800 *2; s8 "NUM3";
326 2; 0; 0; 0; 0x050800 *2; s8 "NUM4";
327 2; 0; 0; 0; 0x050800 *2; s8 "NUM5";
328
329 dnl String variables.
330 2; 1; 0; 0; 0x010100 *2; s8 "STR1"; dnl index 6
331 2; 2; 0; 0; 0x010200 *2; s8 "STR2"; dnl index 7
332 2; 3; 0; 0; 0x010300 *2; s8 "STR3"; dnl index 8
333 2; 4; 0; 0; 0x010400 *2; s8 "STR4"; dnl index 9
334 2; 4; 0; 0; 0x010400 *2; s8 "STR5"; dnl index 10
335 2; 6; 0; 0; 0x010600 *2; s8 "STR6"; dnl index 11
336 2; 7; 0; 0; 0x010700 *2; s8 "STR7"; dnl index 12
337 2; 8; 0; 0; 0x010800 *2; s8 "STR8"; dnl index 13
338 2; 9; 0; 0; 0x010900 *2; "STR9"; i8 230; s3 ""; dnl index 14
339 2; -1; 0; 0; 0; 0; s8 "";
340 2; 12; 0; 0; 0x010c00 *2; s8 "STR12"; dnl index 16
341 2; -1; 0; 0; 0; 0; s8 "";
342 2; 16; 0; 0; 0x011000 *2; s8 "STR16"; dnl index 18
343 2; -1; 0; 0; 0; 0; s8 "";
344 2; 17; 0; 0; 0x011100 *2; s8 "STR17"; dnl index 20
345 ( 2; -1; 0; 0; 0; 0; s8 ""; ) * 2;
346
347 dnl One value label for NUM1.
348 3; 1; 1.0; i8 17; i8 238; i8 228; i8 232; i8 237; s19 " (in Russian)"; 4; 1; 1;
349
350 dnl Two value labels for NUM2, as a single pair of type 3 and type 4 records.
351 3; 2; 1.0; i8 3; s7 "one"; 2.0; i8 3; s7 "two"; 4; 1; 2;
352
353 dnl Two value labels for NUM3, as two pairs of type 3 and type 4 records.
354 3; 1; 3.0; i8 5; s7 "three"; 4; 1; 3;
355 3; 1; 4.0; i8 4; s7 "four"; 4; 1; 3;
356
357 dnl Two common value labels for NUM4 and NUM5, plus two different ones for each.
358 3; 1; 5.0; i8 4; s7 "five"; 4; 1; 4;
359 3; 1; 6.0; i8 3; s7 "six"; 4; 1; 5;
360 3; 2; 7.0; i8 5; s7 "seven"; 8.0; i8 5; s7 "eight"; 4; 2; 4; 5;
361 3; 1; 9.0; i8 4; s7 "nine"; 4; 1; 4;
362 3; 1; 10.0; i8 3; s7 "ten"; 4; 1; 5;
363
364 dnl One value label for STR1.
365 3; 1; s8 "a"; i8 19; s23 "value label for `a'"; 4; 1; 6;
366
367 dnl Two value labels for STR2, as a single pair of type 3 and type 4 records.
368 3; 2;
369 s8 "bc"; i8 20; s23 "value label for `bc'";
370 s8 "de"; i8 20; s23 "value label for `de'";
371 4; 1; 7;
372
373 dnl Two value labels for STR3, as two pairs of type 3 and type 4 records.
374 3; 1; s8 "fgh"; i8 21; s23 "value label for `fgh'"; 4; 1; 8;
375 3; 1; s8 "ijk"; i8 21; s23 "value label for `ijk'"; 4; 1; 8;
376
377 dnl Two common value labels for STR4 and STR5, plus two different ones for each.
378 3; 1; s8 "lmno"; i8 22; s23 "value label for `lmno'"; 4; 1; 9;
379 3; 1; s8 "pqrs"; i8 22; s23 "value label for `pqrs'"; 4; 1; 10;
380 3; 2;
381 s8 "tuvw"; i8 22; s23 "value label for `tuvw'";
382 s8 "xyzA"; i8 22; s23 "value label for `xyzA'";
383 4; 2; 9; 10;
384 3; 1; s8 "BCDE"; i8 22; s23 "value label for `BCDE'"; 4; 1; 9;
385 3; 1; s8 "FGHI"; i8 22; s23 "value label for `FGHI'"; 4; 1; 10;
386
387 dnl One value label for STR6, STR7, STR8.
388 3; 1; s8 "JKLMNO"; i8 24; s31 "value label for `JKLMNO'"; 4; 1; 11;
389 3; 1; s8 "JKLMNOP"; i8 25; s31 "value label for `JKLMNOP'"; 4; 1; 12;
390 3; 1; s8 "JKLMNOPQ"; i8 26; s31 "value label for `JKLMNOPQ'"; 4; 1; 13;
391
392 dnl Machine integer info record.
393 7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1251;
394
395 dnl Character encoding record.
396 7; 20; 1; 12; "windows-1251";
397
398 7; 21; 1; COUNT (
399 dnl One value label for STR9ж,
400 COUNT("STR9"; i8 230); 9; 1; COUNT("RSTUVWXYZ"); COUNT("value label for `RSTUVWXYZ'");
401
402 dnl Two value labels for STR12.
403 COUNT("STR12"); 12; 2;
404 COUNT("0123456789ab"); COUNT("value label for `0123456789ab'");
405 COUNT("cdefghijklmn"); COUNT("value label for `cdefghijklmn'");
406
407 dnl Three value labels for STR16.
408 COUNT("STR16"); 16; 3;
409 COUNT("opqrstuvwxyzABCD"); COUNT("value label for `opqrstuvwxyzABCD'");
410 COUNT("EFGHIJKLMNOPQRST"); COUNT("value label for `EFGHIJKLMNOPQRST'");
411 COUNT("UVWXYZ0123456789"); COUNT("value label for `UVWXYZ0123456789' with Cyrillic letters: `"; i8 244; i8 245; i8 246; "'");
412
413 dnl One value label for STR17.
414 COUNT("STR17"); 17; 1;
415 COUNT("abcdefghijklmnopq"); COUNT("value label for `abcdefghijklmnopq'");
416 );
417
418 dnl Dictionary termination record.
419 999; 0;
420 ])
421 for variant in be le; do
422   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
423   AT_DATA([sys-file.sps], [dnl
424 GET FILE='sys-file.sav'.
425 DISPLAY DICTIONARY.
426 ])
427   AT_CHECK([pspp -o pspp.csv sys-file.sps])
428   AT_CHECK([cat pspp.csv], [0], [dnl
429 Variable,Description,Position
430 num1,"Format: F8.0
431
432 Value,Label
433 1,один (in Russian)",1
434 num2,"Format: F8.0
435
436 Value,Label
437 1,one
438 2,two",2
439 num3,"Format: F8.0
440
441 Value,Label
442 3,three
443 4,four",3
444 num4,"Format: F8.0
445
446 Value,Label
447 5,five
448 7,seven
449 8,eight
450 9,nine",4
451 num5,"Format: F8.0
452
453 Value,Label
454 6,six
455 7,seven
456 8,eight
457 10,ten",5
458 str1,"Format: A1
459
460 Value,Label
461 a,value label for `a'",6
462 str2,"Format: A2
463
464 Value,Label
465 bc,value label for `bc'
466 de,value label for `de'",7
467 str3,"Format: A3
468
469 Value,Label
470 fgh,value label for `fgh'
471 ijk,value label for `ijk'",8
472 str4,"Format: A4
473
474 Value,Label
475 BCDE,value label for `BCDE'
476 lmno,value label for `lmno'
477 tuvw,value label for `tuvw'
478 xyzA,value label for `xyzA'",9
479 str5,"Format: A4
480
481 Value,Label
482 FGHI,value label for `FGHI'
483 pqrs,value label for `pqrs'
484 tuvw,value label for `tuvw'
485 xyzA,value label for `xyzA'",10
486 str6,"Format: A6
487
488 Value,Label
489 JKLMNO,value label for `JKLMNO'",11
490 str7,"Format: A7
491
492 Value,Label
493 JKLMNOP,value label for `JKLMNOP'",12
494 str8,"Format: A8
495
496 Value,Label
497 JKLMNOPQ,value label for `JKLMNOPQ'",13
498 str9ж,"Format: A9
499
500 Value,Label
501 RSTUVWXYZ,value label for `RSTUVWXYZ'",14
502 str12,"Format: A12
503
504 Value,Label
505 0123456789ab,value label for `0123456789ab'
506 cdefghijklmn,value label for `cdefghijklmn'",15
507 str16,"Format: A16
508
509 Value,Label
510 EFGHIJKLMNOPQRST,value label for `EFGHIJKLMNOPQRST'
511 UVWXYZ0123456789,value label for `UVWXYZ0123456789' with Cyrillic letters: `фхц'
512 opqrstuvwxyzABCD,value label for `opqrstuvwxyzABCD'",16
513 str17,"Format: A17
514
515 Value,Label
516 abcdefghijklmnopq,value label for `abcdefghijklmnopq'",17
517 ])
518 done
519 AT_CLEANUP
520
521 AT_SETUP([documents])
522 AT_KEYWORDS([sack synthetic system file positive])
523 AT_DATA([sys-file.sack], [dnl
524 dnl File header.
525 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
526 2; dnl Layout code
527 1; dnl Nominal case size
528 0; dnl Not compressed
529 0; dnl Not weighted 
530 1; dnl 1 case.
531 100.0; dnl Bias.
532 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
533 i8 0 *3;
534
535 dnl Numeric variable, no label or missing values.
536 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
537
538 dnl Machine integer info record.
539 7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1252;
540
541 dnl Document record.
542 6; 5;
543 s80 "First line of documents";
544 s80 "Second line of documents";
545 "abb"; i8 233; " appliqu"; i8 233; " attach"; i8 233; " blas"; i8 233; " caf"; i8 233; " canap"; i8 233; " clich"; i8 233; " consomm"; i8 233;
546 s25 "";
547 s80 "";
548 s80 "Last line of documents";
549
550 dnl Character encoding record.
551 7; 20; 1; 12; "windows-1252";
552
553 dnl Dictionary termination record.
554 999; 0;
555
556 dnl Data.
557 1.0;
558 ])
559 for variant in be le; do
560   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
561   AT_DATA([sys-file.sps], [dnl
562 GET FILE='sys-file.sav'.
563 DISPLAY DOCUMENTS.
564 LIST.
565 ])
566   AT_CHECK([pspp -o pspp.csv sys-file.sps])
567   AT_CHECK([cat pspp.csv], [0], [dnl
568 Documents in the active dataset:
569
570 First line of documents
571
572 Second line of documents
573
574 abbé appliqué attaché blasé café canapé cliché consommé
575
576
577
578 Last line of documents
579
580 Table: Data List
581 num1
582 1
583 ])
584 done
585 AT_CLEANUP
586
587 AT_SETUP([multiple response sets])
588 AT_KEYWORDS([sack synthetic system file positive])
589 AT_DATA([sys-file.sack], [dnl
590 dnl File header.
591 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
592 2; dnl Layout code
593 16; dnl Nominal case size
594 0; dnl Not compressed
595 0; dnl Not weighted 
596 0; dnl No cases.
597 100.0; dnl Bias.
598 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
599 i8 0 *3;
600
601 dnl $a
602 2; 0; 0; 0; 0x050800 *2; i8 0x82; i8 0xa0; s6 "";
603 2; 0; 0; 0; 0x050800 *2; s8 "B";
604 2; 0; 0; 0; 0x050800 *2; s8 "C";
605
606 dnl $b
607 2; 0; 0; 0; 0x050800 *2; s8 "D";
608 2; 0; 0; 0; 0x050800 *2; s8 "E";
609 2; 0; 0; 0; 0x050800 *2; s8 "F";
610 2; 0; 0; 0; 0x050800 *2; s8 "G";
611
612 dnl $c
613 2; 4; 0; 0; 0x010400 *2; s8 "H";
614 2; 4; 0; 0; 0x010400 *2; s8 "I";
615 2; 4; 0; 0; 0x010400 *2; s8 "J";
616
617 dnl $d
618 2; 0; 0; 0; 0x050800 *2; s8 "K";
619 2; 0; 0; 0; 0x050800 *2; s8 "L";
620 2; 0; 0; 0; 0x050800 *2; s8 "M";
621
622 dnl $e
623 2; 6; 0; 0; 0x010600 *2; s8 "N";
624 2; 6; 0; 0; 0x010600 *2; s8 "O";
625 2; 6; 0; 0; 0x010600 *2; s8 "P";
626
627 dnl Machine integer info record.
628 7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 932;
629
630 7; 7; 1;
631 COUNT(
632   "$a=C 10 my mcgroup "; i8 0x82; i8 0xa0; " b c"; i8 10;
633   "$b=D2 55 0  g e f d"; i8 10; i8 10;
634   "$c=D4 "; i8 0x82; i8 0xcd; i8 0x82; i8 0xa2; " 10 mdgroup #2 h i j"; i8 10);
635
636 7; 19; 1;
637 COUNT(
638   i8 10;
639   "$d=E 1 2 34 13 third mdgroup k l m"; i8 10;
640   "$e=E 11 6 choice 0  n o p"; i8 10; i8 10; i8 10; i8 10);
641
642 dnl Character encoding record.
643 7; 20; 1; 9; "shift_jis";
644
645 dnl Dictionary termination record.
646 999; 0;
647 ])
648 for variant in be le; do
649   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
650   AT_DATA([sys-file.sps], [dnl
651 GET FILE='sys-file.sav'.
652 MRSETS /DISPLAY NAME=ALL.
653 ])
654   AT_CHECK([pspp -o pspp.csv sys-file.sps])
655   AT_CHECK([cat pspp.csv], [0], [dnl
656 Table: Multiple Response Sets
657 Name,Variables,Details
658 $a,"あ
659 b
660 c
661 ","Multiple category set
662 Label: my mcgroup
663 "
664 $b,"g
665 e
666 f
667 d
668 ","Multiple dichotomy set
669 Counted value: 55
670 Category label source: Variable labels
671 "
672 $c,"h
673 i
674 j
675 ","Multiple dichotomy set
676 Label: mdgroup #2
677 Label source: Provided by user
678 Counted value: `はい'
679 Category label source: Variable labels
680 "
681 $d,"k
682 l
683 m
684 ","Multiple dichotomy set
685 Label: third mdgroup
686 Label source: Provided by user
687 Counted value: 34
688 Category label source: Value labels of counted value
689 "
690 $e,"n
691 o
692 p
693 ","Multiple dichotomy set
694 Label source: First variable label among variables
695 Counted value: `choice'
696 Category label source: Value labels of counted value
697 "
698 ])
699 done
700 AT_CLEANUP
701
702 dnl Also checks for handling of CR-only line ends in file label and
703 dnl extra product info.
704 AT_SETUP([extra product info])
705 AT_KEYWORDS([sack synthetic system file positive])
706 AT_DATA([sys-file.sack], [dnl
707 dnl File header.
708 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
709 2; dnl Layout code
710 4; dnl Nominal case size
711 0; dnl Not compressed
712 0; dnl Not weighted
713 0; dnl No cases.
714 100.0; dnl Bias.
715 "01 Jan 11"; "20:53:52"; "PSPP synthetic"; i8 13; s49 "test file";
716 i8 0 *3;
717
718 dnl Numeric variables.
719 2; 0; 0; 0; 0x050800 *2; s8 "A";
720 2; 0; 0; 0; 0x050800 *2; s8 "B";
721 2; 0; 0; 0; 0x050800 *2; s8 "C";
722 2; 0; 0; 0; 0x050800 *2; s8 "D";
723
724 dnl Extra product info.
725 7; 10; 1; COUNT ("Extra product info"; i8 13; "another line"; i8 13; "blah");
726
727 dnl Character encoding record.
728 7; 20; 1; 12; "windows-1252";
729
730 dnl Dictionary termination record.
731 999; 0;
732 ])
733 for variant in be le; do
734   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
735   AT_DATA([sys-file.sps], [dnl
736 SYSFILE INFO FILE='sys-file.sav'.
737 ])
738   AT_CHECK([pspp -o pspp.csv sys-file.sps])
739   AT_CHECK([sed 7q pspp.csv], [0], [dnl
740 File:,sys-file.sav
741 Label:,"PSPP synthetic
742 test file"
743 Created:,01 Jan 11 20:53:52 by $(@%:@) SPSS DATA FILE PSPP synthetic test file
744 Product:,"Extra product info
745 another line
746 blah"
747 ])
748 done
749 AT_CLEANUP
750
751 AT_SETUP([variable display parameters, without width])
752 AT_KEYWORDS([sack synthetic system file positive])
753 AT_DATA([sys-file.sack], [dnl
754 dnl File header.
755 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
756 2; dnl Layout code
757 19; dnl Nominal case size
758 0; dnl Not compressed
759 0; dnl Not weighted 
760 0; dnl No cases.
761 100.0; dnl Bias.
762 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
763 i8 0 *3;
764
765 dnl Numeric variables.
766 2; 0; 0; 0; 0x050800 *2; s8 "A";
767 2; 0; 0; 0; 0x050800 *2; s8 "B";
768 2; 0; 0; 0; 0x050800 *2; s8 "C";
769 2; 0; 0; 0; 0x050800 *2; s8 "D";
770
771 dnl Short string variables.
772 2; 3; 0; 0; 0x010300 *2; s8 "H";
773 2; 3; 0; 0; 0x010300 *2; s8 "I";
774 2; 3; 0; 0; 0x010300 *2; s8 "J";
775 2; 3; 0; 0; 0x010300 *2; s8 "K";
776
777 dnl Long string variables.
778 2; 9; 0; 0; 0x010900 *2; s8 "L";
779 2; -1; 0; 0; 0; 0; s8 "";
780 2; 10; 0; 0; 0x010a00 *2; s8 "M";
781 2; -1; 0; 0; 0; 0; s8 "";
782 2; 17; 0; 0; 0x011100 *2; s8 "N";
783 ( 2; -1; 0; 0; 0; 0; s8 "" ) * 2;
784 2; 25; 0; 0; 0x011900 *2; s8 "O";
785 ( 2; -1; 0; 0; 0; 0; s8 "" ) * 3;
786
787 dnl Variable display parameters
788 7; 11; 4; 24;
789 1; 0;
790 2; 0;
791 3; 0;
792 1; 1;
793 2; 1;
794 3; 1;
795 1; 2;
796 2; 2;
797 3; 2;
798 0; 0;
799 0; 1;
800 0; 2;
801
802 dnl Character encoding record.
803 7; 20; 1; 12; "windows-1252";
804
805 dnl Dictionary termination record.
806 999; 0;
807 ])
808 for variant in be le; do
809   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
810   AT_DATA([sys-file.sps], [dnl
811 GET FILE='sys-file.sav'.
812 DISPLAY DICTIONARY.
813 ])
814   AT_CHECK([pspp -o pspp.csv sys-file.sps])
815   AT_CHECK([cat pspp.csv], [0], [dnl
816 Variable,Description,Position
817 a,"Format: F8.0
818 Measure: Nominal
819 Display Alignment: Left",1
820 b,"Format: F8.0
821 Measure: Ordinal
822 Display Alignment: Left",2
823 c,"Format: F8.0
824 Measure: Scale
825 Display Alignment: Left",3
826 d,"Format: F8.0
827 Measure: Nominal
828 Display Alignment: Right",4
829 h,"Format: A3
830 Measure: Ordinal
831 Display Alignment: Right",5
832 i,"Format: A3
833 Measure: Scale
834 Display Alignment: Right",6
835 j,"Format: A3
836 Measure: Nominal
837 Display Alignment: Center",7
838 k,"Format: A3
839 Measure: Ordinal
840 Display Alignment: Center",8
841 l,"Format: A9
842 Measure: Scale
843 Display Alignment: Center",9
844 m,"Format: A10
845 Measure: Nominal
846 Display Alignment: Left",10
847 n,"Format: A17
848 Measure: Nominal
849 Display Alignment: Right",11
850 o,"Format: A25
851 Measure: Nominal
852 Display Alignment: Center",12
853 ])
854 done
855 AT_CLEANUP
856
857 AT_SETUP([variable display parameters, with width])
858 AT_KEYWORDS([sack synthetic system file positive])
859 AT_DATA([sys-file.sack], [dnl
860 dnl File header.
861 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
862 2; dnl Layout code
863 19; dnl Nominal case size
864 0; dnl Not compressed
865 0; dnl Not weighted 
866 0; dnl No cases.
867 100.0; dnl Bias.
868 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
869 i8 0 *3;
870
871 dnl Numeric variables.
872 2; 0; 0; 0; 0x050800 *2; s8 "A";
873 2; 0; 0; 0; 0x050800 *2; s8 "B";
874 2; 0; 0; 0; 0x050800 *2; s8 "C";
875 2; 0; 0; 0; 0x050800 *2; s8 "D";
876
877 dnl Short string variables.
878 2; 3; 0; 0; 0x010300 *2; s8 "H";
879 2; 3; 0; 0; 0x010300 *2; s8 "I";
880 2; 3; 0; 0; 0x010300 *2; s8 "J";
881 2; 3; 0; 0; 0x010300 *2; s8 "K";
882
883 dnl Long string variables.
884 2; 9; 0; 0; 0x010900 *2; s8 "L";
885 2; -1; 0; 0; 0; 0; s8 "";
886 2; 10; 0; 0; 0x010a00 *2; s8 "M";
887 2; -1; 0; 0; 0; 0; s8 "";
888 2; 17; 0; 0; 0x011100 *2; s8 "N";
889 ( 2; -1; 0; 0; 0; 0; s8 "" ) * 2;
890 2; 25; 0; 0; 0x011900 *2; s8 "O";
891 ( 2; -1; 0; 0; 0; 0; s8 "" ) * 3;
892
893 dnl Variable display parameters
894 7; 11; 4; 36;
895 1; 1; 0;
896 2; 2; 0;
897 3; 3; 0;
898 1; 4; 1;
899 2; 5; 1;
900 3; 6; 1;
901 1; 7; 2;
902 2; 8; 2;
903 3; 9; 2;
904 0; 10; 0;
905 0; 11; 1;
906 0; 12; 2;
907
908 dnl Character encoding record.
909 7; 20; 1; 12; "windows-1252";
910
911 dnl Dictionary termination record.
912 999; 0;
913 ])
914 for variant in be le; do
915   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
916   AT_DATA([sys-file.sps], [dnl
917 GET FILE='sys-file.sav'.
918 DISPLAY DICTIONARY.
919 ])
920   AT_CHECK([pspp -o pspp.csv sys-file.sps])
921   AT_CHECK([cat pspp.csv], [0], [dnl
922 Variable,Description,Position
923 a,"Format: F8.0
924 Measure: Nominal
925 Display Alignment: Left
926 Display Width: 1",1
927 b,"Format: F8.0
928 Measure: Ordinal
929 Display Alignment: Left
930 Display Width: 2",2
931 c,"Format: F8.0
932 Measure: Scale
933 Display Alignment: Left
934 Display Width: 3",3
935 d,"Format: F8.0
936 Measure: Nominal
937 Display Alignment: Right
938 Display Width: 4",4
939 h,"Format: A3
940 Measure: Ordinal
941 Display Alignment: Right
942 Display Width: 5",5
943 i,"Format: A3
944 Measure: Scale
945 Display Alignment: Right
946 Display Width: 6",6
947 j,"Format: A3
948 Measure: Nominal
949 Display Alignment: Center
950 Display Width: 7",7
951 k,"Format: A3
952 Measure: Ordinal
953 Display Alignment: Center
954 Display Width: 8",8
955 l,"Format: A9
956 Measure: Scale
957 Display Alignment: Center
958 Display Width: 9",9
959 m,"Format: A10
960 Measure: Nominal
961 Display Alignment: Left
962 Display Width: 10",10
963 n,"Format: A17
964 Measure: Nominal
965 Display Alignment: Right
966 Display Width: 11",11
967 o,"Format: A25
968 Measure: Nominal
969 Display Alignment: Center
970 Display Width: 12",12
971 ])
972 done
973 AT_CLEANUP
974
975 AT_SETUP([long variable names])
976 AT_KEYWORDS([sack synthetic system file positive])
977 AT_DATA([sys-file.sack], [dnl
978 dnl File header.
979 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
980 2; dnl Layout code
981 7; dnl Nominal case size
982 0; dnl Not compressed
983 0; dnl Not weighted 
984 0; dnl No cases.
985 100.0; dnl Bias.
986 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
987 i8 0 *3;
988
989 dnl Numeric variables.
990 2; 0; 0; 0; 0x050800 *2; s8 "LONGVARI";
991 2; 0; 0; 0; 0x050800 *2; s8 "LONGVA_A";
992 2; 0; 0; 0; 0x050800 *2; s8 "LONGVA_B";
993 2; 0; 0; 0; 0x050800 *2; s8 "LONGVA_C";
994 2; 0; 0; 0; 0x050800 *2; "CO"; i8 214; "RDINA";
995 2; 0; 0; 0; 0x050800 *2; "CO"; i8 214; "RDI_A";
996 2; 0; 0; 0; 0x050800 *2; "CO"; i8 214; "RDI_B";
997
998 dnl Machine integer info record.
999 7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1252;
1000
1001 dnl Machine floating-point info record.
1002 7; 4; 8; 3; SYSMIS; HIGHEST; LOWEST;
1003
1004 dnl Long variable names.
1005 7; 13; 1; COUNT (
1006 "LONGVARI=LongVariableName1"; i8 9;
1007 "LONGVA_A=LongVariableName2"; i8 9;
1008 "LONGVA_B=LongVariableName3"; i8 9;
1009 "LONGVA_C=LongVariableName4"; i8 9;
1010 "CO"; i8 214; "RDINA=Co"; i8 246; "rdinate_X"; i8 9;
1011 "CO"; i8 214; "RDI_A=Co"; i8 246; "rdinate_Y"; i8 9;
1012 "CO"; i8 214; "RDI_B=Co"; i8 246; "rdinate_Z";
1013 );
1014
1015 dnl Character encoding record.
1016 7; 20; 1; 12; "windows-1252";
1017
1018 dnl Dictionary termination record.
1019 999; 0;
1020 ])
1021 for variant in be le; do
1022   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1023   AT_DATA([sys-file.sps], [dnl
1024 GET FILE='sys-file.sav'.
1025 DISPLAY DICTIONARY.
1026 ])
1027   AT_CHECK([pspp -o pspp.csv sys-file.sps])
1028   AT_CHECK([cat pspp.csv], [0], [dnl
1029 Variable,Description,Position
1030 LongVariableName1,Format: F8.0,1
1031 LongVariableName2,Format: F8.0,2
1032 LongVariableName3,Format: F8.0,3
1033 LongVariableName4,Format: F8.0,4
1034 Coördinate_X,Format: F8.0,5
1035 Coördinate_Y,Format: F8.0,6
1036 Coördinate_Z,Format: F8.0,7
1037 ])
1038 done
1039 AT_CLEANUP
1040
1041 AT_SETUP([very long strings])
1042 AT_KEYWORDS([sack synthetic system file positive])
1043 AT_DATA([sys-file.sack], [dnl
1044 dnl File header.
1045 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1046 2; dnl Layout code
1047 109; dnl Nominal case size
1048 0; dnl Not compressed
1049 0; dnl Not weighted 
1050 1; dnl No cases.
1051 100.0; dnl Bias.
1052 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
1053 i8 0 *3;
1054
1055 dnl 256-byte string.
1056 2; 255; 0; 0; 0x01FF00 *2; "S"; i8 201; s6 "Q256";
1057 (2; -1; 0; 0; 0; 0; s8 "") * 31;
1058 2; 4; 0; 0; 0x010400 *2; "S"; i8 201; "Q256_1";
1059
1060 dnl 600-byte string.
1061 2; 255; 0; 0; 0x01FF00 *2; s8 "STR600";
1062 (2; -1; 0; 0; 0; 0; s8 "") * 31;
1063 2; 255; 0; 0; 0x01FF00 *2; s8 "STR600_1";
1064 (2; -1; 0; 0; 0; 0; s8 "") * 31;
1065 2; 96; 0; 0; 0x016000 *2; s8 "STR600_2";
1066 (2; -1; 0; 0; 0; 0; s8 "") * 11;
1067
1068 dnl Machine integer info record.
1069 7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1252;
1070
1071 dnl Very long string record.
1072 7; 14; 1; COUNT (
1073 "S"; i8 201; "Q256=00256"; i8 0; i8 9;
1074 "STR600=00600"; i8 0; i8 9;
1075 );
1076
1077 dnl Character encoding record.
1078 7; 20; 1; 12; "windows-1252";
1079
1080 dnl Dictionary termination record.
1081 999; 0;
1082
1083 dnl Data.
1084 "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#" * 4;
1085 "abcdefgh";
1086 "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#" * 9;
1087 "abcdefghijklmnopqrstuvwxyzABCDEF";
1088 ])
1089 for variant in be le; do
1090   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1091   AT_DATA([sys-file.sps], [dnl
1092 GET FILE='sys-file.sav'.
1093 DISPLAY DICTIONARY.
1094 LIST.
1095 ])
1096   AT_CHECK([pspp -o pspp.csv sys-file.sps])
1097   AT_CHECK([cat pspp.csv], [0], [dnl
1098 Variable,Description,Position
1099 séq256,Format: A256,1
1100 str600,Format: A600,2
1101
1102 Table: Data List
1103 séq256,str600
1104 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@a,abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyz
1105 ])
1106 done
1107 AT_CLEANUP
1108
1109 AT_SETUP([data file and variable attributes])
1110 AT_KEYWORDS([sack synthetic system file positive])
1111 AT_DATA([sys-file.sack], [dnl
1112 dnl File header.
1113 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1114 2; dnl Layout code
1115 3; dnl Nominal case size
1116 0; dnl Not compressed
1117 0; dnl Not weighted 
1118 0; dnl 1 case.
1119 100.0; dnl Bias.
1120 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
1121 i8 0 *3;
1122
1123 dnl Variables.
1124 2; 0; 0; 0; 0x050800 *2; s8 "FIRSTVAR";
1125 2; 0; 0; 0; 0x050800 *2; s8 "SECONDVA";
1126 2; 0; 0; 0; 0x050800 *2; s8 "THIRDVAR";
1127
1128 dnl Machine integer info record.
1129 7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1252;
1130
1131 dnl Long variable names.
1132 7; 13; 1; COUNT (
1133 "FIRSTVAR=FirstVariable"; i8 9;
1134 "SECONDVA=S"; i8 233; "condVariable"; i8 9;
1135 "THIRDVAR=ThirdVariable"; i8 9
1136 );
1137
1138 dnl Data file attributes record.
1139 7; 17; 1; COUNT (
1140 "Attr1('Value1'"; i8 10; "''d"; i8 233; "claration''"; i8 10; ")";
1141 "S"; i8 233; "condAttr('123'"; i8 10; "'456'"; i8 10; ")";
1142 );
1143
1144 dnl Variable attributes record.
1145 7; 18; 1; COUNT (
1146 "FirstVariable:";
1147   "ad"; i8 232; "le('23'"; i8 10; "'34'"; i8 10; ")";
1148   "bert('123'"; i8 10; ")";
1149   "$@Role('1'"; i8 10; ")";
1150 "/S"; i8 233; "condVariable:";
1151   "xyzzy('quux'"; i8 10; ")";
1152 );
1153
1154 dnl Another variable attributes record.
1155 dnl Only system files written by "Stata 14.1/-savespss- 1.77 by S.Radyakin"
1156 dnl include multiple variable attributes records.
1157 7; 18; 1; COUNT ("ThirdVariable:fizz('buzz'"; i8 10; ")";);
1158
1159 dnl Character encoding record.
1160 7; 20; 1; 12; "windows-1252";
1161
1162 dnl Dictionary termination record.
1163 999; 0;
1164 ])
1165 for variant in be le; do
1166   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1167   AT_DATA([sys-file.sps], [dnl
1168 GET FILE='sys-file.sav'.
1169 DISPLAY @ATTRIBUTES.
1170 ])
1171   AT_CHECK([pspp -o pspp.csv sys-file.sps])
1172   AT_CHECK([cat pspp.csv], [0],
1173 [[Variable,Description
1174 FirstVariable,"Attribute,Value
1175 $@Role,1
1176 adèle[1],23
1177 adèle[2],34
1178 bert,123"
1179 SécondVariable,"Attribute,Value
1180 xyzzy,quux"
1181 ThirdVariable,"Attribute,Value
1182 fizz,buzz"
1183
1184 Table: Custom data file attributes.
1185 Attribute,Value
1186 Attr1[1],Value1
1187 Attr1[2],'déclaration'
1188 SécondAttr[1],123
1189 SécondAttr[2],456
1190 ]])
1191   AT_DATA([sys-file.sps], [dnl
1192 GET FILE='sys-file.sav'.
1193 DISPLAY DICTIONARY.
1194 ])
1195   AT_CHECK([pspp -o pspp.csv sys-file.sps])
1196   AT_CHECK([cat pspp.csv], [0],
1197 [[Variable,Description,Position
1198 FirstVariable,"Format: F8.0
1199 Role: Output
1200
1201 Attribute,Value
1202 adèle[1],23
1203 adèle[2],34
1204 bert,123",1
1205 SécondVariable,"Format: F8.0
1206 Role: Input
1207
1208 Attribute,Value
1209 xyzzy,quux",2
1210 ThirdVariable,"Format: F8.0
1211 Role: Input
1212
1213 Attribute,Value
1214 fizz,buzz",3
1215
1216 Table: Custom data file attributes.
1217 Attribute,Value
1218 Attr1[1],Value1
1219 Attr1[2],'déclaration'
1220 SécondAttr[1],123
1221 SécondAttr[2],456
1222 ]])
1223 done
1224 AT_CLEANUP
1225
1226 AT_SETUP([variable roles])
1227 AT_KEYWORDS([sack synthetic system file positive])
1228 AT_DATA([sys-file.sack], [dnl
1229 dnl File header.
1230 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1231 2; dnl Layout code
1232 7; dnl Nominal case size
1233 0; dnl Not compressed
1234 0; dnl Not weighted
1235 0; dnl 1 case.
1236 100.0; dnl Bias.
1237 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
1238 i8 0 *3;
1239
1240 dnl Variables.
1241 2; 0; 0; 0; 0x050800 *2; s8 "I";
1242 2; 0; 0; 0; 0x050800 *2; s8 "O";
1243 2; 0; 0; 0; 0x050800 *2; s8 "B";
1244 2; 0; 0; 0; 0x050800 *2; s8 "N";
1245 2; 0; 0; 0; 0x050800 *2; s8 "P";
1246 2; 0; 0; 0; 0x050800 *2; s8 "S";
1247 2; 0; 0; 0; 0x050800 *2; s8 "X";
1248
1249 dnl Machine integer info record.
1250 7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1252;
1251
1252 dnl Variable attributes record.
1253 7; 18; 1; COUNT (
1254 "I:$@Role('0'"; i8 10; ")";
1255 "/O:$@Role('1'"; i8 10; ")";
1256 "/B:$@Role('2'"; i8 10; ")";
1257 "/N:$@Role('3'"; i8 10; ")";
1258 "/P:$@Role('4'"; i8 10; ")";
1259 "/S:$@Role('5'"; i8 10; ")";
1260 "/X:$@Role('6'"; i8 10; ")";
1261 );
1262
1263 dnl Character encoding record.
1264 7; 20; 1; 12; "windows-1252";
1265
1266 dnl Dictionary termination record.
1267 999; 0;
1268 ])
1269 for variant in be le; do
1270   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1271   AT_DATA([sys-file.sps], [dnl
1272 GET FILE='sys-file.sav'.
1273 DISPLAY DICTIONARY.
1274 ])
1275   AT_CHECK([pspp -o pspp.csv sys-file.sps], [0], [dnl
1276 warning: `sys-file.sav': Invalid role for variable x.
1277 ])
1278   AT_CHECK([cat pspp.csv], [0], [dnl
1279 warning: `sys-file.sav': Invalid role for variable x.
1280
1281 Variable,Description,Position
1282 i,"Format: F8.0
1283 Role: Input",1
1284 o,"Format: F8.0
1285 Role: Output",2
1286 b,"Format: F8.0
1287 Role: Both",3
1288 n,"Format: F8.0
1289 Role: None",4
1290 p,"Format: F8.0
1291 Role: Partition",5
1292 s,"Format: F8.0
1293 Role: Split",6
1294 x,"Format: F8.0
1295 Role: Input",7
1296 ])
1297 done
1298 AT_CLEANUP
1299
1300 AT_SETUP([compressed data])
1301 AT_KEYWORDS([sack synthetic system file positive])
1302 AT_DATA([sys-file.sack], [dnl
1303 dnl File header.
1304 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1305 2; dnl Layout code
1306 6; dnl Nominal case size
1307 1; dnl Simple compression
1308 0; dnl Not weighted 
1309 -1; dnl Unspecified number of cases.
1310 100.0; dnl Bias.
1311 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
1312 i8 0 *3;
1313
1314 dnl Numeric variables.
1315 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1316 2; 0; 0; 0; 0x050800 *2; s8 "NUM2";
1317
1318 dnl String variable.
1319 2; 4; 0; 0; 0x010400 *2; s8 "STR4";
1320 2; 8; 0; 0; 0x010800 *2; s8 "STR8";
1321 2; 15; 0; 0; 0x010f00 *2; s8 "STR15";
1322 2; -1; 0; 0; 0; 0; s8 "";
1323
1324 dnl Character encoding record.
1325 7; 20; 1; 12; "windows-1252";
1326
1327 dnl Dictionary termination record.
1328 999; 0;
1329
1330 dnl Compressed data.
1331 i8 1 100 254 253 254 253; i8 255 251; "abcdefgh"; s8 "0123";
1332 i8 253 253 253 254; i8 101 102 253 253; s8 "jklm"; s8 "nopqrstu";
1333 s8 "vwxyzABC"; s8 "DEFG"; s8 "HIJKLMNO";
1334 i8 254 253 252 0 0 0 0 0; s8 "PQRSTUVW";
1335
1336 ])
1337 for variant in be le; do
1338   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1339   AT_DATA([sys-file.sps], [dnl
1340 GET FILE='sys-file.sav'.
1341 DISPLAY DICTIONARY.
1342 LIST.
1343 ])
1344   AT_CHECK([pspp -o pspp.csv sys-file.sps])
1345   AT_CHECK([cat pspp.csv], [0], [dnl
1346 Variable,Description,Position
1347 num1,Format: F8.0,1
1348 num2,Format: F8.0,2
1349 str4,Format: A4,3
1350 str8,Format: A8,4
1351 str15,Format: A15,5
1352
1353 Table: Data List
1354 num1,num2,str4,str8,str15
1355 -99,0,,abcdefgh,0123   @&t@
1356 .,151,jklm,nopqrstu,vwxyzABC       @&t@
1357 1,2,DEFG,HIJKLMNO,PQRSTUV
1358 ])
1359 done
1360 AT_CLEANUP
1361
1362 AT_SETUP([compressed data, zero bias])
1363 AT_KEYWORDS([sack synthetic system file positive])
1364 AT_DATA([sys-file.sack], [dnl
1365 dnl File header.
1366 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1367 2; dnl Layout code
1368 6; dnl Nominal case size
1369 1; dnl Simple compression.
1370 0; dnl Not weighted 
1371 -1; dnl Unspecified number of cases.
1372 0.0; dnl Bias.
1373 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
1374 i8 0 *3;
1375
1376 dnl Numeric variables.
1377 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1378 2; 0; 0; 0; 0x050800 *2; s8 "NUM2";
1379
1380 dnl String variable.
1381 2; 4; 0; 0; 0x010400 *2; s8 "STR4";
1382 2; 8; 0; 0; 0x010800 *2; s8 "STR8";
1383 2; 15; 0; 0; 0x010f00 *2; s8 "STR15";
1384 2; -1; 0; 0; 0; 0; s8 "";
1385
1386 dnl Character encoding record.
1387 7; 20; 1; 12; "windows-1252";
1388
1389 dnl Dictionary termination record.
1390 999; 0;
1391
1392 dnl Compressed data.
1393 i8 1 100 254 253 254 253; i8 255 251; "abcdefgh"; s8 "0123";
1394 i8 253 253 253 254; i8 101 102 253 253; s8 "jklm"; s8 "nopqrstu";
1395 s8 "vwxyzABC"; s8 "DEFG"; s8 "HIJKLMNO";
1396 i8 254 253 252 0 0 0 0 0; s8 "PQRSTUVW";
1397
1398 ])
1399 for variant in be le; do
1400   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1401   AT_DATA([sys-file.sps], [dnl
1402 GET FILE='sys-file.sav'.
1403 DISPLAY DICTIONARY.
1404 LIST.
1405 ])
1406   AT_CHECK([pspp -o pspp.csv sys-file.sps], [0])
1407   AT_CHECK([cat pspp.csv], [0], [dnl
1408 Variable,Description,Position
1409 num1,Format: F8.0,1
1410 num2,Format: F8.0,2
1411 str4,Format: A4,3
1412 str8,Format: A8,4
1413 str15,Format: A15,5
1414
1415 Table: Data List
1416 num1,num2,str4,str8,str15
1417 1,100,,abcdefgh,0123   @&t@
1418 .,251,jklm,nopqrstu,vwxyzABC       @&t@
1419 101,102,DEFG,HIJKLMNO,PQRSTUV
1420 ])
1421 done
1422 AT_CLEANUP
1423
1424 AT_SETUP([compressed data, other bias])
1425 AT_KEYWORDS([sack synthetic system file positive])
1426 AT_DATA([sys-file.sack], [dnl
1427 dnl File header.
1428 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1429 2; dnl Layout code
1430 6; dnl Nominal case size
1431 1; dnl Simple compression.
1432 0; dnl Not weighted 
1433 -1; dnl Unspecified number of cases.
1434 50.0; dnl Bias.
1435 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
1436 i8 0 *3;
1437
1438 dnl Numeric variables.
1439 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1440 2; 0; 0; 0; 0x050800 *2; s8 "NUM2";
1441
1442 dnl String variable.
1443 2; 4; 0; 0; 0x010400 *2; s8 "STR4";
1444 2; 8; 0; 0; 0x010800 *2; s8 "STR8";
1445 2; 15; 0; 0; 0x010f00 *2; s8 "STR15";
1446 2; -1; 0; 0; 0; 0; s8 "";
1447
1448 dnl Character encoding record.
1449 7; 20; 1; 12; "windows-1252";
1450
1451 dnl Dictionary termination record.
1452 999; 0;
1453
1454 dnl Compressed data.
1455 i8 1 100 254 253 254 253; i8 255 251; "abcdefgh"; s8 "0123";
1456 i8 253 253 253 254; i8 101 102 253 253; s8 "jklm"; s8 "nopqrstu";
1457 s8 "vwxyzABC"; s8 "DEFG"; s8 "HIJKLMNO";
1458 i8 254 253 252 0 0 0 0 0; s8 "PQRSTUVW";
1459
1460 ])
1461 for variant in be le; do
1462   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1463   AT_DATA([sys-file.sps], [dnl
1464 GET FILE='sys-file.sav'.
1465 DISPLAY DICTIONARY.
1466 LIST.
1467 ])
1468   AT_CHECK([pspp -o pspp.csv sys-file.sps], [0], 
1469     [warning: `sys-file.sav' near offset 0x54: Compression bias is not the usual value of 100, or system file uses unrecognized floating-point format.
1470 ])
1471   AT_CHECK([cat pspp.csv], [0], [dnl
1472 "warning: `sys-file.sav' near offset 0x54: Compression bias is not the usual value of 100, or system file uses unrecognized floating-point format."
1473
1474 Variable,Description,Position
1475 num1,Format: F8.0,1
1476 num2,Format: F8.0,2
1477 str4,Format: A4,3
1478 str8,Format: A8,4
1479 str15,Format: A15,5
1480
1481 Table: Data List
1482 num1,num2,str4,str8,str15
1483 -49,50,,abcdefgh,0123   @&t@
1484 .,201,jklm,nopqrstu,vwxyzABC       @&t@
1485 51,52,DEFG,HIJKLMNO,PQRSTUV
1486 ])
1487 done
1488 AT_CLEANUP
1489
1490 m4_divert_push([PREPARE_TESTS])
1491 zcompressed_sack () {
1492     cat <<'EOF'
1493 dnl File header.
1494 "$FL3"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1495 2; dnl Layout code
1496 6; dnl Nominal case size
1497 2; dnl zlib compressed
1498 0; dnl Not weighted
1499 -1; dnl Unspecified number of cases.
1500 100.0; dnl Bias.
1501 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
1502 i8 0 *3;
1503
1504 dnl Numeric variables.
1505 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1506 2; 0; 0; 0; 0x050800 *2; s8 "NUM2";
1507
1508 dnl String variable.
1509 2; 4; 0; 0; 0x010400 *2; s8 "STR4";
1510 2; 8; 0; 0; 0x010800 *2; s8 "STR8";
1511 2; 15; 0; 0; 0x010f00 *2; s8 "STR15";
1512 2; -1; 0; 0; 0; 0; s8 "";
1513
1514 dnl Character encoding record.
1515 7; 20; 1; 12; "windows-1252";
1516
1517 dnl Dictionary termination record.
1518 999; 0;
1519
1520 dnl ZLIB data header.
1521 i64 0x194;    # zheader_ofs
1522 i64 0x205;    # ztrailer_ofs
1523 i64 48;       # ztrailer_len
1524
1525 dnl ZLIB data block.
1526 dnl
1527 dnl This is the compressed form of:
1528 dnl
1529 dnl 01 64 fe fd fe fd ff fb  61 62 63 64 65 66 67 68  |.d......abcdefgh|
1530 dnl 30 31 32 33 20 20 20 20  fd fd fd fe 65 66 fd fd  |0123    ....ef..|
1531 dnl 6a 6b 6c 6d 20 20 20 20  6e 6f 70 71 72 73 74 75  |jklm    nopqrstu|
1532 dnl 76 77 78 79 7a 41 42 43  44 45 46 47 20 20 20 20  |vwxyzABCDEFG    |
1533 dnl 48 49 4a 4b 4c 4d 4e 4f  fe fd fc 00 00 00 00 00  |HIJKLMNO........|
1534 dnl 50 51 52 53 54 55 56 57                           |PQRSTUVW|
1535 dnl
1536 dnl which is the data from the "compressed data" test.
1537 hex "78 01 63 4c f9 f7 f7 df  df ff bf 13 93 92 53 52";
1538 hex "d3 d2 33 0c 0c 8d 8c 15  80 e0 ef df bf ff 52 d3";
1539 hex "fe fe cd ca ce c9 05 f1  f3 f2 0b 0a 8b 8a 4b 4a";
1540 hex "cb ca 2b 2a ab 1c 9d 9c  5d 5c dd dc 41 e2 1e 9e";
1541 hex "5e de 3e be 7e fe ff fe  fe 61 00 81 80 c0 a0 e0";
1542 hex "90 d0 b0 70 00 0f 3f 23  d7";
1543
1544 dnl ZLIB data trailer fixed header:
1545 i64 -100;     # ztrailer_bias
1546 i64 0;        # ztrailer_zero
1547 0x3ff000;     # block_size
1548 1;            # n_blocks
1549
1550 dnl ZLIB block descriptor:
1551 i64 0x194;    # uncompressed_ofs
1552 i64 0x1ac;    # compressed_ofs
1553 88;           # uncompressed_size
1554 89;           # compressed_size
1555 EOF
1556 }
1557 m4_divert_pop([PREPARE_TESTS])
1558
1559 AT_SETUP([zcompressed data])
1560 AT_KEYWORDS([sack synthetic system file positive zlib])
1561 zcompressed_sack > sys-file.sack
1562 for variant in be le; do
1563   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1564   AT_DATA([sys-file.sps], [dnl
1565 GET FILE='sys-file.sav'.
1566 DISPLAY DICTIONARY.
1567 LIST.
1568 ])
1569   AT_CHECK([pspp -o pspp.csv sys-file.sps])
1570   AT_CHECK([cat pspp.csv], [0], [dnl
1571 Variable,Description,Position
1572 num1,Format: F8.0,1
1573 num2,Format: F8.0,2
1574 str4,Format: A4,3
1575 str8,Format: A8,4
1576 str15,Format: A15,5
1577
1578 Table: Data List
1579 num1,num2,str4,str8,str15
1580 -99,0,,abcdefgh,0123   @&t@
1581 .,151,jklm,nopqrstu,vwxyzABC       @&t@
1582 1,2,DEFG,HIJKLMNO,PQRSTUV
1583 ])
1584 done
1585 AT_CLEANUP
1586 \f
1587 AT_BANNER([system file reader - negative])
1588
1589 AT_SETUP([no variables])
1590 AT_KEYWORDS([sack synthetic system file negative])
1591 AT_DATA([sys-file.sack], [dnl
1592 dnl File header.
1593 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1594 2; dnl Layout code
1595 0; dnl Nominal case size (empty)
1596 0; dnl Not compressed
1597 0; dnl Not weighted
1598 0; dnl 0 cases.
1599 100.0; dnl Bias.
1600 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
1601 i8 0 *3;
1602
1603 dnl Character encoding record.
1604 7; 20; 1; 12; "windows-1252";
1605
1606 dnl Dictionary termination record.
1607 999; 0;
1608 ])
1609 for variant in be le; do
1610   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1611   AT_DATA([sys-file.sps], [dnl
1612 GET FILE='sys-file.sav'.
1613 ])
1614   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
1615 sys-file.sps:1: error: GET: `sys-file.sav': Data file dictionary has no variables.
1616 ])
1617
1618   dnl At one point pspp-convert would hang forever if there were no variables,
1619   dnl so check against regression.
1620   AT_CHECK([pspp-convert sys-file.sav sys-file.txt])
1621   AT_CHECK([cat sys-file.txt], [0], [
1622 ])
1623 done
1624 AT_CLEANUP
1625
1626 AT_SETUP([unspecified character encoding])
1627 AT_KEYWORDS([sack synthetic system file positive])
1628 AT_DATA([sys-file.sack], [dnl
1629 dnl File header.
1630 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1631 2; dnl Layout code
1632 4; dnl Nominal case size
1633 0; dnl Not compressed
1634 0; dnl Not weighted
1635 0; dnl No cases.
1636 100.0; dnl Bias.
1637 "01 Jan 11"; "20:53:52";
1638 "PSPP synthetic test file: "; i8 244; i8 245; i8 246; i8 248; s34 "";
1639 i8 0 *3;
1640
1641 dnl Numeric variables.
1642 2; 0; 0; 0; 0x050800 *2; s8 "A";
1643 2; 0; 0; 0; 0x050800 *2; s8 "B";
1644 2; 0; 0; 0; 0x050800 *2; s8 "C";
1645 2; 0; 0; 0; 0x050800 *2; s8 "D";
1646
1647 dnl Dictionary termination record.
1648 999; 0;
1649 ])
1650 for variant in be le; do
1651   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1652   AT_DATA([sys-file.sps], [dnl
1653 GET 'sys-file.sav'.
1654 ])
1655   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [stdout])
1656   AT_CHECK([sed 's/default encoding.*For/default encoding.  For/' stdout], [0], [dnl
1657 "warning: `sys-file.sav': This system file does not indicate its own character encoding.  Using default encoding.  For best results, specify an encoding explicitly.  Use SYSFILE INFO with ENCODING=""DETECT"" to analyze the possible encodings."
1658 ])
1659 done
1660 AT_CLEANUP
1661
1662 AT_SETUP([misplaced type 4 record])
1663 AT_KEYWORDS([sack synthetic system file negative])
1664 AT_DATA([sys-file.sack], [dnl
1665 dnl File header.
1666 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1667 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1668
1669 dnl Numeric variable.
1670 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1671
1672 dnl Type 4 record.
1673 >>4<<;
1674 ])
1675 for variant in be le; do
1676   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1677   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1678 ])
1679   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
1680    [error: `sys-file.sav' near offset 0xd4: Misplaced type 4 record.
1681 ])
1682 done
1683 AT_CLEANUP
1684
1685 AT_SETUP([bad record type])
1686 AT_KEYWORDS([sack synthetic system file negative])
1687 AT_DATA([sys-file.sack], [dnl
1688 dnl File header.
1689 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1690 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1691
1692 dnl Numeric variable.
1693 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1694
1695 dnl Type 8 record (not a valid type).
1696 >>8<<;
1697 ])
1698 for variant in be le; do
1699   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1700   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1701 ])
1702   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
1703    [error: `sys-file.sav' near offset 0xd4: Unrecognized record type 8.
1704 ])
1705 done
1706 AT_CLEANUP
1707
1708 AT_SETUP([wrong number of variable positions])
1709 AT_KEYWORDS([sack synthetic system file negative])
1710 AT_DATA([sys-file.sack], [dnl
1711 dnl File header.
1712 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1713 2; >>2<<; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1714
1715 dnl Numeric variable.
1716 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1717
1718 dnl Character encoding record.
1719 7; 20; 1; 12; "windows-1252";
1720
1721 dnl End of dictionary.
1722 999; 0;
1723 ])
1724 for variant in be le; do
1725   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1726   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1727 ])
1728   AT_CHECK([pspp -O format=csv sys-file.sps], [0], 
1729    [warning: `sys-file.sav': File header claims 2 variable positions but 1 were read from file.
1730 ])
1731 done
1732 AT_CLEANUP
1733
1734 AT_SETUP([variable name may not begin with `#'])
1735 AT_KEYWORDS([sack synthetic system file negative])
1736 AT_DATA([sys-file.sack], [dnl
1737 dnl File header.
1738 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1739 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1740
1741 dnl Numeric variable.
1742 2; 0; 0; 0; 0x050800 *2; s8 >>"$UM1"<<;
1743
1744 dnl Character encoding record.
1745 7; 20; 1; 12; "windows-1252";
1746
1747 dnl End of dictionary.
1748 999; 0;
1749 ])
1750 for variant in be le; do
1751   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1752   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1753 ])
1754   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
1755    [error: `sys-file.sav' near offset 0xb4: Invalid variable name `$UM1'.
1756 ])
1757 done
1758 AT_CLEANUP
1759
1760 AT_SETUP([variable name may not be reserved word])
1761 AT_KEYWORDS([sack synthetic system file negative])
1762 AT_DATA([sys-file.sack], [dnl
1763 dnl File header.
1764 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1765 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1766
1767 dnl Numeric variable.
1768 2; 0; 0; 0; 0x050800 *2; s8 >>"TO"<<;
1769
1770 dnl Character encoding record.
1771 7; 20; 1; 12; "windows-1252";
1772
1773 dnl End of dictionary.
1774 999; 0;
1775 ])
1776 for variant in be le; do
1777   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1778   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1779 ])
1780   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
1781    [error: `sys-file.sav' near offset 0xb4: Invalid variable name `TO'.
1782 ])
1783 done
1784 AT_CLEANUP
1785
1786 AT_SETUP([variable width must be between 0 and 255])
1787 AT_KEYWORDS([sack synthetic system file negative])
1788 AT_DATA([sys-file.sack], [dnl
1789 dnl File header.
1790 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1791 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1792
1793 dnl String variable with invalid width 256.
1794 2; 256; 0; 0; 0x050800 *2; s8 "VAR1";
1795
1796 dnl Character encoding record.
1797 7; 20; 1; 12; "windows-1252";
1798
1799 dnl End of dictionary.
1800 999; 0;
1801 ])
1802 for variant in be le; do
1803   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1804   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1805 ])
1806   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
1807    [error: `sys-file.sav' near offset 0xb4: Bad width 256 for variable VAR1.
1808 ])
1809 done
1810 AT_CLEANUP
1811
1812 dnl SPSS-generated system file can contain duplicate variable names
1813 dnl (see bug #41475).
1814 AT_SETUP([duplicate variable name])
1815 AT_KEYWORDS([sack synthetic system file negative])
1816 AT_DATA([sys-file.sack], [dnl
1817 dnl File header.
1818 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1819 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1820
1821 dnl Numeric variables.
1822 2; 0; 0; 0; 0x050800 *2; s8 "VAR1";
1823 2; 0; 0; 0; 0x050800 *2; s8 "VAR1";
1824
1825 dnl Character encoding record.
1826 7; 20; 1; 12; "windows-1252";
1827
1828 dnl End of dictionary.
1829 999; 0;
1830 ])
1831 for variant in be le; do
1832   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1833   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1834 DISPLAY DICTIONARY.
1835 ])
1836   AT_CHECK([pspp -O format=csv sys-file.sps], [0],
1837    [warning: `sys-file.sav' near offset 0xd4: Renaming variable with duplicate name `VAR1' to `VAR001'.
1838
1839 Variable,Description,Position
1840 var1,Format: F8.0,1
1841 var001,Format: F8.0,2
1842 ])
1843 done
1844 AT_CLEANUP
1845
1846 AT_SETUP([variable label indicator not 0 or 1])
1847 AT_KEYWORDS([sack synthetic system file negative])
1848 AT_DATA([sys-file.sack], [dnl
1849 dnl File header.
1850 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1851 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1852
1853 dnl Numeric variable.
1854 2; 0; >>2<<; 0; 0x050800 *2; s8 "VAR1";
1855
1856 dnl Character encoding record.
1857 7; 20; 1; 12; "windows-1252";
1858
1859 dnl End of dictionary.
1860 999; 0;
1861 ])
1862 for variant in be le; do
1863   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1864   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1865 ])
1866   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
1867    [error: `sys-file.sav' near offset 0xb4: Variable label indicator field is not 0 or 1.
1868 ])
1869 done
1870 AT_CLEANUP
1871
1872 AT_SETUP([invalid numeric missing value indicator])
1873 AT_KEYWORDS([sack synthetic system file negative])
1874 AT_DATA([sys-file.sack], [dnl
1875 dnl File header.
1876 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1877 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1878
1879 dnl Numeric variable.
1880 2; 0; 0; >>-1<<; 0x050800 *2; s8 "VAR1";
1881
1882 dnl Character encoding record.
1883 7; 20; 1; 12; "windows-1252";
1884
1885 dnl End of dictionary.
1886 999; 0;
1887 ])
1888 for variant in be le; do
1889   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1890   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1891 ])
1892   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
1893    ["error: `sys-file.sav' near offset 0xb4: Numeric missing value indicator field is not -3, -2, 0, 1, 2, or 3."
1894 ])
1895 done
1896 AT_CLEANUP
1897
1898 AT_SETUP([invalid string missing value indicator])
1899 AT_KEYWORDS([sack synthetic system file negative])
1900 AT_DATA([sys-file.sack], [dnl
1901 dnl File header.
1902 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1903 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1904
1905 dnl String variable.
1906 2; 8; 0; >>4<<; 0x010800 *2; s8 "VAR1";
1907
1908 dnl Character encoding record.
1909 7; 20; 1; 12; "windows-1252";
1910
1911 dnl End of dictionary.
1912 999; 0;
1913 ])
1914 for variant in be le; do
1915   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1916   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1917 ])
1918   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
1919    ["error: `sys-file.sav' near offset 0xb4: String missing value indicator field is not 0, 1, 2, or 3."
1920 ])
1921 done
1922 AT_CLEANUP
1923
1924 AT_SETUP([missing string continuation record])
1925 AT_KEYWORDS([sack synthetic system file negative])
1926 AT_DATA([sys-file.sack], [dnl
1927 dnl File header.
1928 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1929 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1930
1931 dnl String variable.
1932 2; 10; 0; 0; 0x010a00 *2; s8 "VAR1";
1933 >>2; 0; 0; 0; 0x050800 *2; s8 "VAR2";<<
1934
1935 dnl Character encoding record.
1936 7; 20; 1; 12; "windows-1252";
1937
1938 dnl End of dictionary.
1939 999; 0;
1940 ])
1941 for variant in be le; do
1942   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1943   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1944 ])
1945   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
1946    [error: `sys-file.sav' near offset 0xb4: Missing string continuation record.
1947 ])
1948 done
1949 AT_CLEANUP
1950
1951 AT_SETUP([invalid variable format])
1952 AT_KEYWORDS([sack synthetic system file negative])
1953 AT_DATA([sys-file.sack], [dnl
1954 dnl File header.
1955 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1956 2; 4; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1957
1958 dnl Numeric variable, invalid format types.
1959 dnl No warning is issued for type 0 because it has been observed in real
1960 dnl system files.
1961 2; 0; 0; 0; >>0xff0800; 0<<; s8 "NUM1";
1962
1963 dnl Numeric variable, string formats.
1964 2; 0; 0; 0; >>0x010800<<; >>0x021000<<; s8 "VAR1";
1965
1966 dnl String variable, numeric formats.
1967 2; 4; 0; 0; >>0x050800<<; >>0x110a01<<; s8 "STR1";
1968
1969 dnl String variable, wrong width formats.
1970 2; 4; 0; 0; >>0x010800<<; >>0x020400<<; s8 "STR2";
1971
1972 dnl Character encoding record.
1973 7; 20; 1; 12; "windows-1252";
1974
1975 dnl End of dictionary.
1976 999; 0;
1977 ])
1978 for variant in be le; do
1979   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1980   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1981 ])
1982   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
1983 warning: `sys-file.sav' near offset 0xc0: Variable NUM1 with width 0 has invalid print format 0xff0800.
1984
1985 warning: `sys-file.sav' near offset 0xe0: Variable VAR1 with width 0 has invalid print format 0x10800.
1986
1987 warning: `sys-file.sav' near offset 0xe4: Variable VAR1 with width 0 has invalid write format 0x21000.
1988
1989 warning: `sys-file.sav' near offset 0x100: Variable STR1 with width 4 has invalid print format 0x50800.
1990
1991 warning: `sys-file.sav' near offset 0x104: Variable STR1 with width 4 has invalid write format 0x110a01.
1992
1993 warning: `sys-file.sav' near offset 0x120: Variable STR2 with width 4 has invalid print format 0x10800.
1994
1995 warning: `sys-file.sav' near offset 0x124: Variable STR2 with width 4 has invalid write format 0x20400.
1996 ])
1997 done
1998 AT_CLEANUP
1999
2000 AT_SETUP([invalid long string missing values])
2001 AT_KEYWORDS([sack synthetic system file negative])
2002 AT_DATA([sys-file.sack], [dnl
2003 dnl File header.
2004 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2005 2; dnl Layout code
2006 7; dnl Nominal case size
2007 0; dnl Not compressed
2008 0; dnl Not weighted
2009 1; dnl 1 case.
2010 100.0; dnl Bias.
2011 "01 Jan 11"; "20:53:52";
2012 "PSPP synthetic test file: "; i8 244; i8 245; i8 246; i8 248; s34 "";
2013 i8 0 *3;
2014
2015 dnl One numeric variable.
2016 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2017
2018 dnl Long string variables that will have missing values added with a
2019 dnl later record.
2020 2; 9; 0; 0; 0x010900 *2; s8 "STR1";
2021 2; -1; 0; 0; 0; 0; s8 "";
2022 2; 10; 0; 0; 0x010a00 *2; s8 "STR2";
2023 2; -1; 0; 0; 0; 0; s8 "";
2024 2; 11; 0; 0; 0x010b00 *2; s8 "STR3";
2025 2; -1; 0; 0; 0; 0; s8 "";
2026
2027 dnl Machine integer info record.
2028 7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1252;
2029
2030 dnl Machine floating-point info record.
2031 7; 4; 8; 3; SYSMIS; HIGHEST; LOWEST;
2032
2033 dnl Long string variable missing values record.
2034 7; 22; 1; COUNT (
2035 dnl Zero missing values (not allowed) for STR1 .
2036 COUNT("STR1"); i8 >>0<<;
2037
2038 dnl Four missing values (not allowed) for STR2.
2039 COUNT("STR2"); i8 4;
2040 8; "abcdefgh"; 8; "ijklmnop"; 8; "qrstuvwx"; 8; "yz012345";
2041
2042 dnl Missing values for unknown variable
2043 COUNT(>>"Nonexistent"<<); i8 1; 8; "abcdefgh";
2044
2045 dnl Missing values for numeric variable
2046 COUNT(>>"NUM1"<<); i8 1; 8; "abcdefgh";
2047
2048 dnl Too long missing value
2049 COUNT("STR3"); i8 1; >>COUNT("abcdefghijkl")<<;
2050 );
2051
2052 dnl Character encoding record.
2053 7; 20; 1; 12; "windows-1252";
2054
2055 dnl Dictionary termination record.
2056 999; 0;
2057 s8 "abcd"; s8 "efgh"; s8 "ijkl"; s8 "mnop"; s8 "qrst"; s8 "uvwx";
2058 s16 "yzABCDEFGHI"; s16 "JKLMNOPQR"; s16 "STUVWXYZ01";
2059 s16 "23456789abc"; s32 "defghijklmnopqstuvwxyzABC";
2060 ])
2061
2062 for variant in be le; do
2063   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2064   AT_DATA([sys-file.sps], [dnl
2065 GET FILE='sys-file.sav'.
2066 DISPLAY DICTIONARY.
2067 ])
2068   AT_CHECK([pspp -O format=csv sys-file.sps], [0],
2069    ["warning: `sys-file.sav' near offset 0x1f8: Long string missing values record says variable STR1 has 0 missing values, but only 1 to 3 missing values are allowed."
2070
2071 "warning: `sys-file.sav' near offset 0x201: Long string missing values record says variable STR2 has 4 missing values, but only 1 to 3 missing values are allowed."
2072
2073 warning: `sys-file.sav' near offset 0x242: Ignoring long string missing value record for unknown variable Nonexistent.
2074
2075 warning: `sys-file.sav' near offset 0x257: Ignoring long string missing value record for numeric variable NUM1.
2076
2077 "warning: `sys-file.sav' near offset 0x270: Ignoring long string missing value 0 for variable str3, with width 11, that has bad value width 12."
2078
2079 Variable,Description,Position
2080 num1,Format: F8.0,1
2081 str1,Format: A9,2
2082 str2,"Format: A10
2083 Missing Values: ""abcdefgh""; ""ijklmnop""; ""qrstuvwx""",3
2084 str3,Format: A11,4
2085 ])
2086 done
2087 AT_CLEANUP
2088
2089 AT_SETUP([weighting variable must be numeric])
2090 AT_KEYWORDS([sack synthetic system file negative])
2091 AT_DATA([sys-file.sack], [dnl
2092 dnl File header.
2093 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2094 2; 2; 1; >>2<<; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2095
2096 dnl Numeric variable.
2097 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2098
2099 dnl String variable.
2100 2; 4; 0; 0; 0x010400 *2; s8 "STR1";
2101
2102 dnl Character encoding record.
2103 7; 20; 1; 12; "windows-1252";
2104
2105 dnl End of dictionary.
2106 999; 0;
2107 ])
2108 for variant in be le; do
2109   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2110   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2111 DISPLAY DICTIONARY.
2112 ])
2113   AT_CHECK([pspp -O format=csv sys-file.sps], [0],
2114    [warning: `sys-file.sav': Ignoring string variable `STR1' set as weighting variable.
2115
2116 Variable,Description,Position
2117 num1,Format: F8.0,1
2118 str1,Format: A4,2
2119 ])
2120 done
2121 AT_CLEANUP
2122
2123 AT_SETUP([bad weighting variable index])
2124 AT_KEYWORDS([sack synthetic system file negative])
2125 AT_DATA([sys-file.sack], [dnl
2126 dnl File header.
2127 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2128 2; 2; 1; >>3<<; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2129
2130 dnl Numeric variable.
2131 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2132
2133 dnl String variable.
2134 2; 4; 0; 0; 0x010400 *2; s8 "STR1";
2135
2136 dnl Character encoding record.
2137 7; 20; 1; 12; "windows-1252";
2138
2139 dnl End of dictionary.
2140 999; 0;
2141 ])
2142 for variant in be le; do
2143   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2144   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2145 ])
2146   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
2147    [error: `sys-file.sav' near offset 0x4c: Variable index 3 not in valid range 1...2.
2148 ])
2149 done
2150 AT_CLEANUP
2151
2152 AT_SETUP([variable index is long string contination])
2153 AT_KEYWORDS([sack synthetic system file negative])
2154 AT_DATA([sys-file.sack], [dnl
2155 dnl File header.
2156 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2157 2; 3; 1; >>3<<; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2158
2159 dnl Numeric variable.
2160 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2161
2162 dnl Long string variable.
2163 2; 9; 0; 0; 0x010900 *2; s8 "STR1";
2164 (2; -1; 0; 0; 0; 0; s8 "");
2165
2166 dnl Character encoding record.
2167 7; 20; 1; 12; "windows-1252";
2168
2169 dnl End of dictionary.
2170 999; 0;
2171 ])
2172 for variant in be le; do
2173   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2174   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2175 ])
2176   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
2177    [error: `sys-file.sav' near offset 0x4c: Variable index 3 refers to long string continuation.
2178 ])
2179 done
2180 AT_CLEANUP
2181
2182 AT_SETUP([multiple documents records])
2183 AT_KEYWORDS([sack synthetic system file negative])
2184 AT_DATA([sys-file.sack], [dnl
2185 dnl File header.
2186 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2187 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2188
2189 dnl Numeric variable, no label or missing values.
2190 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2191
2192 dnl Two document records.
2193 (6; 1; s80 "One line of documents") >>* 2<<;
2194
2195 dnl Dictionary termination record.
2196 999; 0;
2197
2198 dnl Character encoding record.
2199 7; 20; 1; 12; "windows-1252";
2200
2201 dnl Data.
2202 1.0;
2203 ])
2204 for variant in be le; do
2205   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2206   AT_DATA([sys-file.sps], [dnl
2207 GET FILE='sys-file.sav'.
2208 ])
2209   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
2210 error: `sys-file.sav' near offset 0x12c: Duplicate type 6 (document) record.
2211 ])
2212 done
2213 AT_CLEANUP
2214
2215
2216 AT_SETUP([empty document record])
2217 AT_KEYWORDS([sack synthetic system file negative])
2218 AT_DATA([sys-file.sack], [dnl
2219 dnl File header.
2220 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2221 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2222
2223 dnl Numeric variable, no label or missing values.
2224 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2225
2226 dnl Empty document record.
2227 6; >>0<<;
2228
2229 dnl Dictionary termination record.
2230 999; 0;
2231
2232 dnl Data.
2233 1.0;
2234 ])
2235 for variant in be le; do
2236   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2237   AT_DATA([sys-file.sps], [dnl
2238 GET FILE='sys-file.sav'.
2239 ])
2240   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
2241 error: `sys-file.sav' near offset 0xd4: Number of document lines (0) must be greater than 0 and less than 26843545.
2242 ])
2243 done
2244 AT_CLEANUP
2245
2246 AT_SETUP([extension record too large])
2247 AT_KEYWORDS([sack synthetic system file negative])
2248 AT_DATA([sys-file.sack], [dnl
2249 dnl File header.
2250 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2251 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2252
2253 dnl Numeric variable, no label or missing values.
2254 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2255
2256 dnl Too-large extension record.
2257 7; 3; >>0xfffff000 * 2<<;
2258 ])
2259 for variant in be le; do
2260   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2261   AT_DATA([sys-file.sps], [dnl
2262 GET FILE='sys-file.sav'.
2263 ])
2264   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
2265 error: `sys-file.sav' near offset 0xd8: Record type 7 subtype 3 too large.
2266 ])
2267 done
2268 AT_CLEANUP
2269
2270 AT_SETUP([unknown extension record])
2271 AT_KEYWORDS([sack synthetic system file negative])
2272 AT_DATA([sys-file.sack], [dnl
2273 dnl File header.
2274 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2275 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2276
2277 dnl Numeric variable, no label or missing values.
2278 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2279
2280 dnl Unknown extension record type.
2281 7; 30; 1; 1; i8 0;
2282
2283 dnl Character encoding record.
2284 7; 20; 1; 12; "windows-1252";
2285
2286 dnl End of dictionary.
2287 999; 0;
2288 ])
2289 for variant in be le; do
2290   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2291   AT_DATA([sys-file.sps], [dnl
2292 GET FILE='sys-file.sav'.
2293 ])
2294   AT_CHECK_UNQUOTED([pspp -O format=csv sys-file.sps], [0], [dnl
2295 "warning: \`sys-file.sav' near offset 0xd8: Unrecognized record type 7, subtype 30.  For help, please send this file to ${PACKAGE_BUGREPORT} and mention that you were using ${PACKAGE_STRING}."
2296 ])
2297 done
2298 AT_CLEANUP
2299
2300 AT_SETUP([bad machine integer info size])
2301 AT_KEYWORDS([sack synthetic system file negative])
2302 AT_DATA([sys-file.sack], [dnl
2303 dnl File header.
2304 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2305 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2306
2307 dnl Numeric variable, no label or missing values.
2308 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2309
2310 dnl Machine integer info record.
2311 7; 3; 4; >>9<<; 1; 2; 3; -1; 1; 1; ENDIAN; 1252; >>1234<<;
2312
2313 dnl Character encoding record.
2314 7; 20; 1; 12; "windows-1252";
2315
2316 dnl End of dictionary.
2317 999; 0;
2318 ])
2319 for variant in be le; do
2320   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2321   AT_DATA([sys-file.sps], [dnl
2322 GET FILE='sys-file.sav'.
2323 ])
2324   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2325 "warning: `sys-file.sav' near offset 0xd8: Record type 7, subtype 3 has bad count 9 (expected 8)."
2326 ])
2327 done
2328 AT_CLEANUP
2329
2330 AT_SETUP([bad machine integer info float format])
2331 AT_KEYWORDS([sack synthetic system file negative])
2332 AT_DATA([sys-file.sack], [dnl
2333 dnl File header.
2334 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2335 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2336
2337 dnl Numeric variable, no label or missing values.
2338 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2339
2340 dnl Machine integer info record.
2341 7; 3; 4; 8; 1; 2; 3; -1; >>2<<; 1; ENDIAN; 1252;
2342
2343 dnl Character encoding record.
2344 7; 20; 1; 12; "windows-1252";
2345
2346 dnl End of dictionary.
2347 999; 0;
2348 ])
2349 for variant in be le; do
2350   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2351   AT_DATA([sys-file.sps], [dnl
2352 GET FILE='sys-file.sav'.
2353 ])
2354   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
2355 error: `sys-file.sav' near offset 0xd8: Floating-point representation indicated by system file (2) differs from expected (1).
2356 ])
2357 done
2358 AT_CLEANUP
2359
2360 AT_SETUP([bad machine integer info endianness])
2361 AT_KEYWORDS([sack synthetic system file negative])
2362 AT_DATA([sys-file.sack], [dnl
2363 dnl File header.
2364 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2365 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2366
2367 dnl Numeric variable, no label or missing values.
2368 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2369
2370 dnl Machine integer info record.
2371 7; 3; 4; 8; 1; 2; 3; -1; 1; 1; >>3<<; 1252;
2372
2373 dnl Character encoding record.
2374 7; 20; 1; 12; "windows-1252";
2375
2376 dnl End of dictionary.
2377 999; 0;
2378 ])
2379 for variant in "be 1" "le 2"; do
2380   set $variant
2381   AT_CHECK([sack --$[1] sys-file.sack > sys-file.sav])
2382   AT_DATA([sys-file.sps], [dnl
2383 GET FILE='sys-file.sav'.
2384 DISPLAY DICTIONARY.
2385 ])
2386   AT_CHECK_UNQUOTED([pspp -O format=csv sys-file.sps], [0], [dnl
2387 warning: \`sys-file.sav' near offset 0xd8: Integer format indicated by system file (3) differs from expected ($[2]).
2388
2389 Variable,Description,Position
2390 num1,Format: F8.0,1
2391 ])
2392 done
2393 AT_CLEANUP
2394
2395
2396 AT_SETUP([bad machine floating-point info size])
2397 AT_KEYWORDS([sack synthetic system file negative])
2398 AT_DATA([sys-file.sack], [dnl
2399 dnl File header.
2400 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2401 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2402
2403 dnl Numeric variable, no label or missing values.
2404 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2405
2406 dnl Machine floating-point info record.
2407 7; 4; 8; >>4<<; SYSMIS; HIGHEST; LOWEST; 0.0;
2408
2409 dnl Character encoding record.
2410 7; 20; 1; 12; "windows-1252";
2411
2412 dnl End of dictionary.
2413 999; 0;
2414 ])
2415 for variant in be le; do
2416   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2417   AT_DATA([sys-file.sps], [dnl
2418 GET FILE='sys-file.sav'.
2419 ])
2420   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2421 "warning: `sys-file.sav' near offset 0xd8: Record type 7, subtype 4 has bad count 4 (expected 3)."
2422 ])
2423 done
2424 AT_CLEANUP
2425
2426 AT_SETUP([wrong special floating point values])
2427 AT_KEYWORDS([sack synthetic system file negative])
2428 AT_DATA([sys-file.sack], [dnl
2429 dnl File header.
2430 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2431 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2432
2433 dnl Numeric variable, no label or missing values.
2434 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2435
2436 dnl Machine floating-point info record.
2437 7; 4; 8; 3; >>0.0<<; >>1.0<<; >>2.0<<;
2438
2439 dnl Character encoding record.
2440 7; 20; 1; 12; "windows-1252";
2441
2442 dnl End of dictionary.
2443 999; 0;
2444 ])
2445 for variant in be le; do
2446   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2447   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2448 ])
2449   AT_CHECK([pspp -O format=csv sys-file.sps | sed 's/ [(].*/.../'], [0], [dnl
2450 "warning: `sys-file.sav' near offset 0xd8: File specifies unexpected value 0...
2451
2452 "warning: `sys-file.sav' near offset 0xd8: File specifies unexpected value 1...
2453
2454 "warning: `sys-file.sav' near offset 0xd8: File specifies unexpected value 2...
2455 ])
2456 done
2457 AT_CLEANUP
2458
2459 AT_SETUP([bad mrsets name])
2460 AT_KEYWORDS([sack synthetic system file negative multiple response])
2461 AT_DATA([sys-file.sack], [dnl
2462 dnl File header.
2463 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2464 2; dnl Layout code
2465 16; dnl Nominal case size
2466 0; dnl Not compressed
2467 0; dnl Not weighted
2468 0; dnl No cases.
2469 100.0; dnl Bias.
2470 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
2471 i8 0 *3;
2472
2473 dnl $a
2474 2; 0; 0; 0; 0x050800 *2; i8 0x82; i8 0xa0; s6 "";
2475 2; 0; 0; 0; 0x050800 *2; s8 "B";
2476 2; 0; 0; 0; 0x050800 *2; s8 "C";
2477
2478 dnl $b
2479 2; 0; 0; 0; 0x050800 *2; s8 "D";
2480 2; 0; 0; 0; 0x050800 *2; s8 "E";
2481 2; 0; 0; 0; 0x050800 *2; s8 "F";
2482 2; 0; 0; 0; 0x050800 *2; s8 "G";
2483
2484 dnl $c
2485 2; 4; 0; 0; 0x010400 *2; s8 "H";
2486 2; 4; 0; 0; 0x010400 *2; s8 "I";
2487 2; 4; 0; 0; 0x010400 *2; s8 "J";
2488
2489 dnl $d
2490 2; 0; 0; 0; 0x050800 *2; s8 "K";
2491 2; 0; 0; 0; 0x050800 *2; s8 "L";
2492 2; 0; 0; 0; 0x050800 *2; s8 "M";
2493
2494 dnl $e
2495 2; 6; 0; 0; 0x010600 *2; s8 "N";
2496 2; 6; 0; 0; 0x010600 *2; s8 "O";
2497 2; 6; 0; 0; 0x010600 *2; s8 "P";
2498
2499 dnl Machine integer info record.
2500 7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 932;
2501
2502 7; 7; 1;
2503 COUNT(
2504   "$a=C 10 my mcgroup "; i8 0x82; i8 0xa0; " b c"; i8 10;
2505   "b=D2 55 0  g e f d"; i8 10;
2506   "$c=D4 "; i8 0x82; i8 0xcd; i8 0x82; i8 0xa2; " 10 mdgroup #2 h i j"; i8 10);
2507
2508 7; 19; 1;
2509 COUNT(
2510   "$d=E 1 2 34 13 third mdgroup k l m"; i8 10;
2511   "e=E 11 6 choice 0  n o p"; i8 10);
2512
2513 dnl Character encoding record.
2514 7; 20; 1; 9; "shift_jis";
2515
2516 dnl Dictionary termination record.
2517 999; 0;
2518 ])
2519 for variant in be le; do
2520   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2521   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2522 MRSETS /DISPLAY NAME=ALL.
2523 ])
2524   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2525 warning: `sys-file.sav': Multiple response set name `b' does not begin with `$'.
2526
2527 warning: `sys-file.sav': Multiple response set name `e' does not begin with `$'.
2528
2529 Table: Multiple Response Sets
2530 Name,Variables,Details
2531 $a,"あ
2532 b
2533 c
2534 ","Multiple category set
2535 Label: my mcgroup
2536 "
2537 $c,"h
2538 i
2539 j
2540 ","Multiple dichotomy set
2541 Label: mdgroup #2
2542 Label source: Provided by user
2543 Counted value: `はい'
2544 Category label source: Variable labels
2545 "
2546 $d,"k
2547 l
2548 m
2549 ","Multiple dichotomy set
2550 Label: third mdgroup
2551 Label source: Provided by user
2552 Counted value: 34
2553 Category label source: Value labels of counted value
2554 "
2555 ])
2556 done
2557 AT_CLEANUP
2558
2559 AT_SETUP([missing space after C in mrsets])
2560 AT_KEYWORDS([sack synthetic system file negative multiple response])
2561 AT_DATA([sys-file.sack], [dnl
2562 dnl File header.
2563 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2564 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2565
2566 dnl Numeric variable, no label or missing values.
2567 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2568
2569 dnl Multiple response sets.
2570 7; 7; 1; COUNT("$a=Cx");
2571
2572 dnl Character encoding record.
2573 7; 20; 1; 12; "windows-1252";
2574
2575 999; 0;
2576 ])
2577 for variant in be le; do
2578   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2579   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2580 ])
2581   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2582 warning: `sys-file.sav' near offset 0xd8: Missing space following `C' at offset 4 in MRSETS record.
2583 ])
2584 done
2585 AT_CLEANUP
2586
2587 AT_SETUP([missing space after E in mrsets])
2588 AT_KEYWORDS([sack synthetic system file negative multiple response])
2589 AT_DATA([sys-file.sack], [dnl
2590 dnl File header.
2591 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2592 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2593
2594 dnl Numeric variable, no label or missing values.
2595 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2596
2597 dnl Multiple response sets.
2598 7; 7; 1; COUNT("$a=Ex");
2599
2600 dnl Character encoding record.
2601 7; 20; 1; 12; "windows-1252";
2602
2603 999; 0;
2604 ])
2605 for variant in be le; do
2606   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2607   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2608 ])
2609   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2610 warning: `sys-file.sav' near offset 0xd8: Missing space following `E' at offset 4 in MRSETS record.
2611 ])
2612 done
2613 AT_CLEANUP
2614
2615 AT_SETUP([unexpected label source in mrsets])
2616 AT_KEYWORDS([sack synthetic system file negative multiple response])
2617 AT_DATA([sys-file.sack], [dnl
2618 dnl File header.
2619 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2620 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2621
2622 dnl Numeric variable, no label or missing values.
2623 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2624
2625 dnl Multiple response sets.
2626 7; 7; 1; COUNT("$a=E 2");
2627
2628 dnl Character encoding record.
2629 7; 20; 1; 12; "windows-1252";
2630
2631 999; 0;
2632 ])
2633 for variant in be le; do
2634   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2635   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2636 ])
2637   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2638 warning: `sys-file.sav' near offset 0xd8: Unexpected label source value following `E' at offset 7 in MRSETS record.
2639
2640 warning: `sys-file.sav' near offset 0xd8: Expecting digit at offset 7 in MRSETS record.
2641 ])
2642 done
2643 AT_CLEANUP
2644
2645 AT_SETUP([bad type character in mrsets])
2646 AT_KEYWORDS([sack synthetic system file negative multiple response])
2647 AT_DATA([sys-file.sack], [dnl
2648 dnl File header.
2649 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2650 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2651
2652 dnl Numeric variable, no label or missing values.
2653 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2654
2655 dnl Multiple response sets.
2656 7; 7; 1; COUNT("$a=");
2657
2658 dnl Character encoding record.
2659 7; 20; 1; 12; "windows-1252";
2660
2661 999; 0;
2662 ])
2663 for variant in be le; do
2664   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2665   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2666 ])
2667   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2668 "warning: `sys-file.sav' near offset 0xd8: Missing `C', `D', or `E' at offset 3 in MRSETS record."
2669 ])
2670 done
2671 AT_CLEANUP
2672
2673 AT_SETUP([bad counted string length in mrsets])
2674 AT_KEYWORDS([sack synthetic system file negative multiple response])
2675 AT_DATA([sys-file.sack], [dnl
2676 dnl File header.
2677 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2678 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2679
2680 dnl Numeric variable, no label or missing values.
2681 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2682
2683 dnl Multiple response sets.
2684 7; 7; 1; COUNT("$a=Dx");
2685
2686 dnl Character encoding record.
2687 7; 20; 1; 12; "windows-1252";
2688
2689 999; 0;
2690 ])
2691 for variant in be le; do
2692   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2693   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2694 ])
2695   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2696 warning: `sys-file.sav' near offset 0xd8: Expecting digit at offset 4 in MRSETS record.
2697 ])
2698 done
2699 AT_CLEANUP
2700
2701 AT_SETUP([missing space in counted string in mrsets])
2702 AT_KEYWORDS([sack synthetic system file negative multiple response])
2703 AT_DATA([sys-file.sack], [dnl
2704 dnl File header.
2705 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2706 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2707
2708 dnl Numeric variable, no label or missing values.
2709 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2710
2711 dnl Multiple response sets.
2712 7; 7; 1; COUNT("$a=D1x");
2713
2714 dnl Character encoding record.
2715 7; 20; 1; 12; "windows-1252";
2716
2717 999; 0;
2718 ])
2719 for variant in be le; do
2720   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2721   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2722 ])
2723   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2724 warning: `sys-file.sav' near offset 0xd8: Expecting space at offset 5 in MRSETS record.
2725 ])
2726 done
2727 AT_CLEANUP
2728
2729 AT_SETUP([counted string too long in mrsets])
2730 AT_KEYWORDS([sack synthetic system file negative multiple response])
2731 AT_DATA([sys-file.sack], [dnl
2732 dnl File header.
2733 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2734 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2735
2736 dnl Numeric variable, no label or missing values.
2737 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2738
2739 dnl Multiple response sets.
2740 7; 7; 1; COUNT("$a=D4 abc");
2741
2742 dnl Character encoding record.
2743 7; 20; 1; 12; "windows-1252";
2744
2745 999; 0;
2746 ])
2747 for variant in be le; do
2748   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2749   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2750 ])
2751   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2752 warning: `sys-file.sav' near offset 0xd8: 4-byte string starting at offset 6 exceeds record length 9.
2753 ])
2754 done
2755 AT_CLEANUP
2756
2757 AT_SETUP([missing space after counted string in mrsets])
2758 AT_KEYWORDS([sack synthetic system file negative multiple response])
2759 AT_DATA([sys-file.sack], [dnl
2760 dnl File header.
2761 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2762 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2763
2764 dnl Numeric variable, no label or missing values.
2765 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2766
2767 dnl Multiple response sets.
2768 7; 7; 1; COUNT("$a=D3 abcx");
2769
2770 dnl Character encoding record.
2771 7; 20; 1; 12; "windows-1252";
2772
2773 999; 0;
2774 ])
2775 for variant in be le; do
2776   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2777   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2778 ])
2779   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2780 warning: `sys-file.sav' near offset 0xd8: Expecting space at offset 9 following 3-byte string.
2781 ])
2782 done
2783 AT_CLEANUP
2784
2785 AT_SETUP([missing newline after variable name in mrsets])
2786 AT_KEYWORDS([sack synthetic system file negative multiple response])
2787 AT_DATA([sys-file.sack], [dnl
2788 dnl File header.
2789 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2790 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2791
2792 dnl Numeric variable, no label or missing values.
2793 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2794
2795 dnl Multiple response sets.
2796 7; 7; 1; COUNT("$a=C 0  NUM1");
2797
2798 dnl Character encoding record.
2799 7; 20; 1; 12; "windows-1252";
2800
2801 999; 0;
2802 ])
2803 for variant in be le; do
2804   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2805   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2806 ])
2807   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2808 warning: `sys-file.sav' near offset 0xd8: Missing new-line parsing variable names at offset 13 in MRSETS record.
2809
2810 warning: `sys-file.sav': MRSET $a has only one variable.
2811 ])
2812 done
2813 AT_CLEANUP
2814
2815 AT_SETUP([duplicate variable name in mrsets])
2816 AT_KEYWORDS([sack synthetic system file negative multiple response])
2817 AT_DATA([sys-file.sack], [dnl
2818 dnl File header.
2819 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2820 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2821
2822 dnl Numeric variable, no label or missing values.
2823 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2824
2825 dnl Multiple response sets.
2826 7; 7; 1; COUNT("$a=C 0  NUM1 NUM1"; i8 10);
2827
2828 dnl Character encoding record.
2829 7; 20; 1; 12; "windows-1252";
2830
2831 999; 0;
2832 ])
2833 for variant in be le; do
2834   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2835   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2836 ])
2837   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2838 warning: `sys-file.sav': MRSET $a contains duplicate variable name NUM1.
2839
2840 warning: `sys-file.sav': MRSET $a has only one variable.
2841 ])
2842 done
2843 AT_CLEANUP
2844
2845 AT_SETUP([mixed variable types in mrsets])
2846 AT_KEYWORDS([sack synthetic system file negative multiple response])
2847 AT_DATA([sys-file.sack], [dnl
2848 dnl File header.
2849 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2850 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2851
2852 dnl Variables.
2853 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2854 2; 8; 0; 0; 0x010800 *2; s8 "STR1";
2855
2856 dnl Multiple response sets.
2857 7; 7; 1; COUNT("$a=C 0  NUM1 STR1"; i8 10);
2858
2859 dnl Character encoding record.
2860 7; 20; 1; 12; "windows-1252";
2861
2862 999; 0;
2863 ])
2864 for variant in be le; do
2865   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2866   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2867 ])
2868   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2869 warning: `sys-file.sav': MRSET $a contains both string and numeric variables.
2870
2871 warning: `sys-file.sav': MRSET $a has only one variable.
2872 ])
2873 done
2874 AT_CLEANUP
2875
2876 AT_SETUP([missing newline after variable name in mrsets])
2877 AT_KEYWORDS([sack synthetic system file negative multiple response])
2878 AT_DATA([sys-file.sack], [dnl
2879 dnl File header.
2880 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2881 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2882
2883 dnl Numeric variable, no label or missing values.
2884 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2885
2886 dnl Multiple response sets.
2887 7; 7; 1; COUNT("$a=C 0  NUM1"; i8 10);
2888
2889 dnl Character encoding record.
2890 7; 20; 1; 12; "windows-1252";
2891
2892 999; 0;
2893 ])
2894 for variant in be le; do
2895   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2896   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2897 ])
2898   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2899 warning: `sys-file.sav': MRSET $a has only one variable.
2900 ])
2901 done
2902 AT_CLEANUP
2903
2904 AT_SETUP([zero or one variable in mrset])
2905 AT_KEYWORDS([sack synthetic system file negative multiple response])
2906 AT_DATA([sys-file.sack], [dnl
2907 dnl File header.
2908 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2909 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2910
2911 dnl Numeric variable, no label or missing values.
2912 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2913
2914 dnl Multiple response sets.
2915 7; 7; 1; COUNT("$a=C 0  NUM1"; i8 10; "$b=C 0  "; i8 10);
2916
2917 dnl Character encoding record.
2918 7; 20; 1; 12; "windows-1252";
2919
2920 999; 0;
2921 ])
2922 for variant in be le; do
2923   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2924   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2925 ])
2926   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2927 warning: `sys-file.sav': MRSET $a has only one variable.
2928
2929 warning: `sys-file.sav': MRSET $b has no variables.
2930 ])
2931 done
2932 AT_CLEANUP
2933
2934 AT_SETUP([wrong display parameter size])
2935 AT_KEYWORDS([sack synthetic system file negative])
2936 AT_DATA([sys-file.sack], [dnl
2937 dnl File header.
2938 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2939 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2940
2941 dnl Numeric variable, no label or missing values.
2942 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2943
2944 dnl Display parameters record.
2945 7; 11; >>8<<; 2; 1.0; 1.0;
2946
2947 dnl Character encoding record.
2948 7; 20; 1; 12; "windows-1252";
2949
2950 dnl End of dictionary.
2951 999; 0;
2952 ])
2953 for variant in be le; do
2954   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2955   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2956 ])
2957   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2958 "warning: `sys-file.sav' near offset 0xd8: Record type 7, subtype 11 has bad size 8 (expected 4)."
2959 ])
2960 done
2961 AT_CLEANUP
2962
2963 AT_SETUP([wrong display parameter count])
2964 AT_KEYWORDS([sack synthetic system file negative])
2965 AT_DATA([sys-file.sack], [dnl
2966 dnl File header.
2967 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2968 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2969
2970 dnl Numeric variable, no label or missing values.
2971 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2972
2973 dnl Display parameters record.
2974 7; 11; 4; >>4<<; 1; 1; 2; 2;
2975
2976 dnl Character encoding record.
2977 7; 20; 1; 12; "windows-1252";
2978
2979 dnl End of dictionary.
2980 999; 0;
2981 ])
2982 for variant in be le; do
2983   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2984   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2985 ])
2986   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2987 warning: `sys-file.sav' near offset 0xd8: Extension 11 has bad count 4 (for 1 variables).
2988 ])
2989 done
2990 AT_CLEANUP
2991
2992 AT_SETUP([wrong display measurement level])
2993 AT_KEYWORDS([sack synthetic system file negative])
2994 AT_DATA([sys-file.sack], [dnl
2995 dnl File header.
2996 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2997 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2998
2999 dnl Numeric variable, no label or missing values.
3000 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3001
3002 dnl Display parameters record.
3003 7; 11; 4; 2; >>4<<; 0;
3004
3005 dnl Character encoding record.
3006 7; 20; 1; 12; "windows-1252";
3007
3008 dnl End of dictionary.
3009 999; 0;
3010 ])
3011 for variant in be le; do
3012   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3013   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3014 ])
3015   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
3016 warning: `sys-file.sav' near offset 0xd8: Invalid variable display parameters for variable 0 (NUM1).  Default parameters substituted.
3017 ])
3018 done
3019 AT_CLEANUP
3020
3021 AT_SETUP([wrong display alignment])
3022 AT_KEYWORDS([sack synthetic system file negative])
3023 AT_DATA([sys-file.sack], [dnl
3024 dnl File header.
3025 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3026 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3027
3028 dnl Numeric variable, no label or missing values.
3029 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3030
3031 dnl Display parameters record.
3032 7; 11; 4; 2; 1; >>-1<<;
3033
3034 dnl Character encoding record.
3035 7; 20; 1; 12; "windows-1252";
3036
3037 dnl End of dictionary.
3038 999; 0;
3039 ])
3040 for variant in be le; do
3041   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3042   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3043 ])
3044   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
3045 warning: `sys-file.sav' near offset 0xd8: Invalid variable display parameters for variable 0 (NUM1).  Default parameters substituted.
3046 ])
3047 done
3048 AT_CLEANUP
3049
3050 AT_SETUP([bad variable name in variable/value pair])
3051 AT_KEYWORDS([sack synthetic system file negative])
3052 AT_DATA([sys-file.sack], [dnl
3053 dnl File header.
3054 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3055 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3056
3057 dnl Numeric variables.
3058 2; 0; 0; 0; 0x050800 *2; s8 "LONGVARI";
3059
3060 dnl Long variable names.
3061 7; 13; 1; COUNT (>>"xyzzy"<<);
3062
3063 dnl Character encoding record.
3064 7; 20; 1; 12; "windows-1252";
3065
3066 dnl Dictionary termination record.
3067 999; 0;
3068 ])
3069 for variant in be le; do
3070   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3071   AT_DATA([sys-file.sps], [dnl
3072 GET FILE='sys-file.sav'.
3073 ])
3074   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
3075 warning: `sys-file.sav' near offset 0xde: Dictionary record refers to unknown variable xyzzy.
3076 ])
3077 done
3078 AT_CLEANUP
3079
3080 AT_SETUP([duplicate long variable name])
3081 AT_KEYWORDS([sack synthetic system file negative])
3082 AT_DATA([sys-file.sack], [dnl
3083 dnl File header.
3084 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3085 2; 4; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3086
3087 dnl Numeric variables.
3088 2; 0; 0; 0; 0x050800 *2; s8 "LONGVARI";
3089 2; 0; 0; 0; 0x050800 *2; s8 "LONGVA_A";
3090 2; 0; 0; 0; 0x050800 *2; s8 "LONGVA_B";
3091 2; 0; 0; 0; 0x050800 *2; s8 "LONGVA_C";
3092
3093 dnl Long variable names.
3094 7; 13; 1; COUNT (
3095 "LONGVARI=_Invalid"; i8 9;
3096 "LONGVARI=$Invalid"; i8 9;
3097 "LONGVARI=#Invalid"; i8 9;
3098 "LONGVA_A=LongVariableName"; i8 9;
3099 "LONGVA_B=LONGVARIABLENAME"; i8 9;
3100 );
3101
3102 dnl Character encoding record.
3103 7; 20; 1; 12; "windows-1252";
3104
3105 dnl Dictionary termination record.
3106 999; 0;
3107 ])
3108 for variant in be le; do
3109   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3110   AT_DATA([sys-file.sps], [dnl
3111 GET FILE='sys-file.sav'.
3112 ])
3113   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
3114 warning: `sys-file.sav' near offset 0x138: Long variable mapping from LONGVARI to invalid variable name `_Invalid'.
3115
3116 warning: `sys-file.sav' near offset 0x138: Long variable mapping from LONGVARI to invalid variable name `$Invalid'.
3117
3118 warning: `sys-file.sav' near offset 0x138: Long variable mapping from LONGVARI to invalid variable name `#Invalid'.
3119
3120 warning: `sys-file.sav' near offset 0x138: Duplicate long variable name `LONGVARIABLENAME'.
3121 ])
3122 done
3123 AT_CLEANUP
3124
3125 AT_SETUP([bad very long string length])
3126 AT_KEYWORDS([sack synthetic system file negative])
3127 AT_DATA([sys-file.sack], [dnl
3128 dnl File header.
3129 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3130 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3131
3132 dnl Numeric variable.
3133 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3134
3135 dnl Very long string map.
3136 7; 14; 1; COUNT (
3137 "NUM1=00000"; i8 0; i8 9;
3138 "NUM1=00255"; i8 0; i8 9;
3139 "NUM1=00256"; i8 0; i8 9;
3140 );
3141
3142 dnl Character encoding record.
3143 7; 20; 1; 12; "windows-1252";
3144
3145 dnl Dictionary termination record.
3146 999; 0;
3147 ])
3148 for variant in be le; do
3149   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3150   AT_DATA([sys-file.sps], [dnl
3151 GET FILE='sys-file.sav'.
3152 ])
3153   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
3154 warning: `sys-file.sav' near offset 0xd8: NUM1 listed as string of invalid length 00000 in very long string record.
3155
3156 "warning: `sys-file.sav' near offset 0xd8: NUM1 listed in very long string record with width 00255, which requires only one segment."
3157
3158 error: `sys-file.sav' near offset 0xd8: Very long string NUM1 overflows dictionary.
3159 ])
3160 done
3161 AT_CLEANUP
3162
3163 AT_SETUP([bad very long string segment width])
3164 AT_KEYWORDS([sack synthetic system file negative])
3165 AT_DATA([sys-file.sack], [dnl
3166 dnl File header.
3167 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3168 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3169
3170 dnl Variables.
3171 2; 255; 0; 0; 0x01ff00 *2; s8 "STR1";
3172 (2; -1; 0; 0; 0; 0; s8 "") * 31;
3173 2; >>9<<; 0; 0; 0x010900 *2; s8 "STR1_A";
3174 >>2; -1; 0; 0; 0; 0; s8 "";<<
3175
3176 dnl Very long string map.
3177 7; 14; 1; COUNT (
3178 "STR1=00256"; i8 0; i8 9;
3179 );
3180
3181 dnl Character encoding record.
3182 7; 20; 1; 12; "windows-1252";
3183
3184 dnl Dictionary termination record.
3185 999; 0;
3186 ])
3187 for variant in be le; do
3188   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3189   AT_DATA([sys-file.sps], [dnl
3190 GET FILE='sys-file.sav'.
3191 ])
3192   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
3193 error: `sys-file.sav' near offset 0x4f8: Very long string with width 256 has segment 1 of width 9 (expected 4).
3194 ])
3195 done
3196 AT_CLEANUP
3197
3198 AT_SETUP([too many value labels])
3199 AT_KEYWORDS([sack synthetic system file negative])
3200 AT_DATA([sys-file.sack], [dnl
3201 dnl File header.
3202 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3203 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3204
3205 dnl Numeric variable.
3206 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3207 3; >>0x7fffffff<<;
3208 ])
3209 for variant in be le; do
3210   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3211   AT_DATA([sys-file.sps], [dnl
3212 GET FILE='sys-file.sav'.
3213 ])
3214   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
3215 error: `sys-file.sav' near offset 0xd4: Invalid number of labels 2147483647.
3216 ])
3217 done
3218 AT_CLEANUP
3219
3220 AT_SETUP([missing type 4 record])
3221 AT_KEYWORDS([sack synthetic system file negative])
3222 AT_DATA([sys-file.sack], [dnl
3223 dnl File header.
3224 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3225 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3226
3227 dnl Numeric variable.
3228 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3229
3230 dnl Value label with missing type 4 record.
3231 3; 1; 1.0; i8 3; s7 "one";
3232
3233 dnl Character encoding record.
3234 7; 20; 1; 12; "windows-1252";
3235
3236 dnl End of dictionary.
3237 >>999; 0<<;
3238 ])
3239 for variant in be le; do
3240   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3241   AT_DATA([sys-file.sps], [dnl
3242 GET FILE='sys-file.sav'.
3243 ])
3244   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
3245 error: `sys-file.sav' near offset 0xe8: Variable index record (type 4) does not immediately follow value label record (type 3) as it should.
3246 ])
3247 done
3248 AT_CLEANUP
3249
3250 AT_SETUP([value label with no associated variables])
3251 AT_KEYWORDS([sack synthetic system file negative])
3252 AT_DATA([sys-file.sack], [dnl
3253 dnl File header.
3254 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3255 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3256
3257 dnl Numeric variable.
3258 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3259
3260 dnl Value label with no variables.
3261 3; 1; 1.0; i8 3; s7 "one"; 4; >>0<<;
3262 ])
3263 for variant in be le; do
3264   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3265   AT_DATA([sys-file.sps], [dnl
3266 GET FILE='sys-file.sav'.
3267 ])
3268   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
3269 error: `sys-file.sav' near offset 0xec: Number of variables associated with a value label (0) is not between 1 and the number of variables (1).
3270 ])
3271 done
3272 AT_CLEANUP
3273
3274 AT_SETUP([type 4 record names long string variable])
3275 AT_KEYWORDS([sack synthetic system file negative])
3276 AT_DATA([sys-file.sack], [dnl
3277 dnl File header.
3278 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3279 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3280
3281 dnl Long string variable.
3282 2; 9; 0; 0; 0x010900 *2; s8 "STR1";
3283 2; -1; 0; 0; 0; 0; s8 "";
3284
3285 dnl Value label that names long string variable.
3286 3; 1; s8 "xyzzy"; i8 3; s7 "one"; 4; 1; >>1<<;
3287
3288 dnl Character encoding record.
3289 7; 20; 1; 12; "windows-1252";
3290
3291 dnl End of dictionary.
3292 999; 0;
3293 ])
3294 for variant in be le; do
3295   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3296   AT_DATA([sys-file.sps], [dnl
3297 GET FILE='sys-file.sav'.
3298 ])
3299   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
3300 error: `sys-file.sav' near offset 0xf4: Value labels may not be added to long string variables (e.g. STR1) using records types 3 and 4.
3301 ])
3302 done
3303 AT_CLEANUP
3304
3305 AT_SETUP([variables for value label must all be same type])
3306 AT_KEYWORDS([sack synthetic system file negative])
3307 AT_DATA([sys-file.sack], [dnl
3308 dnl File header.
3309 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3310 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3311
3312 dnl Variables.
3313 2; 6; 0; 0; 0x010600 *2; s8 "STR1";
3314 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3315
3316 dnl Value label that names numeric and string variables.
3317 3; 1; s8 "xyzzy"; i8 3; s7 "one"; 4; 2; >>1; 2<<;
3318
3319 dnl Character encoding record.
3320 7; 20; 1; 12; "windows-1252";
3321
3322 dnl End of dictionary.
3323 999; 0;
3324 ])
3325 for variant in be le; do
3326   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3327   AT_DATA([sys-file.sps], [dnl
3328 GET FILE='sys-file.sav'.
3329 ])
3330   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
3331 "error: `sys-file.sav' near offset 0xf4: Variables associated with value label are not all of identical type.  Variable STR1 is string, but variable NUM1 is numeric."
3332 ])
3333 done
3334 AT_CLEANUP
3335
3336 AT_SETUP([duplicate value labels type])
3337 AT_KEYWORDS([sack synthetic system file negative])
3338 AT_DATA([sys-file.sack], [dnl
3339 dnl File header.
3340 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3341 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3342
3343 dnl Variables.
3344 2; 6; 0; 0; 0x010600 *2; s8 "STR1";
3345 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3346
3347 dnl Duplicate value labels.
3348 3; 1; s8 "xyzzy"; i8 3; s7 "one"; 4; 2; >>1; 1<<;
3349 3; 1; 1.0; i8 3; s7 "one"; 4; 2; >>2; 2<<;
3350
3351 dnl Character encoding record.
3352 7; 20; 1; 12; "windows-1252";
3353
3354 dnl End of dictionary.
3355 999; 0;
3356 ])
3357 for variant in be le; do
3358   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3359   AT_DATA([sys-file.sps], [dnl
3360 GET FILE='sys-file.sav'.
3361 ])
3362   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
3363 warning: `sys-file.sav' near offset 0xf4: Duplicate value label for `xyzzy ' on STR1.
3364
3365 warning: `sys-file.sav' near offset 0x11c: Duplicate value label for 1 on NUM1.
3366 ])
3367 done
3368 AT_CLEANUP
3369
3370 AT_SETUP([missing attribute value])
3371 AT_KEYWORDS([sack synthetic system file negative])
3372 AT_DATA([sys-file.sack], [dnl
3373 dnl File header.
3374 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3375 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3376
3377 dnl Variables.
3378 2; 0; 0; 0; 0x050800 *2; s8 "FIRSTVAR";
3379
3380 dnl Data file attributes record.
3381 7; 17; 1; COUNT (
3382 "Attr1("
3383 );
3384
3385 dnl Variable attributes record.
3386 7; 18; 1; COUNT (
3387 "FIRSTVAR:";
3388   "fred('23'"; i8 10
3389 );
3390
3391 dnl Character encoding record.
3392 7; 20; 1; 12; "windows-1252";
3393
3394 dnl Dictionary termination record.
3395 999; 0;
3396 ])
3397 for variant in be le; do
3398   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3399   AT_DATA([sys-file.sps], [dnl
3400 GET FILE='sys-file.sav'.
3401 ])
3402   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
3403 warning: `sys-file.sav' near offset 0xde: Error parsing attribute value Attr1[[1]].
3404
3405 warning: `sys-file.sav' near offset 0x101: Error parsing attribute value fred[[2]].
3406 ])
3407 done
3408 AT_CLEANUP
3409
3410 AT_SETUP([unquoted attribute value])
3411 AT_KEYWORDS([sack synthetic system file negative])
3412 AT_DATA([sys-file.sack], [dnl
3413 dnl File header.
3414 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3415 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3416
3417 dnl Variables.
3418 2; 0; 0; 0; 0x050800 *2; s8 "FIRSTVAR";
3419
3420 dnl Data file attributes record.
3421 7; 17; 1; COUNT (
3422 "Attr1(value"; i8 10;
3423 ")"
3424 );
3425
3426 dnl Variable attributes record.
3427 7; 18; 1; COUNT (
3428 "FIRSTVAR:";
3429   "fred(23"; i8 10; ")"
3430 );
3431
3432 dnl Character encoding record.
3433 7; 20; 1; 12; "windows-1252";
3434
3435 dnl Dictionary termination record.
3436 999; 0;
3437 ])
3438 for variant in be le; do
3439   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3440   AT_DATA([sys-file.sps], [dnl
3441 GET FILE='sys-file.sav'.
3442 ])
3443   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
3444 warning: `sys-file.sav' near offset 0xe4: Attribute value Attr1[[1]] is not quoted: value.
3445
3446 warning: `sys-file.sav' near offset 0x106: Attribute value fred[[1]] is not quoted: 23.
3447 ])
3448 done
3449 AT_CLEANUP
3450
3451 AT_SETUP([bad variable name in long string value label])
3452 AT_KEYWORDS([sack synthetic system file negative])
3453 AT_DATA([sys-file.sack], [dnl
3454 dnl File header.
3455 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3456 2; 3; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3457
3458 dnl Variables.
3459 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3460 2; 14; 0; 0; 0x010e00 *2; s8 "STR14";
3461 2; -1; 0; 0; 0; 0; s8 "";
3462
3463 7; 21; 1; COUNT (
3464 dnl No variable named STR9.
3465 COUNT(>>"STR9"<<); 9;
3466 1; COUNT("RSTUVWXYZ"); COUNT("value label for `RSTUVWXYZ'");
3467
3468 dnl NUM1 is numeric.
3469 COUNT(>>"NUM1"<<); 0;
3470 1; COUNT("xyz"); COUNT("value label for 1.0");
3471
3472 dnl Wrong width for STR14.
3473 COUNT("STR14"); >>9<<;
3474 1; COUNT("RSTUVWXYZ"); COUNT("value label for `RSTUVWXYZ'");
3475
3476 dnl Wrong width for value.
3477 COUNT("STR14"); 14;
3478 1; COUNT(>>"RSTUVWXYZ"<<); COUNT("value label for `RSTUVWXYZ'");
3479
3480 dnl Duplicate value label.
3481 COUNT("STR14"); 14; 2;
3482 COUNT("abcdefghijklmn"); COUNT("value label for `abcdefghijklmn'");
3483 >>COUNT("abcdefghijklmn"); COUNT("another value label for `abcdefghijklmn'")<<;
3484 );
3485
3486 dnl Character encoding record.
3487 7; 20; 1; 12; "windows-1252";
3488
3489 dnl Dictionary termination record.
3490 999; 0;
3491 ])
3492 for variant in be le; do
3493   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3494   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3495 ])
3496   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
3497 warning: `sys-file.sav' near offset 0x128: Ignoring long string value label record for unknown variable STR9.
3498
3499 warning: `sys-file.sav' near offset 0x164: Ignoring long string value label record for numeric variable NUM1.
3500
3501 warning: `sys-file.sav' near offset 0x193: Ignoring long string value label record for variable STR14 because the record's width (9) does not match the variable's width (14).
3502
3503 "warning: `sys-file.sav' near offset 0x1d4: Ignoring long string value label 0 for variable str14, with width 14, that has bad value width 9."
3504
3505 warning: `sys-file.sav' near offset 0x259: Duplicate value label for `abcdefghijklmn' on str14.
3506 ])
3507 done
3508 AT_CLEANUP
3509
3510 AT_SETUP([fewer data records than indicated by file header])
3511 AT_KEYWORDS([sack synthetic system file negative])
3512 AT_DATA([sys-file.sack], [dnl
3513 dnl File header.
3514 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3515 2; 2; 0; 0; >>5<<; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3516
3517 dnl Numeric variables.
3518 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3519 2; 0; 0; 0; 0x050800 *2; s8 "NUM2";
3520
3521 dnl Character encoding record.
3522 7; 20; 1; 12; "windows-1252";
3523
3524 dnl Data.
3525 999; 0;
3526 1.0; 2.0;
3527 3.0; 4.0;
3528 5.0; 6.0;
3529 7.0; 8.0;
3530 dnl Missing record here.
3531 ])
3532 for variant in be le; do
3533   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3534   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3535 LIST.
3536 ])
3537   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
3538    [error: Error reading case from file `sys-file.sav'.
3539
3540 Table: Data List
3541 num1,num2
3542 1,2
3543 3,4
3544 5,6
3545 7,8
3546 ])
3547 done
3548 AT_CLEANUP
3549
3550 AT_SETUP([partial data record between variables])
3551 AT_KEYWORDS([sack synthetic system file negative])
3552 AT_DATA([sys-file.sack], [dnl
3553 dnl File header.
3554 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3555 2; 2; 0; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3556
3557 dnl Numeric variables.
3558 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3559 2; 0; 0; 0; 0x050800 *2; s8 "NUM2";
3560
3561 dnl Character encoding record.
3562 7; 20; 1; 12; "windows-1252";
3563
3564 dnl Data.
3565 999; 0;
3566 1.0; 2.0;
3567 3.0;
3568 ])
3569 for variant in be le; do
3570   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3571   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3572 LIST.
3573 ])
3574   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
3575    [error: `sys-file.sav' near offset 0x12c: File ends in partial case.
3576
3577 Table: Data List
3578 num1,num2
3579 1,2
3580 ])
3581 done
3582 AT_CLEANUP
3583
3584 AT_SETUP([partial data record within long string])
3585 AT_KEYWORDS([sack synthetic system file negative])
3586 AT_DATA([sys-file.sack], [dnl
3587 dnl File header.
3588 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3589 2; 2; 0; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3590
3591 dnl Numeric variables.
3592 2; 14; 0; 0; 0x010e00 *2; s8 "STR14";
3593 2; -1; 0; 0; 0; 0; s8 "";
3594
3595 dnl Character encoding record.
3596 7; 20; 1; 12; "windows-1252";
3597
3598 dnl Data.
3599 999; 0;
3600 s14 "one data item";
3601 s8 "partial";
3602 ])
3603 for variant in be le; do
3604   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3605   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3606 LIST.
3607 ])
3608   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
3609    [error: `sys-file.sav' near offset 0x12a: Unexpected end of file.
3610
3611 Table: Data List
3612 str14
3613 one data item @&t@
3614 ])
3615 done
3616 AT_CLEANUP
3617
3618 AT_SETUP([partial compressed data record])
3619 AT_KEYWORDS([sack synthetic system file positive])
3620 AT_DATA([sys-file.sack], [dnl
3621 dnl File header.
3622 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3623 2; dnl Layout code
3624 6; dnl Nominal case size
3625 1; dnl Compressed
3626 0; dnl Not weighted 
3627 -1; dnl Unspecified number of cases.
3628 100.0; dnl Bias.
3629 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
3630 i8 0 *3;
3631
3632 dnl Numeric variables.
3633 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3634 2; 0; 0; 0; 0x050800 *2; s8 "NUM2";
3635
3636 dnl String variable.
3637 2; 4; 0; 0; 0x010400 *2; s8 "STR4";
3638 2; 8; 0; 0; 0x010800 *2; s8 "STR8";
3639 2; 15; 0; 0; 0x010f00 *2; s8 "STR15";
3640 2; -1; 0; 0; 0; 0; s8 "";
3641
3642 dnl Character encoding record.
3643 7; 20; 1; 12; "windows-1252";
3644
3645 dnl Dictionary termination record.
3646 999; 0;
3647
3648 dnl Compressed data.
3649 i8 1 100 254 253 254 253; i8 255 251; "abcdefgh"; s8 "0123";
3650 ])
3651 for variant in be le; do
3652   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3653   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3654 LIST.
3655 ])
3656   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
3657    [error: `sys-file.sav' near offset 0x1ac: File ends in partial case.
3658
3659 Table: Data List
3660 num1,num2,str4,str8,str15
3661 -99,0,,abcdefgh,0123   @&t@
3662 ])
3663 done
3664 AT_CLEANUP
3665
3666 AT_SETUP([zcompressed data - bad zheader_ofs])
3667 AT_KEYWORDS([sack synthetic system file negative zlib])
3668 zcompressed_sack | sed 's/.*zheader_ofs.*/>>i64 0<<;/' > sys-file.sack
3669 for variant in be le; do
3670   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3671   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3672 ])
3673   AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x194: Wrong ZLIB data header offset 0 (expected 0x194).
3674 ])
3675 done
3676 AT_CLEANUP
3677
3678 AT_SETUP([zcompressed data - bad ztrailer_ofs])
3679 AT_KEYWORDS([sack synthetic system file negative zlib])
3680 zcompressed_sack | sed 's/.*ztrailer_ofs.*/>>i64 0<<;/' > sys-file.sack
3681 for variant in be le; do
3682   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3683   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3684 ])
3685   AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x194: Impossible ZLIB trailer offset 0x0.
3686 ])
3687 done
3688 AT_CLEANUP
3689
3690 # ztrailer_len must be a multiple of 24 and at least 48,
3691 # so a value of 12 is impossible.
3692 AT_SETUP([zcompressed data - invalid ztrailer_len])
3693 AT_KEYWORDS([sack synthetic system file negative zlib])
3694 zcompressed_sack | sed 's/.*ztrailer_len.*/>>i64 12<<;/' > sys-file.sack
3695 for variant in be le; do
3696   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3697   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3698 ])
3699   AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x194: Invalid ZLIB trailer length 12.
3700 ])
3701 done
3702 AT_CLEANUP
3703
3704 # ztrailer_ofs + ztrailer_len must be the file size.
3705 AT_SETUP([zcompressed data - wrong ztrailer_len])
3706 AT_KEYWORDS([sack synthetic system file negative zlib])
3707 zcompressed_sack | sed 's/.*ztrailer_len.*/>>i64 72<<;/' > sys-file.sack
3708 for variant in be le; do
3709   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3710   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3711 ])
3712   AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [warning: `sys-file.sav' near offset 0x1ac: End of ZLIB trailer (0x24d) is not file size (0x235).
3713 error: `sys-file.sav' near offset 0x21d: 72-byte ZLIB trailer specifies 1 data blocks (expected 2).
3714 ])
3715 done
3716 AT_CLEANUP
3717
3718 AT_SETUP([zcompressed data - wrong ztrailer_bias])
3719 AT_KEYWORDS([sack synthetic system file negative zlib])
3720 zcompressed_sack | sed 's/.*ztrailer_bias.*/>>i64 0<<;/' > sys-file.sack
3721 for variant in be le; do
3722   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3723   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3724 ])
3725   AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x20d: ZLIB trailer bias (0) differs from file header bias (100.00).
3726 ])
3727 done
3728 AT_CLEANUP
3729
3730 AT_SETUP([zcompressed data - wrong ztrailer_zero])
3731 AT_KEYWORDS([sack synthetic system file negative zlib])
3732 zcompressed_sack | sed 's/.*ztrailer_zero.*/>>i64 100<<;/' > sys-file.sack
3733 for variant in be le; do
3734   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3735   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3736 ])
3737   AT_CHECK([pspp -o pspp.csv sys-file.sps], [0], [warning: `sys-file.sav' near offset 0x215: ZLIB trailer "zero" field has nonzero value 100.
3738 ])
3739 done
3740 AT_CLEANUP
3741
3742 AT_SETUP([zcompressed data - wrong block_size])
3743 AT_KEYWORDS([sack synthetic system file negative zlib])
3744 zcompressed_sack | sed 's/.*block_size.*/>>0x1000<<;/' > sys-file.sack
3745 for variant in be le; do
3746   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3747   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3748 ])
3749   AT_CHECK([pspp -o pspp.csv sys-file.sps], [0], [warning: `sys-file.sav' near offset 0x219: ZLIB trailer specifies unexpected 4096-byte block size.
3750 ])
3751 done
3752 AT_CLEANUP
3753
3754 AT_SETUP([zcompressed data - wrong n_blocks])
3755 AT_KEYWORDS([sack synthetic system file negative zlib])
3756 zcompressed_sack | sed 's/.*n_blocks.*/>>2<<;/' > sys-file.sack
3757 for variant in be le; do
3758   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3759   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3760 ])
3761   AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x21d: 48-byte ZLIB trailer specifies 2 data blocks (expected 1).
3762 ])
3763 done
3764 AT_CLEANUP
3765
3766 AT_SETUP([zcompressed data - wrong uncompressed_ofs])
3767 AT_KEYWORDS([sack synthetic system file negative zlib])
3768 zcompressed_sack | sed 's/.*uncompressed_ofs.*/i64 >>0x177<<;/' > sys-file.sack
3769 for variant in be le; do
3770   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3771   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3772 ])
3773   AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x21d: ZLIB block descriptor 0 reported uncompressed data offset 0x177, when 0x194 was expected.
3774 ])
3775 done
3776 AT_CLEANUP
3777
3778 AT_SETUP([zcompressed data - wrong compressed_ofs])
3779 AT_KEYWORDS([sack synthetic system file negative zlib])
3780 zcompressed_sack | sed 's/.*@%:@ compressed_ofs.*/i64 >>0x191<<;/' > sys-file.sack
3781 for variant in be le; do
3782   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3783   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3784 ])
3785   AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x21d: ZLIB block descriptor 0 reported compressed data offset 0x191, when 0x1ac was expected.
3786 ])
3787 done
3788 AT_CLEANUP
3789
3790 AT_SETUP([zcompressed data - compressed sizes don't add up])
3791 AT_KEYWORDS([sack synthetic system file negative zlib])
3792 AT_DATA([sys-file.sack], [dnl
3793 dnl File header.
3794 "$FL3"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3795 2; dnl Layout code
3796 6; dnl Nominal case size
3797 2; dnl zlib compressed
3798 0; dnl Not weighted
3799 -1; dnl Unspecified number of cases.
3800 100.0; dnl Bias.
3801 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
3802 i8 0 *3;
3803
3804 dnl Numeric variables.
3805 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3806 2; 0; 0; 0; 0x050800 *2; s8 "NUM2";
3807
3808 dnl String variable.
3809 2; 4; 0; 0; 0x010400 *2; s8 "STR4";
3810 2; 8; 0; 0; 0x010800 *2; s8 "STR8";
3811 2; 15; 0; 0; 0x010f00 *2; s8 "STR15";
3812 2; -1; 0; 0; 0; 0; s8 "";
3813
3814 dnl Character encoding record.
3815 7; 20; 1; 12; "windows-1252";
3816
3817 dnl Dictionary termination record.
3818 999; 0;
3819
3820 dnl ZLIB data header.
3821 i64 0x194;    # zheader_ofs
3822 i64 0x1ac;    # ztrailer_ofs
3823 i64 72;       # ztrailer_len
3824
3825 dnl This is where the ZLIB data blocks would go, but we don't need any to
3826 dnl provoke this message so we omit them.
3827
3828 dnl ZLIB data trailer fixed header:
3829 i64 -100;     # ztrailer_bias
3830 i64 0;        # ztrailer_zero
3831 0x3ff000;     # block_size
3832 2;            # n_blocks
3833
3834 dnl ZLIB block descriptor 1:
3835 i64 0x194;    # uncompressed_ofs
3836 i64 0x1ac;    # compressed_ofs
3837 0x100000;     # uncompressed_size
3838 0x12345;      # compressed_size
3839
3840 dnl ZLIB block descriptor 2:
3841 i64 0x100194; # uncompressed_ofs
3842 i64 0x12421;  # compressed_ofs
3843 0x100000;     # uncompressed_size
3844 0x12345;      # compressed_size
3845 ])
3846 for variant in be le; do
3847   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3848   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3849 ])
3850   AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [warning: `sys-file.sav' near offset 0x1c4: ZLIB block descriptor 0 reported block size 0x100000, when 0x3ff000 was expected.
3851 error: `sys-file.sav' near offset 0x1dc: ZLIB block descriptor 1 reported compressed data offset 0x12421, when 0x124f1 was expected.
3852 ])
3853 done
3854 AT_CLEANUP
3855
3856 AT_SETUP([zcompressed data - uncompressed_size > block_size])
3857 AT_KEYWORDS([sack synthetic system file negative zlib])
3858 zcompressed_sack | sed 's/.*uncompressed_size.*/>>0x400000<<;/' > sys-file.sack
3859 for variant in be le; do
3860   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3861   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3862 ])
3863   AT_CHECK([pspp -o pspp.csv sys-file.sps], [0], [warning: `sys-file.sav' near offset 0x21d: ZLIB block descriptor 0 reported block size 0x400000, when at most 0x3ff000 was expected.
3864 ])
3865 done
3866 AT_CLEANUP
3867
3868 AT_SETUP([zcompressed data - compression expands data too much])
3869 AT_KEYWORDS([sack synthetic system file negative zlib])
3870 zcompressed_sack | sed 's/.*uncompressed_size.*/>>50<<;/
3871 s/.*@%:@ compressed_size.*/>>100<<;/' > sys-file.sack
3872 for variant in be le; do
3873   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3874   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3875 ])
3876   AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x21d: ZLIB block descriptor 0 reports compressed size 100 and uncompressed size 50.
3877 ])
3878 done
3879 AT_CLEANUP
3880
3881 AT_SETUP([zcompressed data - compressed sizes don't add up])
3882 AT_KEYWORDS([sack synthetic system file negative zlib])
3883 zcompressed_sack | sed 's/.*@%:@ compressed_size.*/>>88<<;/' > sys-file.sack
3884 for variant in be le; do
3885   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3886   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3887 ])
3888   AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x235: ZLIB trailer is at offset 0x205 but 0x204 would be expected from block descriptors.
3889 ])
3890 done
3891 AT_CLEANUP
3892
3893 # CVE-2017-10791.
3894 # See also https://bugzilla.redhat.com/show_bug.cgi?id=1467004.
3895 # See also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=866890.
3896 # See also https://security-tracker.debian.org/tracker/CVE-2017-10791.
3897 # Found by team OWL337, using the collAFL fuzzer.
3898 AT_SETUP([integer overflows in long string missing values])
3899 AT_KEYWORDS([system file negative])
3900 cp $top_srcdir/tests/data/CVE-2017-10791.sav .
3901 AT_CHECK([pspp-convert -O csv -e ASCII CVE-2017-10791.sav -], [0], [], [dnl
3902 `CVE-2017-10791.sav' near offset 0x217: Extension record subtype 21 ends unexpectedly.
3903 ])
3904 AT_CLEANUP
3905
3906 # CVE-2017-10792.
3907 # See also https://bugzilla.redhat.com/show_bug.cgi?id=1467005.
3908 # See also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=866890.
3909 # See also https://security-tracker.debian.org/tracker/CVE-2017-10792.
3910 # Reported by team OWL337, with fuzzer collAFL.
3911 AT_SETUP([null dereference skipping bad extension record 18])
3912 AT_KEYWORDS([system file negative])
3913 cp $top_srcdir/tests/data/CVE-2017-10792.sav .
3914 AT_CHECK([pspp-convert -O csv -e ASCII CVE-2017-10792.sav -], [0], [], [dnl
3915 `CVE-2017-10792.sav' near offset 0x1c0: Record type 7, subtype 18 has bad size 4 (expected 1).
3916 ])
3917 AT_CLEANUP