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