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