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