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