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