lexer: Reimplement for better testability and internationalization.
[pspp-builds.git] / tests / data / sys-file-reader.at
1 AT_BANNER([system file reader - positive])
2
3 AT_SETUP([variable labels and missing values])
4 AT_KEYWORDS([sack synthetic system file positive])
5 AT_DATA([sys-file.sack], [dnl
6 dnl File header.
7 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
8 2; dnl Layout code
9 22; dnl Nominal case size
10 0; dnl Not compressed
11 0; dnl Not weighted 
12 1; dnl 1 case.
13 100.0; dnl Bias.
14 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
15 i8 0 *3;
16
17 dnl Numeric variable, no label or missing values.
18 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
19
20 dnl Numeric variable, variable label.
21 2; 0; 1; 0; 0x050800 *2; s8 "NUM2";
22 26; "Numeric variable 2's label"; i8 0 *2;
23
24 dnl Numeric variable, one missing value.
25 2; 0; 0; 1; 0x050800 *2; s8 "NUM3";
26 1.0;
27
28 dnl Numeric variable, variable label and missing value.
29 2; 0; 1; 1; 0x050800 *2; s8 "NUM4";
30 30; "Another numeric variable label"; i8 0 * 2;
31 1.0;
32
33 dnl Numeric variable, two missing values.
34 2; 0; 0; 2; 0x050800 *2; s8 "NUM5"; 1.0; 2.0;
35
36 dnl Numeric variable, three missing values.
37 2; 0; 0; 3; 0x050800 *2; s8 "NUM6"; 1.0; 2.0; 3.0;
38
39 dnl Numeric variable, range of missing values.
40 2; 0; 0; -2; 0x050800 *2; s8 "NUM7"; 1.0; 3.0;
41
42 dnl Numeric variables, range of missing values plus discrete value.
43 2; 0; 0; -3; 0x050800 *2; s8 "NUM8"; 1.0; 3.0; 5.0;
44 2; 0; 0; -3; 0x050800 *2; s8 "NUM9"; 1.0; HIGHEST; -5.0;
45 2; 0; 0; -3; 0x050800 *2; s8 "NUM10"; LOWEST; 1.0; 5.0;
46
47 dnl String variable, no label or missing values.
48 2; 4; 0; 0; 0x010400 *2; s8 "STR1";
49
50 dnl String variable, variable label.
51 2; 4; 1; 0; 0x010400 *2; s8 "STR2";
52 25; "String variable 2's label"; i8 0 * 3;
53
54 dnl String variable, one missing value.
55 2; 4; 0; 1; 0x010400 *2; s8 "STR3"; s8 "MISS";
56
57 dnl String variable, variable label and missing value.
58 2; 4; 1; 1; 0x010400 *2; s8 "STR4";
59 29; "Another string variable label"; i8 0 * 3;
60 s8 "OTHR";
61
62 dnl String variable, two missing values.
63 2; 4; 0; 2; 0x010400 *2; s8 "STR5"; s8 "MISS"; s8 "OTHR";
64
65 dnl String variable, three missing values.
66 2; 4; 0; 3; 0x010400 *2; s8 "STR6"; s8 "MISS"; s8 "OTHR"; s8 "MORE";
67
68 dnl Long string variable, one missing value.
69 2; 11; 0; 1; 0x010b00 *2; s8 "STR7"; "first8by";
70 2; -1; 0; 0; 0; 0; s8 "";
71
72 dnl Long string variable, value label.
73 2; 25; 1; 0; 0x011900 *2; s8 "STR8"; 14; "25-byte string"; i8 0 * 2;
74 ( 2; -1; 0; 0; 0; 0; s8 ""; ) * 2;
75 dnl Variable label fields on continuation records have been spotted in system
76 dnl files created by "SPSS Power Macintosh Release 6.1".
77 2; -1; 1; 0; 0; 0; s8 ""; 20; "dummy variable label";
78
79 dnl Machine integer info record.
80 7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1252;
81
82 dnl Machine floating-point info record.
83 7; 4; 8; 3; SYSMIS; HIGHEST; LOWEST;
84
85 dnl Character encoding record.
86 7; 20; 1; 12; "windows-1252";
87
88 dnl Dictionary termination record.
89 999; 0;
90
91 dnl Data.
92 1.0; 2.0; 3.0; 4.0; 5.0; 6.0; 7.0; 8.0; 9.0; 10.0;
93 s8 "abcd"; s8 "efgh"; s8 "ijkl"; s8 "mnop"; s8 "qrst"; s8 "uvwx";
94 s16 "yzABCDEFGHI"; s32 "JKLMNOPQRSTUVWXYZ01234567";
95 ])
96 for variant in \
97         "be e07ee28eaf7bceca017e83e9fd46be3c" \
98         "le c357aa20227c856b8a80d1b840722da1"
99 do
100   set $variant
101   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
102 ])
103   AT_DATA([sys-file.sps], [dnl
104 GET FILE='sys-file.sav'.
105 DISPLAY DICTIONARY.
106 LIST.
107 ])
108   AT_CHECK([pspp -o pspp.csv sys-file.sps])
109   AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl
110 Variable,Description,,Position
111 num1,Format: F8.0,,1
112 num2,Numeric variable 2's label,,2
113 ,Format: F8.0,,
114 num3,Format: F8.0,,3
115 ,Missing Values: 1,,
116 num4,Another numeric variable label,,4
117 ,Format: F8.0,,
118 ,Missing Values: 1,,
119 num5,Format: F8.0,,5
120 ,Missing Values: 1; 2,,
121 num6,Format: F8.0,,6
122 ,Missing Values: 1; 2; 3,,
123 num7,Format: F8.0,,7
124 ,Missing Values: 1 THRU 3,,
125 num8,Format: F8.0,,8
126 ,Missing Values: 1 THRU 3; 5,,
127 num9,Format: F8.0,,9
128 ,Missing Values: 1 THRU HIGHEST; -5,,
129 num10,Format: F8.0,,10
130 ,Missing Values: LOWEST THRU 1; 5,,
131 str1,Format: A4,,11
132 str2,String variable 2's label,,12
133 ,Format: A4,,
134 str3,Format: A4,,13
135 ,"Missing Values: ""MISS""",,
136 str4,Another string variable label,,14
137 ,Format: A4,,
138 ,"Missing Values: ""OTHR""",,
139 str5,Format: A4,,15
140 ,"Missing Values: ""MISS""; ""OTHR""",,
141 str6,Format: A4,,16
142 ,"Missing Values: ""MISS""; ""OTHR""; ""MORE""",,
143 str7,Format: A11,,17
144 ,"Missing Values: ""first8by""",,
145 str8,25-byte string,,18
146 ,Format: A25,,
147
148 Table: Data List
149 num1,num2,num3,num4,num5,num6,num7,num8,num9,num10,str1,str2,str3,str4,str5,str6,str7,str8
150 1,2,3,4,5,6,7,8,9,10,abcd,efgh,ijkl,mnop,qrst,uvwx,yzABCDEFGHI,JKLMNOPQRSTUVWXYZ01234567
151 ])
152 done
153 AT_CLEANUP
154
155 AT_SETUP([unspecified number of variable positions])
156 AT_KEYWORDS([sack synthetic system file positive])
157 AT_DATA([sys-file.sack], [dnl
158 dnl File header.
159 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
160 2; dnl Layout code
161 -1; dnl Nominal case size (unspecified)
162 0; dnl Not compressed
163 0; dnl Not weighted 
164 1; dnl 1 case.
165 100.0; dnl Bias.
166 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
167 i8 0 *3;
168
169 dnl Numeric variable, no label or missing values.
170 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
171
172 dnl Numeric variable, variable label.
173 2; 0; 1; 0; 0x050800 *2; s8 "NUM2";
174 26; "Numeric variable 2's label"; i8 0 *2;
175
176 dnl Dictionary termination record.
177 999; 0;
178
179 dnl Data.
180 1.0; 2.0; 
181 ])
182 for variant in \
183         "be 413e7bc80a47fcd7e4c8020e8e120060" \
184         "le d7db9120b1ff28c83aa6fe9fc405d903"
185 do
186   set $variant
187   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
188 ])
189   AT_DATA([sys-file.sps], [dnl
190 GET FILE='sys-file.sav'.
191 DISPLAY DICTIONARY.
192 LIST.
193 ])
194   AT_CHECK([pspp -o pspp.csv sys-file.sps])
195   AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl
196 Variable,Description,,Position
197 num1,Format: F8.0,,1
198 num2,Numeric variable 2's label,,2
199 ,Format: F8.0,,
200
201 Table: Data List
202 num1,num2
203 1,2
204 ])
205 done
206 AT_CLEANUP
207
208 AT_SETUP([wrong number of variable positions but version 13])
209 AT_KEYWORDS([sack synthetic system file positive])
210 AT_DATA([sys-file.sack], [dnl
211 dnl File header.
212 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
213 2; dnl Layout code
214 -1; dnl Nominal case size (unspecified)
215 0; dnl Not compressed
216 0; dnl Not weighted 
217 1; dnl 1 case.
218 100.0; dnl Bias.
219 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
220 i8 0 *3;
221
222 dnl Numeric variable, no label or missing values.
223 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
224
225 dnl Numeric variable, variable label.
226 2; 0; 1; 0; 0x050800 *2; s8 "NUM2";
227 26; "Numeric variable 2's label"; i8 0 *2;
228
229 dnl Machine integer info record (SPSS 13).
230 7; 3; 4; 8; 13; 2; 3; -1; 1; 1; ENDIAN; 1252;
231
232 dnl Dictionary termination record.
233 999; 0;
234
235 dnl Data.
236 1.0; 2.0; 
237 ])
238 for variant in \
239         "be 3d17aae7d99538dc73c5cb42692b1038" \
240         "le 8ad1000df598617d5258f323c882d749"
241 do
242   set $variant
243   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
244 ])
245   AT_DATA([sys-file.sps], [dnl
246 GET FILE='sys-file.sav'.
247 DISPLAY DICTIONARY.
248 LIST.
249 ])
250   AT_CHECK([pspp -o pspp.csv sys-file.sps])
251   AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl
252 Variable,Description,,Position
253 num1,Format: F8.0,,1
254 num2,Numeric variable 2's label,,2
255 ,Format: F8.0,,
256
257 Table: Data List
258 num1,num2
259 1,2
260 ])
261 done
262 AT_CLEANUP
263
264 AT_SETUP([value labels])
265 AT_KEYWORDS([sack synthetic system file positive])
266 AT_DATA([sys-file.sack], [dnl
267 dnl File header.
268 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
269 2; dnl Layout code
270 22; dnl Nominal case size
271 0; dnl Not compressed
272 0; dnl Not weighted 
273 1; dnl 1 case.
274 100.0; dnl Bias.
275 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
276 i8 0 *3;
277
278 dnl Numeric variables.
279 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
280 2; 0; 0; 0; 0x050800 *2; s8 "NUM2";
281 2; 0; 0; 0; 0x050800 *2; s8 "NUM3";
282 2; 0; 0; 0; 0x050800 *2; s8 "NUM4";
283 2; 0; 0; 0; 0x050800 *2; s8 "NUM5";
284
285 dnl String variables.
286 2; 1; 0; 0; 0x010100 *2; s8 "STR1"; dnl index 6
287 2; 2; 0; 0; 0x010200 *2; s8 "STR2"; dnl index 7
288 2; 3; 0; 0; 0x010300 *2; s8 "STR3"; dnl index 8
289 2; 4; 0; 0; 0x010400 *2; s8 "STR4"; dnl index 9
290 2; 4; 0; 0; 0x010400 *2; s8 "STR5"; dnl index 10
291 2; 6; 0; 0; 0x010600 *2; s8 "STR6"; dnl index 11
292 2; 7; 0; 0; 0x010700 *2; s8 "STR7"; dnl index 12
293 2; 8; 0; 0; 0x010800 *2; s8 "STR8"; dnl index 13
294 2; 9; 0; 0; 0x010900 *2; s8 "STR9"; dnl index 14
295 2; -1; 0; 0; 0; 0; s8 "";
296 2; 12; 0; 0; 0x010c00 *2; s8 "STR12"; dnl index 16
297 2; -1; 0; 0; 0; 0; s8 "";
298 2; 16; 0; 0; 0x011000 *2; s8 "STR16"; dnl index 18
299 2; -1; 0; 0; 0; 0; s8 "";
300 2; 17; 0; 0; 0x011100 *2; s8 "STR17"; dnl index 20
301 ( 2; -1; 0; 0; 0; 0; s8 ""; ) * 2;
302
303 dnl One value label for NUM1.
304 3; 1; 1.0; i8 3; s7 "one"; 4; 1; 1;
305
306 dnl Two value labels for NUM2, as a single pair of type 3 and type 4 records.
307 3; 2; 1.0; i8 3; s7 "one"; 2.0; i8 3; s7 "two"; 4; 1; 2;
308
309 dnl Two value labels for NUM3, as two pairs of type 3 and type 4 records.
310 3; 1; 3.0; i8 5; s7 "three"; 4; 1; 3;
311 3; 1; 4.0; i8 4; s7 "four"; 4; 1; 3;
312
313 dnl Two common value labels for NUM4 and NUM5, plus two different ones for each.
314 3; 1; 5.0; i8 4; s7 "five"; 4; 1; 4;
315 3; 1; 6.0; i8 3; s7 "six"; 4; 1; 5;
316 3; 2; 7.0; i8 5; s7 "seven"; 8.0; i8 5; s7 "eight"; 4; 2; 4; 5;
317 3; 1; 9.0; i8 4; s7 "nine"; 4; 1; 4;
318 3; 1; 10.0; i8 3; s7 "ten"; 4; 1; 5;
319
320 dnl One value label for STR1.
321 3; 1; s8 "a"; i8 19; s23 "value label for `a'"; 4; 1; 6;
322
323 dnl Two value labels for STR2, as a single pair of type 3 and type 4 records.
324 3; 2;
325 s8 "bc"; i8 20; s23 "value label for `bc'";
326 s8 "de"; i8 20; s23 "value label for `de'";
327 4; 1; 7;
328
329 dnl Two value labels for STR3, as two pairs of type 3 and type 4 records.
330 3; 1; s8 "fgh"; i8 21; s23 "value label for `fgh'"; 4; 1; 8;
331 3; 1; s8 "ijk"; i8 21; s23 "value label for `ijk'"; 4; 1; 8;
332
333 dnl Two common value labels for STR4 and STR5, plus two different ones for each.
334 3; 1; s8 "lmno"; i8 22; s23 "value label for `lmno'"; 4; 1; 9;
335 3; 1; s8 "pqrs"; i8 22; s23 "value label for `pqrs'"; 4; 1; 10;
336 3; 2;
337 s8 "tuvw"; i8 22; s23 "value label for `tuvw'";
338 s8 "xyzA"; i8 22; s23 "value label for `xyzA'";
339 4; 2; 9; 10;
340 3; 1; s8 "BCDE"; i8 22; s23 "value label for `BCDE'"; 4; 1; 9;
341 3; 1; s8 "FGHI"; i8 22; s23 "value label for `FGHI'"; 4; 1; 10;
342
343 dnl One value label for STR6, STR7, STR8.
344 3; 1; s8 "JKLMNO"; i8 24; s31 "value label for `JKLMNO'"; 4; 1; 11;
345 3; 1; s8 "JKLMNOP"; i8 25; s31 "value label for `JKLMNOP'"; 4; 1; 12;
346 3; 1; s8 "JKLMNOPQ"; i8 26; s31 "value label for `JKLMNOPQ'"; 4; 1; 13;
347
348 7; 21; 1; COUNT (
349 dnl One value label for STR9,
350 COUNT("STR9"); 9; 1; COUNT("RSTUVWXYZ"); COUNT("value label for `RSTUVWXYZ'");
351
352 dnl Two value labels for STR12.
353 COUNT("STR12"); 12; 2;
354 COUNT("0123456789ab"); COUNT("value label for `0123456789ab'");
355 COUNT("cdefghijklmn"); COUNT("value label for `cdefghijklmn'");
356
357 dnl Three value labels for STR16.
358 COUNT("STR16"); 16; 3;
359 COUNT("opqrstuvwxyzABCD"); COUNT("value label for `opqrstuvwxyzABCD'");
360 COUNT("EFGHIJKLMNOPQRST"); COUNT("value label for `EFGHIJKLMNOPQRST'");
361 COUNT("UVWXYZ0123456789"); COUNT("value label for `UVWXYZ0123456789'");
362
363 dnl One value label for STR17.
364 COUNT("STR17"); 17; 1;
365 COUNT("abcdefghijklmnopq"); COUNT("value label for `abcdefghijklmnopq'");
366 );
367
368 dnl Dictionary termination record.
369 999; 0;
370 ])
371 for variant in \
372         "be 1de55cc9fb523c8f9b014cdc5387c12b" \
373         "le 76a6974012df7351b591c5964c41e582"
374 do
375   set $variant
376   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
377 ])
378   AT_DATA([sys-file.sps], [dnl
379 GET FILE='sys-file.sav'.
380 DISPLAY DICTIONARY.
381 ])
382   AT_CHECK([pspp -o pspp.csv sys-file.sps])
383   AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl
384 Variable,Description,,Position
385 num1,Format: F8.0,,1
386 ,1,one,
387 num2,Format: F8.0,,2
388 ,1,one,
389 ,2,two,
390 num3,Format: F8.0,,3
391 ,3,three,
392 ,4,four,
393 num4,Format: F8.0,,4
394 ,5,five,
395 ,7,seven,
396 ,8,eight,
397 ,9,nine,
398 num5,Format: F8.0,,5
399 ,6,six,
400 ,7,seven,
401 ,8,eight,
402 ,10,ten,
403 str1,Format: A1,,6
404 ,a,value label for `a',
405 str2,Format: A2,,7
406 ,bc,value label for `bc',
407 ,de,value label for `de',
408 str3,Format: A3,,8
409 ,fgh,value label for `fgh',
410 ,ijk,value label for `ijk',
411 str4,Format: A4,,9
412 ,BCDE,value label for `BCDE',
413 ,lmno,value label for `lmno',
414 ,tuvw,value label for `tuvw',
415 ,xyzA,value label for `xyzA',
416 str5,Format: A4,,10
417 ,FGHI,value label for `FGHI',
418 ,pqrs,value label for `pqrs',
419 ,tuvw,value label for `tuvw',
420 ,xyzA,value label for `xyzA',
421 str6,Format: A6,,11
422 ,JKLMNO,value label for `JKLMNO',
423 str7,Format: A7,,12
424 ,JKLMNOP,value label for `JKLMNOP',
425 str8,Format: A8,,13
426 ,JKLMNOPQ,value label for `JKLMNOPQ',
427 str9,Format: A9,,14
428 ,RSTUVWXYZ,value label for `RSTUVWXYZ',
429 str12,Format: A12,,15
430 ,0123456789ab,value label for `0123456789ab',
431 ,cdefghijklmn,value label for `cdefghijklmn',
432 str16,Format: A16,,16
433 ,EFGHIJKLMNOPQRST,value label for `EFGHIJKLMNOPQRST',
434 ,UVWXYZ0123456789,value label for `UVWXYZ0123456789',
435 ,opqrstuvwxyzABCD,value label for `opqrstuvwxyzABCD',
436 str17,Format: A17,,17
437 ,abcdefghijklmnopq,value label for `abcdefghijklmnopq',
438 ])
439 done
440 AT_CLEANUP
441
442 AT_SETUP([documents])
443 AT_KEYWORDS([sack synthetic system file positive])
444 AT_DATA([sys-file.sack], [dnl
445 dnl File header.
446 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
447 2; dnl Layout code
448 1; dnl Nominal case size
449 0; dnl Not compressed
450 0; dnl Not weighted 
451 1; dnl 1 case.
452 100.0; dnl Bias.
453 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
454 i8 0 *3;
455
456 dnl Numeric variable, no label or missing values.
457 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
458
459 dnl Document record.
460 6; 4;
461 s80 "First line of documents";
462 s80 "Second line of documents";
463 s80 "";
464 s80 "Last line of documents";
465
466 dnl Dictionary termination record.
467 999; 0;
468
469 dnl Data.
470 1.0;
471 ])
472 for variant in \
473         "be 8738124d7932cc8ff803142fbf38710b" \
474         "le f3ca2123ec9e8bda91c6b865ba39f506"
475 do
476   set $variant
477   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
478 ])
479   AT_DATA([sys-file.sps], [dnl
480 GET FILE='sys-file.sav'.
481 DISPLAY DOCUMENTS.
482 LIST.
483 ])
484   AT_CHECK([pspp -o pspp.csv sys-file.sps])
485   AT_CHECK([cat pspp.csv], [0], [dnl
486 Documents in the active file:
487
488 First line of documents
489
490 Second line of documents
491
492
493
494 Last line of documents
495
496 Table: Data List
497 num1
498 1
499 ])
500 done
501 AT_CLEANUP
502
503 AT_SETUP([multiple response sets])
504 AT_KEYWORDS([sack synthetic system file positive])
505 AT_DATA([sys-file.sack], [dnl
506 dnl File header.
507 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
508 2; dnl Layout code
509 16; dnl Nominal case size
510 0; dnl Not compressed
511 0; dnl Not weighted 
512 0; dnl No cases.
513 100.0; dnl Bias.
514 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
515 i8 0 *3;
516
517 dnl $a
518 2; 0; 0; 0; 0x050800 *2; s8 "A";
519 2; 0; 0; 0; 0x050800 *2; s8 "B";
520 2; 0; 0; 0; 0x050800 *2; s8 "C";
521
522 dnl $b
523 2; 0; 0; 0; 0x050800 *2; s8 "D";
524 2; 0; 0; 0; 0x050800 *2; s8 "E";
525 2; 0; 0; 0; 0x050800 *2; s8 "F";
526 2; 0; 0; 0; 0x050800 *2; s8 "G";
527
528 dnl $c
529 2; 3; 0; 0; 0x010300 *2; s8 "H";
530 2; 3; 0; 0; 0x010300 *2; s8 "I";
531 2; 3; 0; 0; 0x010300 *2; s8 "J";
532
533 dnl $d
534 2; 0; 0; 0; 0x050800 *2; s8 "K";
535 2; 0; 0; 0; 0x050800 *2; s8 "L";
536 2; 0; 0; 0; 0x050800 *2; s8 "M";
537
538 dnl $e
539 2; 6; 0; 0; 0x010600 *2; s8 "N";
540 2; 6; 0; 0; 0x010600 *2; s8 "O";
541 2; 6; 0; 0; 0x010600 *2; s8 "P";
542
543 7; 7; 1;
544 COUNT(
545   "$a=C 10 my mcgroup a b c"; i8 10;
546   "$b=D2 55 0  g e f d"; i8 10;
547   "$c=D3 Yes 10 mdgroup #2 h i j"; i8 10);
548
549 7; 19; 1;
550 COUNT(
551   "$d=E 1 2 34 13 third mdgroup k l m"; i8 10;
552   "$e=E 11 6 choice 0  n o p"; i8 10);
553
554 dnl Dictionary termination record.
555 999; 0;
556 ])
557 for variant in \
558         "be 0caa3446d7a3f6985e79fd1fcc999b10" \
559         "le 9dbeba699e4149ed836f55bad7346d67"
560 do
561   set $variant
562   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
563 ])
564   AT_DATA([sys-file.sps], [dnl
565 GET FILE='sys-file.sav'.
566 MRSETS /DISPLAY NAME=ALL.
567 ])
568   AT_CHECK([pspp -o pspp.csv sys-file.sps])
569   AT_CHECK([cat pspp.csv], [0], [dnl
570 Table: Multiple Response Sets
571 Name,Variables,Details
572 $a,"a
573 b
574 c
575 ","Multiple category set
576 Label: my mcgroup
577 "
578 $b,"g
579 e
580 f
581 d
582 ","Multiple dichotomy set
583 Counted value: 55
584 Category label source: Variable labels
585 "
586 $c,"h
587 i
588 j
589 ","Multiple dichotomy set
590 Label: mdgroup #2
591 Label source: Provided by user
592 Counted value: `Yes'
593 Category label source: Variable labels
594 "
595 $d,"k
596 l
597 m
598 ","Multiple dichotomy set
599 Label: third mdgroup
600 Label source: Provided by user
601 Counted value: 34
602 Category label source: Value labels of counted value
603 "
604 $e,"n
605 o
606 p
607 ","Multiple dichotomy set
608 Label source: First variable label among variables
609 Counted value: `choice'
610 Category label source: Value labels of counted value
611 "
612 ])
613 done
614 AT_CLEANUP
615
616 AT_SETUP([variable display parameters, without width])
617 AT_KEYWORDS([sack synthetic system file positive])
618 AT_DATA([sys-file.sack], [dnl
619 dnl File header.
620 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
621 2; dnl Layout code
622 19; dnl Nominal case size
623 0; dnl Not compressed
624 0; dnl Not weighted 
625 0; dnl No cases.
626 100.0; dnl Bias.
627 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
628 i8 0 *3;
629
630 dnl Numeric variables.
631 2; 0; 0; 0; 0x050800 *2; s8 "A";
632 2; 0; 0; 0; 0x050800 *2; s8 "B";
633 2; 0; 0; 0; 0x050800 *2; s8 "C";
634 2; 0; 0; 0; 0x050800 *2; s8 "D";
635
636 dnl Short string variables.
637 2; 3; 0; 0; 0x010300 *2; s8 "H";
638 2; 3; 0; 0; 0x010300 *2; s8 "I";
639 2; 3; 0; 0; 0x010300 *2; s8 "J";
640 2; 3; 0; 0; 0x010300 *2; s8 "K";
641
642 dnl Long string variables.
643 2; 9; 0; 0; 0x010900 *2; s8 "L";
644 2; -1; 0; 0; 0; 0; s8 "";
645 2; 10; 0; 0; 0x010a00 *2; s8 "M";
646 2; -1; 0; 0; 0; 0; s8 "";
647 2; 17; 0; 0; 0x011100 *2; s8 "N";
648 ( 2; -1; 0; 0; 0; 0; s8 "" ) * 2;
649 2; 25; 0; 0; 0x011900 *2; s8 "O";
650 ( 2; -1; 0; 0; 0; 0; s8 "" ) * 3;
651
652 dnl Variable display parameters
653 7; 11; 4; 24;
654 1; 0;
655 2; 0;
656 3; 0;
657 1; 1;
658 2; 1;
659 3; 1;
660 1; 2;
661 2; 2;
662 3; 2;
663 0; 0;
664 0; 1;
665 0; 2;
666
667 dnl Dictionary termination record.
668 999; 0;
669 ])
670 for variant in \
671         "be c130d9345080579b8862b360924edbfa" \
672         "le 6fde96f5a7c7386bff6cca049cd84d6a"
673 do
674   set $variant
675   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
676 ])
677   AT_DATA([sys-file.sps], [dnl
678 GET FILE='sys-file.sav'.
679 DISPLAY DICTIONARY.
680 ])
681   AT_CHECK([pspp -o pspp.csv sys-file.sps])
682   AT_CHECK([cat pspp.csv], [0], [dnl
683 Variable,Description,,Position
684 a,Format: F8.0,,1
685 ,Measure: Nominal,,
686 ,Display Alignment: Left,,
687 ,Display Width: 8,,
688 b,Format: F8.0,,2
689 ,Measure: Ordinal,,
690 ,Display Alignment: Left,,
691 ,Display Width: 8,,
692 c,Format: F8.0,,3
693 ,Measure: Scale,,
694 ,Display Alignment: Left,,
695 ,Display Width: 8,,
696 d,Format: F8.0,,4
697 ,Measure: Nominal,,
698 ,Display Alignment: Right,,
699 ,Display Width: 8,,
700 h,Format: A3,,5
701 ,Measure: Ordinal,,
702 ,Display Alignment: Right,,
703 ,Display Width: 3,,
704 i,Format: A3,,6
705 ,Measure: Scale,,
706 ,Display Alignment: Right,,
707 ,Display Width: 3,,
708 j,Format: A3,,7
709 ,Measure: Nominal,,
710 ,Display Alignment: Center,,
711 ,Display Width: 3,,
712 k,Format: A3,,8
713 ,Measure: Ordinal,,
714 ,Display Alignment: Center,,
715 ,Display Width: 3,,
716 l,Format: A9,,9
717 ,Measure: Scale,,
718 ,Display Alignment: Center,,
719 ,Display Width: 9,,
720 m,Format: A10,,10
721 ,Measure: Nominal,,
722 ,Display Alignment: Left,,
723 ,Display Width: 10,,
724 n,Format: A17,,11
725 ,Measure: Nominal,,
726 ,Display Alignment: Right,,
727 ,Display Width: 17,,
728 o,Format: A25,,12
729 ,Measure: Nominal,,
730 ,Display Alignment: Center,,
731 ,Display Width: 25,,
732 ])
733 done
734 AT_CLEANUP
735
736 AT_SETUP([variable display parameters, with width])
737 AT_KEYWORDS([sack synthetic system file positive])
738 AT_DATA([sys-file.sack], [dnl
739 dnl File header.
740 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
741 2; dnl Layout code
742 19; dnl Nominal case size
743 0; dnl Not compressed
744 0; dnl Not weighted 
745 0; dnl No cases.
746 100.0; dnl Bias.
747 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
748 i8 0 *3;
749
750 dnl Numeric variables.
751 2; 0; 0; 0; 0x050800 *2; s8 "A";
752 2; 0; 0; 0; 0x050800 *2; s8 "B";
753 2; 0; 0; 0; 0x050800 *2; s8 "C";
754 2; 0; 0; 0; 0x050800 *2; s8 "D";
755
756 dnl Short string variables.
757 2; 3; 0; 0; 0x010300 *2; s8 "H";
758 2; 3; 0; 0; 0x010300 *2; s8 "I";
759 2; 3; 0; 0; 0x010300 *2; s8 "J";
760 2; 3; 0; 0; 0x010300 *2; s8 "K";
761
762 dnl Long string variables.
763 2; 9; 0; 0; 0x010900 *2; s8 "L";
764 2; -1; 0; 0; 0; 0; s8 "";
765 2; 10; 0; 0; 0x010a00 *2; s8 "M";
766 2; -1; 0; 0; 0; 0; s8 "";
767 2; 17; 0; 0; 0x011100 *2; s8 "N";
768 ( 2; -1; 0; 0; 0; 0; s8 "" ) * 2;
769 2; 25; 0; 0; 0x011900 *2; s8 "O";
770 ( 2; -1; 0; 0; 0; 0; s8 "" ) * 3;
771
772 dnl Variable display parameters
773 7; 11; 4; 36;
774 1; 1; 0;
775 2; 2; 0;
776 3; 3; 0;
777 1; 4; 1;
778 2; 5; 1;
779 3; 6; 1;
780 1; 7; 2;
781 2; 8; 2;
782 3; 9; 2;
783 0; 10; 0;
784 0; 11; 1;
785 0; 12; 2;
786
787 dnl Dictionary termination record.
788 999; 0;
789 ])
790 for variant in \
791         "be 3ace75689a0b7faa9360936bbfe26055" \
792         "le 6e93f35d19a9882eb53ffb1b067ef7cd"
793 do
794   set $variant
795   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
796 ])
797   AT_DATA([sys-file.sps], [dnl
798 GET FILE='sys-file.sav'.
799 DISPLAY DICTIONARY.
800 ])
801   AT_CHECK([pspp -o pspp.csv sys-file.sps])
802   AT_CHECK([cat pspp.csv], [0], [dnl
803 Variable,Description,,Position
804 a,Format: F8.0,,1
805 ,Measure: Nominal,,
806 ,Display Alignment: Left,,
807 ,Display Width: 1,,
808 b,Format: F8.0,,2
809 ,Measure: Ordinal,,
810 ,Display Alignment: Left,,
811 ,Display Width: 2,,
812 c,Format: F8.0,,3
813 ,Measure: Scale,,
814 ,Display Alignment: Left,,
815 ,Display Width: 3,,
816 d,Format: F8.0,,4
817 ,Measure: Nominal,,
818 ,Display Alignment: Right,,
819 ,Display Width: 4,,
820 h,Format: A3,,5
821 ,Measure: Ordinal,,
822 ,Display Alignment: Right,,
823 ,Display Width: 5,,
824 i,Format: A3,,6
825 ,Measure: Scale,,
826 ,Display Alignment: Right,,
827 ,Display Width: 6,,
828 j,Format: A3,,7
829 ,Measure: Nominal,,
830 ,Display Alignment: Center,,
831 ,Display Width: 7,,
832 k,Format: A3,,8
833 ,Measure: Ordinal,,
834 ,Display Alignment: Center,,
835 ,Display Width: 8,,
836 l,Format: A9,,9
837 ,Measure: Scale,,
838 ,Display Alignment: Center,,
839 ,Display Width: 9,,
840 m,Format: A10,,10
841 ,Measure: Nominal,,
842 ,Display Alignment: Left,,
843 ,Display Width: 10,,
844 n,Format: A17,,11
845 ,Measure: Nominal,,
846 ,Display Alignment: Right,,
847 ,Display Width: 11,,
848 o,Format: A25,,12
849 ,Measure: Nominal,,
850 ,Display Alignment: Center,,
851 ,Display Width: 12,,
852 ])
853 done
854 AT_CLEANUP
855
856 AT_SETUP([long variable names])
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 4; 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 "LONGVARI";
872 2; 0; 0; 0; 0x050800 *2; s8 "LONGVA_A";
873 2; 0; 0; 0; 0x050800 *2; s8 "LONGVA_B";
874 2; 0; 0; 0; 0x050800 *2; s8 "LONGVA_C";
875
876 dnl Long variable names.
877 7; 13; 1; COUNT (
878 "LONGVARI=LongVariableName1"; i8 9;
879 "LONGVA_A=LongVariableName2"; i8 9;
880 "LONGVA_B=LongVariableName3"; i8 9;
881 "LONGVA_C=LongVariableName4";
882 );
883
884 dnl Dictionary termination record.
885 999; 0;
886 ])
887 for variant in \
888         "be eb7a8b4055a5d880a185a566048876b3" \
889         "le dd4ecd7541320b9b51746717ef20973f"
890 do
891   set $variant
892   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
893 ])
894   AT_DATA([sys-file.sps], [dnl
895 GET FILE='sys-file.sav'.
896 DISPLAY DICTIONARY.
897 ])
898   AT_CHECK([pspp -o pspp.csv sys-file.sps])
899   AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl
900 Variable,Description,,Position
901 LongVariableName1,Format: F8.0,,1
902 LongVariableName2,Format: F8.0,,2
903 LongVariableName3,Format: F8.0,,3
904 LongVariableName4,Format: F8.0,,4
905 ])
906 done
907 AT_CLEANUP
908
909 AT_SETUP([very long strings])
910 AT_KEYWORDS([sack synthetic system file positive])
911 AT_DATA([sys-file.sack], [dnl
912 dnl File header.
913 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
914 2; dnl Layout code
915 109; dnl Nominal case size
916 0; dnl Not compressed
917 0; dnl Not weighted 
918 1; dnl No cases.
919 100.0; dnl Bias.
920 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
921 i8 0 *3;
922
923 dnl 256-byte string.
924 2; 255; 0; 0; 0x01FF00 *2; s8 "STR256";
925 (2; -1; 0; 0; 0; 0; s8 "") * 31;
926 2; 4; 0; 0; 0x010400 *2; s8 "STR256_1";
927
928 dnl 600-byte string.
929 2; 255; 0; 0; 0x01FF00 *2; s8 "STR600";
930 (2; -1; 0; 0; 0; 0; s8 "") * 31;
931 2; 255; 0; 0; 0x01FF00 *2; s8 "STR600_1";
932 (2; -1; 0; 0; 0; 0; s8 "") * 31;
933 2; 96; 0; 0; 0x016000 *2; s8 "STR600_2";
934 (2; -1; 0; 0; 0; 0; s8 "") * 11;
935
936 dnl Very long string record.
937 7; 14; 1; COUNT (
938 "STR256=00256"; i8 0; i8 9;
939 "STR600=00600"; i8 0; i8 9;
940 );
941
942 dnl Dictionary termination record.
943 999; 0;
944
945 dnl Data.
946 "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#" * 4;
947 "abcdefgh";
948 "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#" * 9;
949 "abcdefghijklmnopqrstuvwxyzABCDEF";
950 ])
951 for variant in \
952         "be 40a4327805d8b59891084317248f5d4a" \
953         "le ced2584a43037b893b7feb068e2cb9d6"
954 do
955   set $variant
956   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
957 ])
958   AT_DATA([sys-file.sps], [dnl
959 GET FILE='sys-file.sav'.
960 DISPLAY DICTIONARY.
961 LIST.
962 ])
963   AT_CHECK([pspp -o pspp.csv sys-file.sps])
964   AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl
965 Variable,Description,,Position
966 str256,Format: A256,,1
967 str600,Format: A600,,2
968
969 Table: Data List
970 str256,str600
971 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@a,abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyz
972 ])
973 done
974 AT_CLEANUP
975
976 AT_SETUP([data file and variable attributes])
977 AT_KEYWORDS([sack synthetic system file positive])
978 AT_DATA([sys-file.sack], [dnl
979 dnl File header.
980 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
981 2; dnl Layout code
982 2; dnl Nominal case size
983 0; dnl Not compressed
984 0; dnl Not weighted 
985 0; dnl 1 case.
986 100.0; dnl Bias.
987 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
988 i8 0 *3;
989
990 dnl Variables.
991 2; 0; 0; 0; 0x050800 *2; s8 "FIRSTVAR";
992 2; 0; 0; 0; 0x050800 *2; s8 "SECONDVA";
993
994 dnl Long variable names.
995 7; 13; 1; COUNT (
996 "FIRSTVAR=FirstVariable"; i8 9;
997 "SECONDVA=SecondVariable"; i8 9;
998 );
999
1000 dnl Data file attributes record.
1001 7; 17; 1; COUNT (
1002 "Attr1('Value1'"; i8 10; "''QuotedValue''"; i8 10; ")";
1003 "SecondAttr('123'"; i8 10; "'456'"; i8 10; ")";
1004 );
1005
1006 dnl Variable attributes record.
1007 7; 18; 1; COUNT (
1008 "FirstVariable:";
1009   "fred('23'"; i8 10; "'34'"; i8 10; ")";
1010   "bert('123'"; i8 10; ")";
1011 "/SecondVariable:";
1012   "xyzzy('quux'"; i8 10; ")";
1013 );
1014
1015 dnl Dictionary termination record.
1016 999; 0;
1017 ])
1018 for variant in \
1019         "be 955802de462daf810c0ecc81ee2320a1" \
1020         "le 7fc6439aedfa00615bb1fe94d6701305"
1021 do
1022   set $variant
1023   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
1024 ])
1025   AT_DATA([sys-file.sps], [dnl
1026 GET FILE='sys-file.sav'.
1027 DISPLAY ATTRIBUTES.
1028 ])
1029   AT_CHECK([pspp -o pspp.csv sys-file.sps])
1030   AT_CHECK([cat pspp.csv], [0],
1031 [[Variable,Description,
1032 FirstVariable,Custom attributes:,
1033 ,bert,123
1034 ,fred[1],23
1035 ,fred[2],34
1036 SecondVariable,Custom attributes:,
1037 ,xyzzy,quux
1038
1039 Table: Custom data file attributes.
1040 Attribute,Value
1041 SecondAttr[1],123
1042 SecondAttr[2],456
1043 Attr1[1],Value1
1044 Attr1[2],'QuotedValue'
1045 ]])
1046 done
1047 AT_CLEANUP
1048
1049 AT_SETUP([compressed data])
1050 AT_KEYWORDS([sack synthetic system file positive])
1051 AT_DATA([sys-file.sack], [dnl
1052 dnl File header.
1053 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1054 2; dnl Layout code
1055 6; dnl Nominal case size
1056 1; dnl Not compressed
1057 0; dnl Not weighted 
1058 -1; dnl Unspecified number of cases.
1059 100.0; dnl Bias.
1060 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
1061 i8 0 *3;
1062
1063 dnl Numeric variables.
1064 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1065 2; 0; 0; 0; 0x050800 *2; s8 "NUM2";
1066
1067 dnl String variable.
1068 2; 4; 0; 0; 0x010400 *2; s8 "STR4";
1069 2; 8; 0; 0; 0x010800 *2; s8 "STR8";
1070 2; 15; 0; 0; 0x010f00 *2; s8 "STR15";
1071 2; -1; 0; 0; 0; 0; s8 "";
1072
1073 dnl Dictionary termination record.
1074 999; 0;
1075
1076 dnl Compressed data.
1077 i8 1 100 254 253 254 253; i8 255 251; "abcdefgh"; s8 "0123";
1078 i8 253 253 253 254; i8 101 102 253 253; s8 "jklm"; s8 "nopqrstu";
1079 s8 "vwxyzABC"; s8 "DEFG"; s8 "HIJKLMNO";
1080 i8 254 253 252 0 0 0 0 0; s8 "PQRSTUVW";
1081
1082 ])
1083 for variant in \
1084         "be c0670e436b068f45710b98f6f7d01dc5" \
1085         "le 2e43a7f8861df4e714a192dfb3c8b2f4"
1086 do
1087   set $variant
1088   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
1089 ])
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([grep -v Measure pspp.csv | grep -v Display], [0], [dnl
1097 Variable,Description,,Position
1098 num1,Format: F8.0,,1
1099 num2,Format: F8.0,,2
1100 str4,Format: A4,,3
1101 str8,Format: A8,,4
1102 str15,Format: A15,,5
1103
1104 Table: Data List
1105 num1,num2,str4,str8,str15
1106 -99,0,,abcdefgh,0123   @&t@
1107 .,151,jklm,nopqrstu,vwxyzABC       @&t@
1108 1,2,DEFG,HIJKLMNO,PQRSTUV
1109 ])
1110 done
1111 AT_CLEANUP
1112
1113 AT_SETUP([compressed data, zero bias])
1114 AT_KEYWORDS([sack synthetic system file positive])
1115 AT_DATA([sys-file.sack], [dnl
1116 dnl File header.
1117 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1118 2; dnl Layout code
1119 6; dnl Nominal case size
1120 1; dnl Not compressed
1121 0; dnl Not weighted 
1122 -1; dnl Unspecified number of cases.
1123 0.0; dnl Bias.
1124 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
1125 i8 0 *3;
1126
1127 dnl Numeric variables.
1128 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1129 2; 0; 0; 0; 0x050800 *2; s8 "NUM2";
1130
1131 dnl String variable.
1132 2; 4; 0; 0; 0x010400 *2; s8 "STR4";
1133 2; 8; 0; 0; 0x010800 *2; s8 "STR8";
1134 2; 15; 0; 0; 0x010f00 *2; s8 "STR15";
1135 2; -1; 0; 0; 0; 0; s8 "";
1136
1137 dnl Dictionary termination record.
1138 999; 0;
1139
1140 dnl Compressed data.
1141 i8 1 100 254 253 254 253; i8 255 251; "abcdefgh"; s8 "0123";
1142 i8 253 253 253 254; i8 101 102 253 253; s8 "jklm"; s8 "nopqrstu";
1143 s8 "vwxyzABC"; s8 "DEFG"; s8 "HIJKLMNO";
1144 i8 254 253 252 0 0 0 0 0; s8 "PQRSTUVW";
1145
1146 ])
1147 for variant in \
1148         "be 2f0d25704ee497ae833213a3e4ff5e8b" \
1149         "le 49f68a9e1ba02a2f7e9166686a0db9d9"
1150 do
1151   set $variant
1152   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
1153 ])
1154   AT_DATA([sys-file.sps], [dnl
1155 GET FILE='sys-file.sav'.
1156 DISPLAY DICTIONARY.
1157 LIST.
1158 ])
1159   AT_CHECK([pspp -o pspp.csv sys-file.sps], [0])
1160   AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl
1161 Variable,Description,,Position
1162 num1,Format: F8.0,,1
1163 num2,Format: F8.0,,2
1164 str4,Format: A4,,3
1165 str8,Format: A8,,4
1166 str15,Format: A15,,5
1167
1168 Table: Data List
1169 num1,num2,str4,str8,str15
1170 1,100,,abcdefgh,0123   @&t@
1171 .,251,jklm,nopqrstu,vwxyzABC       @&t@
1172 101,102,DEFG,HIJKLMNO,PQRSTUV
1173 ])
1174 done
1175 AT_CLEANUP
1176
1177 AT_SETUP([compressed data, other bias])
1178 AT_KEYWORDS([sack synthetic system file positive])
1179 AT_DATA([sys-file.sack], [dnl
1180 dnl File header.
1181 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1182 2; dnl Layout code
1183 6; dnl Nominal case size
1184 1; dnl Not compressed
1185 0; dnl Not weighted 
1186 -1; dnl Unspecified number of cases.
1187 50.0; dnl Bias.
1188 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
1189 i8 0 *3;
1190
1191 dnl Numeric variables.
1192 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1193 2; 0; 0; 0; 0x050800 *2; s8 "NUM2";
1194
1195 dnl String variable.
1196 2; 4; 0; 0; 0x010400 *2; s8 "STR4";
1197 2; 8; 0; 0; 0x010800 *2; s8 "STR8";
1198 2; 15; 0; 0; 0x010f00 *2; s8 "STR15";
1199 2; -1; 0; 0; 0; 0; s8 "";
1200
1201 dnl Dictionary termination record.
1202 999; 0;
1203
1204 dnl Compressed data.
1205 i8 1 100 254 253 254 253; i8 255 251; "abcdefgh"; s8 "0123";
1206 i8 253 253 253 254; i8 101 102 253 253; s8 "jklm"; s8 "nopqrstu";
1207 s8 "vwxyzABC"; s8 "DEFG"; s8 "HIJKLMNO";
1208 i8 254 253 252 0 0 0 0 0; s8 "PQRSTUVW";
1209
1210 ])
1211 for variant in \
1212         "be 668b85e3dee0797883e9933a096b8c18" \
1213         "le 5e7a9c4e88cd2dbc2322943da663868e"
1214 do
1215   set $variant
1216   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
1217 ])
1218   AT_DATA([sys-file.sps], [dnl
1219 GET FILE='sys-file.sav'.
1220 DISPLAY DICTIONARY.
1221 LIST.
1222 ])
1223   AT_CHECK([pspp -o pspp.csv sys-file.sps], [0], 
1224     [warning: `sys-file.sav' near offset 0x54: Compression bias is not the usual value of 100, or system file uses unrecognized floating-point format.
1225 ])
1226   AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl
1227 "warning: `sys-file.sav' near offset 0x54: Compression bias is not the usual value of 100, or system file uses unrecognized floating-point format."
1228
1229 Variable,Description,,Position
1230 num1,Format: F8.0,,1
1231 num2,Format: F8.0,,2
1232 str4,Format: A4,,3
1233 str8,Format: A8,,4
1234 str15,Format: A15,,5
1235
1236 Table: Data List
1237 num1,num2,str4,str8,str15
1238 -49,50,,abcdefgh,0123   @&t@
1239 .,201,jklm,nopqrstu,vwxyzABC       @&t@
1240 51,52,DEFG,HIJKLMNO,PQRSTUV
1241 ])
1242 done
1243 AT_CLEANUP
1244 \f
1245 AT_BANNER([system file reader - negative])
1246
1247 AT_SETUP([misplaced type 4 record])
1248 AT_KEYWORDS([sack synthetic system file negative])
1249 AT_DATA([sys-file.sack], [dnl
1250 dnl File header.
1251 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1252 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1253
1254 dnl Numeric variable.
1255 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1256
1257 dnl Type 4 record.
1258 >>4<<;
1259 ])
1260 for variant in \
1261         "be 6e0bb549fff1fd1af333d51b8a6e0f43" \
1262         "le 7b62734edcee2a1689c463f2866d11b8"
1263 do
1264   set $variant
1265   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
1266 ])
1267   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1268 ])
1269   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
1270    [error: `sys-file.sav' near offset 0xd4: Misplaced type 4 record.
1271 ])
1272 done
1273 AT_CLEANUP
1274
1275 AT_SETUP([bad record type])
1276 AT_KEYWORDS([sack synthetic system file negative])
1277 AT_DATA([sys-file.sack], [dnl
1278 dnl File header.
1279 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1280 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1281
1282 dnl Numeric variable.
1283 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1284
1285 dnl Type 8 record (not a valid type).
1286 >>8<<;
1287 ])
1288 for variant in \
1289         "be dc8f078c23046ee7db74ec1003178a11" \
1290         "le dc7f111642f0629f4370630fd092eee3"
1291 do
1292   set $variant
1293   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
1294 ])
1295   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1296 ])
1297   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
1298    [error: `sys-file.sav' near offset 0xd4: Unrecognized record type 8.
1299 ])
1300 done
1301 AT_CLEANUP
1302
1303 AT_SETUP([wrong number of variable positions])
1304 AT_KEYWORDS([sack synthetic system file negative])
1305 AT_DATA([sys-file.sack], [dnl
1306 dnl File header.
1307 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1308 2; >>2<<; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1309
1310 dnl Numeric variable.
1311 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1312
1313 dnl End of dictionary.
1314 999; 0;
1315 ])
1316 for variant in \
1317         "be c57e91aa426f61813c3ad91ea3a56dda" \
1318         "le 5d1a6c114b135b219473c8ad5bb44bda"
1319 do
1320   set $variant
1321   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
1322 ])
1323   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1324 ])
1325   AT_CHECK([pspp -O format=csv sys-file.sps], [0], 
1326    [warning: `sys-file.sav': File header claims 2 variable positions but 1 were read from file.
1327 ])
1328 done
1329 AT_CLEANUP
1330
1331 AT_SETUP([variable name may not begin with `#'])
1332 AT_KEYWORDS([sack synthetic system file negative])
1333 AT_DATA([sys-file.sack], [dnl
1334 dnl File header.
1335 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1336 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1337
1338 dnl Numeric variable.
1339 2; 0; 0; 0; 0x050800 *2; s8 >>"$UM1"<<;
1340
1341 dnl End of dictionary.
1342 999; 0;
1343 ])
1344 for variant in \
1345         "be decb7ac6defa1ab3cc7a386d1843c1ae" \
1346         "le 5279b6275633bac55d167faebccfdb14"
1347 do
1348   set $variant
1349   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
1350 ])
1351   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1352 ])
1353   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
1354    [error: `sys-file.sav' near offset 0xb4: Invalid variable name `$UM1'.
1355 ])
1356 done
1357 AT_CLEANUP
1358
1359 AT_SETUP([variable name may not be reserved word])
1360 AT_KEYWORDS([sack synthetic system file negative])
1361 AT_DATA([sys-file.sack], [dnl
1362 dnl File header.
1363 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1364 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1365
1366 dnl Numeric variable.
1367 2; 0; 0; 0; 0x050800 *2; s8 >>"TO"<<;
1368
1369 dnl End of dictionary.
1370 999; 0;
1371 ])
1372 for variant in \
1373         "be 57e6ad709668bbf538e2efee4af49916" \
1374         "le 523f14b611efa380bbadf7a16ea43fed"
1375 do
1376   set $variant
1377   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
1378 ])
1379   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1380 ])
1381   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
1382    [error: `sys-file.sav' near offset 0xb4: Invalid variable name `TO'.
1383 ])
1384 done
1385 AT_CLEANUP
1386
1387 AT_SETUP([variable width must be between 0 and 255])
1388 AT_KEYWORDS([sack synthetic system file negative])
1389 AT_DATA([sys-file.sack], [dnl
1390 dnl File header.
1391 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1392 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1393
1394 dnl String variable with invalid width 256.
1395 2; 256; 0; 0; 0x050800 *2; s8 "VAR1";
1396
1397 dnl End of dictionary.
1398 999; 0;
1399 ])
1400 for variant in \
1401         "be 170bb18589ba264a0ed2d57b41fe77e1" \
1402         "le 9528b4b5936ef5630bbd3bdd60a123c3"
1403 do
1404   set $variant
1405   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
1406 ])
1407   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1408 ])
1409   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
1410    [error: `sys-file.sav' near offset 0xb4: Bad width 256 for variable VAR1.
1411 ])
1412 done
1413 AT_CLEANUP
1414
1415 AT_SETUP([duplicate variable name])
1416 AT_KEYWORDS([sack synthetic system file negative])
1417 AT_DATA([sys-file.sack], [dnl
1418 dnl File header.
1419 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1420 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1421
1422 dnl Numeric variables.
1423 2; 0; 0; 0; 0x050800 *2; s8 "VAR1";
1424 2; 0; 0; 0; 0x050800 *2; s8 "VAR1";
1425
1426 dnl End of dictionary.
1427 999; 0;
1428 ])
1429 for variant in \
1430         "be d8f5fd768ab1d641f9330a4840c71343" \
1431         "le f01e123d384cdaa7c2f7fc4791325ebf"
1432 do
1433   set $variant
1434   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
1435 ])
1436   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1437 ])
1438   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
1439    [error: `sys-file.sav' near offset 0xd4: Duplicate variable name `VAR1'.
1440 ])
1441 done
1442 AT_CLEANUP
1443
1444 AT_SETUP([variable label indicator not 0 or 1])
1445 AT_KEYWORDS([sack synthetic system file negative])
1446 AT_DATA([sys-file.sack], [dnl
1447 dnl File header.
1448 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1449 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1450
1451 dnl Numeric variable.
1452 2; 0; >>2<<; 0; 0x050800 *2; s8 "VAR1";
1453
1454 dnl End of dictionary.
1455 999; 0;
1456 ])
1457 for variant in \
1458         "be 3c5ff8d8f146457a385ca92d3d23ca8a" \
1459         "le 37e9f956d321ae57b0bf7fe2384e892b"
1460 do
1461   set $variant
1462   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
1463 ])
1464   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1465 ])
1466   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
1467    [error: `sys-file.sav' near offset 0xb4: Variable label indicator field is not 0 or 1.
1468 ])
1469 done
1470 AT_CLEANUP
1471
1472 AT_SETUP([invalid numeric missing value indicator])
1473 AT_KEYWORDS([sack synthetic system file negative])
1474 AT_DATA([sys-file.sack], [dnl
1475 dnl File header.
1476 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1477 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1478
1479 dnl Numeric variable.
1480 2; 0; 0; >>-1<<; 0x050800 *2; s8 "VAR1";
1481
1482 dnl End of dictionary.
1483 999; 0;
1484 ])
1485 for variant in \
1486         "be d1d0d4aedf9f053452c4b1e658ade5e2" \
1487         "le df697575499fe12921185a3d23a5d61d"
1488 do
1489   set $variant
1490   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
1491 ])
1492   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1493 ])
1494   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
1495    ["error: `sys-file.sav' near offset 0xb4: Numeric missing value indicator field is not -3, -2, 0, 1, 2, or 3."
1496 ])
1497 done
1498 AT_CLEANUP
1499
1500 AT_SETUP([invalid string missing value indicator])
1501 AT_KEYWORDS([sack synthetic system file negative])
1502 AT_DATA([sys-file.sack], [dnl
1503 dnl File header.
1504 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1505 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1506
1507 dnl String variable.
1508 2; 8; 0; >>4<<; 0x010800 *2; s8 "VAR1";
1509
1510 dnl End of dictionary.
1511 999; 0;
1512 ])
1513 for variant in \
1514         "be f833033be7b102fae19159989f62faa6" \
1515         "le 9704ba828bb7a36ef0262838f6b7936b"
1516 do
1517   set $variant
1518   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
1519 ])
1520   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1521 ])
1522   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
1523    ["error: `sys-file.sav' near offset 0xb4: String missing value indicator field is not 0, 1, 2, or 3."
1524 ])
1525 done
1526 AT_CLEANUP
1527
1528 AT_SETUP([missing string continuation record])
1529 AT_KEYWORDS([sack synthetic system file negative])
1530 AT_DATA([sys-file.sack], [dnl
1531 dnl File header.
1532 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1533 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1534
1535 dnl String variable.
1536 2; 10; 0; 0; 0x010a00 *2; s8 "VAR1";
1537 >>2; 0; 0; 0; 0x050800 *2; s8 "VAR2";<<
1538
1539 dnl End of dictionary.
1540 999; 0;
1541 ])
1542 for variant in \
1543         "be c8f9ad2b2acd2918055e2b78c1e0b4b8" \
1544         "le 1afab4d6aee90a6fe8d2dbf229e06409"
1545 do
1546   set $variant
1547   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
1548 ])
1549   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1550 ])
1551   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
1552    [error: `sys-file.sav' near offset 0xb4: Missing string continuation record.
1553 ])
1554 done
1555 AT_CLEANUP
1556
1557 AT_SETUP([unknown variable format])
1558 AT_KEYWORDS([sack synthetic system file negative])
1559 AT_DATA([sys-file.sack], [dnl
1560 dnl File header.
1561 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1562 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1563
1564 dnl Numeric variable.
1565 2; 0; 0; 0; >>0xff0800<< *2; s8 "VAR1";
1566
1567 dnl End of dictionary.
1568 999; 0;
1569 ])
1570 for variant in \
1571         "be fcf94b3ff11b7e2ff50c226b609cff1e" \
1572         "le 88fc97cc80d5a170e53a7cc89e204b0d"
1573 do
1574   set $variant
1575   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
1576 ])
1577   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1578 ])
1579   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
1580    [error: `sys-file.sav' near offset 0xc0: Unknown variable format 255.
1581 ])
1582 done
1583 AT_CLEANUP
1584
1585 AT_SETUP([invalid numeric variable format])
1586 AT_KEYWORDS([sack synthetic system file negative])
1587 AT_DATA([sys-file.sack], [dnl
1588 dnl File header.
1589 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1590 2; 3; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1591
1592 dnl Numeric variable, string formats.
1593 2; 0; 0; 0; >>0x010800<<; >>0x021000<<; s8 "VAR1";
1594
1595 dnl String variable, numeric formats.
1596 2; 4; 0; 0; >>0x050800<<; >>0x110a01<<; s8 "STR1";
1597
1598 dnl String variable, wrong width formats.
1599 2; 4; 0; 0; >>0x010800<<; >>0x020400<<; s8 "STR2";
1600
1601 dnl End of dictionary.
1602 999; 0;
1603 ])
1604 for variant in \
1605         "be 0c36a39ec9118eb4a83f10a9483b5a37" \
1606         "le 1d498d60eeb2c88e0479f113fb3ffe4b"
1607 do
1608   set $variant
1609   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
1610 ])
1611   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1612 ])
1613   AT_CHECK([pspp -O format=csv sys-file.sps], [0], 
1614    [warning: `sys-file.sav' near offset 0xc0: Numeric variable VAR1 has invalid print format A8.
1615
1616 warning: `sys-file.sav' near offset 0xc4: Numeric variable VAR1 has invalid write format AHEX16.
1617
1618 warning: `sys-file.sav' near offset 0xe0: String variable STR1 has invalid print format F8.0.
1619
1620 warning: `sys-file.sav' near offset 0xe4: String variable STR1 has invalid write format E10.1.
1621
1622 warning: `sys-file.sav' near offset 0x100: String variable STR2 has invalid print format A8.
1623
1624 warning: `sys-file.sav' near offset 0x104: String variable STR2 has invalid write format AHEX4.
1625 ])
1626 done
1627 AT_CLEANUP
1628
1629 AT_SETUP([weighting variable must be numeric])
1630 AT_KEYWORDS([sack synthetic system file negative])
1631 AT_DATA([sys-file.sack], [dnl
1632 dnl File header.
1633 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1634 2; 2; 1; >>2<<; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1635
1636 dnl Numeric variable.
1637 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1638
1639 dnl String variable.
1640 2; 4; 0; 0; 0x010400 *2; s8 "STR1";
1641
1642 dnl End of dictionary.
1643 999; 0;
1644 ])
1645 for variant in \
1646         "be 82d30105e46c4896c24f9dcec26c4749" \
1647         "le 32e235119be70050eb78bf4186a5a046"
1648 do
1649   set $variant
1650   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
1651 ])
1652   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1653 ])
1654   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
1655    [error: `sys-file.sav': Weighting variable must be numeric (not string variable `STR1').
1656 ])
1657 done
1658 AT_CLEANUP
1659
1660 AT_SETUP([bad weighting variable index])
1661 AT_KEYWORDS([sack synthetic system file negative])
1662 AT_DATA([sys-file.sack], [dnl
1663 dnl File header.
1664 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1665 2; 2; 1; >>3<<; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1666
1667 dnl Numeric variable.
1668 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1669
1670 dnl String variable.
1671 2; 4; 0; 0; 0x010400 *2; s8 "STR1";
1672
1673 dnl End of dictionary.
1674 999; 0;
1675 ])
1676 for variant in \
1677         "be cd9af924ff20bc75834aa2c696254c97" \
1678         "le cbe0f2f514f5e95f27644d0b4314bc78"
1679 do
1680   set $variant
1681   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
1682 ])
1683   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1684 ])
1685   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
1686    [error: `sys-file.sav' near offset 0x4c: Variable index 3 not in valid range 1...2.
1687 ])
1688 done
1689 AT_CLEANUP
1690
1691 AT_SETUP([variable index is long string contination])
1692 AT_KEYWORDS([sack synthetic system file negative])
1693 AT_DATA([sys-file.sack], [dnl
1694 dnl File header.
1695 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1696 2; 2; 1; >>3<<; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1697
1698 dnl Numeric variable.
1699 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1700
1701 dnl Long string variable.
1702 2; 9; 0; 0; 0x010900 *2; s8 "STR1";
1703 (2; -1; 0; 0; 0; 0; s8 "");
1704
1705 dnl End of dictionary.
1706 999; 0;
1707 ])
1708 for variant in \
1709         "be 0c395354df56ea5ff374aafcc535d633" \
1710         "le d977f684ea9d4648ed40f8c6dddde9f7"
1711 do
1712   set $variant
1713   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
1714 ])
1715   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1716 ])
1717   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
1718    [error: `sys-file.sav' near offset 0x4c: Variable index 3 refers to long string continuation.
1719 ])
1720 done
1721 AT_CLEANUP
1722
1723 AT_SETUP([multiple documents records])
1724 AT_KEYWORDS([sack synthetic system file negative])
1725 AT_DATA([sys-file.sack], [dnl
1726 dnl File header.
1727 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1728 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1729
1730 dnl Numeric variable, no label or missing values.
1731 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1732
1733 dnl Two document records.
1734 (6; 1; s80 "One line of documents") >>* 2<<;
1735
1736 dnl Dictionary termination record.
1737 999; 0;
1738
1739 dnl Data.
1740 1.0;
1741 ])
1742 for variant in \
1743         "be 18aa3348a216ed494efe28285b348fa8" \
1744         "le 19b21522bcef1dcc60af328f923f307e"
1745 do
1746   set $variant
1747   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
1748 ])
1749   AT_DATA([sys-file.sps], [dnl
1750 GET FILE='sys-file.sav'.
1751 ])
1752   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
1753 error: `sys-file.sav' near offset 0x12c: Duplicate type 6 (document) record.
1754 ])
1755 done
1756 AT_CLEANUP
1757
1758
1759 AT_SETUP([empty document record])
1760 AT_KEYWORDS([sack synthetic system file negative])
1761 AT_DATA([sys-file.sack], [dnl
1762 dnl File header.
1763 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1764 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1765
1766 dnl Numeric variable, no label or missing values.
1767 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1768
1769 dnl Empty document record.
1770 6; >>0<<;
1771
1772 dnl Dictionary termination record.
1773 999; 0;
1774
1775 dnl Data.
1776 1.0;
1777 ])
1778 for variant in \
1779         "be d8ef29c1b97f9ed226cbd938c9c49b6e" \
1780         "le f6a560c5b62e2c472429d85294f36e61"
1781 do
1782   set $variant
1783   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
1784 ])
1785   AT_DATA([sys-file.sps], [dnl
1786 GET FILE='sys-file.sav'.
1787 ])
1788   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
1789 error: `sys-file.sav' near offset 0xd4: Number of document lines (0) must be greater than 0 and less than 26843545.
1790 ])
1791 done
1792 AT_CLEANUP
1793
1794 AT_SETUP([extension record too large])
1795 AT_KEYWORDS([sack synthetic system file negative])
1796 AT_DATA([sys-file.sack], [dnl
1797 dnl File header.
1798 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1799 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1800
1801 dnl Numeric variable, no label or missing values.
1802 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1803
1804 dnl Too-large extension record.
1805 7; 3; >>0xfffff000 * 2<<;
1806 ])
1807 for variant in \
1808         "be 5a6679dc41ac349b0b73fc430937c05c" \
1809         "le d4769c7f650cfbf160e0386d0d33be04"
1810 do
1811   set $variant
1812   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
1813 ])
1814   AT_DATA([sys-file.sps], [dnl
1815 GET FILE='sys-file.sav'.
1816 ])
1817   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
1818 error: `sys-file.sav' near offset 0xd8: Record type 7 subtype 3 too large.
1819 ])
1820 done
1821 AT_CLEANUP
1822
1823 AT_SETUP([unknown extension record])
1824 AT_KEYWORDS([sack synthetic system file negative])
1825 AT_DATA([sys-file.sack], [dnl
1826 dnl File header.
1827 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1828 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1829
1830 dnl Numeric variable, no label or missing values.
1831 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1832
1833 dnl Unknown extension record type.
1834 7; 30; 1; 1; i8 0;
1835
1836 dnl End of dictionary.
1837 999; 0;
1838 ])
1839 for variant in \
1840         "be ac8395e27677408189bcb8655e56cc0e" \
1841         "le e308bfcd51f1e3c28d7379c29271f9d6"
1842 do
1843   set $variant
1844   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
1845 ])
1846   AT_DATA([sys-file.sps], [dnl
1847 GET FILE='sys-file.sav'.
1848 ])
1849   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
1850 "warning: `sys-file.sav' near offset 0xd8: Unrecognized record type 7, subtype 30.  Please send a copy of this file, and the syntax which created it to bug-gnu-pspp@gnu.org."
1851 ])
1852 done
1853 AT_CLEANUP
1854
1855 AT_SETUP([bad machine integer info size])
1856 AT_KEYWORDS([sack synthetic system file negative])
1857 AT_DATA([sys-file.sack], [dnl
1858 dnl File header.
1859 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1860 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1861
1862 dnl Numeric variable, no label or missing values.
1863 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1864
1865 dnl Machine integer info record.
1866 7; 3; 4; >>9<<; 1; 2; 3; -1; 1; 1; ENDIAN; 1252; >>1234<<;
1867
1868 dnl End of dictionary.
1869 999; 0;
1870 ])
1871 for variant in \
1872         "be 21ec84826886b0a266d1360f8279d769" \
1873         "le 15dcba7b2b89b7d8a21ebcc872f515af"
1874 do
1875   set $variant
1876   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [ignore])
1877   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1878 ])
1879   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
1880 "warning: `sys-file.sav' near offset 0xd8: Record type 7, subtype 3 has bad count 9 (expected 8)."
1881 ])
1882 done
1883 AT_CLEANUP
1884
1885 AT_SETUP([bad machine integer info float format])
1886 AT_KEYWORDS([sack synthetic system file negative])
1887 AT_DATA([sys-file.sack], [dnl
1888 dnl File header.
1889 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1890 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1891
1892 dnl Numeric variable, no label or missing values.
1893 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1894
1895 dnl Machine integer info record.
1896 7; 3; 4; 8; 1; 2; 3; -1; >>2<<; 1; ENDIAN; 1252;
1897
1898 dnl End of dictionary.
1899 999; 0;
1900 ])
1901 for variant in \
1902         "be d510ed28278649eee997fb6881a4c04f" \
1903         "le fbf1eca561a4e243b7ae844ed1677035"
1904 do
1905   set $variant
1906   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [ignore])
1907   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1908 ])
1909   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
1910 error: `sys-file.sav' near offset 0xd8: Floating-point representation indicated by system file (2) differs from expected (1).
1911 ])
1912 done
1913 AT_CLEANUP
1914
1915 AT_SETUP([bad machine integer info endianness])
1916 AT_KEYWORDS([sack synthetic system file negative])
1917 AT_DATA([sys-file.sack], [dnl
1918 dnl File header.
1919 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1920 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1921
1922 dnl Numeric variable, no label or missing values.
1923 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1924
1925 dnl Machine integer info record.
1926 7; 3; 4; 8; 1; 2; 3; -1; 1; 1; >>3<<; 1252;
1927
1928 dnl End of dictionary.
1929 999; 0;
1930 ])
1931 for variant in \
1932         "be 855123d16d5e1560b91d60753dad79ad 1" \
1933         "le d6626b4fa2e46a91f26c2fc609b2f1e0 2"
1934 do
1935   set $variant
1936   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
1937 ])
1938   AT_DATA([sys-file.sps], [dnl
1939 GET FILE='sys-file.sav'.
1940 DISPLAY DICTIONARY.
1941 ])
1942   AT_CHECK_UNQUOTED([pspp -O format=csv sys-file.sps], [0], [dnl
1943 warning: \`sys-file.sav' near offset 0xd8: Integer format indicated by system file (3) differs from expected ($[3]).
1944
1945 Variable,Description,,Position
1946 num1,Format: F8.0,,1
1947 ,Measure: Scale,,
1948 ,Display Alignment: Right,,
1949 ,Display Width: 8,,
1950 ])
1951 done
1952 AT_CLEANUP
1953
1954
1955 AT_SETUP([bad machine floating-point info size])
1956 AT_KEYWORDS([sack synthetic system file negative])
1957 AT_DATA([sys-file.sack], [dnl
1958 dnl File header.
1959 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1960 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1961
1962 dnl Numeric variable, no label or missing values.
1963 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1964
1965 dnl Machine floating-point info record.
1966 7; 4; 8; >>4<<; SYSMIS; HIGHEST; LOWEST; 0.0;
1967
1968 dnl End of dictionary.
1969 999; 0;
1970 ])
1971 for variant in \
1972         "be 29c9a173638fbb8bb1efe1176c4d670f" \
1973         "le 5cb49eb1084e5b9cd573a54705ff86a7"
1974 do
1975   set $variant
1976   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [ignore])
1977   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1978 ])
1979   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
1980 "warning: `sys-file.sav' near offset 0xd8: Record type 7, subtype 4 has bad count 4 (expected 3)."
1981 ])
1982 done
1983 AT_CLEANUP
1984
1985 AT_SETUP([wrong special floating point values])
1986 AT_KEYWORDS([sack synthetic system file negative])
1987 AT_DATA([sys-file.sack], [dnl
1988 dnl File header.
1989 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1990 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1991
1992 dnl Numeric variable, no label or missing values.
1993 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1994
1995 dnl Machine floating-point info record.
1996 7; 4; 8; 3; >>0.0<<; >>1.0<<; >>2.0<<;
1997
1998 dnl End of dictionary.
1999 999; 0;
2000 ])
2001 for variant in \
2002         "be 1e7452d9bb0a2397bf6084a25437514e" \
2003         "le f59f9a83f723cde1611869ff6d91d325"
2004 do
2005   set $variant
2006   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
2007 ])
2008   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2009 ])
2010   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2011 warning: `sys-file.sav' near offset 0xd8: File specifies unexpected value 0 as SYSMIS.
2012
2013 warning: `sys-file.sav' near offset 0xd8: File specifies unexpected value 1 as HIGHEST.
2014
2015 warning: `sys-file.sav' near offset 0xd8: File specifies unexpected value 2 as LOWEST.
2016 ])
2017 done
2018 AT_CLEANUP
2019
2020 AT_SETUP([bad mrsets name])
2021 AT_KEYWORDS([sack synthetic system file negative multiple response])
2022 AT_DATA([sys-file.sack], [dnl
2023 dnl File header.
2024 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2025 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2026
2027 dnl Numeric variable, no label or missing values.
2028 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2029
2030 dnl Multiple response sets.
2031 7; 7; 1; COUNT("a=C");
2032 7; 19; 1; COUNT("xyz=D");
2033
2034 999; 0;
2035 ])
2036 for variant in \
2037         "be 15a9bf44d0cd6186a60629b77079c5a5" \
2038         "le 161c99aca5e7a3684df096137e72ce5b"
2039 do
2040   set $variant
2041   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
2042 ])
2043   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2044 ])
2045   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2046 warning: `sys-file.sav' near offset 0xd8: `a' does not begin with `$' at UTF-8 offset 2 in MRSETS record.
2047
2048 warning: `sys-file.sav' near offset 0xeb: `xyz' does not begin with `$' at UTF-8 offset 4 in MRSETS record.
2049 ])
2050 done
2051 AT_CLEANUP
2052
2053 AT_SETUP([missing space after C in mrsets])
2054 AT_KEYWORDS([sack synthetic system file negative multiple response])
2055 AT_DATA([sys-file.sack], [dnl
2056 dnl File header.
2057 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2058 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2059
2060 dnl Numeric variable, no label or missing values.
2061 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2062
2063 dnl Multiple response sets.
2064 7; 7; 1; COUNT("$a=Cx");
2065
2066 999; 0;
2067 ])
2068 for variant in \
2069         "be c5e5656ba3d74c3a967850f29ad89970" \
2070         "le 29f110509c3d6893a7d21ae2d66aad9d"
2071 do
2072   set $variant
2073   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
2074 ])
2075   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2076 ])
2077   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2078 warning: `sys-file.sav' near offset 0xd8: Missing space following `C' at UTF-8 offset 4 in MRSETS record.
2079 ])
2080 done
2081 AT_CLEANUP
2082
2083 AT_SETUP([missing space after E in mrsets])
2084 AT_KEYWORDS([sack synthetic system file negative multiple response])
2085 AT_DATA([sys-file.sack], [dnl
2086 dnl File header.
2087 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2088 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2089
2090 dnl Numeric variable, no label or missing values.
2091 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2092
2093 dnl Multiple response sets.
2094 7; 7; 1; COUNT("$a=Ex");
2095
2096 999; 0;
2097 ])
2098 for variant in \
2099         "be a9e1dc63e2524882a5e3d2949a2da9d4" \
2100         "le ac709ca1928f65f47a8c8efdd9454b50"
2101 do
2102   set $variant
2103   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
2104 ])
2105   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2106 ])
2107   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2108 warning: `sys-file.sav' near offset 0xd8: Missing space following `E' at UTF-8 offset 4 in MRSETS record.
2109 ])
2110 done
2111 AT_CLEANUP
2112
2113 AT_SETUP([unexpected label source in mrsets])
2114 AT_KEYWORDS([sack synthetic system file negative multiple response])
2115 AT_DATA([sys-file.sack], [dnl
2116 dnl File header.
2117 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2118 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2119
2120 dnl Numeric variable, no label or missing values.
2121 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2122
2123 dnl Multiple response sets.
2124 7; 7; 1; COUNT("$a=E 2");
2125
2126 999; 0;
2127 ])
2128 for variant in \
2129         "be 8c710e85a0a1609d0d03dec80aaf5f94" \
2130         "le 4682440b82f22d4bd2ac56afb7fa3152"
2131 do
2132   set $variant
2133   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
2134 ])
2135   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2136 ])
2137   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2138 warning: `sys-file.sav' near offset 0xd8: Unexpected label source value `2' following `E' at UTF-8 offset 7 in MRSETS record.
2139
2140 warning: `sys-file.sav' near offset 0xd8: Expecting digit at UTF-8 offset 7 in MRSETS record.
2141 ])
2142 done
2143 AT_CLEANUP
2144
2145 AT_SETUP([bad type character in mrsets])
2146 AT_KEYWORDS([sack synthetic system file negative multiple response])
2147 AT_DATA([sys-file.sack], [dnl
2148 dnl File header.
2149 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2150 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2151
2152 dnl Numeric variable, no label or missing values.
2153 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2154
2155 dnl Multiple response sets.
2156 7; 7; 1; COUNT("$a=");
2157
2158 999; 0;
2159 ])
2160 for variant in \
2161         "be fc5e5200d8f56b9a5a713e4a95313a3b" \
2162         "le 578a61e8a06b20216612f566c2050879"
2163 do
2164   set $variant
2165   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
2166 ])
2167   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2168 ])
2169   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2170 "warning: `sys-file.sav' near offset 0xd8: Missing `C', `D', or `E' at UTF-8 offset 3 in MRSETS record."
2171 ])
2172 done
2173 AT_CLEANUP
2174
2175 AT_SETUP([bad counted string length in mrsets])
2176 AT_KEYWORDS([sack synthetic system file negative multiple response])
2177 AT_DATA([sys-file.sack], [dnl
2178 dnl File header.
2179 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2180 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2181
2182 dnl Numeric variable, no label or missing values.
2183 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2184
2185 dnl Multiple response sets.
2186 7; 7; 1; COUNT("$a=Dx");
2187
2188 999; 0;
2189 ])
2190 for variant in \
2191         "be 23d0e2f65c7c5f93bbedcc0f2b260c69" \
2192         "le c3860c1d80e08842264948056e72c0db"
2193 do
2194   set $variant
2195   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
2196 ])
2197   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2198 ])
2199   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2200 warning: `sys-file.sav' near offset 0xd8: Expecting digit at UTF-8 offset 4 in MRSETS record.
2201 ])
2202 done
2203 AT_CLEANUP
2204
2205 AT_SETUP([missing space in counted string in mrsets])
2206 AT_KEYWORDS([sack synthetic system file negative multiple response])
2207 AT_DATA([sys-file.sack], [dnl
2208 dnl File header.
2209 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2210 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2211
2212 dnl Numeric variable, no label or missing values.
2213 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2214
2215 dnl Multiple response sets.
2216 7; 7; 1; COUNT("$a=D1x");
2217
2218 999; 0;
2219 ])
2220 for variant in \
2221         "be c9ce001723763e0698878b7e43a887e8" \
2222         "le e258a1e4491d5a1d1e7d2272ef631a22"
2223 do
2224   set $variant
2225   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
2226 ])
2227   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2228 ])
2229   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2230 warning: `sys-file.sav' near offset 0xd8: Expecting space at UTF-8 offset 5 in MRSETS record.
2231 ])
2232 done
2233 AT_CLEANUP
2234
2235 AT_SETUP([counted string too long in mrsets])
2236 AT_KEYWORDS([sack synthetic system file negative multiple response])
2237 AT_DATA([sys-file.sack], [dnl
2238 dnl File header.
2239 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2240 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2241
2242 dnl Numeric variable, no label or missing values.
2243 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2244
2245 dnl Multiple response sets.
2246 7; 7; 1; COUNT("$a=D4 abc");
2247
2248 999; 0;
2249 ])
2250 for variant in \
2251         "be 196d1266fa0e8e315769dcbe3130e3df" \
2252         "le 23df1ba7b77a26da8ce1c2cfbcaadce0"
2253 do
2254   set $variant
2255   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
2256 ])
2257   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2258 ])
2259   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2260 warning: `sys-file.sav' near offset 0xd8: 4-byte string starting at UTF-8 offset 6 exceeds record length 9.
2261 ])
2262 done
2263 AT_CLEANUP
2264
2265 AT_SETUP([missing space after counted string in mrsets])
2266 AT_KEYWORDS([sack synthetic system file negative multiple response])
2267 AT_DATA([sys-file.sack], [dnl
2268 dnl File header.
2269 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2270 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2271
2272 dnl Numeric variable, no label or missing values.
2273 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2274
2275 dnl Multiple response sets.
2276 7; 7; 1; COUNT("$a=D3 abcx");
2277
2278 999; 0;
2279 ])
2280 for variant in \
2281         "be 86314bb0bbdfad48c10af8b8d8106d6e" \
2282         "le 2b8d05ff501ca78e51f7110ce88a2364"
2283 do
2284   set $variant
2285   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
2286 ])
2287   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2288 ])
2289   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2290 warning: `sys-file.sav' near offset 0xd8: Expecting space at UTF-8 offset 9 following 3-byte string.
2291 ])
2292 done
2293 AT_CLEANUP
2294
2295 AT_SETUP([missing newline after variable name in mrsets])
2296 AT_KEYWORDS([sack synthetic system file negative multiple response])
2297 AT_DATA([sys-file.sack], [dnl
2298 dnl File header.
2299 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2300 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2301
2302 dnl Numeric variable, no label or missing values.
2303 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2304
2305 dnl Multiple response sets.
2306 7; 7; 1; COUNT("$a=C 0  NUM1");
2307
2308 999; 0;
2309 ])
2310 for variant in \
2311         "be cea939cf3e6a5f88cb45e8fa871c5e13" \
2312         "le 52135afec082f50f37eafacadbb2cd65"
2313 do
2314   set $variant
2315   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
2316 ])
2317   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2318 ])
2319   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2320 warning: `sys-file.sav' near offset 0xd8: Missing new-line parsing variable names at UTF-8 offset 14 in MRSETS record.
2321
2322 warning: `sys-file.sav' near offset 0xd8: MRSET $a has only 1 variables.
2323 ])
2324 done
2325 AT_CLEANUP
2326
2327 AT_SETUP([duplicate variable name in mrsets])
2328 AT_KEYWORDS([sack synthetic system file negative multiple response])
2329 AT_DATA([sys-file.sack], [dnl
2330 dnl File header.
2331 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2332 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2333
2334 dnl Numeric variable, no label or missing values.
2335 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2336
2337 dnl Multiple response sets.
2338 7; 7; 1; COUNT("$a=C 0  NUM1 NUM1"; i8 10);
2339
2340 999; 0;
2341 ])
2342 for variant in \
2343         "be 4b1b5fa2dc22cf0afdd35422290b0a29" \
2344         "le e4304b57976440a036f25f8dd8ac1404"
2345 do
2346   set $variant
2347   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
2348 ])
2349   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2350 ])
2351   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2352 warning: `sys-file.sav' near offset 0xd8: Duplicate variable name NUM1 at UTF-8 offset 18 in MRSETS record.
2353
2354 warning: `sys-file.sav' near offset 0xd8: MRSET $a has only 1 variables.
2355 ])
2356 done
2357 AT_CLEANUP
2358
2359 AT_SETUP([mixed variable types in mrsets])
2360 AT_KEYWORDS([sack synthetic system file negative multiple response])
2361 AT_DATA([sys-file.sack], [dnl
2362 dnl File header.
2363 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2364 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2365
2366 dnl Variables.
2367 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2368 2; 8; 0; 0; 0x010800 *2; s8 "STR1";
2369
2370 dnl Multiple response sets.
2371 7; 7; 1; COUNT("$a=C 0  NUM1 STR1"; i8 10);
2372
2373 999; 0;
2374 ])
2375 for variant in \
2376         "be 0f130e967e4097823f85b8711eb20727" \
2377         "le 4dc987b4303fd115f1cae9be3963acc9"
2378 do
2379   set $variant
2380   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
2381 ])
2382   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2383 ])
2384   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2385 warning: `sys-file.sav' near offset 0xf8: MRSET $a contains both string and numeric variables.
2386
2387 warning: `sys-file.sav' near offset 0xf8: MRSET $a has only 1 variables.
2388 ])
2389 done
2390 AT_CLEANUP
2391
2392 AT_SETUP([missing newline after variable name in mrsets])
2393 AT_KEYWORDS([sack synthetic system file negative multiple response])
2394 AT_DATA([sys-file.sack], [dnl
2395 dnl File header.
2396 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2397 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2398
2399 dnl Numeric variable, no label or missing values.
2400 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2401
2402 dnl Multiple response sets.
2403 7; 7; 1; COUNT("$a=C 0  NUM1"; i8 10);
2404
2405 999; 0;
2406 ])
2407 for variant in \
2408         "be 3a891e0a467afb3d622629c70f329ada" \
2409         "le 432998ec08370510411af4f5207c015e"
2410 do
2411   set $variant
2412   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
2413 ])
2414   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2415 ])
2416   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2417 warning: `sys-file.sav' near offset 0xd8: MRSET $a has only 1 variables.
2418 ])
2419 done
2420 AT_CLEANUP
2421
2422 AT_SETUP([only one variable in mrset])
2423 AT_KEYWORDS([sack synthetic system file negative multiple response])
2424 AT_DATA([sys-file.sack], [dnl
2425 dnl File header.
2426 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2427 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2428
2429 dnl Numeric variable, no label or missing values.
2430 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2431
2432 dnl Multiple response sets.
2433 7; 7; 1; COUNT("$a=C 0  NUM1"; i8 10);
2434
2435 999; 0;
2436 ])
2437 for variant in \
2438         "be 3a891e0a467afb3d622629c70f329ada" \
2439         "le 432998ec08370510411af4f5207c015e"
2440 do
2441   set $variant
2442   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
2443 ])
2444   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2445 ])
2446   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2447 warning: `sys-file.sav' near offset 0xd8: MRSET $a has only 1 variables.
2448 ])
2449 done
2450 AT_CLEANUP
2451
2452 AT_SETUP([wrong display parameter size])
2453 AT_KEYWORDS([sack synthetic system file negative])
2454 AT_DATA([sys-file.sack], [dnl
2455 dnl File header.
2456 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2457 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2458
2459 dnl Numeric variable, no label or missing values.
2460 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2461
2462 dnl Display parameters record.
2463 7; 11; >>8<<; 2; 1.0; 1.0;
2464
2465 dnl End of dictionary.
2466 999; 0;
2467 ])
2468 for variant in \
2469         "be 7c0f1ae47ae11e37d435c4abaceca226" \
2470         "le c29d05a1f8f15ed2201f31f8b787aaa0"
2471 do
2472   set $variant
2473   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
2474 ])
2475   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2476 ])
2477   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2478 "warning: `sys-file.sav' near offset 0xd8: Record type 7, subtype 11 has bad size 8 (expected 4)."
2479 ])
2480 done
2481 AT_CLEANUP
2482
2483 AT_SETUP([wrong display parameter count])
2484 AT_KEYWORDS([sack synthetic system file negative])
2485 AT_DATA([sys-file.sack], [dnl
2486 dnl File header.
2487 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2488 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2489
2490 dnl Numeric variable, no label or missing values.
2491 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2492
2493 dnl Display parameters record.
2494 7; 11; 4; >>4<<; 1; 1; 2; 2;
2495
2496 dnl End of dictionary.
2497 999; 0;
2498 ])
2499 for variant in \
2500         "be 372b57e73c69b05047b60bf6c596e2a1" \
2501         "le 2a550d8c5ceae4de7ced77df66e49d0f"
2502 do
2503   set $variant
2504   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
2505 ])
2506   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2507 ])
2508   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2509 warning: `sys-file.sav' near offset 0xd8: Extension 11 has bad count 4 (for 1 variables).
2510 ])
2511 done
2512 AT_CLEANUP
2513
2514 AT_SETUP([wrong display measurement level])
2515 AT_KEYWORDS([sack synthetic system file negative])
2516 AT_DATA([sys-file.sack], [dnl
2517 dnl File header.
2518 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2519 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2520
2521 dnl Numeric variable, no label or missing values.
2522 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2523
2524 dnl Display parameters record.
2525 7; 11; 4; 2; >>4<<; 0;
2526
2527 dnl End of dictionary.
2528 999; 0;
2529 ])
2530 for variant in \
2531         "be d43e7616b03743339f37292dec6c2204" \
2532         "le 821533c29a070cefdd8f07f4e1741d2a"
2533 do
2534   set $variant
2535   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
2536 ])
2537   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2538 ])
2539   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2540 warning: `sys-file.sav' near offset 0xd8: Invalid variable display parameters for variable 0 (NUM1).  Default parameters substituted.
2541 ])
2542 done
2543 AT_CLEANUP
2544
2545 AT_SETUP([wrong display alignment])
2546 AT_KEYWORDS([sack synthetic system file negative])
2547 AT_DATA([sys-file.sack], [dnl
2548 dnl File header.
2549 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2550 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2551
2552 dnl Numeric variable, no label or missing values.
2553 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2554
2555 dnl Display parameters record.
2556 7; 11; 4; 2; 1; >>-1<<;
2557
2558 dnl End of dictionary.
2559 999; 0;
2560 ])
2561 for variant in \
2562         "be c54bc48b5767e2ec3a9ef31df790cb7c" \
2563         "le a4d8b14af64221abe83adb417d110e10"
2564 do
2565   set $variant
2566   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
2567 ])
2568   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2569 ])
2570   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2571 warning: `sys-file.sav' near offset 0xd8: Invalid variable display parameters for variable 0 (NUM1).  Default parameters substituted.
2572 ])
2573 done
2574 AT_CLEANUP
2575
2576 AT_SETUP([bad variable name in variable/value pair])
2577 AT_KEYWORDS([sack synthetic system file negative])
2578 AT_DATA([sys-file.sack], [dnl
2579 dnl File header.
2580 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2581 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2582
2583 dnl Numeric variables.
2584 2; 0; 0; 0; 0x050800 *2; s8 "LONGVARI";
2585
2586 dnl Long variable names.
2587 7; 13; 1; COUNT (>>"xyzzy"<<);
2588
2589 dnl Dictionary termination record.
2590 999; 0;
2591 ])
2592 for variant in \
2593         "be b67b6e3c1900e5a9cc691055008f0447" \
2594         "le 26cc52e601f830f9087a0ea2bd9527df"
2595 do
2596   set $variant
2597   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
2598 ])
2599   AT_DATA([sys-file.sps], [dnl
2600 GET FILE='sys-file.sav'.
2601 ])
2602   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2603 warning: `sys-file.sav' near offset 0xde: Dictionary record refers to unknown variable xyzzy.
2604 ])
2605 done
2606 AT_CLEANUP
2607
2608 AT_SETUP([duplicate long variable name])
2609 AT_KEYWORDS([sack synthetic system file negative])
2610 AT_DATA([sys-file.sack], [dnl
2611 dnl File header.
2612 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2613 2; 4; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2614
2615 dnl Numeric variables.
2616 2; 0; 0; 0; 0x050800 *2; s8 "LONGVARI";
2617 2; 0; 0; 0; 0x050800 *2; s8 "LONGVA_A";
2618 2; 0; 0; 0; 0x050800 *2; s8 "LONGVA_B";
2619 2; 0; 0; 0; 0x050800 *2; s8 "LONGVA_C";
2620
2621 dnl Long variable names.
2622 7; 13; 1; COUNT (
2623 "LONGVARI=_Invalid"; i8 9;
2624 "LONGVA_A=LongVariableName"; i8 9;
2625 "LONGVA_B=LONGVARIABLENAME"; i8 9;
2626 );
2627
2628 dnl Dictionary termination record.
2629 999; 0;
2630 ])
2631 for variant in \
2632         "be 9b4b4daa00084d984efb8f889bcb727c" \
2633         "le c1b1470d5cd615106e9ae507c9948d8e"
2634 do
2635   set $variant
2636   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
2637 ])
2638   AT_DATA([sys-file.sps], [dnl
2639 GET FILE='sys-file.sav'.
2640 ])
2641   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2642 warning: `sys-file.sav' near offset 0x138: Long variable mapping from LONGVARI to invalid variable name `_Invalid'.
2643
2644 warning: `sys-file.sav' near offset 0x138: Duplicate long variable name `LONGVARIABLENAME'.
2645 ])
2646 done
2647 AT_CLEANUP
2648
2649 AT_SETUP([bad very long string length])
2650 AT_KEYWORDS([sack synthetic system file negative])
2651 AT_DATA([sys-file.sack], [dnl
2652 dnl File header.
2653 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2654 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2655
2656 dnl Numeric variable.
2657 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2658
2659 dnl Very long string map.
2660 7; 14; 1; COUNT (
2661 "NUM1=00000"; i8 0; i8 9;
2662 "NUM1=00255"; i8 0; i8 9;
2663 "NUM1=00256"; i8 0; i8 9;
2664 );
2665
2666 dnl Dictionary termination record.
2667 999; 0;
2668 ])
2669 for variant in \
2670         "be 1309d8d9fb24bcf08952dce9b0f39a94" \
2671         "le 94a39de88f8034001b3e467c4cc04d0f"
2672 do
2673   set $variant
2674   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
2675 ])
2676   AT_DATA([sys-file.sps], [dnl
2677 GET FILE='sys-file.sav'.
2678 ])
2679   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
2680 warning: `sys-file.sav' near offset 0xd8: NUM1 listed as string of invalid length 00000 in very long string record.
2681
2682 "warning: `sys-file.sav' near offset 0xd8: NUM1 listed in very long string record with width 00255, which requires only one segment."
2683
2684 error: `sys-file.sav' near offset 0xd8: Very long string NUM1 overflows dictionary.
2685 ])
2686 done
2687 AT_CLEANUP
2688
2689 AT_SETUP([bad very long string segment width])
2690 AT_KEYWORDS([sack synthetic system file negative])
2691 AT_DATA([sys-file.sack], [dnl
2692 dnl File header.
2693 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2694 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2695
2696 dnl Variables.
2697 2; 255; 0; 0; 0x01ff00 *2; s8 "STR1";
2698 (2; -1; 0; 0; 0; 0; s8 "") * 31;
2699 2; >>9<<; 0; 0; 0x010900 *2; s8 "STR1_A";
2700 >>2; -1; 0; 0; 0; 0; s8 "";<<
2701
2702 dnl Very long string map.
2703 7; 14; 1; COUNT (
2704 "STR1=00256"; i8 0; i8 9;
2705 );
2706
2707 dnl Dictionary termination record.
2708 999; 0;
2709 ])
2710 for variant in \
2711         "be 1d09a44a46859e6eda28e053dd4b7a8b" \
2712         "le 63b9ac0b3953f3e0d5ee248ebe257794"
2713 do
2714   set $variant
2715   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
2716 ])
2717   AT_DATA([sys-file.sps], [dnl
2718 GET FILE='sys-file.sav'.
2719 ])
2720   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
2721 error: `sys-file.sav' near offset 0x4f8: Very long string with width 256 has segment 1 of width 9 (expected 4).
2722 ])
2723 done
2724 AT_CLEANUP
2725
2726 AT_SETUP([too many value labels])
2727 dnl Skip the test if multiplying a small number by INT32_MAX would not
2728 dnl cause an overflow in size_t.
2729 AT_SKIP_IF([test $SIZEOF_SIZE_T -gt 4])
2730 AT_KEYWORDS([sack synthetic system file negative])
2731 AT_DATA([sys-file.sack], [dnl
2732 dnl File header.
2733 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2734 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2735
2736 dnl Numeric variable.
2737 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2738 3; >>0x7fffffff<<;
2739 ])
2740 for variant in \
2741         "be 975b2668dde395ddf619977958b37412" \
2742         "le 0c14aa278cfc2a4b801f91c14321f03b"
2743 do
2744   set $variant
2745   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
2746 ])
2747   AT_DATA([sys-file.sps], [dnl
2748 GET FILE='sys-file.sav'.
2749 ])
2750   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
2751 error: `sys-file.sav' near offset 0xd4: Invalid number of labels 2147483647.
2752 ])
2753 done
2754 AT_CLEANUP
2755
2756 AT_SETUP([missing type 4 record])
2757 AT_KEYWORDS([sack synthetic system file negative])
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.
2764 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2765
2766 dnl Value label with missing type 4 record.
2767 3; 1; 1.0; i8 3; s7 "one";
2768
2769 dnl End of dictionary.
2770 >>999; 0<<;
2771 ])
2772 for variant in \
2773         "be 5e1286ac92e3f25ff98492bc5019d608" \
2774         "le b33c12f776bbcaa43aa3bfdd4799e0c0"
2775 do
2776   set $variant
2777   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
2778 ])
2779   AT_DATA([sys-file.sps], [dnl
2780 GET FILE='sys-file.sav'.
2781 ])
2782   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
2783 error: `sys-file.sav' near offset 0xe8: Variable index record (type 4) does not immediately follow value label record (type 3) as it should.
2784 ])
2785 done
2786 AT_CLEANUP
2787
2788 AT_SETUP([value label with no associated variables])
2789 AT_KEYWORDS([sack synthetic system file negative])
2790 AT_DATA([sys-file.sack], [dnl
2791 dnl File header.
2792 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2793 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2794
2795 dnl Numeric variable.
2796 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2797
2798 dnl Value label with no variables.
2799 3; 1; 1.0; i8 3; s7 "one"; 4; >>0<<;
2800 ])
2801 for variant in \
2802         "be b0dcec30a936cbcad21c4f3d6fe10fcf" \
2803         "le 3b9fdfce5c8c248048232fd6eac018e3"
2804 do
2805   set $variant
2806   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
2807 ])
2808   AT_DATA([sys-file.sps], [dnl
2809 GET FILE='sys-file.sav'.
2810 ])
2811   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
2812 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).
2813 ])
2814 done
2815 AT_CLEANUP
2816
2817 AT_SETUP([type 4 record names long string variable])
2818 AT_KEYWORDS([sack synthetic system file negative])
2819 AT_DATA([sys-file.sack], [dnl
2820 dnl File header.
2821 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2822 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2823
2824 dnl Long string variable.
2825 2; 9; 0; 0; 0x010900 *2; s8 "STR1";
2826 2; -1; 0; 0; 0; 0; s8 "";
2827
2828 dnl Value label that names long string variable.
2829 3; 1; s8 "xyzzy"; i8 3; s7 "one"; 4; 1; >>1<<;
2830
2831 dnl End of dictionary.
2832 999; 0;
2833 ])
2834 for variant in \
2835         "be 14053a4f09de4c7c4c55281534dd66f4" \
2836         "le 8a61cc994c659fd66307d2f0fd64ce20"
2837 do
2838   set $variant
2839   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [ignore])
2840   AT_DATA([sys-file.sps], [dnl
2841 GET FILE='sys-file.sav'.
2842 ])
2843   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
2844 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.
2845 ])
2846 done
2847 AT_CLEANUP
2848
2849 AT_SETUP([variables for value label must all be same type])
2850 AT_KEYWORDS([sack synthetic system file negative])
2851 AT_DATA([sys-file.sack], [dnl
2852 dnl File header.
2853 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2854 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2855
2856 dnl Variables.
2857 2; 6; 0; 0; 0x010600 *2; s8 "STR1";
2858 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2859
2860 dnl Value label that names numeric and string variables.
2861 3; 1; s8 "xyzzy"; i8 3; s7 "one"; 4; 2; >>1; 2<<;
2862
2863 dnl End of dictionary.
2864 999; 0;
2865 ])
2866 for variant in \
2867         "be 7577c456726a88f52bbef63a8b47bf1a" \
2868         "le 3ba5c6af9ad0ae5cc88f9f63e726e414"
2869 do
2870   set $variant
2871   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [ignore])
2872   AT_DATA([sys-file.sps], [dnl
2873 GET FILE='sys-file.sav'.
2874 ])
2875   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
2876 "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."
2877 ])
2878 done
2879 AT_CLEANUP
2880
2881 AT_SETUP([duplicate value labels type])
2882 AT_KEYWORDS([sack synthetic system file negative])
2883 AT_DATA([sys-file.sack], [dnl
2884 dnl File header.
2885 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2886 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2887
2888 dnl Variables.
2889 2; 6; 0; 0; 0x010600 *2; s8 "STR1";
2890 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2891
2892 dnl Duplicate value labels.
2893 3; 1; s8 "xyzzy"; i8 3; s7 "one"; 4; 2; >>1; 1<<;
2894 3; 1; 1.0; i8 3; s7 "one"; 4; 2; >>2; 2<<;
2895
2896 dnl End of dictionary.
2897 999; 0;
2898 ])
2899 for variant in \
2900         "be ef0f5b2ebddb5a3bfcda16c93a2508f4" \
2901         "le c00e27abd9a6c06bf29a108d7220435a"
2902 do
2903   set $variant
2904   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
2905 ])
2906   AT_DATA([sys-file.sps], [dnl
2907 GET FILE='sys-file.sav'.
2908 ])
2909   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2910 warning: `sys-file.sav' near offset 0xf4: Duplicate value label for `xyzzy ' on STR1.
2911
2912 warning: `sys-file.sav' near offset 0x11c: Duplicate value label for 1 on NUM1.
2913 ])
2914 done
2915 AT_CLEANUP
2916
2917 AT_SETUP([missing attribute value])
2918 AT_KEYWORDS([sack synthetic system file negative])
2919 AT_DATA([sys-file.sack], [dnl
2920 dnl File header.
2921 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2922 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2923
2924 dnl Variables.
2925 2; 0; 0; 0; 0x050800 *2; s8 "FIRSTVAR";
2926
2927 dnl Data file attributes record.
2928 7; 17; 1; COUNT (
2929 "Attr1("
2930 );
2931
2932 dnl Variable attributes record.
2933 7; 18; 1; COUNT (
2934 "FIRSTVAR:";
2935   "fred('23'"; i8 10
2936 );
2937
2938 dnl Dictionary termination record.
2939 999; 0;
2940 ])
2941 for variant in \
2942         "be 0fc71f5e3cdb6b7f2dd73d011d4885c2" \
2943         "le e519b44715400156a2bfe648eb5cff34"
2944 do
2945   set $variant
2946   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
2947 ])
2948   AT_DATA([sys-file.sps], [dnl
2949 GET FILE='sys-file.sav'.
2950 ])
2951   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2952 warning: `sys-file.sav' near offset 0xdf: Error parsing attribute value Attr1[[1]].
2953
2954 warning: `sys-file.sav' near offset 0x102: Error parsing attribute value fred[[2]].
2955 ])
2956 done
2957 AT_CLEANUP
2958
2959 AT_SETUP([unquoted attribute value])
2960 AT_KEYWORDS([sack synthetic system file negative])
2961 AT_DATA([sys-file.sack], [dnl
2962 dnl File header.
2963 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2964 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2965
2966 dnl Variables.
2967 2; 0; 0; 0; 0x050800 *2; s8 "FIRSTVAR";
2968
2969 dnl Data file attributes record.
2970 7; 17; 1; COUNT (
2971 "Attr1(value"; i8 10;
2972 ")"
2973 );
2974
2975 dnl Variable attributes record.
2976 7; 18; 1; COUNT (
2977 "FIRSTVAR:";
2978   "fred(23"; i8 10; ")"
2979 );
2980
2981 dnl Dictionary termination record.
2982 999; 0;
2983 ])
2984 for variant in \
2985         "be 33dba37c2247e63c04bb74a7b472293d" \
2986         "le 041025a9d9d9e21a7fabd90ba7341934"
2987 do
2988   set $variant
2989   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
2990 ])
2991   AT_DATA([sys-file.sps], [dnl
2992 GET FILE='sys-file.sav'.
2993 ])
2994   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2995 warning: `sys-file.sav' near offset 0xe4: Attribute value Attr1[[1]] is not quoted: value.
2996
2997 warning: `sys-file.sav' near offset 0x106: Attribute value fred[[1]] is not quoted: 23.
2998 ])
2999 done
3000 AT_CLEANUP
3001
3002 AT_SETUP([bad variable name in long string value label])
3003 AT_KEYWORDS([sack synthetic system file negative])
3004 AT_DATA([sys-file.sack], [dnl
3005 dnl File header.
3006 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3007 2; 3; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3008
3009 dnl Variables.
3010 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3011 2; 14; 0; 0; 0x010e00 *2; s8 "STR14";
3012 2; -1; 0; 0; 0; 0; s8 "";
3013
3014 7; 21; 1; COUNT (
3015 dnl No variable named STR9.
3016 COUNT(>>"STR9"<<); 9;
3017 1; COUNT("RSTUVWXYZ"); COUNT("value label for `RSTUVWXYZ'");
3018
3019 dnl NUM1 is numeric.
3020 COUNT(>>"NUM1"<<); 0;
3021 1; COUNT("xyz"); COUNT("value label for 1.0");
3022
3023 dnl Wrong width for STR14.
3024 COUNT("STR14"); >>9<<;
3025 1; COUNT("RSTUVWXYZ"); COUNT("value label for `RSTUVWXYZ'");
3026
3027 dnl Wrong width for value.
3028 COUNT("STR14"); 14;
3029 1; COUNT(>>"RSTUVWXYZ"<<); COUNT("value label for `RSTUVWXYZ'");
3030
3031 dnl Duplicate value label.
3032 COUNT("STR14"); 14; 2;
3033 COUNT("abcdefghijklmn"); COUNT("value label for `abcdefghijklmn'");
3034 >>COUNT("abcdefghijklmn"); COUNT("another value label for `abcdefghijklmn'")<<;
3035 );
3036
3037 dnl Dictionary termination record.
3038 999; 0;
3039 ])
3040 for variant in \
3041         "be cf2e883dadb00e2c6404c09ea0a4e388" \
3042         "le 89c340faf0a7e4a8c834f9687684c091"
3043 do
3044   set $variant
3045   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
3046 ])
3047   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3048 ])
3049   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
3050 warning: `sys-file.sav' near offset 0x128: Ignoring long string value record for unknown variable STR9.
3051
3052 warning: `sys-file.sav' near offset 0x164: Ignoring long string value record for numeric variable NUM1.
3053
3054 warning: `sys-file.sav' near offset 0x193: Ignoring long string value record for variable STR14 because the record's width (9) does not match the variable's width (14).
3055
3056 "warning: `sys-file.sav' near offset 0x1d4: Ignoring long string value 0 for variable str14, with width 14, that has bad value width 9."
3057
3058 warning: `sys-file.sav' near offset 0x259: Duplicate value label for `abcdefghijklmn' on str14.
3059 ])
3060 done
3061 AT_CLEANUP
3062
3063 AT_SETUP([fewer data records than indicated by file header])
3064 AT_KEYWORDS([sack synthetic system file negative])
3065 AT_DATA([sys-file.sack], [dnl
3066 dnl File header.
3067 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3068 2; 2; 0; 0; >>5<<; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3069
3070 dnl Numeric variables.
3071 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3072 2; 0; 0; 0; 0x050800 *2; s8 "NUM2";
3073
3074 dnl Data.
3075 999; 0;
3076 1.0; 2.0;
3077 3.0; 4.0;
3078 5.0; 6.0;
3079 7.0; 8.0;
3080 dnl Missing record here.
3081 ])
3082 for variant in \
3083         "be 6ee097c3934055d0c4564641636f4b5a" \
3084         "le ae03fe1b888091d6938b5a436d44ac60"
3085 do
3086   set $variant
3087   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
3088 ])
3089   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3090 LIST.
3091 ])
3092   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
3093    [error: Error reading case from file `sys-file.sav'.
3094
3095 Table: Data List
3096 num1,num2
3097 1,2
3098 3,4
3099 5,6
3100 7,8
3101 ])
3102 done
3103 AT_CLEANUP
3104
3105 AT_SETUP([partial data record between variables])
3106 AT_KEYWORDS([sack synthetic system file negative])
3107 AT_DATA([sys-file.sack], [dnl
3108 dnl File header.
3109 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3110 2; 2; 0; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3111
3112 dnl Numeric variables.
3113 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3114 2; 0; 0; 0; 0x050800 *2; s8 "NUM2";
3115
3116 dnl Data.
3117 999; 0;
3118 1.0; 2.0;
3119 3.0;
3120 ])
3121 for variant in \
3122         "be 4bcc085d7d8f0f09c6a4ba8064ffe61c" \
3123         "le 7387fc5edd2740aff92c30ca688d6d9b"
3124 do
3125   set $variant
3126   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
3127 ])
3128   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3129 LIST.
3130 ])
3131   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
3132    [error: `sys-file.sav' near offset 0x110: File ends in partial case.
3133
3134 Table: Data List
3135 num1,num2
3136 1,2
3137 ])
3138 done
3139 AT_CLEANUP
3140
3141 AT_SETUP([partial data record within long string])
3142 AT_KEYWORDS([sack synthetic system file negative])
3143 AT_DATA([sys-file.sack], [dnl
3144 dnl File header.
3145 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3146 2; 2; 0; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3147
3148 dnl Numeric variables.
3149 2; 14; 0; 0; 0x010e00 *2; s8 "STR14";
3150 2; -1; 0; 0; 0; 0; s8 "";
3151
3152 dnl Data.
3153 999; 0;
3154 s14 "one data item";
3155 s8 "partial";
3156 ])
3157 for variant in \
3158         "be 4a9e84f9e679afb7bb71acd0bb7eab89" \
3159         "le 30752606f14ee2deec2854e8e6de4b3b"
3160 do
3161   set $variant
3162   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
3163 ])
3164   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3165 LIST.
3166 ])
3167   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
3168    [error: `sys-file.sav' near offset 0x10e: Unexpected end of file.
3169
3170 Table: Data List
3171 str14
3172 one data item @&t@
3173 ])
3174 done
3175 AT_CLEANUP
3176
3177 AT_SETUP([partial compressed data record])
3178 AT_KEYWORDS([sack synthetic system file positive])
3179 AT_DATA([sys-file.sack], [dnl
3180 dnl File header.
3181 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3182 2; dnl Layout code
3183 6; dnl Nominal case size
3184 1; dnl Compressed
3185 0; dnl Not weighted 
3186 -1; dnl Unspecified number of cases.
3187 100.0; dnl Bias.
3188 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
3189 i8 0 *3;
3190
3191 dnl Numeric variables.
3192 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3193 2; 0; 0; 0; 0x050800 *2; s8 "NUM2";
3194
3195 dnl String variable.
3196 2; 4; 0; 0; 0x010400 *2; s8 "STR4";
3197 2; 8; 0; 0; 0x010800 *2; s8 "STR8";
3198 2; 15; 0; 0; 0x010f00 *2; s8 "STR15";
3199 2; -1; 0; 0; 0; 0; s8 "";
3200
3201 dnl Dictionary termination record.
3202 999; 0;
3203
3204 dnl Compressed data.
3205 i8 1 100 254 253 254 253; i8 255 251; "abcdefgh"; s8 "0123";
3206 ])
3207 for variant in \
3208         "be ef01b16e2e397d979a3a7d20725ebe6d" \
3209         "le 51f7a61e9bc68992469d16c55d6ecd88"
3210 do
3211   set $variant
3212   AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2]
3213 ])
3214   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3215 LIST.
3216 ])
3217   AT_CHECK([pspp -O format=csv sys-file.sps], [1], 
3218    [error: `sys-file.sav' near offset 0x190: File ends in partial case.
3219
3220 Table: Data List
3221 num1,num2,str4,str8,str15
3222 -99,0,,abcdefgh,0123   @&t@
3223 ])
3224 done
3225 AT_CLEANUP
3226