sys-file-reader: Disallow system and scratch long variable names too.
[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 2; 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
1111 dnl Machine integer info record.
1112 7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1252;
1113
1114 dnl Long variable names.
1115 7; 13; 1; COUNT (
1116 "FIRSTVAR=FirstVariable"; i8 9;
1117 "SECONDVA=S"; i8 233; "condVariable"; i8 9;
1118 );
1119
1120 dnl Data file attributes record.
1121 7; 17; 1; COUNT (
1122 "Attr1('Value1'"; i8 10; "''d"; i8 233; "claration''"; i8 10; ")";
1123 "S"; i8 233; "condAttr('123'"; i8 10; "'456'"; i8 10; ")";
1124 );
1125
1126 dnl Variable attributes record.
1127 7; 18; 1; COUNT (
1128 "FirstVariable:";
1129   "ad"; i8 232; "le('23'"; i8 10; "'34'"; i8 10; ")";
1130   "bert('123'"; i8 10; ")";
1131   "$@Role('1'"; i8 10; ")";
1132 "/S"; i8 233; "condVariable:";
1133   "xyzzy('quux'"; i8 10; ")";
1134 );
1135
1136
1137 dnl Character encoding record.
1138 7; 20; 1; 12; "windows-1252";
1139
1140 dnl Dictionary termination record.
1141 999; 0;
1142 ])
1143 for variant in be le; do
1144   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1145   AT_DATA([sys-file.sps], [dnl
1146 GET FILE='sys-file.sav'.
1147 DISPLAY @ATTRIBUTES.
1148 ])
1149   AT_CHECK([pspp -o pspp.csv sys-file.sps])
1150   AT_CHECK([cat pspp.csv], [0],
1151 [[Variable,Description
1152 FirstVariable,"Attribute,Value
1153 $@Role,1
1154 adèle[1],23
1155 adèle[2],34
1156 bert,123"
1157 SécondVariable,"Attribute,Value
1158 xyzzy,quux"
1159
1160 Table: Custom data file attributes.
1161 Attribute,Value
1162 Attr1[1],Value1
1163 Attr1[2],'déclaration'
1164 SécondAttr[1],123
1165 SécondAttr[2],456
1166 ]])
1167   AT_DATA([sys-file.sps], [dnl
1168 GET FILE='sys-file.sav'.
1169 DISPLAY DICTIONARY.
1170 ])
1171   AT_CHECK([pspp -o pspp.csv sys-file.sps])
1172   AT_CHECK([cat pspp.csv], [0],
1173 [[Variable,Description,Position
1174 FirstVariable,"Format: F8.0
1175 Role: Output
1176
1177 Attribute,Value
1178 adèle[1],23
1179 adèle[2],34
1180 bert,123",1
1181 SécondVariable,"Format: F8.0
1182 Role: Input
1183
1184 Attribute,Value
1185 xyzzy,quux",2
1186
1187 Table: Custom data file attributes.
1188 Attribute,Value
1189 Attr1[1],Value1
1190 Attr1[2],'déclaration'
1191 SécondAttr[1],123
1192 SécondAttr[2],456
1193 ]])
1194 done
1195 AT_CLEANUP
1196
1197 AT_SETUP([variable roles])
1198 AT_KEYWORDS([sack synthetic system file positive])
1199 AT_DATA([sys-file.sack], [dnl
1200 dnl File header.
1201 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1202 2; dnl Layout code
1203 7; dnl Nominal case size
1204 0; dnl Not compressed
1205 0; dnl Not weighted
1206 0; dnl 1 case.
1207 100.0; dnl Bias.
1208 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
1209 i8 0 *3;
1210
1211 dnl Variables.
1212 2; 0; 0; 0; 0x050800 *2; s8 "I";
1213 2; 0; 0; 0; 0x050800 *2; s8 "O";
1214 2; 0; 0; 0; 0x050800 *2; s8 "B";
1215 2; 0; 0; 0; 0x050800 *2; s8 "N";
1216 2; 0; 0; 0; 0x050800 *2; s8 "P";
1217 2; 0; 0; 0; 0x050800 *2; s8 "S";
1218 2; 0; 0; 0; 0x050800 *2; s8 "X";
1219
1220 dnl Machine integer info record.
1221 7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1252;
1222
1223 dnl Variable attributes record.
1224 7; 18; 1; COUNT (
1225 "I:$@Role('0'"; i8 10; ")";
1226 "/O:$@Role('1'"; i8 10; ")";
1227 "/B:$@Role('2'"; i8 10; ")";
1228 "/N:$@Role('3'"; i8 10; ")";
1229 "/P:$@Role('4'"; i8 10; ")";
1230 "/S:$@Role('5'"; i8 10; ")";
1231 "/X:$@Role('6'"; i8 10; ")";
1232 );
1233
1234 dnl Character encoding record.
1235 7; 20; 1; 12; "windows-1252";
1236
1237 dnl Dictionary termination record.
1238 999; 0;
1239 ])
1240 for variant in be le; do
1241   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1242   AT_DATA([sys-file.sps], [dnl
1243 GET FILE='sys-file.sav'.
1244 DISPLAY DICTIONARY.
1245 ])
1246   AT_CHECK([pspp -o pspp.csv sys-file.sps], [0], [dnl
1247 warning: `sys-file.sav': Invalid role for variable x.
1248 ])
1249   AT_CHECK([cat pspp.csv], [0], [dnl
1250 warning: `sys-file.sav': Invalid role for variable x.
1251
1252 Variable,Description,Position
1253 i,"Format: F8.0
1254 Role: Input",1
1255 o,"Format: F8.0
1256 Role: Output",2
1257 b,"Format: F8.0
1258 Role: Both",3
1259 n,"Format: F8.0
1260 Role: None",4
1261 p,"Format: F8.0
1262 Role: Partition",5
1263 s,"Format: F8.0
1264 Role: Split",6
1265 x,"Format: F8.0
1266 Role: Input",7
1267 ])
1268 done
1269 AT_CLEANUP
1270
1271 AT_SETUP([compressed data])
1272 AT_KEYWORDS([sack synthetic system file positive])
1273 AT_DATA([sys-file.sack], [dnl
1274 dnl File header.
1275 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1276 2; dnl Layout code
1277 6; dnl Nominal case size
1278 1; dnl Simple compression
1279 0; dnl Not weighted 
1280 -1; dnl Unspecified number of cases.
1281 100.0; dnl Bias.
1282 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
1283 i8 0 *3;
1284
1285 dnl Numeric variables.
1286 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1287 2; 0; 0; 0; 0x050800 *2; s8 "NUM2";
1288
1289 dnl String variable.
1290 2; 4; 0; 0; 0x010400 *2; s8 "STR4";
1291 2; 8; 0; 0; 0x010800 *2; s8 "STR8";
1292 2; 15; 0; 0; 0x010f00 *2; s8 "STR15";
1293 2; -1; 0; 0; 0; 0; s8 "";
1294
1295 dnl Character encoding record.
1296 7; 20; 1; 12; "windows-1252";
1297
1298 dnl Dictionary termination record.
1299 999; 0;
1300
1301 dnl Compressed data.
1302 i8 1 100 254 253 254 253; i8 255 251; "abcdefgh"; s8 "0123";
1303 i8 253 253 253 254; i8 101 102 253 253; s8 "jklm"; s8 "nopqrstu";
1304 s8 "vwxyzABC"; s8 "DEFG"; s8 "HIJKLMNO";
1305 i8 254 253 252 0 0 0 0 0; s8 "PQRSTUVW";
1306
1307 ])
1308 for variant in be le; do
1309   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1310   AT_DATA([sys-file.sps], [dnl
1311 GET FILE='sys-file.sav'.
1312 DISPLAY DICTIONARY.
1313 LIST.
1314 ])
1315   AT_CHECK([pspp -o pspp.csv sys-file.sps])
1316   AT_CHECK([cat pspp.csv], [0], [dnl
1317 Variable,Description,Position
1318 num1,Format: F8.0,1
1319 num2,Format: F8.0,2
1320 str4,Format: A4,3
1321 str8,Format: A8,4
1322 str15,Format: A15,5
1323
1324 Table: Data List
1325 num1,num2,str4,str8,str15
1326 -99,0,,abcdefgh,0123   @&t@
1327 .,151,jklm,nopqrstu,vwxyzABC       @&t@
1328 1,2,DEFG,HIJKLMNO,PQRSTUV
1329 ])
1330 done
1331 AT_CLEANUP
1332
1333 AT_SETUP([compressed data, zero bias])
1334 AT_KEYWORDS([sack synthetic system file positive])
1335 AT_DATA([sys-file.sack], [dnl
1336 dnl File header.
1337 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1338 2; dnl Layout code
1339 6; dnl Nominal case size
1340 1; dnl Simple compression.
1341 0; dnl Not weighted 
1342 -1; dnl Unspecified number of cases.
1343 0.0; dnl Bias.
1344 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
1345 i8 0 *3;
1346
1347 dnl Numeric variables.
1348 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1349 2; 0; 0; 0; 0x050800 *2; s8 "NUM2";
1350
1351 dnl String variable.
1352 2; 4; 0; 0; 0x010400 *2; s8 "STR4";
1353 2; 8; 0; 0; 0x010800 *2; s8 "STR8";
1354 2; 15; 0; 0; 0x010f00 *2; s8 "STR15";
1355 2; -1; 0; 0; 0; 0; s8 "";
1356
1357 dnl Character encoding record.
1358 7; 20; 1; 12; "windows-1252";
1359
1360 dnl Dictionary termination record.
1361 999; 0;
1362
1363 dnl Compressed data.
1364 i8 1 100 254 253 254 253; i8 255 251; "abcdefgh"; s8 "0123";
1365 i8 253 253 253 254; i8 101 102 253 253; s8 "jklm"; s8 "nopqrstu";
1366 s8 "vwxyzABC"; s8 "DEFG"; s8 "HIJKLMNO";
1367 i8 254 253 252 0 0 0 0 0; s8 "PQRSTUVW";
1368
1369 ])
1370 for variant in be le; do
1371   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1372   AT_DATA([sys-file.sps], [dnl
1373 GET FILE='sys-file.sav'.
1374 DISPLAY DICTIONARY.
1375 LIST.
1376 ])
1377   AT_CHECK([pspp -o pspp.csv sys-file.sps], [0])
1378   AT_CHECK([cat pspp.csv], [0], [dnl
1379 Variable,Description,Position
1380 num1,Format: F8.0,1
1381 num2,Format: F8.0,2
1382 str4,Format: A4,3
1383 str8,Format: A8,4
1384 str15,Format: A15,5
1385
1386 Table: Data List
1387 num1,num2,str4,str8,str15
1388 1,100,,abcdefgh,0123   @&t@
1389 .,251,jklm,nopqrstu,vwxyzABC       @&t@
1390 101,102,DEFG,HIJKLMNO,PQRSTUV
1391 ])
1392 done
1393 AT_CLEANUP
1394
1395 AT_SETUP([compressed data, other bias])
1396 AT_KEYWORDS([sack synthetic system file positive])
1397 AT_DATA([sys-file.sack], [dnl
1398 dnl File header.
1399 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1400 2; dnl Layout code
1401 6; dnl Nominal case size
1402 1; dnl Simple compression.
1403 0; dnl Not weighted 
1404 -1; dnl Unspecified number of cases.
1405 50.0; dnl Bias.
1406 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
1407 i8 0 *3;
1408
1409 dnl Numeric variables.
1410 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1411 2; 0; 0; 0; 0x050800 *2; s8 "NUM2";
1412
1413 dnl String variable.
1414 2; 4; 0; 0; 0x010400 *2; s8 "STR4";
1415 2; 8; 0; 0; 0x010800 *2; s8 "STR8";
1416 2; 15; 0; 0; 0x010f00 *2; s8 "STR15";
1417 2; -1; 0; 0; 0; 0; s8 "";
1418
1419 dnl Character encoding record.
1420 7; 20; 1; 12; "windows-1252";
1421
1422 dnl Dictionary termination record.
1423 999; 0;
1424
1425 dnl Compressed data.
1426 i8 1 100 254 253 254 253; i8 255 251; "abcdefgh"; s8 "0123";
1427 i8 253 253 253 254; i8 101 102 253 253; s8 "jklm"; s8 "nopqrstu";
1428 s8 "vwxyzABC"; s8 "DEFG"; s8 "HIJKLMNO";
1429 i8 254 253 252 0 0 0 0 0; s8 "PQRSTUVW";
1430
1431 ])
1432 for variant in be le; do
1433   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1434   AT_DATA([sys-file.sps], [dnl
1435 GET FILE='sys-file.sav'.
1436 DISPLAY DICTIONARY.
1437 LIST.
1438 ])
1439   AT_CHECK([pspp -o pspp.csv sys-file.sps], [0], 
1440     [warning: `sys-file.sav' near offset 0x54: Compression bias is not the usual value of 100, or system file uses unrecognized floating-point format.
1441 ])
1442   AT_CHECK([cat pspp.csv], [0], [dnl
1443 "warning: `sys-file.sav' near offset 0x54: Compression bias is not the usual value of 100, or system file uses unrecognized floating-point format."
1444
1445 Variable,Description,Position
1446 num1,Format: F8.0,1
1447 num2,Format: F8.0,2
1448 str4,Format: A4,3
1449 str8,Format: A8,4
1450 str15,Format: A15,5
1451
1452 Table: Data List
1453 num1,num2,str4,str8,str15
1454 -49,50,,abcdefgh,0123   @&t@
1455 .,201,jklm,nopqrstu,vwxyzABC       @&t@
1456 51,52,DEFG,HIJKLMNO,PQRSTUV
1457 ])
1458 done
1459 AT_CLEANUP
1460
1461 m4_divert_push([PREPARE_TESTS])
1462 zcompressed_sack () {
1463     cat <<'EOF'
1464 dnl File header.
1465 "$FL3"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1466 2; dnl Layout code
1467 6; dnl Nominal case size
1468 2; dnl zlib compressed
1469 0; dnl Not weighted
1470 -1; dnl Unspecified number of cases.
1471 100.0; dnl Bias.
1472 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
1473 i8 0 *3;
1474
1475 dnl Numeric variables.
1476 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1477 2; 0; 0; 0; 0x050800 *2; s8 "NUM2";
1478
1479 dnl String variable.
1480 2; 4; 0; 0; 0x010400 *2; s8 "STR4";
1481 2; 8; 0; 0; 0x010800 *2; s8 "STR8";
1482 2; 15; 0; 0; 0x010f00 *2; s8 "STR15";
1483 2; -1; 0; 0; 0; 0; s8 "";
1484
1485 dnl Character encoding record.
1486 7; 20; 1; 12; "windows-1252";
1487
1488 dnl Dictionary termination record.
1489 999; 0;
1490
1491 dnl ZLIB data header.
1492 i64 0x194;    # zheader_ofs
1493 i64 0x205;    # ztrailer_ofs
1494 i64 48;       # ztrailer_len
1495
1496 dnl ZLIB data block.
1497 dnl
1498 dnl This is the compressed form of:
1499 dnl
1500 dnl 01 64 fe fd fe fd ff fb  61 62 63 64 65 66 67 68  |.d......abcdefgh|
1501 dnl 30 31 32 33 20 20 20 20  fd fd fd fe 65 66 fd fd  |0123    ....ef..|
1502 dnl 6a 6b 6c 6d 20 20 20 20  6e 6f 70 71 72 73 74 75  |jklm    nopqrstu|
1503 dnl 76 77 78 79 7a 41 42 43  44 45 46 47 20 20 20 20  |vwxyzABCDEFG    |
1504 dnl 48 49 4a 4b 4c 4d 4e 4f  fe fd fc 00 00 00 00 00  |HIJKLMNO........|
1505 dnl 50 51 52 53 54 55 56 57                           |PQRSTUVW|
1506 dnl
1507 dnl which is the data from the "compressed data" test.
1508 hex "78 01 63 4c f9 f7 f7 df  df ff bf 13 93 92 53 52";
1509 hex "d3 d2 33 0c 0c 8d 8c 15  80 e0 ef df bf ff 52 d3";
1510 hex "fe fe cd ca ce c9 05 f1  f3 f2 0b 0a 8b 8a 4b 4a";
1511 hex "cb ca 2b 2a ab 1c 9d 9c  5d 5c dd dc 41 e2 1e 9e";
1512 hex "5e de 3e be 7e fe ff fe  fe 61 00 81 80 c0 a0 e0";
1513 hex "90 d0 b0 70 00 0f 3f 23  d7";
1514
1515 dnl ZLIB data trailer fixed header:
1516 i64 -100;     # ztrailer_bias
1517 i64 0;        # ztrailer_zero
1518 0x3ff000;     # block_size
1519 1;            # n_blocks
1520
1521 dnl ZLIB block descriptor:
1522 i64 0x194;    # uncompressed_ofs
1523 i64 0x1ac;    # compressed_ofs
1524 88;           # uncompressed_size
1525 89;           # compressed_size
1526 EOF
1527 }
1528 m4_divert_pop([PREPARE_TESTS])
1529
1530 AT_SETUP([zcompressed data])
1531 AT_KEYWORDS([sack synthetic system file positive zlib])
1532 zcompressed_sack > sys-file.sack
1533 for variant in be le; do
1534   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1535   AT_DATA([sys-file.sps], [dnl
1536 GET FILE='sys-file.sav'.
1537 DISPLAY DICTIONARY.
1538 LIST.
1539 ])
1540   AT_CHECK([pspp -o pspp.csv sys-file.sps])
1541   AT_CHECK([cat pspp.csv], [0], [dnl
1542 Variable,Description,Position
1543 num1,Format: F8.0,1
1544 num2,Format: F8.0,2
1545 str4,Format: A4,3
1546 str8,Format: A8,4
1547 str15,Format: A15,5
1548
1549 Table: Data List
1550 num1,num2,str4,str8,str15
1551 -99,0,,abcdefgh,0123   @&t@
1552 .,151,jklm,nopqrstu,vwxyzABC       @&t@
1553 1,2,DEFG,HIJKLMNO,PQRSTUV
1554 ])
1555 done
1556 AT_CLEANUP
1557 \f
1558 AT_BANNER([system file reader - negative])
1559
1560 AT_SETUP([no variables])
1561 AT_KEYWORDS([sack synthetic system file negative])
1562 AT_DATA([sys-file.sack], [dnl
1563 dnl File header.
1564 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1565 2; dnl Layout code
1566 0; dnl Nominal case size (empty)
1567 0; dnl Not compressed
1568 0; dnl Not weighted
1569 0; dnl 0 cases.
1570 100.0; dnl Bias.
1571 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
1572 i8 0 *3;
1573
1574 dnl Character encoding record.
1575 7; 20; 1; 12; "windows-1252";
1576
1577 dnl Dictionary termination record.
1578 999; 0;
1579 ])
1580 for variant in be le; do
1581   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1582   AT_DATA([sys-file.sps], [dnl
1583 GET FILE='sys-file.sav'.
1584 ])
1585   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
1586 sys-file.sps:1: error: GET: `sys-file.sav': Data file dictionary has no variables.
1587 ])
1588
1589   dnl At one point pspp-convert would hang forever if there were no variables,
1590   dnl so check against regression.
1591   AT_CHECK([pspp-convert sys-file.sav sys-file.txt])
1592   AT_CHECK([cat sys-file.txt], [0], [
1593 ])
1594 done
1595 AT_CLEANUP
1596
1597 AT_SETUP([unspecified character encoding])
1598 AT_KEYWORDS([sack synthetic system file positive])
1599 AT_DATA([sys-file.sack], [dnl
1600 dnl File header.
1601 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1602 2; dnl Layout code
1603 4; dnl Nominal case size
1604 0; dnl Not compressed
1605 0; dnl Not weighted
1606 0; dnl No cases.
1607 100.0; dnl Bias.
1608 "01 Jan 11"; "20:53:52";
1609 "PSPP synthetic test file: "; i8 244; i8 245; i8 246; i8 248; s34 "";
1610 i8 0 *3;
1611
1612 dnl Numeric variables.
1613 2; 0; 0; 0; 0x050800 *2; s8 "A";
1614 2; 0; 0; 0; 0x050800 *2; s8 "B";
1615 2; 0; 0; 0; 0x050800 *2; s8 "C";
1616 2; 0; 0; 0; 0x050800 *2; s8 "D";
1617
1618 dnl Dictionary termination record.
1619 999; 0;
1620 ])
1621 for variant in be le; do
1622   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1623   AT_DATA([sys-file.sps], [dnl
1624 GET 'sys-file.sav'.
1625 ])
1626   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [stdout])
1627   AT_CHECK([sed 's/default encoding.*For/default encoding.  For/' stdout], [0], [dnl
1628 "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."
1629 ])
1630 done
1631 AT_CLEANUP
1632
1633 AT_SETUP([misplaced type 4 record])
1634 AT_KEYWORDS([sack synthetic system file negative])
1635 AT_DATA([sys-file.sack], [dnl
1636 dnl File header.
1637 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1638 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1639
1640 dnl Numeric variable.
1641 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1642
1643 dnl Type 4 record.
1644 >>4<<;
1645 ])
1646 for variant in be le; do
1647   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1648   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1649 ])
1650   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
1651    [error: `sys-file.sav' near offset 0xd4: Misplaced type 4 record.
1652 ])
1653 done
1654 AT_CLEANUP
1655
1656 AT_SETUP([bad record type])
1657 AT_KEYWORDS([sack synthetic system file negative])
1658 AT_DATA([sys-file.sack], [dnl
1659 dnl File header.
1660 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1661 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1662
1663 dnl Numeric variable.
1664 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1665
1666 dnl Type 8 record (not a valid type).
1667 >>8<<;
1668 ])
1669 for variant in be le; do
1670   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1671   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1672 ])
1673   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
1674    [error: `sys-file.sav' near offset 0xd4: Unrecognized record type 8.
1675 ])
1676 done
1677 AT_CLEANUP
1678
1679 AT_SETUP([wrong number of variable positions])
1680 AT_KEYWORDS([sack synthetic system file negative])
1681 AT_DATA([sys-file.sack], [dnl
1682 dnl File header.
1683 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1684 2; >>2<<; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1685
1686 dnl Numeric variable.
1687 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1688
1689 dnl Character encoding record.
1690 7; 20; 1; 12; "windows-1252";
1691
1692 dnl End of dictionary.
1693 999; 0;
1694 ])
1695 for variant in be le; do
1696   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1697   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1698 ])
1699   AT_CHECK([pspp -O format=csv sys-file.sps], [0], 
1700    [warning: `sys-file.sav': File header claims 2 variable positions but 1 were read from file.
1701 ])
1702 done
1703 AT_CLEANUP
1704
1705 AT_SETUP([variable name may not begin with `#'])
1706 AT_KEYWORDS([sack synthetic system file negative])
1707 AT_DATA([sys-file.sack], [dnl
1708 dnl File header.
1709 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1710 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1711
1712 dnl Numeric variable.
1713 2; 0; 0; 0; 0x050800 *2; s8 >>"$UM1"<<;
1714
1715 dnl Character encoding record.
1716 7; 20; 1; 12; "windows-1252";
1717
1718 dnl End of dictionary.
1719 999; 0;
1720 ])
1721 for variant in be le; do
1722   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1723   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1724 ])
1725   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
1726    [error: `sys-file.sav' near offset 0xb4: Invalid variable name `$UM1'.
1727 ])
1728 done
1729 AT_CLEANUP
1730
1731 AT_SETUP([variable name may not be reserved word])
1732 AT_KEYWORDS([sack synthetic system file negative])
1733 AT_DATA([sys-file.sack], [dnl
1734 dnl File header.
1735 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1736 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1737
1738 dnl Numeric variable.
1739 2; 0; 0; 0; 0x050800 *2; s8 >>"TO"<<;
1740
1741 dnl Character encoding record.
1742 7; 20; 1; 12; "windows-1252";
1743
1744 dnl End of dictionary.
1745 999; 0;
1746 ])
1747 for variant in be le; do
1748   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1749   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1750 ])
1751   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
1752    [error: `sys-file.sav' near offset 0xb4: Invalid variable name `TO'.
1753 ])
1754 done
1755 AT_CLEANUP
1756
1757 AT_SETUP([variable width must be between 0 and 255])
1758 AT_KEYWORDS([sack synthetic system file negative])
1759 AT_DATA([sys-file.sack], [dnl
1760 dnl File header.
1761 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1762 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1763
1764 dnl String variable with invalid width 256.
1765 2; 256; 0; 0; 0x050800 *2; s8 "VAR1";
1766
1767 dnl Character encoding record.
1768 7; 20; 1; 12; "windows-1252";
1769
1770 dnl End of dictionary.
1771 999; 0;
1772 ])
1773 for variant in be le; do
1774   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1775   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1776 ])
1777   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
1778    [error: `sys-file.sav' near offset 0xb4: Bad width 256 for variable VAR1.
1779 ])
1780 done
1781 AT_CLEANUP
1782
1783 dnl SPSS-generated system file can contain duplicate variable names
1784 dnl (see bug #41475).
1785 AT_SETUP([duplicate variable name])
1786 AT_KEYWORDS([sack synthetic system file negative])
1787 AT_DATA([sys-file.sack], [dnl
1788 dnl File header.
1789 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1790 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1791
1792 dnl Numeric variables.
1793 2; 0; 0; 0; 0x050800 *2; s8 "VAR1";
1794 2; 0; 0; 0; 0x050800 *2; s8 "VAR1";
1795
1796 dnl Character encoding record.
1797 7; 20; 1; 12; "windows-1252";
1798
1799 dnl End of dictionary.
1800 999; 0;
1801 ])
1802 for variant in be le; do
1803   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1804   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1805 DISPLAY DICTIONARY.
1806 ])
1807   AT_CHECK([pspp -O format=csv sys-file.sps], [0],
1808    [warning: `sys-file.sav' near offset 0xd4: Renaming variable with duplicate name `VAR1' to `VAR001'.
1809
1810 Variable,Description,Position
1811 var1,Format: F8.0,1
1812 var001,Format: F8.0,2
1813 ])
1814 done
1815 AT_CLEANUP
1816
1817 AT_SETUP([variable label indicator not 0 or 1])
1818 AT_KEYWORDS([sack synthetic system file negative])
1819 AT_DATA([sys-file.sack], [dnl
1820 dnl File header.
1821 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1822 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1823
1824 dnl Numeric variable.
1825 2; 0; >>2<<; 0; 0x050800 *2; s8 "VAR1";
1826
1827 dnl Character encoding record.
1828 7; 20; 1; 12; "windows-1252";
1829
1830 dnl End of dictionary.
1831 999; 0;
1832 ])
1833 for variant in be le; do
1834   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1835   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1836 ])
1837   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
1838    [error: `sys-file.sav' near offset 0xb4: Variable label indicator field is not 0 or 1.
1839 ])
1840 done
1841 AT_CLEANUP
1842
1843 AT_SETUP([invalid numeric missing value indicator])
1844 AT_KEYWORDS([sack synthetic system file negative])
1845 AT_DATA([sys-file.sack], [dnl
1846 dnl File header.
1847 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1848 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1849
1850 dnl Numeric variable.
1851 2; 0; 0; >>-1<<; 0x050800 *2; s8 "VAR1";
1852
1853 dnl Character encoding record.
1854 7; 20; 1; 12; "windows-1252";
1855
1856 dnl End of dictionary.
1857 999; 0;
1858 ])
1859 for variant in be le; do
1860   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1861   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1862 ])
1863   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
1864    ["error: `sys-file.sav' near offset 0xb4: Numeric missing value indicator field is not -3, -2, 0, 1, 2, or 3."
1865 ])
1866 done
1867 AT_CLEANUP
1868
1869 AT_SETUP([invalid string missing value indicator])
1870 AT_KEYWORDS([sack synthetic system file negative])
1871 AT_DATA([sys-file.sack], [dnl
1872 dnl File header.
1873 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1874 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1875
1876 dnl String variable.
1877 2; 8; 0; >>4<<; 0x010800 *2; s8 "VAR1";
1878
1879 dnl Character encoding record.
1880 7; 20; 1; 12; "windows-1252";
1881
1882 dnl End of dictionary.
1883 999; 0;
1884 ])
1885 for variant in be le; do
1886   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1887   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1888 ])
1889   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
1890    ["error: `sys-file.sav' near offset 0xb4: String missing value indicator field is not 0, 1, 2, or 3."
1891 ])
1892 done
1893 AT_CLEANUP
1894
1895 AT_SETUP([missing string continuation record])
1896 AT_KEYWORDS([sack synthetic system file negative])
1897 AT_DATA([sys-file.sack], [dnl
1898 dnl File header.
1899 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1900 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1901
1902 dnl String variable.
1903 2; 10; 0; 0; 0x010a00 *2; s8 "VAR1";
1904 >>2; 0; 0; 0; 0x050800 *2; s8 "VAR2";<<
1905
1906 dnl Character encoding record.
1907 7; 20; 1; 12; "windows-1252";
1908
1909 dnl End of dictionary.
1910 999; 0;
1911 ])
1912 for variant in be le; do
1913   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1914   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1915 ])
1916   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
1917    [error: `sys-file.sav' near offset 0xb4: Missing string continuation record.
1918 ])
1919 done
1920 AT_CLEANUP
1921
1922 AT_SETUP([invalid variable format])
1923 AT_KEYWORDS([sack synthetic system file negative])
1924 AT_DATA([sys-file.sack], [dnl
1925 dnl File header.
1926 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1927 2; 4; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1928
1929 dnl Numeric variable, invalid format types.
1930 dnl No warning is issued for type 0 because it has been observed in real
1931 dnl system files.
1932 2; 0; 0; 0; >>0xff0800; 0<<; s8 "NUM1";
1933
1934 dnl Numeric variable, string formats.
1935 2; 0; 0; 0; >>0x010800<<; >>0x021000<<; s8 "VAR1";
1936
1937 dnl String variable, numeric formats.
1938 2; 4; 0; 0; >>0x050800<<; >>0x110a01<<; s8 "STR1";
1939
1940 dnl String variable, wrong width formats.
1941 2; 4; 0; 0; >>0x010800<<; >>0x020400<<; s8 "STR2";
1942
1943 dnl Character encoding record.
1944 7; 20; 1; 12; "windows-1252";
1945
1946 dnl End of dictionary.
1947 999; 0;
1948 ])
1949 for variant in be le; do
1950   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1951   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1952 ])
1953   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
1954 warning: `sys-file.sav' near offset 0xc0: Variable NUM1 with width 0 has invalid print format 0xff0800.
1955
1956 warning: `sys-file.sav' near offset 0xe0: Variable VAR1 with width 0 has invalid print format 0x10800.
1957
1958 warning: `sys-file.sav' near offset 0xe4: Variable VAR1 with width 0 has invalid write format 0x21000.
1959
1960 warning: `sys-file.sav' near offset 0x100: Variable STR1 with width 4 has invalid print format 0x50800.
1961
1962 warning: `sys-file.sav' near offset 0x104: Variable STR1 with width 4 has invalid write format 0x110a01.
1963
1964 warning: `sys-file.sav' near offset 0x120: Variable STR2 with width 4 has invalid print format 0x10800.
1965
1966 warning: `sys-file.sav' near offset 0x124: Variable STR2 with width 4 has invalid write format 0x20400.
1967 ])
1968 done
1969 AT_CLEANUP
1970
1971 AT_SETUP([invalid long string missing values])
1972 AT_KEYWORDS([sack synthetic system file negative])
1973 AT_DATA([sys-file.sack], [dnl
1974 dnl File header.
1975 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1976 2; dnl Layout code
1977 7; dnl Nominal case size
1978 0; dnl Not compressed
1979 0; dnl Not weighted
1980 1; dnl 1 case.
1981 100.0; dnl Bias.
1982 "01 Jan 11"; "20:53:52";
1983 "PSPP synthetic test file: "; i8 244; i8 245; i8 246; i8 248; s34 "";
1984 i8 0 *3;
1985
1986 dnl One numeric variable.
1987 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1988
1989 dnl Long string variables that will have missing values added with a
1990 dnl later record.
1991 2; 9; 0; 0; 0x010900 *2; s8 "STR1";
1992 2; -1; 0; 0; 0; 0; s8 "";
1993 2; 10; 0; 0; 0x010a00 *2; s8 "STR2";
1994 2; -1; 0; 0; 0; 0; s8 "";
1995 2; 11; 0; 0; 0x010b00 *2; s8 "STR3";
1996 2; -1; 0; 0; 0; 0; s8 "";
1997
1998 dnl Machine integer info record.
1999 7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1252;
2000
2001 dnl Machine floating-point info record.
2002 7; 4; 8; 3; SYSMIS; HIGHEST; LOWEST;
2003
2004 dnl Long string variable missing values record.
2005 7; 22; 1; COUNT (
2006 dnl Zero missing values (not allowed) for STR1 .
2007 COUNT("STR1"); i8 >>0<<;
2008
2009 dnl Four missing values (not allowed) for STR2.
2010 COUNT("STR2"); i8 4;
2011 8; "abcdefgh"; 8; "ijklmnop"; 8; "qrstuvwx"; 8; "yz012345";
2012
2013 dnl Missing values for unknown variable
2014 COUNT(>>"Nonexistent"<<); i8 1; 8; "abcdefgh";
2015
2016 dnl Missing values for numeric variable
2017 COUNT(>>"NUM1"<<); i8 1; 8; "abcdefgh";
2018
2019 dnl Too long missing value
2020 COUNT("STR3"); i8 1; >>COUNT("abcdefghijkl")<<;
2021 );
2022
2023 dnl Character encoding record.
2024 7; 20; 1; 12; "windows-1252";
2025
2026 dnl Dictionary termination record.
2027 999; 0;
2028 s8 "abcd"; s8 "efgh"; s8 "ijkl"; s8 "mnop"; s8 "qrst"; s8 "uvwx";
2029 s16 "yzABCDEFGHI"; s16 "JKLMNOPQR"; s16 "STUVWXYZ01";
2030 s16 "23456789abc"; s32 "defghijklmnopqstuvwxyzABC";
2031 ])
2032
2033 for variant in be le; do
2034   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2035   AT_DATA([sys-file.sps], [dnl
2036 GET FILE='sys-file.sav'.
2037 DISPLAY DICTIONARY.
2038 ])
2039   AT_CHECK([pspp -O format=csv sys-file.sps], [0],
2040    ["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."
2041
2042 "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."
2043
2044 warning: `sys-file.sav' near offset 0x242: Ignoring long string missing value record for unknown variable Nonexistent.
2045
2046 warning: `sys-file.sav' near offset 0x257: Ignoring long string missing value record for numeric variable NUM1.
2047
2048 "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."
2049
2050 Variable,Description,Position
2051 num1,Format: F8.0,1
2052 str1,Format: A9,2
2053 str2,"Format: A10
2054 Missing Values: ""abcdefgh""; ""ijklmnop""; ""qrstuvwx""",3
2055 str3,Format: A11,4
2056 ])
2057 done
2058 AT_CLEANUP
2059
2060 AT_SETUP([weighting variable must be numeric])
2061 AT_KEYWORDS([sack synthetic system file negative])
2062 AT_DATA([sys-file.sack], [dnl
2063 dnl File header.
2064 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2065 2; 2; 1; >>2<<; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2066
2067 dnl Numeric variable.
2068 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2069
2070 dnl String variable.
2071 2; 4; 0; 0; 0x010400 *2; s8 "STR1";
2072
2073 dnl Character encoding record.
2074 7; 20; 1; 12; "windows-1252";
2075
2076 dnl End of dictionary.
2077 999; 0;
2078 ])
2079 for variant in be le; do
2080   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2081   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2082 DISPLAY DICTIONARY.
2083 ])
2084   AT_CHECK([pspp -O format=csv sys-file.sps], [0],
2085    [warning: `sys-file.sav': Ignoring string variable `STR1' set as weighting variable.
2086
2087 Variable,Description,Position
2088 num1,Format: F8.0,1
2089 str1,Format: A4,2
2090 ])
2091 done
2092 AT_CLEANUP
2093
2094 AT_SETUP([bad weighting variable index])
2095 AT_KEYWORDS([sack synthetic system file negative])
2096 AT_DATA([sys-file.sack], [dnl
2097 dnl File header.
2098 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2099 2; 2; 1; >>3<<; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2100
2101 dnl Numeric variable.
2102 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2103
2104 dnl String variable.
2105 2; 4; 0; 0; 0x010400 *2; s8 "STR1";
2106
2107 dnl Character encoding record.
2108 7; 20; 1; 12; "windows-1252";
2109
2110 dnl End of dictionary.
2111 999; 0;
2112 ])
2113 for variant in be le; do
2114   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2115   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2116 ])
2117   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
2118    [error: `sys-file.sav' near offset 0x4c: Variable index 3 not in valid range 1...2.
2119 ])
2120 done
2121 AT_CLEANUP
2122
2123 AT_SETUP([variable index is long string contination])
2124 AT_KEYWORDS([sack synthetic system file negative])
2125 AT_DATA([sys-file.sack], [dnl
2126 dnl File header.
2127 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2128 2; 3; 1; >>3<<; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2129
2130 dnl Numeric variable.
2131 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2132
2133 dnl Long string variable.
2134 2; 9; 0; 0; 0x010900 *2; s8 "STR1";
2135 (2; -1; 0; 0; 0; 0; s8 "");
2136
2137 dnl Character encoding record.
2138 7; 20; 1; 12; "windows-1252";
2139
2140 dnl End of dictionary.
2141 999; 0;
2142 ])
2143 for variant in be le; do
2144   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2145   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2146 ])
2147   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
2148    [error: `sys-file.sav' near offset 0x4c: Variable index 3 refers to long string continuation.
2149 ])
2150 done
2151 AT_CLEANUP
2152
2153 AT_SETUP([multiple documents records])
2154 AT_KEYWORDS([sack synthetic system file negative])
2155 AT_DATA([sys-file.sack], [dnl
2156 dnl File header.
2157 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2158 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2159
2160 dnl Numeric variable, no label or missing values.
2161 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2162
2163 dnl Two document records.
2164 (6; 1; s80 "One line of documents") >>* 2<<;
2165
2166 dnl Dictionary termination record.
2167 999; 0;
2168
2169 dnl Character encoding record.
2170 7; 20; 1; 12; "windows-1252";
2171
2172 dnl Data.
2173 1.0;
2174 ])
2175 for variant in be le; do
2176   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2177   AT_DATA([sys-file.sps], [dnl
2178 GET FILE='sys-file.sav'.
2179 ])
2180   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
2181 error: `sys-file.sav' near offset 0x12c: Duplicate type 6 (document) record.
2182 ])
2183 done
2184 AT_CLEANUP
2185
2186
2187 AT_SETUP([empty document record])
2188 AT_KEYWORDS([sack synthetic system file negative])
2189 AT_DATA([sys-file.sack], [dnl
2190 dnl File header.
2191 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2192 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2193
2194 dnl Numeric variable, no label or missing values.
2195 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2196
2197 dnl Empty document record.
2198 6; >>0<<;
2199
2200 dnl Dictionary termination record.
2201 999; 0;
2202
2203 dnl Data.
2204 1.0;
2205 ])
2206 for variant in be le; do
2207   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2208   AT_DATA([sys-file.sps], [dnl
2209 GET FILE='sys-file.sav'.
2210 ])
2211   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
2212 error: `sys-file.sav' near offset 0xd4: Number of document lines (0) must be greater than 0 and less than 26843545.
2213 ])
2214 done
2215 AT_CLEANUP
2216
2217 AT_SETUP([extension record too large])
2218 AT_KEYWORDS([sack synthetic system file negative])
2219 AT_DATA([sys-file.sack], [dnl
2220 dnl File header.
2221 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2222 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2223
2224 dnl Numeric variable, no label or missing values.
2225 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2226
2227 dnl Too-large extension record.
2228 7; 3; >>0xfffff000 * 2<<;
2229 ])
2230 for variant in be le; do
2231   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2232   AT_DATA([sys-file.sps], [dnl
2233 GET FILE='sys-file.sav'.
2234 ])
2235   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
2236 error: `sys-file.sav' near offset 0xd8: Record type 7 subtype 3 too large.
2237 ])
2238 done
2239 AT_CLEANUP
2240
2241 AT_SETUP([unknown extension record])
2242 AT_KEYWORDS([sack synthetic system file negative])
2243 AT_DATA([sys-file.sack], [dnl
2244 dnl File header.
2245 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2246 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2247
2248 dnl Numeric variable, no label or missing values.
2249 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2250
2251 dnl Unknown extension record type.
2252 7; 30; 1; 1; i8 0;
2253
2254 dnl Character encoding record.
2255 7; 20; 1; 12; "windows-1252";
2256
2257 dnl End of dictionary.
2258 999; 0;
2259 ])
2260 for variant in be le; do
2261   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2262   AT_DATA([sys-file.sps], [dnl
2263 GET FILE='sys-file.sav'.
2264 ])
2265   AT_CHECK_UNQUOTED([pspp -O format=csv sys-file.sps], [0], [dnl
2266 "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}."
2267 ])
2268 done
2269 AT_CLEANUP
2270
2271 AT_SETUP([bad machine integer info size])
2272 AT_KEYWORDS([sack synthetic system file negative])
2273 AT_DATA([sys-file.sack], [dnl
2274 dnl File header.
2275 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2276 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2277
2278 dnl Numeric variable, no label or missing values.
2279 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2280
2281 dnl Machine integer info record.
2282 7; 3; 4; >>9<<; 1; 2; 3; -1; 1; 1; ENDIAN; 1252; >>1234<<;
2283
2284 dnl Character encoding record.
2285 7; 20; 1; 12; "windows-1252";
2286
2287 dnl End of dictionary.
2288 999; 0;
2289 ])
2290 for variant in be le; do
2291   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2292   AT_DATA([sys-file.sps], [dnl
2293 GET FILE='sys-file.sav'.
2294 ])
2295   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2296 "warning: `sys-file.sav' near offset 0xd8: Record type 7, subtype 3 has bad count 9 (expected 8)."
2297 ])
2298 done
2299 AT_CLEANUP
2300
2301 AT_SETUP([bad machine integer info float format])
2302 AT_KEYWORDS([sack synthetic system file negative])
2303 AT_DATA([sys-file.sack], [dnl
2304 dnl File header.
2305 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2306 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2307
2308 dnl Numeric variable, no label or missing values.
2309 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2310
2311 dnl Machine integer info record.
2312 7; 3; 4; 8; 1; 2; 3; -1; >>2<<; 1; ENDIAN; 1252;
2313
2314 dnl Character encoding record.
2315 7; 20; 1; 12; "windows-1252";
2316
2317 dnl End of dictionary.
2318 999; 0;
2319 ])
2320 for variant in be le; do
2321   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2322   AT_DATA([sys-file.sps], [dnl
2323 GET FILE='sys-file.sav'.
2324 ])
2325   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
2326 error: `sys-file.sav' near offset 0xd8: Floating-point representation indicated by system file (2) differs from expected (1).
2327 ])
2328 done
2329 AT_CLEANUP
2330
2331 AT_SETUP([bad machine integer info endianness])
2332 AT_KEYWORDS([sack synthetic system file negative])
2333 AT_DATA([sys-file.sack], [dnl
2334 dnl File header.
2335 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2336 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2337
2338 dnl Numeric variable, no label or missing values.
2339 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2340
2341 dnl Machine integer info record.
2342 7; 3; 4; 8; 1; 2; 3; -1; 1; 1; >>3<<; 1252;
2343
2344 dnl Character encoding record.
2345 7; 20; 1; 12; "windows-1252";
2346
2347 dnl End of dictionary.
2348 999; 0;
2349 ])
2350 for variant in "be 1" "le 2"; do
2351   set $variant
2352   AT_CHECK([sack --$[1] sys-file.sack > sys-file.sav])
2353   AT_DATA([sys-file.sps], [dnl
2354 GET FILE='sys-file.sav'.
2355 DISPLAY DICTIONARY.
2356 ])
2357   AT_CHECK_UNQUOTED([pspp -O format=csv sys-file.sps], [0], [dnl
2358 warning: \`sys-file.sav' near offset 0xd8: Integer format indicated by system file (3) differs from expected ($[2]).
2359
2360 Variable,Description,Position
2361 num1,Format: F8.0,1
2362 ])
2363 done
2364 AT_CLEANUP
2365
2366
2367 AT_SETUP([bad machine floating-point info size])
2368 AT_KEYWORDS([sack synthetic system file negative])
2369 AT_DATA([sys-file.sack], [dnl
2370 dnl File header.
2371 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2372 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2373
2374 dnl Numeric variable, no label or missing values.
2375 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2376
2377 dnl Machine floating-point info record.
2378 7; 4; 8; >>4<<; SYSMIS; HIGHEST; LOWEST; 0.0;
2379
2380 dnl Character encoding record.
2381 7; 20; 1; 12; "windows-1252";
2382
2383 dnl End of dictionary.
2384 999; 0;
2385 ])
2386 for variant in be le; do
2387   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2388   AT_DATA([sys-file.sps], [dnl
2389 GET FILE='sys-file.sav'.
2390 ])
2391   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2392 "warning: `sys-file.sav' near offset 0xd8: Record type 7, subtype 4 has bad count 4 (expected 3)."
2393 ])
2394 done
2395 AT_CLEANUP
2396
2397 AT_SETUP([wrong special floating point values])
2398 AT_KEYWORDS([sack synthetic system file negative])
2399 AT_DATA([sys-file.sack], [dnl
2400 dnl File header.
2401 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2402 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2403
2404 dnl Numeric variable, no label or missing values.
2405 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2406
2407 dnl Machine floating-point info record.
2408 7; 4; 8; 3; >>0.0<<; >>1.0<<; >>2.0<<;
2409
2410 dnl Character encoding record.
2411 7; 20; 1; 12; "windows-1252";
2412
2413 dnl End of dictionary.
2414 999; 0;
2415 ])
2416 for variant in be le; do
2417   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2418   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2419 ])
2420   AT_CHECK([pspp -O format=csv sys-file.sps | sed 's/ [(].*/.../'], [0], [dnl
2421 "warning: `sys-file.sav' near offset 0xd8: File specifies unexpected value 0...
2422
2423 "warning: `sys-file.sav' near offset 0xd8: File specifies unexpected value 1...
2424
2425 "warning: `sys-file.sav' near offset 0xd8: File specifies unexpected value 2...
2426 ])
2427 done
2428 AT_CLEANUP
2429
2430 AT_SETUP([bad mrsets name])
2431 AT_KEYWORDS([sack synthetic system file negative multiple response])
2432 AT_DATA([sys-file.sack], [dnl
2433 dnl File header.
2434 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2435 2; dnl Layout code
2436 16; dnl Nominal case size
2437 0; dnl Not compressed
2438 0; dnl Not weighted
2439 0; dnl No cases.
2440 100.0; dnl Bias.
2441 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
2442 i8 0 *3;
2443
2444 dnl $a
2445 2; 0; 0; 0; 0x050800 *2; i8 0x82; i8 0xa0; s6 "";
2446 2; 0; 0; 0; 0x050800 *2; s8 "B";
2447 2; 0; 0; 0; 0x050800 *2; s8 "C";
2448
2449 dnl $b
2450 2; 0; 0; 0; 0x050800 *2; s8 "D";
2451 2; 0; 0; 0; 0x050800 *2; s8 "E";
2452 2; 0; 0; 0; 0x050800 *2; s8 "F";
2453 2; 0; 0; 0; 0x050800 *2; s8 "G";
2454
2455 dnl $c
2456 2; 4; 0; 0; 0x010400 *2; s8 "H";
2457 2; 4; 0; 0; 0x010400 *2; s8 "I";
2458 2; 4; 0; 0; 0x010400 *2; s8 "J";
2459
2460 dnl $d
2461 2; 0; 0; 0; 0x050800 *2; s8 "K";
2462 2; 0; 0; 0; 0x050800 *2; s8 "L";
2463 2; 0; 0; 0; 0x050800 *2; s8 "M";
2464
2465 dnl $e
2466 2; 6; 0; 0; 0x010600 *2; s8 "N";
2467 2; 6; 0; 0; 0x010600 *2; s8 "O";
2468 2; 6; 0; 0; 0x010600 *2; s8 "P";
2469
2470 dnl Machine integer info record.
2471 7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 932;
2472
2473 7; 7; 1;
2474 COUNT(
2475   "$a=C 10 my mcgroup "; i8 0x82; i8 0xa0; " b c"; i8 10;
2476   "b=D2 55 0  g e f d"; i8 10;
2477   "$c=D4 "; i8 0x82; i8 0xcd; i8 0x82; i8 0xa2; " 10 mdgroup #2 h i j"; i8 10);
2478
2479 7; 19; 1;
2480 COUNT(
2481   "$d=E 1 2 34 13 third mdgroup k l m"; i8 10;
2482   "e=E 11 6 choice 0  n o p"; i8 10);
2483
2484 dnl Character encoding record.
2485 7; 20; 1; 9; "shift_jis";
2486
2487 dnl Dictionary termination record.
2488 999; 0;
2489 ])
2490 for variant in be le; do
2491   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2492   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2493 MRSETS /DISPLAY NAME=ALL.
2494 ])
2495   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2496 warning: `sys-file.sav': Multiple response set name `b' does not begin with `$'.
2497
2498 warning: `sys-file.sav': Multiple response set name `e' does not begin with `$'.
2499
2500 Table: Multiple Response Sets
2501 Name,Variables,Details
2502 $a,"あ
2503 b
2504 c
2505 ","Multiple category set
2506 Label: my mcgroup
2507 "
2508 $c,"h
2509 i
2510 j
2511 ","Multiple dichotomy set
2512 Label: mdgroup #2
2513 Label source: Provided by user
2514 Counted value: `はい'
2515 Category label source: Variable labels
2516 "
2517 $d,"k
2518 l
2519 m
2520 ","Multiple dichotomy set
2521 Label: third mdgroup
2522 Label source: Provided by user
2523 Counted value: 34
2524 Category label source: Value labels of counted value
2525 "
2526 ])
2527 done
2528 AT_CLEANUP
2529
2530 AT_SETUP([missing space after C in mrsets])
2531 AT_KEYWORDS([sack synthetic system file negative multiple response])
2532 AT_DATA([sys-file.sack], [dnl
2533 dnl File header.
2534 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2535 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2536
2537 dnl Numeric variable, no label or missing values.
2538 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2539
2540 dnl Multiple response sets.
2541 7; 7; 1; COUNT("$a=Cx");
2542
2543 dnl Character encoding record.
2544 7; 20; 1; 12; "windows-1252";
2545
2546 999; 0;
2547 ])
2548 for variant in be le; do
2549   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2550   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2551 ])
2552   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2553 warning: `sys-file.sav' near offset 0xd8: Missing space following `C' at offset 4 in MRSETS record.
2554 ])
2555 done
2556 AT_CLEANUP
2557
2558 AT_SETUP([missing space after E in mrsets])
2559 AT_KEYWORDS([sack synthetic system file negative multiple response])
2560 AT_DATA([sys-file.sack], [dnl
2561 dnl File header.
2562 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2563 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2564
2565 dnl Numeric variable, no label or missing values.
2566 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2567
2568 dnl Multiple response sets.
2569 7; 7; 1; COUNT("$a=Ex");
2570
2571 dnl Character encoding record.
2572 7; 20; 1; 12; "windows-1252";
2573
2574 999; 0;
2575 ])
2576 for variant in be le; do
2577   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2578   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2579 ])
2580   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2581 warning: `sys-file.sav' near offset 0xd8: Missing space following `E' at offset 4 in MRSETS record.
2582 ])
2583 done
2584 AT_CLEANUP
2585
2586 AT_SETUP([unexpected label source in mrsets])
2587 AT_KEYWORDS([sack synthetic system file negative multiple response])
2588 AT_DATA([sys-file.sack], [dnl
2589 dnl File header.
2590 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2591 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2592
2593 dnl Numeric variable, no label or missing values.
2594 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2595
2596 dnl Multiple response sets.
2597 7; 7; 1; COUNT("$a=E 2");
2598
2599 dnl Character encoding record.
2600 7; 20; 1; 12; "windows-1252";
2601
2602 999; 0;
2603 ])
2604 for variant in be le; do
2605   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2606   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2607 ])
2608   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2609 warning: `sys-file.sav' near offset 0xd8: Unexpected label source value following `E' at offset 7 in MRSETS record.
2610
2611 warning: `sys-file.sav' near offset 0xd8: Expecting digit at offset 7 in MRSETS record.
2612 ])
2613 done
2614 AT_CLEANUP
2615
2616 AT_SETUP([bad type character in mrsets])
2617 AT_KEYWORDS([sack synthetic system file negative multiple response])
2618 AT_DATA([sys-file.sack], [dnl
2619 dnl File header.
2620 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2621 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2622
2623 dnl Numeric variable, no label or missing values.
2624 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2625
2626 dnl Multiple response sets.
2627 7; 7; 1; COUNT("$a=");
2628
2629 dnl Character encoding record.
2630 7; 20; 1; 12; "windows-1252";
2631
2632 999; 0;
2633 ])
2634 for variant in be le; do
2635   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2636   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2637 ])
2638   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2639 "warning: `sys-file.sav' near offset 0xd8: Missing `C', `D', or `E' at offset 3 in MRSETS record."
2640 ])
2641 done
2642 AT_CLEANUP
2643
2644 AT_SETUP([bad counted string length in mrsets])
2645 AT_KEYWORDS([sack synthetic system file negative multiple response])
2646 AT_DATA([sys-file.sack], [dnl
2647 dnl File header.
2648 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2649 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2650
2651 dnl Numeric variable, no label or missing values.
2652 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2653
2654 dnl Multiple response sets.
2655 7; 7; 1; COUNT("$a=Dx");
2656
2657 dnl Character encoding record.
2658 7; 20; 1; 12; "windows-1252";
2659
2660 999; 0;
2661 ])
2662 for variant in be le; do
2663   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2664   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2665 ])
2666   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2667 warning: `sys-file.sav' near offset 0xd8: Expecting digit at offset 4 in MRSETS record.
2668 ])
2669 done
2670 AT_CLEANUP
2671
2672 AT_SETUP([missing space in counted string in mrsets])
2673 AT_KEYWORDS([sack synthetic system file negative multiple response])
2674 AT_DATA([sys-file.sack], [dnl
2675 dnl File header.
2676 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2677 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2678
2679 dnl Numeric variable, no label or missing values.
2680 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2681
2682 dnl Multiple response sets.
2683 7; 7; 1; COUNT("$a=D1x");
2684
2685 dnl Character encoding record.
2686 7; 20; 1; 12; "windows-1252";
2687
2688 999; 0;
2689 ])
2690 for variant in be le; do
2691   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2692   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2693 ])
2694   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2695 warning: `sys-file.sav' near offset 0xd8: Expecting space at offset 5 in MRSETS record.
2696 ])
2697 done
2698 AT_CLEANUP
2699
2700 AT_SETUP([counted string too long in mrsets])
2701 AT_KEYWORDS([sack synthetic system file negative multiple response])
2702 AT_DATA([sys-file.sack], [dnl
2703 dnl File header.
2704 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2705 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2706
2707 dnl Numeric variable, no label or missing values.
2708 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2709
2710 dnl Multiple response sets.
2711 7; 7; 1; COUNT("$a=D4 abc");
2712
2713 dnl Character encoding record.
2714 7; 20; 1; 12; "windows-1252";
2715
2716 999; 0;
2717 ])
2718 for variant in be le; do
2719   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2720   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2721 ])
2722   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2723 warning: `sys-file.sav' near offset 0xd8: 4-byte string starting at offset 6 exceeds record length 9.
2724 ])
2725 done
2726 AT_CLEANUP
2727
2728 AT_SETUP([missing space after counted string in mrsets])
2729 AT_KEYWORDS([sack synthetic system file negative multiple response])
2730 AT_DATA([sys-file.sack], [dnl
2731 dnl File header.
2732 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2733 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2734
2735 dnl Numeric variable, no label or missing values.
2736 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2737
2738 dnl Multiple response sets.
2739 7; 7; 1; COUNT("$a=D3 abcx");
2740
2741 dnl Character encoding record.
2742 7; 20; 1; 12; "windows-1252";
2743
2744 999; 0;
2745 ])
2746 for variant in be le; do
2747   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2748   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2749 ])
2750   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2751 warning: `sys-file.sav' near offset 0xd8: Expecting space at offset 9 following 3-byte string.
2752 ])
2753 done
2754 AT_CLEANUP
2755
2756 AT_SETUP([missing newline after variable name in mrsets])
2757 AT_KEYWORDS([sack synthetic system file negative multiple response])
2758 AT_DATA([sys-file.sack], [dnl
2759 dnl File header.
2760 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2761 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2762
2763 dnl Numeric variable, no label or missing values.
2764 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2765
2766 dnl Multiple response sets.
2767 7; 7; 1; COUNT("$a=C 0  NUM1");
2768
2769 dnl Character encoding record.
2770 7; 20; 1; 12; "windows-1252";
2771
2772 999; 0;
2773 ])
2774 for variant in be le; do
2775   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2776   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2777 ])
2778   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2779 warning: `sys-file.sav' near offset 0xd8: Missing new-line parsing variable names at offset 13 in MRSETS record.
2780
2781 warning: `sys-file.sav': MRSET $a has only one variable.
2782 ])
2783 done
2784 AT_CLEANUP
2785
2786 AT_SETUP([duplicate variable name in mrsets])
2787 AT_KEYWORDS([sack synthetic system file negative multiple response])
2788 AT_DATA([sys-file.sack], [dnl
2789 dnl File header.
2790 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2791 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2792
2793 dnl Numeric variable, no label or missing values.
2794 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2795
2796 dnl Multiple response sets.
2797 7; 7; 1; COUNT("$a=C 0  NUM1 NUM1"; i8 10);
2798
2799 dnl Character encoding record.
2800 7; 20; 1; 12; "windows-1252";
2801
2802 999; 0;
2803 ])
2804 for variant in be le; do
2805   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2806   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2807 ])
2808   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2809 warning: `sys-file.sav': MRSET $a contains duplicate variable name NUM1.
2810
2811 warning: `sys-file.sav': MRSET $a has only one variable.
2812 ])
2813 done
2814 AT_CLEANUP
2815
2816 AT_SETUP([mixed variable types in mrsets])
2817 AT_KEYWORDS([sack synthetic system file negative multiple response])
2818 AT_DATA([sys-file.sack], [dnl
2819 dnl File header.
2820 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2821 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2822
2823 dnl Variables.
2824 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2825 2; 8; 0; 0; 0x010800 *2; s8 "STR1";
2826
2827 dnl Multiple response sets.
2828 7; 7; 1; COUNT("$a=C 0  NUM1 STR1"; i8 10);
2829
2830 dnl Character encoding record.
2831 7; 20; 1; 12; "windows-1252";
2832
2833 999; 0;
2834 ])
2835 for variant in be le; do
2836   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2837   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2838 ])
2839   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2840 warning: `sys-file.sav': MRSET $a contains both string and numeric variables.
2841
2842 warning: `sys-file.sav': MRSET $a has only one variable.
2843 ])
2844 done
2845 AT_CLEANUP
2846
2847 AT_SETUP([missing newline after variable name in mrsets])
2848 AT_KEYWORDS([sack synthetic system file negative multiple response])
2849 AT_DATA([sys-file.sack], [dnl
2850 dnl File header.
2851 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2852 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2853
2854 dnl Numeric variable, no label or missing values.
2855 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2856
2857 dnl Multiple response sets.
2858 7; 7; 1; COUNT("$a=C 0  NUM1"; i8 10);
2859
2860 dnl Character encoding record.
2861 7; 20; 1; 12; "windows-1252";
2862
2863 999; 0;
2864 ])
2865 for variant in be le; do
2866   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2867   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2868 ])
2869   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2870 warning: `sys-file.sav': MRSET $a has only one variable.
2871 ])
2872 done
2873 AT_CLEANUP
2874
2875 AT_SETUP([zero or one variable in mrset])
2876 AT_KEYWORDS([sack synthetic system file negative multiple response])
2877 AT_DATA([sys-file.sack], [dnl
2878 dnl File header.
2879 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2880 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2881
2882 dnl Numeric variable, no label or missing values.
2883 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2884
2885 dnl Multiple response sets.
2886 7; 7; 1; COUNT("$a=C 0  NUM1"; i8 10; "$b=C 0  "; i8 10);
2887
2888 dnl Character encoding record.
2889 7; 20; 1; 12; "windows-1252";
2890
2891 999; 0;
2892 ])
2893 for variant in be le; do
2894   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2895   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2896 ])
2897   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2898 warning: `sys-file.sav': MRSET $a has only one variable.
2899
2900 warning: `sys-file.sav': MRSET $b has no variables.
2901 ])
2902 done
2903 AT_CLEANUP
2904
2905 AT_SETUP([wrong display parameter size])
2906 AT_KEYWORDS([sack synthetic system file negative])
2907 AT_DATA([sys-file.sack], [dnl
2908 dnl File header.
2909 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2910 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2911
2912 dnl Numeric variable, no label or missing values.
2913 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2914
2915 dnl Display parameters record.
2916 7; 11; >>8<<; 2; 1.0; 1.0;
2917
2918 dnl Character encoding record.
2919 7; 20; 1; 12; "windows-1252";
2920
2921 dnl End of dictionary.
2922 999; 0;
2923 ])
2924 for variant in be le; do
2925   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2926   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2927 ])
2928   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2929 "warning: `sys-file.sav' near offset 0xd8: Record type 7, subtype 11 has bad size 8 (expected 4)."
2930 ])
2931 done
2932 AT_CLEANUP
2933
2934 AT_SETUP([wrong display parameter count])
2935 AT_KEYWORDS([sack synthetic system file negative])
2936 AT_DATA([sys-file.sack], [dnl
2937 dnl File header.
2938 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2939 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2940
2941 dnl Numeric variable, no label or missing values.
2942 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2943
2944 dnl Display parameters record.
2945 7; 11; 4; >>4<<; 1; 1; 2; 2;
2946
2947 dnl Character encoding record.
2948 7; 20; 1; 12; "windows-1252";
2949
2950 dnl End of dictionary.
2951 999; 0;
2952 ])
2953 for variant in be le; do
2954   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2955   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2956 ])
2957   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2958 warning: `sys-file.sav' near offset 0xd8: Extension 11 has bad count 4 (for 1 variables).
2959 ])
2960 done
2961 AT_CLEANUP
2962
2963 AT_SETUP([wrong display measurement level])
2964 AT_KEYWORDS([sack synthetic system file negative])
2965 AT_DATA([sys-file.sack], [dnl
2966 dnl File header.
2967 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2968 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2969
2970 dnl Numeric variable, no label or missing values.
2971 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2972
2973 dnl Display parameters record.
2974 7; 11; 4; 2; >>4<<; 0;
2975
2976 dnl Character encoding record.
2977 7; 20; 1; 12; "windows-1252";
2978
2979 dnl End of dictionary.
2980 999; 0;
2981 ])
2982 for variant in be le; do
2983   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2984   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2985 ])
2986   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2987 warning: `sys-file.sav' near offset 0xd8: Invalid variable display parameters for variable 0 (NUM1).  Default parameters substituted.
2988 ])
2989 done
2990 AT_CLEANUP
2991
2992 AT_SETUP([wrong display alignment])
2993 AT_KEYWORDS([sack synthetic system file negative])
2994 AT_DATA([sys-file.sack], [dnl
2995 dnl File header.
2996 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2997 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2998
2999 dnl Numeric variable, no label or missing values.
3000 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3001
3002 dnl Display parameters record.
3003 7; 11; 4; 2; 1; >>-1<<;
3004
3005 dnl Character encoding record.
3006 7; 20; 1; 12; "windows-1252";
3007
3008 dnl End of dictionary.
3009 999; 0;
3010 ])
3011 for variant in be le; do
3012   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3013   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3014 ])
3015   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
3016 warning: `sys-file.sav' near offset 0xd8: Invalid variable display parameters for variable 0 (NUM1).  Default parameters substituted.
3017 ])
3018 done
3019 AT_CLEANUP
3020
3021 AT_SETUP([bad variable name in variable/value pair])
3022 AT_KEYWORDS([sack synthetic system file negative])
3023 AT_DATA([sys-file.sack], [dnl
3024 dnl File header.
3025 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3026 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3027
3028 dnl Numeric variables.
3029 2; 0; 0; 0; 0x050800 *2; s8 "LONGVARI";
3030
3031 dnl Long variable names.
3032 7; 13; 1; COUNT (>>"xyzzy"<<);
3033
3034 dnl Character encoding record.
3035 7; 20; 1; 12; "windows-1252";
3036
3037 dnl Dictionary termination record.
3038 999; 0;
3039 ])
3040 for variant in be le; do
3041   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3042   AT_DATA([sys-file.sps], [dnl
3043 GET FILE='sys-file.sav'.
3044 ])
3045   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
3046 warning: `sys-file.sav' near offset 0xde: Dictionary record refers to unknown variable xyzzy.
3047 ])
3048 done
3049 AT_CLEANUP
3050
3051 AT_SETUP([duplicate long variable name])
3052 AT_KEYWORDS([sack synthetic system file negative])
3053 AT_DATA([sys-file.sack], [dnl
3054 dnl File header.
3055 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3056 2; 4; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3057
3058 dnl Numeric variables.
3059 2; 0; 0; 0; 0x050800 *2; s8 "LONGVARI";
3060 2; 0; 0; 0; 0x050800 *2; s8 "LONGVA_A";
3061 2; 0; 0; 0; 0x050800 *2; s8 "LONGVA_B";
3062 2; 0; 0; 0; 0x050800 *2; s8 "LONGVA_C";
3063
3064 dnl Long variable names.
3065 7; 13; 1; COUNT (
3066 "LONGVARI=_Invalid"; i8 9;
3067 "LONGVARI=$Invalid"; i8 9;
3068 "LONGVARI=#Invalid"; i8 9;
3069 "LONGVA_A=LongVariableName"; i8 9;
3070 "LONGVA_B=LONGVARIABLENAME"; i8 9;
3071 );
3072
3073 dnl Character encoding record.
3074 7; 20; 1; 12; "windows-1252";
3075
3076 dnl Dictionary termination record.
3077 999; 0;
3078 ])
3079 for variant in be le; do
3080   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3081   AT_DATA([sys-file.sps], [dnl
3082 GET FILE='sys-file.sav'.
3083 ])
3084   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
3085 warning: `sys-file.sav' near offset 0x138: Long variable mapping from LONGVARI to invalid variable name `_Invalid'.
3086
3087 warning: `sys-file.sav' near offset 0x138: Long variable mapping from LONGVARI to invalid variable name `$Invalid'.
3088
3089 warning: `sys-file.sav' near offset 0x138: Long variable mapping from LONGVARI to invalid variable name `#Invalid'.
3090
3091 warning: `sys-file.sav' near offset 0x138: Duplicate long variable name `LONGVARIABLENAME'.
3092 ])
3093 done
3094 AT_CLEANUP
3095
3096 AT_SETUP([bad very long string length])
3097 AT_KEYWORDS([sack synthetic system file negative])
3098 AT_DATA([sys-file.sack], [dnl
3099 dnl File header.
3100 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3101 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3102
3103 dnl Numeric variable.
3104 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3105
3106 dnl Very long string map.
3107 7; 14; 1; COUNT (
3108 "NUM1=00000"; i8 0; i8 9;
3109 "NUM1=00255"; i8 0; i8 9;
3110 "NUM1=00256"; i8 0; i8 9;
3111 );
3112
3113 dnl Character encoding record.
3114 7; 20; 1; 12; "windows-1252";
3115
3116 dnl Dictionary termination record.
3117 999; 0;
3118 ])
3119 for variant in be le; do
3120   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3121   AT_DATA([sys-file.sps], [dnl
3122 GET FILE='sys-file.sav'.
3123 ])
3124   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
3125 warning: `sys-file.sav' near offset 0xd8: NUM1 listed as string of invalid length 00000 in very long string record.
3126
3127 "warning: `sys-file.sav' near offset 0xd8: NUM1 listed in very long string record with width 00255, which requires only one segment."
3128
3129 error: `sys-file.sav' near offset 0xd8: Very long string NUM1 overflows dictionary.
3130 ])
3131 done
3132 AT_CLEANUP
3133
3134 AT_SETUP([bad very long string segment width])
3135 AT_KEYWORDS([sack synthetic system file negative])
3136 AT_DATA([sys-file.sack], [dnl
3137 dnl File header.
3138 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3139 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3140
3141 dnl Variables.
3142 2; 255; 0; 0; 0x01ff00 *2; s8 "STR1";
3143 (2; -1; 0; 0; 0; 0; s8 "") * 31;
3144 2; >>9<<; 0; 0; 0x010900 *2; s8 "STR1_A";
3145 >>2; -1; 0; 0; 0; 0; s8 "";<<
3146
3147 dnl Very long string map.
3148 7; 14; 1; COUNT (
3149 "STR1=00256"; i8 0; i8 9;
3150 );
3151
3152 dnl Character encoding record.
3153 7; 20; 1; 12; "windows-1252";
3154
3155 dnl Dictionary termination record.
3156 999; 0;
3157 ])
3158 for variant in be le; do
3159   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3160   AT_DATA([sys-file.sps], [dnl
3161 GET FILE='sys-file.sav'.
3162 ])
3163   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
3164 error: `sys-file.sav' near offset 0x4f8: Very long string with width 256 has segment 1 of width 9 (expected 4).
3165 ])
3166 done
3167 AT_CLEANUP
3168
3169 AT_SETUP([too many value labels])
3170 AT_KEYWORDS([sack synthetic system file negative])
3171 AT_DATA([sys-file.sack], [dnl
3172 dnl File header.
3173 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3174 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3175
3176 dnl Numeric variable.
3177 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3178 3; >>0x7fffffff<<;
3179 ])
3180 for variant in be le; do
3181   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3182   AT_DATA([sys-file.sps], [dnl
3183 GET FILE='sys-file.sav'.
3184 ])
3185   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
3186 error: `sys-file.sav' near offset 0xd4: Invalid number of labels 2147483647.
3187 ])
3188 done
3189 AT_CLEANUP
3190
3191 AT_SETUP([missing type 4 record])
3192 AT_KEYWORDS([sack synthetic system file negative])
3193 AT_DATA([sys-file.sack], [dnl
3194 dnl File header.
3195 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3196 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3197
3198 dnl Numeric variable.
3199 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3200
3201 dnl Value label with missing type 4 record.
3202 3; 1; 1.0; i8 3; s7 "one";
3203
3204 dnl Character encoding record.
3205 7; 20; 1; 12; "windows-1252";
3206
3207 dnl End of dictionary.
3208 >>999; 0<<;
3209 ])
3210 for variant in be le; do
3211   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3212   AT_DATA([sys-file.sps], [dnl
3213 GET FILE='sys-file.sav'.
3214 ])
3215   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
3216 error: `sys-file.sav' near offset 0xe8: Variable index record (type 4) does not immediately follow value label record (type 3) as it should.
3217 ])
3218 done
3219 AT_CLEANUP
3220
3221 AT_SETUP([value label with no associated variables])
3222 AT_KEYWORDS([sack synthetic system file negative])
3223 AT_DATA([sys-file.sack], [dnl
3224 dnl File header.
3225 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3226 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3227
3228 dnl Numeric variable.
3229 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3230
3231 dnl Value label with no variables.
3232 3; 1; 1.0; i8 3; s7 "one"; 4; >>0<<;
3233 ])
3234 for variant in be le; do
3235   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3236   AT_DATA([sys-file.sps], [dnl
3237 GET FILE='sys-file.sav'.
3238 ])
3239   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
3240 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).
3241 ])
3242 done
3243 AT_CLEANUP
3244
3245 AT_SETUP([type 4 record names long string variable])
3246 AT_KEYWORDS([sack synthetic system file negative])
3247 AT_DATA([sys-file.sack], [dnl
3248 dnl File header.
3249 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3250 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3251
3252 dnl Long string variable.
3253 2; 9; 0; 0; 0x010900 *2; s8 "STR1";
3254 2; -1; 0; 0; 0; 0; s8 "";
3255
3256 dnl Value label that names long string variable.
3257 3; 1; s8 "xyzzy"; i8 3; s7 "one"; 4; 1; >>1<<;
3258
3259 dnl Character encoding record.
3260 7; 20; 1; 12; "windows-1252";
3261
3262 dnl End of dictionary.
3263 999; 0;
3264 ])
3265 for variant in be le; do
3266   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3267   AT_DATA([sys-file.sps], [dnl
3268 GET FILE='sys-file.sav'.
3269 ])
3270   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
3271 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.
3272 ])
3273 done
3274 AT_CLEANUP
3275
3276 AT_SETUP([variables for value label must all be same type])
3277 AT_KEYWORDS([sack synthetic system file negative])
3278 AT_DATA([sys-file.sack], [dnl
3279 dnl File header.
3280 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3281 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3282
3283 dnl Variables.
3284 2; 6; 0; 0; 0x010600 *2; s8 "STR1";
3285 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3286
3287 dnl Value label that names numeric and string variables.
3288 3; 1; s8 "xyzzy"; i8 3; s7 "one"; 4; 2; >>1; 2<<;
3289
3290 dnl Character encoding record.
3291 7; 20; 1; 12; "windows-1252";
3292
3293 dnl End of dictionary.
3294 999; 0;
3295 ])
3296 for variant in be le; do
3297   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3298   AT_DATA([sys-file.sps], [dnl
3299 GET FILE='sys-file.sav'.
3300 ])
3301   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
3302 "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."
3303 ])
3304 done
3305 AT_CLEANUP
3306
3307 AT_SETUP([duplicate value labels type])
3308 AT_KEYWORDS([sack synthetic system file negative])
3309 AT_DATA([sys-file.sack], [dnl
3310 dnl File header.
3311 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3312 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3313
3314 dnl Variables.
3315 2; 6; 0; 0; 0x010600 *2; s8 "STR1";
3316 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3317
3318 dnl Duplicate value labels.
3319 3; 1; s8 "xyzzy"; i8 3; s7 "one"; 4; 2; >>1; 1<<;
3320 3; 1; 1.0; i8 3; s7 "one"; 4; 2; >>2; 2<<;
3321
3322 dnl Character encoding record.
3323 7; 20; 1; 12; "windows-1252";
3324
3325 dnl End of dictionary.
3326 999; 0;
3327 ])
3328 for variant in be le; do
3329   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3330   AT_DATA([sys-file.sps], [dnl
3331 GET FILE='sys-file.sav'.
3332 ])
3333   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
3334 warning: `sys-file.sav' near offset 0xf4: Duplicate value label for `xyzzy ' on STR1.
3335
3336 warning: `sys-file.sav' near offset 0x11c: Duplicate value label for 1 on NUM1.
3337 ])
3338 done
3339 AT_CLEANUP
3340
3341 AT_SETUP([missing attribute value])
3342 AT_KEYWORDS([sack synthetic system file negative])
3343 AT_DATA([sys-file.sack], [dnl
3344 dnl File header.
3345 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3346 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3347
3348 dnl Variables.
3349 2; 0; 0; 0; 0x050800 *2; s8 "FIRSTVAR";
3350
3351 dnl Data file attributes record.
3352 7; 17; 1; COUNT (
3353 "Attr1("
3354 );
3355
3356 dnl Variable attributes record.
3357 7; 18; 1; COUNT (
3358 "FIRSTVAR:";
3359   "fred('23'"; i8 10
3360 );
3361
3362 dnl Character encoding record.
3363 7; 20; 1; 12; "windows-1252";
3364
3365 dnl Dictionary termination record.
3366 999; 0;
3367 ])
3368 for variant in be le; do
3369   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3370   AT_DATA([sys-file.sps], [dnl
3371 GET FILE='sys-file.sav'.
3372 ])
3373   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
3374 warning: `sys-file.sav' near offset 0xde: Error parsing attribute value Attr1[[1]].
3375
3376 warning: `sys-file.sav' near offset 0x101: Error parsing attribute value fred[[2]].
3377 ])
3378 done
3379 AT_CLEANUP
3380
3381 AT_SETUP([unquoted attribute value])
3382 AT_KEYWORDS([sack synthetic system file negative])
3383 AT_DATA([sys-file.sack], [dnl
3384 dnl File header.
3385 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3386 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3387
3388 dnl Variables.
3389 2; 0; 0; 0; 0x050800 *2; s8 "FIRSTVAR";
3390
3391 dnl Data file attributes record.
3392 7; 17; 1; COUNT (
3393 "Attr1(value"; i8 10;
3394 ")"
3395 );
3396
3397 dnl Variable attributes record.
3398 7; 18; 1; COUNT (
3399 "FIRSTVAR:";
3400   "fred(23"; i8 10; ")"
3401 );
3402
3403 dnl Character encoding record.
3404 7; 20; 1; 12; "windows-1252";
3405
3406 dnl Dictionary termination record.
3407 999; 0;
3408 ])
3409 for variant in be le; do
3410   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3411   AT_DATA([sys-file.sps], [dnl
3412 GET FILE='sys-file.sav'.
3413 ])
3414   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
3415 warning: `sys-file.sav' near offset 0xe4: Attribute value Attr1[[1]] is not quoted: value.
3416
3417 warning: `sys-file.sav' near offset 0x106: Attribute value fred[[1]] is not quoted: 23.
3418 ])
3419 done
3420 AT_CLEANUP
3421
3422 AT_SETUP([bad variable name in long string value label])
3423 AT_KEYWORDS([sack synthetic system file negative])
3424 AT_DATA([sys-file.sack], [dnl
3425 dnl File header.
3426 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3427 2; 3; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3428
3429 dnl Variables.
3430 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3431 2; 14; 0; 0; 0x010e00 *2; s8 "STR14";
3432 2; -1; 0; 0; 0; 0; s8 "";
3433
3434 7; 21; 1; COUNT (
3435 dnl No variable named STR9.
3436 COUNT(>>"STR9"<<); 9;
3437 1; COUNT("RSTUVWXYZ"); COUNT("value label for `RSTUVWXYZ'");
3438
3439 dnl NUM1 is numeric.
3440 COUNT(>>"NUM1"<<); 0;
3441 1; COUNT("xyz"); COUNT("value label for 1.0");
3442
3443 dnl Wrong width for STR14.
3444 COUNT("STR14"); >>9<<;
3445 1; COUNT("RSTUVWXYZ"); COUNT("value label for `RSTUVWXYZ'");
3446
3447 dnl Wrong width for value.
3448 COUNT("STR14"); 14;
3449 1; COUNT(>>"RSTUVWXYZ"<<); COUNT("value label for `RSTUVWXYZ'");
3450
3451 dnl Duplicate value label.
3452 COUNT("STR14"); 14; 2;
3453 COUNT("abcdefghijklmn"); COUNT("value label for `abcdefghijklmn'");
3454 >>COUNT("abcdefghijklmn"); COUNT("another value label for `abcdefghijklmn'")<<;
3455 );
3456
3457 dnl Character encoding record.
3458 7; 20; 1; 12; "windows-1252";
3459
3460 dnl Dictionary termination record.
3461 999; 0;
3462 ])
3463 for variant in be le; do
3464   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3465   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3466 ])
3467   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
3468 warning: `sys-file.sav' near offset 0x128: Ignoring long string value label record for unknown variable STR9.
3469
3470 warning: `sys-file.sav' near offset 0x164: Ignoring long string value label record for numeric variable NUM1.
3471
3472 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).
3473
3474 "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."
3475
3476 warning: `sys-file.sav' near offset 0x259: Duplicate value label for `abcdefghijklmn' on str14.
3477 ])
3478 done
3479 AT_CLEANUP
3480
3481 AT_SETUP([fewer data records than indicated by file header])
3482 AT_KEYWORDS([sack synthetic system file negative])
3483 AT_DATA([sys-file.sack], [dnl
3484 dnl File header.
3485 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3486 2; 2; 0; 0; >>5<<; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3487
3488 dnl Numeric variables.
3489 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3490 2; 0; 0; 0; 0x050800 *2; s8 "NUM2";
3491
3492 dnl Character encoding record.
3493 7; 20; 1; 12; "windows-1252";
3494
3495 dnl Data.
3496 999; 0;
3497 1.0; 2.0;
3498 3.0; 4.0;
3499 5.0; 6.0;
3500 7.0; 8.0;
3501 dnl Missing record here.
3502 ])
3503 for variant in be le; do
3504   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3505   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3506 LIST.
3507 ])
3508   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
3509    [error: Error reading case from file `sys-file.sav'.
3510
3511 Table: Data List
3512 num1,num2
3513 1,2
3514 3,4
3515 5,6
3516 7,8
3517 ])
3518 done
3519 AT_CLEANUP
3520
3521 AT_SETUP([partial data record between variables])
3522 AT_KEYWORDS([sack synthetic system file negative])
3523 AT_DATA([sys-file.sack], [dnl
3524 dnl File header.
3525 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3526 2; 2; 0; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3527
3528 dnl Numeric variables.
3529 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3530 2; 0; 0; 0; 0x050800 *2; s8 "NUM2";
3531
3532 dnl Character encoding record.
3533 7; 20; 1; 12; "windows-1252";
3534
3535 dnl Data.
3536 999; 0;
3537 1.0; 2.0;
3538 3.0;
3539 ])
3540 for variant in be le; do
3541   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3542   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3543 LIST.
3544 ])
3545   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
3546    [error: `sys-file.sav' near offset 0x12c: File ends in partial case.
3547
3548 Table: Data List
3549 num1,num2
3550 1,2
3551 ])
3552 done
3553 AT_CLEANUP
3554
3555 AT_SETUP([partial data record within long string])
3556 AT_KEYWORDS([sack synthetic system file negative])
3557 AT_DATA([sys-file.sack], [dnl
3558 dnl File header.
3559 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3560 2; 2; 0; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3561
3562 dnl Numeric variables.
3563 2; 14; 0; 0; 0x010e00 *2; s8 "STR14";
3564 2; -1; 0; 0; 0; 0; s8 "";
3565
3566 dnl Character encoding record.
3567 7; 20; 1; 12; "windows-1252";
3568
3569 dnl Data.
3570 999; 0;
3571 s14 "one data item";
3572 s8 "partial";
3573 ])
3574 for variant in be le; do
3575   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3576   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3577 LIST.
3578 ])
3579   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
3580    [error: `sys-file.sav' near offset 0x12a: Unexpected end of file.
3581
3582 Table: Data List
3583 str14
3584 one data item @&t@
3585 ])
3586 done
3587 AT_CLEANUP
3588
3589 AT_SETUP([partial compressed data record])
3590 AT_KEYWORDS([sack synthetic system file positive])
3591 AT_DATA([sys-file.sack], [dnl
3592 dnl File header.
3593 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3594 2; dnl Layout code
3595 6; dnl Nominal case size
3596 1; dnl Compressed
3597 0; dnl Not weighted 
3598 -1; dnl Unspecified number of cases.
3599 100.0; dnl Bias.
3600 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
3601 i8 0 *3;
3602
3603 dnl Numeric variables.
3604 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3605 2; 0; 0; 0; 0x050800 *2; s8 "NUM2";
3606
3607 dnl String variable.
3608 2; 4; 0; 0; 0x010400 *2; s8 "STR4";
3609 2; 8; 0; 0; 0x010800 *2; s8 "STR8";
3610 2; 15; 0; 0; 0x010f00 *2; s8 "STR15";
3611 2; -1; 0; 0; 0; 0; s8 "";
3612
3613 dnl Character encoding record.
3614 7; 20; 1; 12; "windows-1252";
3615
3616 dnl Dictionary termination record.
3617 999; 0;
3618
3619 dnl Compressed data.
3620 i8 1 100 254 253 254 253; i8 255 251; "abcdefgh"; s8 "0123";
3621 ])
3622 for variant in be le; do
3623   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3624   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3625 LIST.
3626 ])
3627   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
3628    [error: `sys-file.sav' near offset 0x1ac: File ends in partial case.
3629
3630 Table: Data List
3631 num1,num2,str4,str8,str15
3632 -99,0,,abcdefgh,0123   @&t@
3633 ])
3634 done
3635 AT_CLEANUP
3636
3637 AT_SETUP([zcompressed data - bad zheader_ofs])
3638 AT_KEYWORDS([sack synthetic system file negative zlib])
3639 zcompressed_sack | sed 's/.*zheader_ofs.*/>>i64 0<<;/' > sys-file.sack
3640 for variant in be le; do
3641   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3642   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3643 ])
3644   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).
3645 ])
3646 done
3647 AT_CLEANUP
3648
3649 AT_SETUP([zcompressed data - bad ztrailer_ofs])
3650 AT_KEYWORDS([sack synthetic system file negative zlib])
3651 zcompressed_sack | sed 's/.*ztrailer_ofs.*/>>i64 0<<;/' > sys-file.sack
3652 for variant in be le; do
3653   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3654   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3655 ])
3656   AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x194: Impossible ZLIB trailer offset 0x0.
3657 ])
3658 done
3659 AT_CLEANUP
3660
3661 # ztrailer_len must be a multiple of 24 and at least 48,
3662 # so a value of 12 is impossible.
3663 AT_SETUP([zcompressed data - invalid ztrailer_len])
3664 AT_KEYWORDS([sack synthetic system file negative zlib])
3665 zcompressed_sack | sed 's/.*ztrailer_len.*/>>i64 12<<;/' > sys-file.sack
3666 for variant in be le; do
3667   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3668   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3669 ])
3670   AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x194: Invalid ZLIB trailer length 12.
3671 ])
3672 done
3673 AT_CLEANUP
3674
3675 # ztrailer_ofs + ztrailer_len must be the file size.
3676 AT_SETUP([zcompressed data - wrong ztrailer_len])
3677 AT_KEYWORDS([sack synthetic system file negative zlib])
3678 zcompressed_sack | sed 's/.*ztrailer_len.*/>>i64 72<<;/' > 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], [warning: `sys-file.sav' near offset 0x1ac: End of ZLIB trailer (0x24d) is not file size (0x235).
3684 error: `sys-file.sav' near offset 0x21d: 72-byte ZLIB trailer specifies 1 data blocks (expected 2).
3685 ])
3686 done
3687 AT_CLEANUP
3688
3689 AT_SETUP([zcompressed data - wrong ztrailer_bias])
3690 AT_KEYWORDS([sack synthetic system file negative zlib])
3691 zcompressed_sack | sed 's/.*ztrailer_bias.*/>>i64 0<<;/' > 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], [error: `sys-file.sav' near offset 0x20d: ZLIB trailer bias (0) differs from file header bias (100.00).
3697 ])
3698 done
3699 AT_CLEANUP
3700
3701 AT_SETUP([zcompressed data - wrong ztrailer_zero])
3702 AT_KEYWORDS([sack synthetic system file negative zlib])
3703 zcompressed_sack | sed 's/.*ztrailer_zero.*/>>i64 100<<;/' > sys-file.sack
3704 for variant in be le; do
3705   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3706   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3707 ])
3708   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.
3709 ])
3710 done
3711 AT_CLEANUP
3712
3713 AT_SETUP([zcompressed data - wrong block_size])
3714 AT_KEYWORDS([sack synthetic system file negative zlib])
3715 zcompressed_sack | sed 's/.*block_size.*/>>0x1000<<;/' > sys-file.sack
3716 for variant in be le; do
3717   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3718   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3719 ])
3720   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.
3721 ])
3722 done
3723 AT_CLEANUP
3724
3725 AT_SETUP([zcompressed data - wrong n_blocks])
3726 AT_KEYWORDS([sack synthetic system file negative zlib])
3727 zcompressed_sack | sed 's/.*n_blocks.*/>>2<<;/' > sys-file.sack
3728 for variant in be le; do
3729   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3730   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3731 ])
3732   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).
3733 ])
3734 done
3735 AT_CLEANUP
3736
3737 AT_SETUP([zcompressed data - wrong uncompressed_ofs])
3738 AT_KEYWORDS([sack synthetic system file negative zlib])
3739 zcompressed_sack | sed 's/.*uncompressed_ofs.*/i64 >>0x177<<;/' > sys-file.sack
3740 for variant in be le; do
3741   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3742   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3743 ])
3744   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.
3745 ])
3746 done
3747 AT_CLEANUP
3748
3749 AT_SETUP([zcompressed data - wrong compressed_ofs])
3750 AT_KEYWORDS([sack synthetic system file negative zlib])
3751 zcompressed_sack | sed 's/.*@%:@ compressed_ofs.*/i64 >>0x191<<;/' > sys-file.sack
3752 for variant in be le; do
3753   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3754   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3755 ])
3756   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.
3757 ])
3758 done
3759 AT_CLEANUP
3760
3761 AT_SETUP([zcompressed data - compressed sizes don't add up])
3762 AT_KEYWORDS([sack synthetic system file negative zlib])
3763 AT_DATA([sys-file.sack], [dnl
3764 dnl File header.
3765 "$FL3"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3766 2; dnl Layout code
3767 6; dnl Nominal case size
3768 2; dnl zlib compressed
3769 0; dnl Not weighted
3770 -1; dnl Unspecified number of cases.
3771 100.0; dnl Bias.
3772 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
3773 i8 0 *3;
3774
3775 dnl Numeric variables.
3776 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3777 2; 0; 0; 0; 0x050800 *2; s8 "NUM2";
3778
3779 dnl String variable.
3780 2; 4; 0; 0; 0x010400 *2; s8 "STR4";
3781 2; 8; 0; 0; 0x010800 *2; s8 "STR8";
3782 2; 15; 0; 0; 0x010f00 *2; s8 "STR15";
3783 2; -1; 0; 0; 0; 0; s8 "";
3784
3785 dnl Character encoding record.
3786 7; 20; 1; 12; "windows-1252";
3787
3788 dnl Dictionary termination record.
3789 999; 0;
3790
3791 dnl ZLIB data header.
3792 i64 0x194;    # zheader_ofs
3793 i64 0x1ac;    # ztrailer_ofs
3794 i64 72;       # ztrailer_len
3795
3796 dnl This is where the ZLIB data blocks would go, but we don't need any to
3797 dnl provoke this message so we omit them.
3798
3799 dnl ZLIB data trailer fixed header:
3800 i64 -100;     # ztrailer_bias
3801 i64 0;        # ztrailer_zero
3802 0x3ff000;     # block_size
3803 2;            # n_blocks
3804
3805 dnl ZLIB block descriptor 1:
3806 i64 0x194;    # uncompressed_ofs
3807 i64 0x1ac;    # compressed_ofs
3808 0x100000;     # uncompressed_size
3809 0x12345;      # compressed_size
3810
3811 dnl ZLIB block descriptor 2:
3812 i64 0x100194; # uncompressed_ofs
3813 i64 0x12421;  # compressed_ofs
3814 0x100000;     # uncompressed_size
3815 0x12345;      # compressed_size
3816 ])
3817 for variant in be le; do
3818   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3819   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3820 ])
3821   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.
3822 error: `sys-file.sav' near offset 0x1dc: ZLIB block descriptor 1 reported compressed data offset 0x12421, when 0x124f1 was expected.
3823 ])
3824 done
3825 AT_CLEANUP
3826
3827 AT_SETUP([zcompressed data - uncompressed_size > block_size])
3828 AT_KEYWORDS([sack synthetic system file negative zlib])
3829 zcompressed_sack | sed 's/.*uncompressed_size.*/>>0x400000<<;/' > sys-file.sack
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], [0], [warning: `sys-file.sav' near offset 0x21d: ZLIB block descriptor 0 reported block size 0x400000, when at most 0x3ff000 was expected.
3835 ])
3836 done
3837 AT_CLEANUP
3838
3839 AT_SETUP([zcompressed data - compression expands data too much])
3840 AT_KEYWORDS([sack synthetic system file negative zlib])
3841 zcompressed_sack | sed 's/.*uncompressed_size.*/>>50<<;/
3842 s/.*@%:@ compressed_size.*/>>100<<;/' > 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], [1], [error: `sys-file.sav' near offset 0x21d: ZLIB block descriptor 0 reports compressed size 100 and uncompressed size 50.
3848 ])
3849 done
3850 AT_CLEANUP
3851
3852 AT_SETUP([zcompressed data - compressed sizes don't add up])
3853 AT_KEYWORDS([sack synthetic system file negative zlib])
3854 zcompressed_sack | sed 's/.*@%:@ compressed_size.*/>>88<<;/' > sys-file.sack
3855 for variant in be le; do
3856   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3857   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3858 ])
3859   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.
3860 ])
3861 done
3862 AT_CLEANUP