po: Update translations from translationproject.org.
[pspp.git] / tests / data / sys-file-reader.at
blob7771c27155ad5bdde645f999b742f911039ebffd
1 dnl PSPP - a program for statistical analysis.
2 dnl Copyright (C) 2017 Free Software Foundation, Inc.
3 dnl
4 dnl This program is free software: you can redistribute it and/or modify
5 dnl it under the terms of the GNU General Public License as published by
6 dnl the Free Software Foundation, either version 3 of the License, or
7 dnl (at your option) any later version.
8 dnl
9 dnl This program is distributed in the hope that it will be useful,
10 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 dnl GNU General Public License for more details.
13 dnl
14 dnl You should have received a copy of the GNU General Public License
15 dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 dnl
17 AT_BANNER([system file reader - positive])
19 AT_SETUP([variable labels and missing values])
20 AT_KEYWORDS([sack synthetic system file positive])
21 AT_DATA([sys-file.sack], [dnl
22 dnl File header.
23 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
24 2; dnl Layout code
25 28; dnl Nominal case size
26 0; dnl Not compressed
27 0; dnl Not weighted
28 1; dnl 1 case.
29 100.0; dnl Bias.
30 "01 Jan 11"; "20:53:52";
31 "PSPP synthetic test file: "; i8 244; i8 245; i8 246; i8 248; s34 "";
32 i8 0 *3;
34 dnl Numeric variable, no label or missing values.
35 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
37 dnl Numeric variable, variable label.
38 2; 0; 1; 0; 0x050800 *2; s8 "NUM2";
39 32; "Numeric variable 2's label ("; i8 249; i8 250; i8 251; ")";
41 dnl Numeric variable, one missing value.
42 2; 0; 0; 1; 0x050800 *2; s8 "NUM3";
43 1.0;
45 dnl Numeric variable, variable label and missing value.
46 2; 0; 1; 1; 0x050800 *2; s8 "NUM4";
47 30; "Another numeric variable label"; i8 0 * 2;
48 1.0;
50 dnl Numeric variable, two missing values.
51 2; 0; 0; 2; 0x050800 *2; s8 "NUM5"; 1.0; 2.0;
53 dnl Numeric variable, three missing values.
54 2; 0; 0; 3; 0x050800 *2; s8 "NUM6"; 1.0; 2.0; 3.0;
56 dnl Numeric variable, range of missing values.
57 2; 0; 0; -2; 0x050800 *2; s8 "NUM7"; 1.0; 3.0;
59 dnl Numeric variables, range of missing values plus discrete value.
60 2; 0; 0; -3; 0x050800 *2; s8 "NUM8"; 1.0; 3.0; 5.0;
61 2; 0; 0; -3; 0x050800 *2; s8 "NUM9"; 1.0; HIGHEST; -5.0;
62 2; 0; 0; -3; 0x050800 *2; "NUM"; i8 192; i8 200; i8 204; i8 209; i8 210;
63 LOWEST; 1.0; 5.0;
65 dnl String variable, no label or missing values.
66 2; 4; 0; 0; 0x010400 *2; s8 "STR1";
68 dnl String variable, variable label.
69 2; 4; 1; 0; 0x010400 *2; s8 "STR2";
70 25; "String variable 2's label"; i8 0 * 3;
72 dnl String variable, one missing value.
73 2; 4; 0; 1; 0x010400 *2; s8 "STR3"; s8 "MISS";
75 dnl String variable, variable label and missing value.
76 2; 4; 1; 1; 0x010400 *2; s8 "STR4";
77 29; "Another string variable label"; i8 0 * 3;
78 s8 "OTHR";
80 dnl String variable, two missing values.
81 2; 4; 0; 2; 0x010400 *2; s8 "STR5"; s8 "MISS"; s8 "OTHR";
83 dnl String variable, three missing values.
84 2; 4; 0; 3; 0x010400 *2; s8 "STR6"; s8 "MISS"; s8 "OTHR"; s8 "MORE";
86 dnl Long string variable, one missing value.
87 dnl (This is not how SPSS represents missing values for long strings--it
88 dnl uses a separate record as shown later below--but old versions of PSPP
89 dnl did use this representation so we continue supporting it for backward
90 dnl compatibility.
91 2; 11; 0; 1; 0x010b00 *2; s8 "STR7"; "first8by";
92 2; -1; 0; 0; 0; 0; s8 "";
94 dnl Long string variables that will have missing values added with a
95 dnl later record.
96 2; 9; 0; 0; 0x010900 *2; s8 "STR8";
97 2; -1; 0; 0; 0; 0; s8 "";
98 2; 10; 0; 0; 0x010a00 *2; s8 "STR9";
99 2; -1; 0; 0; 0; 0; s8 "";
100 2; 11; 0; 0; 0x010b00 *2; s8 "STR10";
101 2; -1; 0; 0; 0; 0; s8 "";
103 dnl Long string variable, value label.
104 2; 25; 1; 0; 0x011900 *2; s8 "STR11"; 14; "25-byte string"; i8 0 * 2;
105 ( 2; -1; 0; 0; 0; 0; s8 ""; ) * 2;
106 dnl Variable label fields on continuation records have been spotted in system
107 dnl files created by "SPSS Power Macintosh Release 6.1".
108 2; -1; 1; 0; 0; 0; s8 ""; 20; "dummy variable label";
110 dnl Machine integer info record.
111 7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1252;
113 dnl Machine floating-point info record.
114 7; 4; 8; 3; SYSMIS; HIGHEST; LOWEST;
116 dnl Long string variable missing values record.
117 7; 22; 1; COUNT (
118 dnl One missing value for STR8.
119 COUNT("STR8"); i8 1; 8; "abcdefgh";
121 dnl Two missing values for STR9.
122 COUNT("STR9"); i8 2; 8; "abcdefgh"; "01234567";
124 dnl Three missing values for STR9.
125 COUNT("STR10"); i8 3; 8; "abcdefgh"; "01234567"; "0       ";
128 dnl Character encoding record.
129 7; 20; 1; 12; "windows-1252";
131 dnl Dictionary termination record.
132 999; 0;
134 dnl Data.
135 1.0; 2.0; 3.0; 4.0; 5.0; 6.0; 7.0; 8.0; 9.0; 10.0;
136 s8 "abcd"; s8 "efgh"; s8 "ijkl"; s8 "mnop"; s8 "qrst"; s8 "uvwx";
137 s16 "yzABCDEFGHI"; s16 "JKLMNOPQR"; s16 "STUVWXYZ01";
138 s16 "23456789abc"; s32 "defghijklmnopqstuvwxyzABC";
140 for variant in be le; do
141   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
142   AT_DATA([sys-file.sps], [dnl
143 GET FILE='sys-file.sav'.
144 DISPLAY FILE LABEL.
145 DISPLAY DICTIONARY.
146 LIST.
148   AT_CHECK([pspp -o pspp.csv sys-file.sps])
149   AT_CHECK([cat pspp.csv], [0], [dnl
150 Table: File Label
151 Label,PSPP synthetic test file: ôõöø
153 Table: Variables
154 Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
155 num1,1,,Unknown,Input,8,Right,F8.0,F8.0,
156 num2,2,Numeric variable 2's label (ùúû),Unknown,Input,8,Right,F8.0,F8.0,
157 num3,3,,Unknown,Input,8,Right,F8.0,F8.0,1
158 num4,4,Another numeric variable label,Unknown,Input,8,Right,F8.0,F8.0,1
159 num5,5,,Unknown,Input,8,Right,F8.0,F8.0,1; 2
160 num6,6,,Unknown,Input,8,Right,F8.0,F8.0,1; 2; 3
161 num7,7,,Unknown,Input,8,Right,F8.0,F8.0,1 THRU 3
162 num8,8,,Unknown,Input,8,Right,F8.0,F8.0,1 THRU 3; 5
163 num9,9,,Unknown,Input,8,Right,F8.0,F8.0,1 THRU HIGHEST; -5
164 numàèìñò,10,,Unknown,Input,8,Right,F8.0,F8.0,LOWEST THRU 1; 5
165 str1,11,,Nominal,Input,4,Left,A4,A4,
166 str2,12,String variable 2's label,Nominal,Input,4,Left,A4,A4,
167 str3,13,,Nominal,Input,4,Left,A4,A4,"""MISS"""
168 str4,14,Another string variable label,Nominal,Input,4,Left,A4,A4,"""OTHR"""
169 str5,15,,Nominal,Input,4,Left,A4,A4,"""MISS""; ""OTHR"""
170 str6,16,,Nominal,Input,4,Left,A4,A4,"""MISS""; ""OTHR""; ""MORE"""
171 str7,17,,Nominal,Input,11,Left,A11,A11,"""first8by"""
172 str8,18,,Nominal,Input,9,Left,A9,A9,"""abcdefgh"""
173 str9,19,,Nominal,Input,10,Left,A10,A10,"""abcdefgh""; ""01234567"""
174 str10,20,,Nominal,Input,11,Left,A11,A11,"""abcdefgh""; ""01234567""; ""0       """
175 str11,21,25-byte string,Nominal,Input,25,Left,A25,A25,
177 Table: Data List
178 num1,num2,num3,num4,num5,num6,num7,num8,num9,numàèìñò,str1,str2,str3,str4,str5,str6,str7,str8,str9,str10,str11
179 1,2,3,4,5,6,7,8,9,10,abcd,efgh,ijkl,mnop,qrst,uvwx,yzABCDEFGHI,JKLMNOPQR,STUVWXYZ01,23456789abc,defghijklmnopqstuvwxyzABC
181 done
182 AT_CLEANUP
184 AT_SETUP([unspecified number of variable positions])
185 AT_KEYWORDS([sack synthetic system file positive])
186 AT_DATA([sys-file.sack], [dnl
187 dnl File header.
188 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
189 2; dnl Layout code
190 -1; dnl Nominal case size (unspecified)
191 0; dnl Not compressed
192 0; dnl Not weighted
193 1; dnl 1 case.
194 100.0; dnl Bias.
195 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
196 i8 0 *3;
198 dnl Numeric variable, no label or missing values.
199 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
201 dnl Numeric variable, variable label.
202 2; 0; 1; 0; 0x050800 *2; s8 "NUM2";
203 26; "Numeric variable 2's label"; i8 0 *2;
205 dnl Character encoding record.
206 7; 20; 1; 12; "windows-1252";
208 dnl Dictionary termination record.
209 999; 0;
211 dnl Data.
212 1.0; 2.0;
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.
221   AT_CHECK([pspp -o pspp.csv sys-file.sps])
222   AT_CHECK([cat pspp.csv], [0], [dnl
223 Table: Variables
224 Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format
225 num1,1,,Unknown,Input,8,Right,F8.0,F8.0
226 num2,2,Numeric variable 2's label,Unknown,Input,8,Right,F8.0,F8.0
228 Table: Data List
229 num1,num2
232 done
233 AT_CLEANUP
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;
249 dnl Numeric variable, no label or missing values.
250 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
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;
256 dnl Machine integer info record (SPSS 13).
257 7; 3; 4; 8; 13; 2; 3; -1; 1; 1; ENDIAN; 1252;
259 dnl Character encoding record.
260 7; 20; 1; 12; "windows-1252";
262 dnl Dictionary termination record.
263 999; 0;
265 dnl Data.
266 1.0; 2.0;
268 for variant in be le; do
269   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
270   AT_DATA([sys-file.sps], [dnl
271 GET FILE='sys-file.sav'.
272 DISPLAY DICTIONARY.
273 LIST.
275   AT_CHECK([pspp -o pspp.csv sys-file.sps])
276   AT_CHECK([cat pspp.csv], [0], [dnl
277 Table: Variables
278 Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format
279 num1,1,,Unknown,Input,8,Right,F8.0,F8.0
280 num2,2,Numeric variable 2's label,Unknown,Input,8,Right,F8.0,F8.0
282 Table: Data List
283 num1,num2
286 done
287 AT_CLEANUP
289 AT_SETUP([value labels])
290 AT_KEYWORDS([sack synthetic system file positive])
291 AT_DATA([sys-file.sack], [dnl
292 dnl File header.
293 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
294 2; dnl Layout code
295 22; dnl Nominal case size
296 0; dnl Not compressed
297 0; dnl Not weighted
298 1; dnl 1 case.
299 100.0; dnl Bias.
300 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
301 i8 0 *3;
303 dnl Numeric variables.
304 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
305 2; 0; 0; 0; 0x050800 *2; s8 "NUM2";
306 2; 0; 0; 0; 0x050800 *2; s8 "NUM3";
307 2; 0; 0; 0; 0x050800 *2; s8 "NUM4";
308 2; 0; 0; 0; 0x050800 *2; s8 "NUM5";
310 dnl String variables.
311 2; 1; 0; 0; 0x010100 *2; s8 "STR1"; dnl index 6
312 2; 2; 0; 0; 0x010200 *2; s8 "STR2"; dnl index 7
313 2; 3; 0; 0; 0x010300 *2; s8 "STR3"; dnl index 8
314 2; 4; 0; 0; 0x010400 *2; s8 "STR4"; dnl index 9
315 2; 4; 0; 0; 0x010400 *2; s8 "STR5"; dnl index 10
316 2; 6; 0; 0; 0x010600 *2; s8 "STR6"; dnl index 11
317 2; 7; 0; 0; 0x010700 *2; s8 "STR7"; dnl index 12
318 2; 8; 0; 0; 0x010800 *2; s8 "STR8"; dnl index 13
319 2; 9; 0; 0; 0x010900 *2; "STR9"; i8 230; s3 ""; dnl index 14
320 2; -1; 0; 0; 0; 0; s8 "";
321 2; 12; 0; 0; 0x010c00 *2; s8 "STR12"; dnl index 16
322 2; -1; 0; 0; 0; 0; s8 "";
323 2; 16; 0; 0; 0x011000 *2; s8 "STR16"; dnl index 18
324 2; -1; 0; 0; 0; 0; s8 "";
325 2; 17; 0; 0; 0x011100 *2; s8 "STR17"; dnl index 20
326 ( 2; -1; 0; 0; 0; 0; s8 ""; ) * 2;
328 dnl One value label for NUM1.
329 3; 1; 1.0; i8 17; i8 238; i8 228; i8 232; i8 237; s19 " (in Russian)"; 4; 1; 1;
331 dnl Two value labels for NUM2, as a single pair of type 3 and type 4 records.
332 3; 2; 1.0; i8 3; s7 "one"; 2.0; i8 3; s7 "two"; 4; 1; 2;
334 dnl Two value labels for NUM3, as two pairs of type 3 and type 4 records.
335 3; 1; 3.0; i8 5; s7 "three"; 4; 1; 3;
336 3; 1; 4.0; i8 4; s7 "four"; 4; 1; 3;
338 dnl Two common value labels for NUM4 and NUM5, plus two different ones for each.
339 3; 1; 5.0; i8 4; s7 "five"; 4; 1; 4;
340 3; 1; 6.0; i8 3; s7 "six"; 4; 1; 5;
341 3; 2; 7.0; i8 5; s7 "seven"; 8.0; i8 5; s7 "eight"; 4; 2; 4; 5;
342 3; 1; 9.0; i8 4; s7 "nine"; 4; 1; 4;
343 3; 1; 10.0; i8 3; s7 "ten"; 4; 1; 5;
345 dnl One value label for STR1.
346 3; 1; s8 "a"; i8 19; s23 "value label for `a'"; 4; 1; 6;
348 dnl Two value labels for STR2, as a single pair of type 3 and type 4 records.
349 3; 2;
350 s8 "bc"; i8 20; s23 "value label for `bc'";
351 s8 "de"; i8 20; s23 "value label for `de'";
352 4; 1; 7;
354 dnl Two value labels for STR3, as two pairs of type 3 and type 4 records.
355 3; 1; s8 "fgh"; i8 21; s23 "value label for `fgh'"; 4; 1; 8;
356 3; 1; s8 "ijk"; i8 21; s23 "value label for `ijk'"; 4; 1; 8;
358 dnl Two common value labels for STR4 and STR5, plus two different ones for each.
359 3; 1; s8 "lmno"; i8 22; s23 "value label for `lmno'"; 4; 1; 9;
360 3; 1; s8 "pqrs"; i8 22; s23 "value label for `pqrs'"; 4; 1; 10;
361 3; 2;
362 s8 "tuvw"; i8 22; s23 "value label for `tuvw'";
363 s8 "xyzA"; i8 22; s23 "value label for `xyzA'";
364 4; 2; 9; 10;
365 3; 1; s8 "BCDE"; i8 22; s23 "value label for `BCDE'"; 4; 1; 9;
366 3; 1; s8 "FGHI"; i8 22; s23 "value label for `FGHI'"; 4; 1; 10;
368 dnl One value label for STR6, STR7, STR8.
369 3; 1; s8 "JKLMNO"; i8 24; s31 "value label for `JKLMNO'"; 4; 1; 11;
370 3; 1; s8 "JKLMNOP"; i8 25; s31 "value label for `JKLMNOP'"; 4; 1; 12;
371 3; 1; s8 "JKLMNOPQ"; i8 26; s31 "value label for `JKLMNOPQ'"; 4; 1; 13;
373 dnl Machine integer info record.
374 7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1251;
376 dnl Character encoding record.
377 7; 20; 1; 12; "windows-1251";
379 7; 21; 1; COUNT (
380 dnl One value label for STR9ж,
381 COUNT("STR9"; i8 230); 9; 1; COUNT("RSTUVWXYZ"); COUNT("value label for `RSTUVWXYZ'");
383 dnl Two value labels for STR12.
384 COUNT("STR12"); 12; 2;
385 COUNT("0123456789ab"); COUNT("value label for `0123456789ab'");
386 COUNT("cdefghijklmn"); COUNT("value label for `cdefghijklmn'");
388 dnl Three value labels for STR16.
389 COUNT("STR16"); 16; 3;
390 COUNT("opqrstuvwxyzABCD"); COUNT("value label for `opqrstuvwxyzABCD'");
391 COUNT("EFGHIJKLMNOPQRST"); COUNT("value label for `EFGHIJKLMNOPQRST'");
392 COUNT("UVWXYZ0123456789"); COUNT("value label for `UVWXYZ0123456789' with Cyrillic letters: `"; i8 244; i8 245; i8 246; "'");
394 dnl One value label for STR17.
395 COUNT("STR17"); 17; 1;
396 COUNT("abcdefghijklmnopq"); COUNT("value label for `abcdefghijklmnopq'");
399 dnl Dictionary termination record.
400 999; 0;
402 for variant in be le; do
403   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
404   AT_DATA([sys-file.sps], [dnl
405 GET FILE='sys-file.sav'.
406 DISPLAY DICTIONARY.
408   AT_CHECK([pspp -o pspp.csv sys-file.sps])
409   AT_CHECK([cat pspp.csv], [0], [dnl
410 Table: Variables
411 Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format
412 num1,1,Unknown,Input,8,Right,F8.0,F8.0
413 num2,2,Unknown,Input,8,Right,F8.0,F8.0
414 num3,3,Unknown,Input,8,Right,F8.0,F8.0
415 num4,4,Unknown,Input,8,Right,F8.0,F8.0
416 num5,5,Unknown,Input,8,Right,F8.0,F8.0
417 str1,6,Nominal,Input,1,Left,A1,A1
418 str2,7,Nominal,Input,2,Left,A2,A2
419 str3,8,Nominal,Input,3,Left,A3,A3
420 str4,9,Nominal,Input,4,Left,A4,A4
421 str5,10,Nominal,Input,4,Left,A4,A4
422 str6,11,Nominal,Input,6,Left,A6,A6
423 str7,12,Nominal,Input,7,Left,A7,A7
424 str8,13,Nominal,Input,8,Left,A8,A8
425 str9ж,14,Nominal,Input,9,Left,A9,A9
426 str12,15,Nominal,Input,12,Left,A12,A12
427 str16,16,Nominal,Input,16,Left,A16,A16
428 str17,17,Nominal,Input,17,Left,A17,A17
430 Table: Value Labels
431 Variable Value,,Label
432 num1,1,один (in Russian)
433 num2,1,one
434 ,2,two
435 num3,3,three
436 ,4,four
437 num4,5,five
438 ,7,seven
439 ,8,eight
440 ,9,nine
441 num5,6,six
442 ,7,seven
443 ,8,eight
444 ,10,ten
445 str1,a,value label for `a'
446 str2,bc,value label for `bc'
447 ,de,value label for `de'
448 str3,fgh,value label for `fgh'
449 ,ijk,value label for `ijk'
450 str4,BCDE,value label for `BCDE'
451 ,lmno,value label for `lmno'
452 ,tuvw,value label for `tuvw'
453 ,xyzA,value label for `xyzA'
454 str5,FGHI,value label for `FGHI'
455 ,pqrs,value label for `pqrs'
456 ,tuvw,value label for `tuvw'
457 ,xyzA,value label for `xyzA'
458 str6,JKLMNO,value label for `JKLMNO'
459 str7,JKLMNOP,value label for `JKLMNOP'
460 str8,JKLMNOPQ,value label for `JKLMNOPQ'
461 str9ж,RSTUVWXYZ,value label for `RSTUVWXYZ'
462 str12,0123456789ab,value label for `0123456789ab'
463 ,cdefghijklmn,value label for `cdefghijklmn'
464 str16,EFGHIJKLMNOPQRST,value label for `EFGHIJKLMNOPQRST'
465 ,UVWXYZ0123456789,value label for `UVWXYZ0123456789' with Cyrillic letters: `фхц'
466 ,opqrstuvwxyzABCD,value label for `opqrstuvwxyzABCD'
467 str17,abcdefghijklmnopq,value label for `abcdefghijklmnopq'
469 done
470 AT_CLEANUP
472 AT_SETUP([documents])
473 AT_KEYWORDS([sack synthetic system file positive])
474 AT_DATA([sys-file.sack], [dnl
475 dnl File header.
476 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
477 2; dnl Layout code
478 1; dnl Nominal case size
479 0; dnl Not compressed
480 0; dnl Not weighted
481 1; dnl 1 case.
482 100.0; dnl Bias.
483 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
484 i8 0 *3;
486 dnl Numeric variable, no label or missing values.
487 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
489 dnl Machine integer info record.
490 7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1252;
492 dnl Document record.
493 6; 5;
494 s80 "First line of documents";
495 s80 "Second line of documents";
496 "abb"; i8 233; " appliqu"; i8 233; " attach"; i8 233; " blas"; i8 233; " caf"; i8 233; " canap"; i8 233; " clich"; i8 233; " consomm"; i8 233;
497 s25 "";
498 s80 "";
499 s80 "Last line of documents";
501 dnl Character encoding record.
502 7; 20; 1; 12; "windows-1252";
504 dnl Dictionary termination record.
505 999; 0;
507 dnl Data.
508 1.0;
510 for variant in be le; do
511   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
512   AT_DATA([sys-file.sps], [dnl
513 GET FILE='sys-file.sav'.
514 DISPLAY DOCUMENTS.
515 LIST.
517   AT_CHECK([pspp -o pspp.csv sys-file.sps])
518   AT_CHECK([cat pspp.csv], [0], [dnl
519 Table: Documents
520 "First line of documents
521 Second line of documents
522 abbé appliqué attaché blasé café canapé cliché consommé
524 Last line of documents"
526 Table: Data List
527 num1
530 done
531 AT_CLEANUP
533 AT_SETUP([empty document record])
534 AT_KEYWORDS([sack synthetic system file positive])
535 AT_DATA([sys-file.sack], [dnl
536 dnl File header.
537 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
538 2; dnl Layout code
539 1; dnl Nominal case size
540 0; dnl Not compressed
541 0; dnl Not weighted
542 1; dnl 1 case.
543 100.0; dnl Bias.
544 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
545 i8 0 *3;
547 dnl Numeric variable, no label or missing values.
548 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
550 dnl Machine integer info record.
551 7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1252;
553 dnl Document record.
554 6; 0;
556 dnl Character encoding record.
557 7; 20; 1; 12; "windows-1252";
559 dnl Dictionary termination record.
560 999; 0;
562 dnl Data.
563 1.0;
565 for variant in be le; do
566   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
567   AT_DATA([sys-file.sps], [dnl
568 GET FILE='sys-file.sav'.
569 LIST.
571   AT_CHECK([pspp -o pspp.csv sys-file.sps])
572   AT_CHECK([cat pspp.csv], [0], [dnl
573 Table: Data List
574 num1
577 done
578 AT_CLEANUP
580 AT_SETUP([variable sets])
581 AT_KEYWORDS([sack synthetic system file positive set])
582 AT_DATA([sys-file.sack], [dnl
583 dnl File header.
584 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
585 2; dnl Layout code
586 10; dnl Nominal case size
587 0; dnl Not compressed
588 0; dnl Not weighted
589 0; dnl No cases.
590 100.0; dnl Bias.
591 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
592 i8 0 *3;
594 dnl Variable Set 1
595 2; 0; 0; 0; 0x050800 *2; i8 0x82; i8 0xa0; s6 "";
596 2; 0; 0; 0; 0x050800 *2; s8 "B";
597 2; 0; 0; 0; 0x050800 *2; s8 "C";
599 dnl vs2
600 2; 0; 0; 0; 0x050800 *2; s8 "D";
601 2; 0; 0; 0; 0x050800 *2; s8 "E";
602 2; 0; 0; 0; 0x050800 *2; s8 "F";
603 2; 0; 0; 0; 0x050800 *2; s8 "G";
605 dnl c
606 2; 4; 0; 0; 0x010400 *2; s8 "H";
607 2; 4; 0; 0; 0x010400 *2; s8 "I";
608 2; 4; 0; 0; 0x010400 *2; s8 "J";
610 dnl Machine integer info record.
611 7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 932;
613 7; 5; 1;
614 COUNT(
615   "Variable Set 1= "; i8 0x82; i8 0xa0; " b c"; i8 10;
616   "vs2=d e f g"; i8 10;
617   "c=h i j"; i8 13; i8 10;
618   "d= e g i b f"; i8 10;
619   "Empty Variable Set= "; i8 10);
621 dnl Character encoding record.
622 7; 20; 1; 9; "shift_jis";
624 dnl Dictionary termination record.
625 999; 0;
627 AT_DATA([expout], [dnl
628                 Variables
629 ╭────┬────────┬────────────┬────────────╮
630 │Name│Position│Print Format│Write Format│
631 ├────┼────────┼────────────┼────────────┤
632 │あ  │       1│F8.0        │F8.0        │
633 │b   │       2│F8.0        │F8.0        │
634 │c   │       3│F8.0        │F8.0        │
635 │d   │       4│F8.0        │F8.0        │
636 │e   │       5│F8.0        │F8.0        │
637 │f   │       6│F8.0        │F8.0        │
638 │g   │       7│F8.0        │F8.0        │
639 │h   │       8│A4          │A4          │
640 │i   │       9│A4          │A4          │
641 │j   │      10│A4          │A4          │
642 ╰────┴────────┴────────────┴────────────╯
644             Variable Sets
645 ╭──────────────────────────┬────────╮
646 │Variable Set and Position │Variable│
647 ├──────────────────────────┼────────┤
648 │Variable Set 1     1      │あ      │
649 │                   2      │b       │
650 │                   3      │c       │
651 ├──────────────────────────┼────────┤
652 │vs2                1      │d       │
653 │                   2      │e       │
654 │                   3      │f       │
655 │                   4      │g       │
656 ├──────────────────────────┼────────┤
657 │c                  1      │h       │
658 │                   2      │i       │
659 │                   3      │j       │
660 ├──────────────────────────┼────────┤
661 │d                  1      │e       │
662 │                   2      │g       │
663 │                   3      │i       │
664 │                   4      │b       │
665 │                   5      │f       │
666 ├──────────────────────────┼────────┤
667 │Empty Variable Set n/a    │(empty) │
668 ╰──────────────────────────┴────────╯
670 AT_DATA([sys-file-1.sps], [dnl
671 GET FILE='sys-file.sav'.
672 DISPLAY VARIABLES.
673 DISPLAY VARIABLE SETS.
674 SAVE OUTFILE='sys-file-2.sav'.
676 AT_DATA([sys-file-2.sps], [dnl
677 GET FILE='sys-file-2.sav'.
678 DISPLAY VARIABLES.
679 DISPLAY VARIABLE SETS.
681 for variant in be le; do
682   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
683   AT_CHECK([rm -f sys-file-2.sav])
684   AT_CHECK([pspp --testing-mode -O box=unicode sys-file-1.sps], [0], [expout])
685   AT_CHECK([pspp --testing-mode -O box=unicode sys-file-2.sps], [0], [expout])
686 done
687 AT_CLEANUP
689 AT_SETUP([multiple response sets])
690 AT_KEYWORDS([sack synthetic system file positive])
691 AT_DATA([sys-file.sack], [dnl
692 dnl File header.
693 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
694 2; dnl Layout code
695 16; dnl Nominal case size
696 0; dnl Not compressed
697 0; dnl Not weighted
698 0; dnl No cases.
699 100.0; dnl Bias.
700 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
701 i8 0 *3;
703 dnl $a
704 2; 0; 0; 0; 0x050800 *2; i8 0x82; i8 0xa0; s6 "";
705 2; 0; 0; 0; 0x050800 *2; s8 "B";
706 2; 0; 0; 0; 0x050800 *2; s8 "C";
708 dnl $b
709 2; 0; 0; 0; 0x050800 *2; s8 "D";
710 2; 0; 0; 0; 0x050800 *2; s8 "E";
711 2; 0; 0; 0; 0x050800 *2; s8 "F";
712 2; 0; 0; 0; 0x050800 *2; s8 "G";
714 dnl $c
715 2; 4; 0; 0; 0x010400 *2; s8 "H";
716 2; 4; 0; 0; 0x010400 *2; s8 "I";
717 2; 4; 0; 0; 0x010400 *2; s8 "J";
719 dnl $d
720 2; 0; 0; 0; 0x050800 *2; s8 "K";
721 2; 0; 0; 0; 0x050800 *2; s8 "L";
722 2; 0; 0; 0; 0x050800 *2; s8 "M";
724 dnl $e
725 2; 6; 0; 0; 0x010600 *2; s8 "N";
726 2; 6; 0; 0; 0x010600 *2; s8 "O";
727 2; 6; 0; 0; 0x010600 *2; s8 "P";
729 dnl Machine integer info record.
730 7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 932;
732 7; 7; 1;
733 COUNT(
734   "$a=C 10 my mcgroup "; i8 0x82; i8 0xa0; " b c"; i8 10;
735   "$b=D2 55 0  g e f d"; i8 10; i8 10;
736   "$c=D4 "; i8 0x82; i8 0xcd; i8 0x82; i8 0xa2; " 10 mdgroup #2 h i j"; i8 10);
738 7; 19; 1;
739 COUNT(
740   i8 10;
741   "$d=E 1 2 34 13 third mdgroup k l m"; i8 10;
742   "$e=E 11 6 choice 0  n o p"; i8 10; i8 10; i8 10; i8 10);
744 dnl Character encoding record.
745 7; 20; 1; 9; "shift_jis";
747 dnl Dictionary termination record.
748 999; 0;
750 for variant in be le; do
751   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
752   AT_DATA([sys-file.sps], [dnl
753 GET FILE='sys-file.sav'.
754 MRSETS /DISPLAY NAME=ALL.
756   AT_CHECK([pspp -o pspp.csv sys-file.sps])
757   AT_CHECK([cat pspp.csv], [0], [dnl
758 Table: Multiple Response Sets
759 Name,Label,Encoding,Counted Value,Member Variables
760 $a,my mcgroup,Categories,,"あ
763 $b,,Dichotomies,55,"g
767 $c,mdgroup #2,Dichotomies,はい,"h
770 $d,third mdgroup,Dichotomies,34,"k
773 $e,,Dichotomies,choice,"n
777 done
778 AT_CLEANUP
780 dnl Also checks for handling of CR-only line ends in file label and
781 dnl extra product info.
782 AT_SETUP([extra product info])
783 AT_KEYWORDS([sack synthetic system file positive])
784 AT_DATA([sys-file.sack], [dnl
785 dnl File header.
786 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
787 2; dnl Layout code
788 4; dnl Nominal case size
789 0; dnl Not compressed
790 0; dnl Not weighted
791 0; dnl No cases.
792 100.0; dnl Bias.
793 "01 Jan 11"; "20:53:52"; "PSPP synthetic"; i8 13; s49 "test file";
794 i8 0 *3;
796 dnl Numeric variables.
797 2; 0; 0; 0; 0x050800 *2; s8 "A";
798 2; 0; 0; 0; 0x050800 *2; s8 "B";
799 2; 0; 0; 0; 0x050800 *2; s8 "C";
800 2; 0; 0; 0; 0x050800 *2; s8 "D";
802 dnl Extra product info.
803 7; 10; 1; COUNT ("Extra product info"; i8 13; "another line"; i8 13; "blah");
805 dnl Character encoding record.
806 7; 20; 1; 12; "windows-1252";
808 dnl Dictionary termination record.
809 999; 0;
811 for variant in be; do
812   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
813   AT_DATA([sys-file.sps], [dnl
814 SYSFILE INFO FILE='sys-file.sav'.
816   AT_CHECK([pspp -o pspp.csv sys-file.sps])
817   AT_CHECK([sed 8q pspp.csv], [0], [dnl
818 Table: File Information
819 File,sys-file.sav
820 Label,"PSPP synthetic
821 test file"
822 Created,01 Jan 11 20:53:52 by $(@%:@) SPSS DATA FILE PSPP synthetic test file
823 Product,"Extra product info
824 another line
825 blah"
827 done
828 AT_CLEANUP
830 AT_SETUP([variable display parameters, without width])
831 AT_KEYWORDS([sack synthetic system file positive])
832 AT_DATA([sys-file.sack], [dnl
833 dnl File header.
834 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
835 2; dnl Layout code
836 19; dnl Nominal case size
837 0; dnl Not compressed
838 0; dnl Not weighted
839 0; dnl No cases.
840 100.0; dnl Bias.
841 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
842 i8 0 *3;
844 dnl Numeric variables.
845 2; 0; 0; 0; 0x050800 *2; s8 "A";
846 2; 0; 0; 0; 0x050800 *2; s8 "B";
847 2; 0; 0; 0; 0x050800 *2; s8 "C";
848 2; 0; 0; 0; 0x050800 *2; s8 "D";
850 dnl Short string variables.
851 2; 3; 0; 0; 0x010300 *2; s8 "H";
852 2; 3; 0; 0; 0x010300 *2; s8 "I";
853 2; 3; 0; 0; 0x010300 *2; s8 "J";
854 2; 3; 0; 0; 0x010300 *2; s8 "K";
856 dnl Long string variables.
857 2; 9; 0; 0; 0x010900 *2; s8 "L";
858 2; -1; 0; 0; 0; 0; s8 "";
859 2; 10; 0; 0; 0x010a00 *2; s8 "M";
860 2; -1; 0; 0; 0; 0; s8 "";
861 2; 17; 0; 0; 0x011100 *2; s8 "N";
862 ( 2; -1; 0; 0; 0; 0; s8 "" ) * 2;
863 2; 25; 0; 0; 0x011900 *2; s8 "O";
864 ( 2; -1; 0; 0; 0; 0; s8 "" ) * 3;
866 dnl Variable display parameters
867 7; 11; 4; 24;
868 1; 0;
869 2; 0;
870 3; 0;
871 1; 1;
872 2; 1;
873 3; 1;
874 1; 2;
875 2; 2;
876 3; 2;
877 0; 0;
878 0; 1;
879 0; 2;
881 dnl Character encoding record.
882 7; 20; 1; 12; "windows-1252";
884 dnl Dictionary termination record.
885 999; 0;
887 for variant in be le; do
888   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
889   AT_DATA([sys-file.sps], [dnl
890 GET FILE='sys-file.sav'.
891 DISPLAY DICTIONARY.
893   AT_CHECK([pspp -o pspp.csv sys-file.sps])
894   AT_CHECK([cat pspp.csv], [0], [dnl
895 Table: Variables
896 Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format
897 a,1,Nominal,Input,8,Left,F8.0,F8.0
898 b,2,Ordinal,Input,8,Left,F8.0,F8.0
899 c,3,Scale,Input,8,Left,F8.0,F8.0
900 d,4,Nominal,Input,8,Right,F8.0,F8.0
901 h,5,Ordinal,Input,3,Right,A3,A3
902 i,6,Scale,Input,3,Right,A3,A3
903 j,7,Nominal,Input,3,Center,A3,A3
904 k,8,Ordinal,Input,3,Center,A3,A3
905 l,9,Scale,Input,9,Center,A9,A9
906 m,10,Nominal,Input,10,Left,A10,A10
907 n,11,Nominal,Input,17,Right,A17,A17
908 o,12,Nominal,Input,25,Center,A25,A25
910 done
911 AT_CLEANUP
913 AT_SETUP([variable display parameters, with width])
914 AT_KEYWORDS([sack synthetic system file positive])
915 AT_DATA([sys-file.sack], [dnl
916 dnl File header.
917 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
918 2; dnl Layout code
919 19; dnl Nominal case size
920 0; dnl Not compressed
921 0; dnl Not weighted
922 0; dnl No cases.
923 100.0; dnl Bias.
924 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
925 i8 0 *3;
927 dnl Numeric variables.
928 2; 0; 0; 0; 0x050800 *2; s8 "A";
929 2; 0; 0; 0; 0x050800 *2; s8 "B";
930 2; 0; 0; 0; 0x050800 *2; s8 "C";
931 2; 0; 0; 0; 0x050800 *2; s8 "D";
933 dnl Short string variables.
934 2; 3; 0; 0; 0x010300 *2; s8 "H";
935 2; 3; 0; 0; 0x010300 *2; s8 "I";
936 2; 3; 0; 0; 0x010300 *2; s8 "J";
937 2; 3; 0; 0; 0x010300 *2; s8 "K";
939 dnl Long string variables.
940 2; 9; 0; 0; 0x010900 *2; s8 "L";
941 2; -1; 0; 0; 0; 0; s8 "";
942 2; 10; 0; 0; 0x010a00 *2; s8 "M";
943 2; -1; 0; 0; 0; 0; s8 "";
944 2; 17; 0; 0; 0x011100 *2; s8 "N";
945 ( 2; -1; 0; 0; 0; 0; s8 "" ) * 2;
946 2; 25; 0; 0; 0x011900 *2; s8 "O";
947 ( 2; -1; 0; 0; 0; 0; s8 "" ) * 3;
949 dnl Variable display parameters
950 7; 11; 4; 36;
951 1; 1; 0;
952 2; 2; 0;
953 3; 3; 0;
954 1; 4; 1;
955 2; 5; 1;
956 3; 6; 1;
957 1; 7; 2;
958 2; 8; 2;
959 3; 9; 2;
960 0; 10; 0;
961 0; 11; 1;
962 0; 12; 2;
964 dnl Character encoding record.
965 7; 20; 1; 12; "windows-1252";
967 dnl Dictionary termination record.
968 999; 0;
970 for variant in be le; do
971   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
972   AT_DATA([sys-file.sps], [dnl
973 GET FILE='sys-file.sav'.
974 DISPLAY DICTIONARY.
976   AT_CHECK([pspp -o pspp.csv sys-file.sps])
977   AT_CHECK([cat pspp.csv], [0], [dnl
978 Table: Variables
979 Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format
980 a,1,Nominal,Input,1,Left,F8.0,F8.0
981 b,2,Ordinal,Input,2,Left,F8.0,F8.0
982 c,3,Scale,Input,3,Left,F8.0,F8.0
983 d,4,Nominal,Input,4,Right,F8.0,F8.0
984 h,5,Ordinal,Input,5,Right,A3,A3
985 i,6,Scale,Input,6,Right,A3,A3
986 j,7,Nominal,Input,7,Center,A3,A3
987 k,8,Ordinal,Input,8,Center,A3,A3
988 l,9,Scale,Input,9,Center,A9,A9
989 m,10,Nominal,Input,10,Left,A10,A10
990 n,11,Nominal,Input,11,Right,A17,A17
991 o,12,Nominal,Input,12,Center,A25,A25
993 done
994 AT_CLEANUP
996 AT_SETUP([long variable names])
997 AT_KEYWORDS([sack synthetic system file positive])
998 AT_DATA([sys-file.sack], [dnl
999 dnl File header.
1000 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1001 2; dnl Layout code
1002 7; dnl Nominal case size
1003 0; dnl Not compressed
1004 0; dnl Not weighted
1005 0; dnl No cases.
1006 100.0; dnl Bias.
1007 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
1008 i8 0 *3;
1010 dnl Numeric variables.
1011 2; 0; 0; 0; 0x050800 *2; s8 "LONGVARI";
1012 2; 0; 0; 0; 0x050800 *2; s8 "LONGVA_A";
1013 2; 0; 0; 0; 0x050800 *2; s8 "LONGVA_B";
1014 2; 0; 0; 0; 0x050800 *2; s8 "LONGVA_C";
1015 2; 0; 0; 0; 0x050800 *2; "CO"; i8 214; "RDINA";
1016 2; 0; 0; 0; 0x050800 *2; "CO"; i8 214; "RDI_A";
1017 2; 0; 0; 0; 0x050800 *2; "CO"; i8 214; "RDI_B";
1019 dnl Machine integer info record.
1020 7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1252;
1022 dnl Machine floating-point info record.
1023 7; 4; 8; 3; SYSMIS; HIGHEST; LOWEST;
1025 dnl Long variable names.
1026 7; 13; 1; COUNT (
1027 "LONGVARI=LongVariableName1"; i8 9;
1028 "LONGVA_A=LongVariableName2"; i8 9;
1029 "LONGVA_B=LongVariableName3"; i8 9;
1030 "LONGVA_C=LongVariableName4"; i8 9;
1031 "CO"; i8 214; "RDINA=Co"; i8 246; "rdinate_X"; i8 9;
1032 "CO"; i8 214; "RDI_A=Co"; i8 246; "rdinate_Y"; i8 9;
1033 "CO"; i8 214; "RDI_B=Co"; i8 246; "rdinate_Z";
1036 dnl Character encoding record.
1037 7; 20; 1; 12; "windows-1252";
1039 dnl Dictionary termination record.
1040 999; 0;
1042 for variant in be le; do
1043   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1044   AT_DATA([sys-file.sps], [dnl
1045 GET FILE='sys-file.sav'.
1046 DISPLAY DICTIONARY.
1048   AT_CHECK([pspp -o pspp.csv sys-file.sps])
1049   AT_CHECK([cat pspp.csv], [0], [dnl
1050 Table: Variables
1051 Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format
1052 LongVariableName1,1,Unknown,Input,8,Right,F8.0,F8.0
1053 LongVariableName2,2,Unknown,Input,8,Right,F8.0,F8.0
1054 LongVariableName3,3,Unknown,Input,8,Right,F8.0,F8.0
1055 LongVariableName4,4,Unknown,Input,8,Right,F8.0,F8.0
1056 Coördinate_X,5,Unknown,Input,8,Right,F8.0,F8.0
1057 Coördinate_Y,6,Unknown,Input,8,Right,F8.0,F8.0
1058 Coördinate_Z,7,Unknown,Input,8,Right,F8.0,F8.0
1060 done
1061 AT_CLEANUP
1063 AT_SETUP([very long strings])
1064 AT_KEYWORDS([sack synthetic system file positive])
1065 AT_DATA([sys-file.sack], [dnl
1066 dnl File header.
1067 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1068 2; dnl Layout code
1069 109; dnl Nominal case size
1070 0; dnl Not compressed
1071 0; dnl Not weighted
1072 1; dnl No cases.
1073 100.0; dnl Bias.
1074 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
1075 i8 0 *3;
1077 dnl 256-byte string.
1078 2; 255; 0; 0; 0x01FF00 *2; "S"; i8 201; s6 "Q256";
1079 (2; -1; 0; 0; 0; 0; s8 "") * 31;
1080 2; 4; 0; 0; 0x010400 *2; "S"; i8 201; "Q256_1";
1082 dnl 600-byte string.
1083 2; 255; 0; 0; 0x01FF00 *2; s8 "STR600";
1084 (2; -1; 0; 0; 0; 0; s8 "") * 31;
1085 2; 255; 0; 0; 0x01FF00 *2; s8 "STR600_1";
1086 (2; -1; 0; 0; 0; 0; s8 "") * 31;
1087 2; 96; 0; 0; 0x016000 *2; s8 "STR600_2";
1088 (2; -1; 0; 0; 0; 0; s8 "") * 11;
1090 dnl Machine integer info record.
1091 7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1252;
1093 dnl Very long string record.
1094 7; 14; 1; COUNT (
1095 "S"; i8 201; "Q256=00256"; i8 0; i8 9;
1096 "STR600=00600"; i8 0; i8 9;
1099 dnl Character encoding record.
1100 7; 20; 1; 12; "windows-1252";
1102 dnl Dictionary termination record.
1103 999; 0;
1105 dnl Data.
1106 "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#" * 4;
1107 "abcdefgh";
1108 "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#" * 9;
1109 "abcdefghijklmnopqrstuvwxyzABCDEF";
1111 for variant in be le; do
1112   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1113   AT_DATA([sys-file.sps], [dnl
1114 GET FILE='sys-file.sav'.
1115 DISPLAY DICTIONARY.
1116 LIST.
1118   AT_CHECK([pspp -o pspp.csv sys-file.sps])
1119   AT_CHECK([cat pspp.csv], [0], [dnl
1120 Table: Variables
1121 Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format
1122 séq256,1,Nominal,Input,32,Left,A256,A256
1123 str600,2,Nominal,Input,32,Left,A600,A600
1125 Table: Data List
1126 séq256,str600
1127 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@a,abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyz
1129 done
1130 AT_CLEANUP
1132 AT_SETUP([data file and variable attributes])
1133 AT_KEYWORDS([sack synthetic system file positive])
1134 AT_DATA([sys-file.sack], [dnl
1135 dnl File header.
1136 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1137 2; dnl Layout code
1138 3; dnl Nominal case size
1139 0; dnl Not compressed
1140 0; dnl Not weighted
1141 0; dnl 1 case.
1142 100.0; dnl Bias.
1143 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
1144 i8 0 *3;
1146 dnl Variables.
1147 2; 0; 0; 0; 0x050800 *2; s8 "FIRSTVAR";
1148 2; 0; 0; 0; 0x050800 *2; s8 "SECONDVA";
1149 2; 0; 0; 0; 0x050800 *2; s8 "THIRDVAR";
1151 dnl Machine integer info record.
1152 7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1252;
1154 dnl Long variable names.
1155 7; 13; 1; COUNT (
1156 "FIRSTVAR=FirstVariable"; i8 9;
1157 "SECONDVA=S"; i8 233; "condVariable"; i8 9;
1158 "THIRDVAR=ThirdVariable"; i8 9
1161 dnl Data file attributes record.
1162 7; 17; 1; COUNT (
1163 "Attr1('Value1'"; i8 10; "''d"; i8 233; "claration''"; i8 10; ")";
1164 "S"; i8 233; "condAttr('123'"; i8 10; "'456'"; i8 10; ")";
1167 dnl Variable attributes record.
1168 7; 18; 1; COUNT (
1169 "FirstVariable:";
1170   "ad"; i8 232; "le('23'"; i8 10; "'34'"; i8 10; ")";
1171   "bert('123'"; i8 10; ")";
1172   "$@Role('1'"; i8 10; ")";
1173 "/S"; i8 233; "condVariable:";
1174   "xyzzy('quux'"; i8 10; ")";
1177 dnl Another variable attributes record.
1178 dnl Only system files written by "Stata 14.1/-savespss- 1.77 by S.Radyakin"
1179 dnl include multiple variable attributes records.
1180 7; 18; 1; COUNT ("ThirdVariable:fizz('buzz'"; i8 10; ")";);
1182 dnl Character encoding record.
1183 7; 20; 1; 12; "windows-1252";
1185 dnl Dictionary termination record.
1186 999; 0;
1188 for variant in be le; do
1189   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1190   AT_DATA([sys-file.sps], [dnl
1191 GET FILE='sys-file.sav'.
1192 DISPLAY @ATTRIBUTES.
1194   AT_CHECK([pspp -o pspp.csv sys-file.sps])
1195   AT_CHECK([cat pspp.csv], [0],
1196 [[Table: Variable and Dataset Attributes
1197 Variable and Name,,Value
1198 (dataset),Attr1[1],Value1
1199 ,Attr1[2],'déclaration'
1200 ,SécondAttr[1],123
1201 ,SécondAttr[2],456
1202 FirstVariable,$@Role,1
1203 ,adèle[1],23
1204 ,adèle[2],34
1205 ,bert,123
1206 SécondVariable,xyzzy,quux
1207 ThirdVariable,fizz,buzz
1209   AT_DATA([sys-file.sps], [dnl
1210 GET FILE='sys-file.sav'.
1211 DISPLAY DICTIONARY.
1213   AT_CHECK([pspp -o pspp.csv sys-file.sps])
1214   AT_CHECK([cat pspp.csv], [0],
1215 [[Table: Variables
1216 Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format
1217 FirstVariable,1,Unknown,Output,8,Right,F8.0,F8.0
1218 SécondVariable,2,Unknown,Input,8,Right,F8.0,F8.0
1219 ThirdVariable,3,Unknown,Input,8,Right,F8.0,F8.0
1221 done
1222 AT_CLEANUP
1224 AT_SETUP([variable roles])
1225 AT_KEYWORDS([sack synthetic system file positive])
1226 AT_DATA([sys-file.sack], [dnl
1227 dnl File header.
1228 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1229 2; dnl Layout code
1230 7; dnl Nominal case size
1231 0; dnl Not compressed
1232 0; dnl Not weighted
1233 0; dnl 1 case.
1234 100.0; dnl Bias.
1235 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
1236 i8 0 *3;
1238 dnl Variables.
1239 2; 0; 0; 0; 0x050800 *2; s8 "I";
1240 2; 0; 0; 0; 0x050800 *2; s8 "O";
1241 2; 0; 0; 0; 0x050800 *2; s8 "B";
1242 2; 0; 0; 0; 0x050800 *2; s8 "N";
1243 2; 0; 0; 0; 0x050800 *2; s8 "P";
1244 2; 0; 0; 0; 0x050800 *2; s8 "S";
1245 2; 0; 0; 0; 0x050800 *2; s8 "X";
1247 dnl Machine integer info record.
1248 7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1252;
1250 dnl Variable attributes record.
1251 7; 18; 1; COUNT (
1252 "I:$@Role('0'"; i8 10; ")";
1253 "/O:$@Role('1'"; i8 10; ")";
1254 "/B:$@Role('2'"; i8 10; ")";
1255 "/N:$@Role('3'"; i8 10; ")";
1256 "/P:$@Role('4'"; i8 10; ")";
1257 "/S:$@Role('5'"; i8 10; ")";
1258 "/X:$@Role('6'"; i8 10; ")";
1261 dnl Character encoding record.
1262 7; 20; 1; 12; "windows-1252";
1264 dnl Dictionary termination record.
1265 999; 0;
1267 for variant in be le; do
1268   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1269   AT_DATA([sys-file.sps], [dnl
1270 GET FILE='sys-file.sav'.
1271 DISPLAY DICTIONARY.
1273   AT_CHECK([pspp -o pspp.csv sys-file.sps], [0], [dnl
1274 warning: `sys-file.sav': Invalid role for variable x.
1276   AT_CHECK([cat pspp.csv], [0], [dnl
1277 warning: `sys-file.sav': Invalid role for variable x.
1279 Table: Variables
1280 Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format
1281 i,1,Unknown,Input,8,Right,F8.0,F8.0
1282 o,2,Unknown,Output,8,Right,F8.0,F8.0
1283 b,3,Unknown,Both,8,Right,F8.0,F8.0
1284 n,4,Unknown,None,8,Right,F8.0,F8.0
1285 p,5,Unknown,Partition,8,Right,F8.0,F8.0
1286 s,6,Unknown,Split,8,Right,F8.0,F8.0
1287 x,7,Unknown,Input,8,Right,F8.0,F8.0
1289 done
1290 AT_CLEANUP
1292 AT_SETUP([compressed data])
1293 AT_KEYWORDS([sack synthetic system file positive])
1294 AT_DATA([sys-file.sack], [dnl
1295 dnl File header.
1296 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1297 2; dnl Layout code
1298 6; dnl Nominal case size
1299 1; dnl Simple compression
1300 0; dnl Not weighted
1301 -1; dnl Unspecified number of cases.
1302 100.0; dnl Bias.
1303 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
1304 i8 0 *3;
1306 dnl Numeric variables.
1307 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1308 2; 0; 0; 0; 0x050800 *2; s8 "NUM2";
1310 dnl String variable.
1311 2; 4; 0; 0; 0x010400 *2; s8 "STR4";
1312 2; 8; 0; 0; 0x010800 *2; s8 "STR8";
1313 2; 15; 0; 0; 0x010f00 *2; s8 "STR15";
1314 2; -1; 0; 0; 0; 0; s8 "";
1316 dnl Character encoding record.
1317 7; 20; 1; 12; "windows-1252";
1319 dnl Dictionary termination record.
1320 999; 0;
1322 dnl Compressed data.
1323 i8 1 100 254 253 254 253; i8 255 251; "abcdefgh"; s8 "0123";
1324 i8 253 253 253 254; i8 101 102 253 253; s8 "jklm"; s8 "nopqrstu";
1325 s8 "vwxyzABC"; s8 "DEFG"; s8 "HIJKLMNO";
1326 i8 254 253 252 0 0 0 0 0; s8 "PQRSTUVW";
1329 for variant in be le; do
1330   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1331   AT_DATA([sys-file.sps], [dnl
1332 GET FILE='sys-file.sav'.
1333 DISPLAY DICTIONARY.
1334 LIST.
1336   AT_CHECK([pspp -o pspp.csv sys-file.sps])
1337   AT_CHECK([cat pspp.csv], [0], [dnl
1338 Table: Variables
1339 Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format
1340 num1,1,Unknown,Input,8,Right,F8.0,F8.0
1341 num2,2,Unknown,Input,8,Right,F8.0,F8.0
1342 str4,3,Nominal,Input,4,Left,A4,A4
1343 str8,4,Nominal,Input,8,Left,A8,A8
1344 str15,5,Nominal,Input,15,Left,A15,A15
1346 Table: Data List
1347 num1,num2,str4,str8,str15
1348 -99,0,,abcdefgh,0123
1349 .,151,jklm,nopqrstu,vwxyzABC
1350 1,2,DEFG,HIJKLMNO,PQRSTUV
1352 done
1353 AT_CLEANUP
1355 AT_SETUP([compressed data, zero bias])
1356 AT_KEYWORDS([sack synthetic system file positive])
1357 AT_DATA([sys-file.sack], [dnl
1358 dnl File header.
1359 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1360 2; dnl Layout code
1361 6; dnl Nominal case size
1362 1; dnl Simple compression.
1363 0; dnl Not weighted
1364 -1; dnl Unspecified number of cases.
1365 0.0; dnl Bias.
1366 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
1367 i8 0 *3;
1369 dnl Numeric variables.
1370 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1371 2; 0; 0; 0; 0x050800 *2; s8 "NUM2";
1373 dnl String variable.
1374 2; 4; 0; 0; 0x010400 *2; s8 "STR4";
1375 2; 8; 0; 0; 0x010800 *2; s8 "STR8";
1376 2; 15; 0; 0; 0x010f00 *2; s8 "STR15";
1377 2; -1; 0; 0; 0; 0; s8 "";
1379 dnl Character encoding record.
1380 7; 20; 1; 12; "windows-1252";
1382 dnl Dictionary termination record.
1383 999; 0;
1385 dnl Compressed data.
1386 i8 1 100 254 253 254 253; i8 255 251; "abcdefgh"; s8 "0123";
1387 i8 253 253 253 254; i8 101 102 253 253; s8 "jklm"; s8 "nopqrstu";
1388 s8 "vwxyzABC"; s8 "DEFG"; s8 "HIJKLMNO";
1389 i8 254 253 252 0 0 0 0 0; s8 "PQRSTUVW";
1392 for variant in be le; do
1393   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1394   AT_DATA([sys-file.sps], [dnl
1395 GET FILE='sys-file.sav'.
1396 DISPLAY DICTIONARY.
1397 LIST.
1399   AT_CHECK([pspp -o pspp.csv sys-file.sps], [0])
1400   AT_CHECK([cat pspp.csv], [0], [dnl
1401 Table: Variables
1402 Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format
1403 num1,1,Unknown,Input,8,Right,F8.0,F8.0
1404 num2,2,Unknown,Input,8,Right,F8.0,F8.0
1405 str4,3,Nominal,Input,4,Left,A4,A4
1406 str8,4,Nominal,Input,8,Left,A8,A8
1407 str15,5,Nominal,Input,15,Left,A15,A15
1409 Table: Data List
1410 num1,num2,str4,str8,str15
1411 1,100,,abcdefgh,0123
1412 .,251,jklm,nopqrstu,vwxyzABC
1413 101,102,DEFG,HIJKLMNO,PQRSTUV
1415 done
1416 AT_CLEANUP
1418 AT_SETUP([compressed data, other bias])
1419 AT_KEYWORDS([sack synthetic system file positive])
1420 AT_DATA([sys-file.sack], [dnl
1421 dnl File header.
1422 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1423 2; dnl Layout code
1424 6; dnl Nominal case size
1425 1; dnl Simple compression.
1426 0; dnl Not weighted
1427 -1; dnl Unspecified number of cases.
1428 50.0; dnl Bias.
1429 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
1430 i8 0 *3;
1432 dnl Numeric variables.
1433 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1434 2; 0; 0; 0; 0x050800 *2; s8 "NUM2";
1436 dnl String variable.
1437 2; 4; 0; 0; 0x010400 *2; s8 "STR4";
1438 2; 8; 0; 0; 0x010800 *2; s8 "STR8";
1439 2; 15; 0; 0; 0x010f00 *2; s8 "STR15";
1440 2; -1; 0; 0; 0; 0; s8 "";
1442 dnl Character encoding record.
1443 7; 20; 1; 12; "windows-1252";
1445 dnl Dictionary termination record.
1446 999; 0;
1448 dnl Compressed data.
1449 i8 1 100 254 253 254 253; i8 255 251; "abcdefgh"; s8 "0123";
1450 i8 253 253 253 254; i8 101 102 253 253; s8 "jklm"; s8 "nopqrstu";
1451 s8 "vwxyzABC"; s8 "DEFG"; s8 "HIJKLMNO";
1452 i8 254 253 252 0 0 0 0 0; s8 "PQRSTUVW";
1455 for variant in be le; do
1456   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1457   AT_DATA([sys-file.sps], [dnl
1458 GET FILE='sys-file.sav'.
1459 DISPLAY DICTIONARY.
1460 LIST.
1462   AT_CHECK([pspp -o pspp.csv sys-file.sps], [0],
1463     [warning: `sys-file.sav' near offset 0x54: Compression bias is not the usual value of 100, or system file uses unrecognized floating-point format.
1465   AT_CHECK([cat pspp.csv], [0], [dnl
1466 "warning: `sys-file.sav' near offset 0x54: Compression bias is not the usual value of 100, or system file uses unrecognized floating-point format."
1468 Table: Variables
1469 Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format
1470 num1,1,Unknown,Input,8,Right,F8.0,F8.0
1471 num2,2,Unknown,Input,8,Right,F8.0,F8.0
1472 str4,3,Nominal,Input,4,Left,A4,A4
1473 str8,4,Nominal,Input,8,Left,A8,A8
1474 str15,5,Nominal,Input,15,Left,A15,A15
1476 Table: Data List
1477 num1,num2,str4,str8,str15
1478 -49,50,,abcdefgh,0123
1479 .,201,jklm,nopqrstu,vwxyzABC
1480 51,52,DEFG,HIJKLMNO,PQRSTUV
1482 done
1483 AT_CLEANUP
1485 m4_divert_push([PREPARE_TESTS])
1486 zcompressed_sack () {
1487     cat <<'EOF'
1488 dnl File header.
1489 "$FL3"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1490 2; dnl Layout code
1491 6; dnl Nominal case size
1492 2; dnl zlib compressed
1493 0; dnl Not weighted
1494 -1; dnl Unspecified number of cases.
1495 100.0; dnl Bias.
1496 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
1497 i8 0 *3;
1499 dnl Numeric variables.
1500 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1501 2; 0; 0; 0; 0x050800 *2; s8 "NUM2";
1503 dnl String variable.
1504 2; 4; 0; 0; 0x010400 *2; s8 "STR4";
1505 2; 8; 0; 0; 0x010800 *2; s8 "STR8";
1506 2; 15; 0; 0; 0x010f00 *2; s8 "STR15";
1507 2; -1; 0; 0; 0; 0; s8 "";
1509 dnl Character encoding record.
1510 7; 20; 1; 12; "windows-1252";
1512 dnl Dictionary termination record.
1513 999; 0;
1515 dnl ZLIB data header.
1516 i64 0x194;    # zheader_ofs
1517 i64 0x205;    # ztrailer_ofs
1518 i64 48;       # ztrailer_len
1520 dnl ZLIB data block.
1522 dnl This is the compressed form of:
1524 dnl 01 64 fe fd fe fd ff fb  61 62 63 64 65 66 67 68  |.d......abcdefgh|
1525 dnl 30 31 32 33 20 20 20 20  fd fd fd fe 65 66 fd fd  |0123    ....ef..|
1526 dnl 6a 6b 6c 6d 20 20 20 20  6e 6f 70 71 72 73 74 75  |jklm    nopqrstu|
1527 dnl 76 77 78 79 7a 41 42 43  44 45 46 47 20 20 20 20  |vwxyzABCDEFG    |
1528 dnl 48 49 4a 4b 4c 4d 4e 4f  fe fd fc 00 00 00 00 00  |HIJKLMNO........|
1529 dnl 50 51 52 53 54 55 56 57                           |PQRSTUVW|
1531 dnl which is the data from the "compressed data" test.
1532 hex "78 01 63 4c f9 f7 f7 df  df ff bf 13 93 92 53 52";
1533 hex "d3 d2 33 0c 0c 8d 8c 15  80 e0 ef df bf ff 52 d3";
1534 hex "fe fe cd ca ce c9 05 f1  f3 f2 0b 0a 8b 8a 4b 4a";
1535 hex "cb ca 2b 2a ab 1c 9d 9c  5d 5c dd dc 41 e2 1e 9e";
1536 hex "5e de 3e be 7e fe ff fe  fe 61 00 81 80 c0 a0 e0";
1537 hex "90 d0 b0 70 00 0f 3f 23  d7";
1539 dnl ZLIB data trailer fixed header:
1540 i64 -100;     # ztrailer_bias
1541 i64 0;        # ztrailer_zero
1542 0x3ff000;     # block_size
1543 1;            # n_blocks
1545 dnl ZLIB block descriptor:
1546 i64 0x194;    # uncompressed_ofs
1547 i64 0x1ac;    # compressed_ofs
1548 88;           # uncompressed_size
1549 89;           # compressed_size
1552 m4_divert_pop([PREPARE_TESTS])
1554 AT_SETUP([zcompressed data])
1555 AT_KEYWORDS([sack synthetic system file positive zlib])
1556 zcompressed_sack > sys-file.sack
1557 for variant in be le; do
1558   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1559   AT_DATA([sys-file.sps], [dnl
1560 GET FILE='sys-file.sav'.
1561 DISPLAY DICTIONARY.
1562 LIST.
1564   AT_CHECK([pspp -o pspp.csv sys-file.sps])
1565   AT_CHECK([cat pspp.csv], [0], [dnl
1566 Table: Variables
1567 Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format
1568 num1,1,Unknown,Input,8,Right,F8.0,F8.0
1569 num2,2,Unknown,Input,8,Right,F8.0,F8.0
1570 str4,3,Nominal,Input,4,Left,A4,A4
1571 str8,4,Nominal,Input,8,Left,A8,A8
1572 str15,5,Nominal,Input,15,Left,A15,A15
1574 Table: Data List
1575 num1,num2,str4,str8,str15
1576 -99,0,,abcdefgh,0123
1577 .,151,jklm,nopqrstu,vwxyzABC
1578 1,2,DEFG,HIJKLMNO,PQRSTUV
1580 done
1581 AT_CLEANUP
1583 AT_BANNER([system file reader - negative])
1585 AT_SETUP([no variables])
1586 AT_KEYWORDS([sack synthetic system file negative])
1587 AT_DATA([sys-file.sack], [dnl
1588 dnl File header.
1589 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1590 2; dnl Layout code
1591 0; dnl Nominal case size (empty)
1592 0; dnl Not compressed
1593 0; dnl Not weighted
1594 0; dnl 0 cases.
1595 100.0; dnl Bias.
1596 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
1597 i8 0 *3;
1599 dnl Character encoding record.
1600 7; 20; 1; 12; "windows-1252";
1602 dnl Dictionary termination record.
1603 999; 0;
1605 for variant in be le; do
1606   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1607   AT_DATA([sys-file.sps], [dnl
1608 GET FILE='sys-file.sav'.
1610   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
1611 sys-file.sps:1: error: GET: `sys-file.sav': Data file dictionary has no variables.
1614   dnl At one point pspp-convert would hang forever if there were no variables,
1615   dnl so check against regression.
1616   AT_CHECK([pspp-convert sys-file.sav sys-file.txt])
1617   AT_CHECK([cat sys-file.txt], [0], [
1619 done
1620 AT_CLEANUP
1622 AT_SETUP([unspecified character encoding])
1623 AT_KEYWORDS([sack synthetic system file positive])
1624 AT_DATA([sys-file.sack], [dnl
1625 dnl File header.
1626 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1627 2; dnl Layout code
1628 4; dnl Nominal case size
1629 0; dnl Not compressed
1630 0; dnl Not weighted
1631 0; dnl No cases.
1632 100.0; dnl Bias.
1633 "01 Jan 11"; "20:53:52";
1634 "PSPP synthetic test file: "; i8 244; i8 245; i8 246; i8 248; s34 "";
1635 i8 0 *3;
1637 dnl Numeric variables.
1638 2; 0; 0; 0; 0x050800 *2; s8 "A";
1639 2; 0; 0; 0; 0x050800 *2; s8 "B";
1640 2; 0; 0; 0; 0x050800 *2; s8 "C";
1641 2; 0; 0; 0; 0x050800 *2; s8 "D";
1643 dnl Dictionary termination record.
1644 999; 0;
1646 for variant in be le; do
1647   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1648   AT_DATA([sys-file.sps], [dnl
1649 GET 'sys-file.sav'.
1651   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [stdout])
1652   AT_CHECK([sed 's/default encoding.*For/default encoding.  For/' stdout], [0], [dnl
1653 "warning: `sys-file.sav': This system file does not indicate its own character encoding.  Using default encoding.  For best results, specify an encoding explicitly.  Use SYSFILE INFO with ENCODING=""DETECT"" to analyze the possible encodings."
1655 done
1656 AT_CLEANUP
1658 AT_SETUP([misplaced type 4 record])
1659 AT_KEYWORDS([sack synthetic system file negative])
1660 AT_DATA([sys-file.sack], [dnl
1661 dnl File header.
1662 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1663 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1665 dnl Numeric variable.
1666 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1668 dnl Type 4 record.
1669 >>4<<;
1671 for variant in be le; do
1672   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1673   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1675   AT_CHECK([pspp -O format=csv sys-file.sps], [1],
1676    [error: `sys-file.sav' near offset 0xd4: Misplaced type 4 record.
1678 done
1679 AT_CLEANUP
1681 AT_SETUP([bad record type])
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; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1688 dnl Numeric variable.
1689 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1691 dnl Type 8 record (not a valid type).
1692 >>8<<;
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'.
1698   AT_CHECK([pspp -O format=csv sys-file.sps], [1],
1699    [error: `sys-file.sav' near offset 0xd4: Unrecognized record type 8.
1701 done
1702 AT_CLEANUP
1704 AT_SETUP([wrong number of variable positions])
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;
1711 dnl Numeric variable.
1712 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1714 dnl Character encoding record.
1715 7; 20; 1; 12; "windows-1252";
1717 dnl End of dictionary.
1718 999; 0;
1720 for variant in be le; do
1721   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1722   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1724   AT_CHECK([pspp -O format=csv sys-file.sps], [0],
1725    [warning: `sys-file.sav': File header claims 2 variable positions but 1 were read from file.
1727 done
1728 AT_CLEANUP
1730 AT_SETUP([variable name may not begin with `#'])
1731 AT_KEYWORDS([sack synthetic system file negative])
1732 AT_DATA([sys-file.sack], [dnl
1733 dnl File header.
1734 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1735 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1737 dnl Numeric variable.
1738 2; 0; 0; 0; 0x050800 *2; s8 >>"$UM1"<<;
1740 dnl Character encoding record.
1741 7; 20; 1; 12; "windows-1252";
1743 dnl End of dictionary.
1744 999; 0;
1746 for variant in be le; do
1747   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1748   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1750   AT_CHECK([pspp -O format=csv sys-file.sps], 0,
1751    [warning: `sys-file.sav' near offset 0xb4: Renaming variable with invalid or duplicate name `$UM1' to `UM1'.
1753 done
1754 AT_CLEANUP
1756 AT_SETUP([variable name may not be reserved word])
1757 AT_KEYWORDS([sack synthetic system file negative])
1758 AT_DATA([sys-file.sack], [dnl
1759 dnl File header.
1760 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1761 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1763 dnl Numeric variable.
1764 2; 0; 0; 0; 0x050800 *2; s8 >>"TO"<<;
1766 dnl Character encoding record.
1767 7; 20; 1; 12; "windows-1252";
1769 dnl End of dictionary.
1770 999; 0;
1772 for variant in be le; do
1773   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1774   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1776   AT_CHECK([pspp -O format=csv sys-file.sps], 0,
1777    [warning: `sys-file.sav' near offset 0xb4: Renaming variable with invalid or duplicate name `TO' to `TO_A'.
1779 done
1780 AT_CLEANUP
1782 AT_SETUP([variable width must be between 0 and 255])
1783 AT_KEYWORDS([sack synthetic system file negative])
1784 AT_DATA([sys-file.sack], [dnl
1785 dnl File header.
1786 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1787 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1789 dnl String variable with invalid width 256.
1790 2; 256; 0; 0; 0x050800 *2; s8 "VAR1";
1792 dnl Character encoding record.
1793 7; 20; 1; 12; "windows-1252";
1795 dnl End of dictionary.
1796 999; 0;
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'.
1802   AT_CHECK([pspp -O format=csv sys-file.sps], [1],
1803    [error: `sys-file.sav' near offset 0xb4: Bad width 256 for variable VAR1.
1805 done
1806 AT_CLEANUP
1808 dnl SPSS-generated system file can contain duplicate variable names
1809 dnl (see bug #41475).
1810 AT_SETUP([duplicate variable name])
1811 AT_KEYWORDS([sack synthetic system file negative])
1812 AT_DATA([sys-file.sack], [dnl
1813 dnl File header.
1814 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1815 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1817 dnl Numeric variables.
1818 2; 0; 0; 0; 0x050800 *2; s8 "VAR1";
1819 2; 0; 0; 0; 0x050800 *2; s8 "VAR1";
1821 dnl Character encoding record.
1822 7; 20; 1; 12; "windows-1252";
1824 dnl End of dictionary.
1825 999; 0;
1827 for variant in be le; do
1828   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1829   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1830 DISPLAY DICTIONARY.
1832   AT_CHECK([pspp -O format=csv sys-file.sps], [0],
1833    [warning: `sys-file.sav' near offset 0xd4: Renaming variable with invalid or duplicate name `VAR1' to `VAR1_A'.
1835 Table: Variables
1836 Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format
1837 var1,1,Unknown,Input,8,Right,F8.0,F8.0
1838 var1_a,2,Unknown,Input,8,Right,F8.0,F8.0
1840 done
1841 AT_CLEANUP
1843 AT_SETUP([variable label indicator not 0 or 1])
1844 AT_KEYWORDS([sack synthetic system file negative])
1845 AT_DATA([sys-file.sack], [dnl
1846 dnl File header.
1847 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1848 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1850 dnl Numeric variable.
1851 2; 0; >>2<<; 0; 0x050800 *2; s8 "VAR1";
1853 dnl Character encoding record.
1854 7; 20; 1; 12; "windows-1252";
1856 dnl End of dictionary.
1857 999; 0;
1859 for variant in be le; do
1860   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1861   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1863   AT_CHECK([pspp -O format=csv sys-file.sps], [1],
1864    [error: `sys-file.sav' near offset 0xb4: Variable label indicator field is not 0 or 1.
1866 done
1867 AT_CLEANUP
1869 AT_SETUP([invalid numeric missing value indicator])
1870 AT_KEYWORDS([sack synthetic system file negative])
1871 AT_DATA([sys-file.sack], [dnl
1872 dnl File header.
1873 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1874 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1876 dnl Numeric variable.
1877 2; 0; 0; >>-1<<; 0x050800 *2; s8 "VAR1";
1879 dnl Character encoding record.
1880 7; 20; 1; 12; "windows-1252";
1882 dnl End of dictionary.
1883 999; 0;
1885 for variant in be le; do
1886   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1887   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1889   AT_CHECK([pspp -O format=csv sys-file.sps], [1],
1890    ["error: `sys-file.sav' near offset 0xb4: Numeric missing value indicator field is not -3, -2, 0, 1, 2, or 3."
1892 done
1893 AT_CLEANUP
1895 AT_SETUP([invalid string missing value indicator])
1896 AT_KEYWORDS([sack synthetic system file negative])
1897 AT_DATA([sys-file.sack], [dnl
1898 dnl File header.
1899 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1900 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1902 dnl String variable.
1903 2; 8; 0; >>4<<; 0x010800 *2; s8 "VAR1";
1905 dnl Character encoding record.
1906 7; 20; 1; 12; "windows-1252";
1908 dnl End of dictionary.
1909 999; 0;
1911 for variant in be le; do
1912   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1913   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1915   AT_CHECK([pspp -O format=csv sys-file.sps], [1],
1916    ["error: `sys-file.sav' near offset 0xb4: String missing value indicator field is not 0, 1, 2, or 3."
1918 done
1919 AT_CLEANUP
1921 AT_SETUP([missing string continuation record])
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; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1928 dnl String variable.
1929 2; 10; 0; 0; 0x010a00 *2; s8 "VAR1";
1930 >>2; 0; 0; 0; 0x050800 *2; s8 "VAR2";<<
1932 dnl Character encoding record.
1933 7; 20; 1; 12; "windows-1252";
1935 dnl End of dictionary.
1936 999; 0;
1938 for variant in be le; do
1939   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1940   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1942   AT_CHECK([pspp -O format=csv sys-file.sps], [1],
1943    [error: `sys-file.sav' near offset 0xb4: Missing string continuation record.
1945 done
1946 AT_CLEANUP
1948 AT_SETUP([invalid variable format])
1949 AT_KEYWORDS([sack synthetic system file negative])
1950 AT_DATA([sys-file.sack], [dnl
1951 dnl File header.
1952 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1953 2; 4; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1955 dnl Numeric variable, invalid format types.
1956 dnl No warning is issued for type 0 because it has been observed in real
1957 dnl system files.
1958 2; 0; 0; 0; >>0xff0800; 0<<; s8 "NUM1";
1960 dnl Numeric variable, string formats.
1961 2; 0; 0; 0; >>0x010800<<; >>0x021000<<; s8 "VAR1";
1963 dnl String variable, numeric formats.
1964 2; 4; 0; 0; >>0x050800<<; >>0x110a01<<; s8 "STR1";
1966 dnl String variable, wrong width formats.
1967 2; 4; 0; 0; >>0x010800<<; >>0x020400<<; s8 "STR2";
1969 dnl Character encoding record.
1970 7; 20; 1; 12; "windows-1252";
1972 dnl End of dictionary.
1973 999; 0;
1975 for variant in be le; do
1976   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1977   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1979   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
1980 warning: `sys-file.sav' near offset 0xc0: Variable NUM1 with width 0 has invalid print format 0xff0800.
1982 warning: `sys-file.sav' near offset 0xe0: Variable VAR1 with width 0 has invalid print format 0x10800.
1984 warning: `sys-file.sav' near offset 0xe4: Variable VAR1 with width 0 has invalid write format 0x21000.
1986 warning: `sys-file.sav' near offset 0x100: Variable STR1 with width 4 has invalid print format 0x50800.
1988 warning: `sys-file.sav' near offset 0x104: Variable STR1 with width 4 has invalid write format 0x110a01.
1990 warning: `sys-file.sav' near offset 0x120: Variable STR2 with width 4 has invalid print format 0x10800.
1992 warning: `sys-file.sav' near offset 0x124: Variable STR2 with width 4 has invalid write format 0x20400.
1994 done
1995 AT_CLEANUP
1997 AT_SETUP([invalid long string missing values])
1998 AT_KEYWORDS([sack synthetic system file negative])
1999 AT_DATA([sys-file.sack], [dnl
2000 dnl File header.
2001 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2002 2; dnl Layout code
2003 7; dnl Nominal case size
2004 0; dnl Not compressed
2005 0; dnl Not weighted
2006 1; dnl 1 case.
2007 100.0; dnl Bias.
2008 "01 Jan 11"; "20:53:52";
2009 "PSPP synthetic test file: "; i8 244; i8 245; i8 246; i8 248; s34 "";
2010 i8 0 *3;
2012 dnl One numeric variable.
2013 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2015 dnl Long string variables that will have missing values added with a
2016 dnl later record.
2017 2; 9; 0; 0; 0x010900 *2; s8 "STR1";
2018 2; -1; 0; 0; 0; 0; s8 "";
2019 2; 10; 0; 0; 0x010a00 *2; s8 "STR2";
2020 2; -1; 0; 0; 0; 0; s8 "";
2021 2; 11; 0; 0; 0x010b00 *2; s8 "STR3";
2022 2; -1; 0; 0; 0; 0; s8 "";
2024 dnl Machine integer info record.
2025 7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1252;
2027 dnl Machine floating-point info record.
2028 7; 4; 8; 3; SYSMIS; HIGHEST; LOWEST;
2030 dnl Long string variable missing values record.
2031 7; 22; 1; COUNT (
2032 dnl Zero missing values (not allowed) for STR1 .
2033 COUNT("STR1"); i8 >>0<<; 8;
2035 dnl Four missing values (not allowed) for STR2.
2036 COUNT("STR2"); i8 4; 8;
2037 "abcdefgh"; "ijklmnop"; "qrstuvwx"; "yz012345";
2039 dnl Missing values for unknown variable
2040 COUNT(>>"Nonexistent"<<); i8 1; 8; "abcdefgh";
2042 dnl Missing values for numeric variable
2043 COUNT(>>"NUM1"<<); i8 1; 8; "abcdefgh";
2045 dnl Too long missing value
2046 COUNT("STR3"); i8 1; >>COUNT("abcdefghijkl")<<;
2048 dnl Buggy way that this was written in old PSPP, with a length
2049 dnl before each missing value instead of just once.
2050 COUNT("STR3"); i8 2; 8; "ABCDEFGH"; >>8<<; "IJKLMNOP";
2053 dnl Character encoding record.
2054 7; 20; 1; 12; "windows-1252";
2056 dnl Dictionary termination record.
2057 999; 0;
2058 s8 "abcd"; s8 "efgh"; s8 "ijkl"; s8 "mnop"; s8 "qrst"; s8 "uvwx";
2059 s16 "yzABCDEFGHI"; s16 "JKLMNOPQR"; s16 "STUVWXYZ01";
2060 s16 "23456789abc"; s32 "defghijklmnopqstuvwxyzABC";
2063 for variant in be le; do
2064   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2065   AT_DATA([sys-file.sps], [dnl
2066 GET FILE='sys-file.sav'.
2067 DISPLAY DICTIONARY.
2069   AT_CHECK([pspp -O format=csv sys-file.sps], [0],
2070    ["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."
2072 "warning: `sys-file.sav' near offset 0x205: Long string missing values record says variable STR2 has 4 missing values, but only 1 to 3 missing values are allowed."
2074 warning: `sys-file.sav' near offset 0x23a: Ignoring long string missing value record for unknown variable Nonexistent.
2076 warning: `sys-file.sav' near offset 0x24f: Ignoring long string missing value record for numeric variable NUM1.
2078 "warning: `sys-file.sav' near offset 0x268: Ignoring long string missing value 0 for variable str3, with width 11, that has bad value width 12."
2080 "warning: `sys-file.sav' near offset 0x289: This file has corrupted metadata written by a buggy version of PSPP.  To fix it, save a new copy of the file."
2082 Table: Variables
2083 Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
2084 num1,1,Unknown,Input,8,Right,F8.0,F8.0,
2085 str1,2,Nominal,Input,9,Left,A9,A9,
2086 str2,3,Nominal,Input,10,Left,A10,A10,"""abcdefgh""; ""ijklmnop""; ""qrstuvwx"""
2087 str3,4,Nominal,Input,11,Left,A11,A11,"""ABCDEFGH""; ""IJKLMNOP"""
2089 done
2090 AT_CLEANUP
2092 AT_SETUP([weighting variable must be numeric])
2093 AT_KEYWORDS([sack synthetic system file negative])
2094 AT_DATA([sys-file.sack], [dnl
2095 dnl File header.
2096 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2097 2; 2; 1; >>2<<; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2099 dnl Numeric variable.
2100 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2102 dnl String variable.
2103 2; 4; 0; 0; 0x010400 *2; s8 "STR1";
2105 dnl Character encoding record.
2106 7; 20; 1; 12; "windows-1252";
2108 dnl End of dictionary.
2109 999; 0;
2111 for variant in be le; do
2112   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2113   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2114 DISPLAY DICTIONARY.
2116   AT_CHECK([pspp -O format=csv sys-file.sps], [0],
2117    [warning: `sys-file.sav' near offset 0x4c: Ignoring string variable `STR1' set as weighting variable.
2119 Table: Variables
2120 Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format
2121 num1,1,Unknown,Input,8,Right,F8.0,F8.0
2122 str1,2,Nominal,Input,4,Left,A4,A4
2124 done
2125 AT_CLEANUP
2127 AT_SETUP([bad weighting variable index])
2128 AT_KEYWORDS([sack synthetic system file negative])
2129 AT_DATA([sys-file.sack], [dnl
2130 dnl File header.
2131 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2132 2; 2; 1; >>3<<; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2134 dnl Numeric variable.
2135 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2137 dnl String variable.
2138 2; 4; 0; 0; 0x010400 *2; s8 "STR1";
2140 dnl Character encoding record.
2141 7; 20; 1; 12; "windows-1252";
2143 dnl End of dictionary.
2144 999; 0;
2146 for variant in be le; do
2147   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2148   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2150   AT_CHECK([pspp -O format=csv sys-file.sps], 0,
2151    [warning: `sys-file.sav' near offset 0x4c: Weight variable index 3 not in valid range 1...2.  Treating file as unweighted.
2153 done
2154 AT_CLEANUP
2156 AT_SETUP([variable index is long string continuation])
2157 AT_KEYWORDS([sack synthetic system file negative])
2158 AT_DATA([sys-file.sack], [dnl
2159 dnl File header.
2160 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2161 2; 3; 1; >>3<<; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2163 dnl Numeric variable.
2164 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2166 dnl Long string variable.
2167 2; 9; 0; 0; 0x010900 *2; s8 "STR1";
2168 (2; -1; 0; 0; 0; 0; s8 "");
2170 dnl Character encoding record.
2171 7; 20; 1; 12; "windows-1252";
2173 dnl End of dictionary.
2174 999; 0;
2176 for variant in be le; do
2177   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2178   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2180   AT_CHECK([pspp -O format=csv sys-file.sps], 0,
2181    [warning: `sys-file.sav' near offset 0x4c: Weight variable index 3 refers to long string continuation.  Treating file as unweighted.
2183 done
2184 AT_CLEANUP
2186 AT_SETUP([multiple documents records])
2187 AT_KEYWORDS([sack synthetic system file negative])
2188 AT_DATA([sys-file.sack], [dnl
2189 dnl File header.
2190 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2191 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2193 dnl Numeric variables, no label or missing values.
2194 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2195 2; 0; 0; 0; 0x050800 *2; s8 "NUM2";
2197 dnl Two document records.
2198 (6; 1; s80 "One line of documents") >>* 2<<;
2200 dnl Character encoding record.
2201 7; 20; 1; 12; "windows-1252";
2203 dnl Dictionary termination record.
2204 999; 0;
2206 dnl Data.
2207 1.0;
2209 for variant in be le; do
2210   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2211   AT_DATA([sys-file.sps], [dnl
2212 GET FILE='sys-file.sav'.
2214   AT_CHECK([pspp -O format=csv sys-file.sps], 0, [dnl
2215 warning: `sys-file.sav' near offset 0x14c: Duplicate type 6 (document) record.
2217 done
2218 AT_CLEANUP
2221 AT_SETUP([extension record too large])
2222 AT_KEYWORDS([sack synthetic system file negative])
2223 AT_DATA([sys-file.sack], [dnl
2224 dnl File header.
2225 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2226 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2228 dnl Numeric variable, no label or missing values.
2229 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2231 dnl Too-large extension record.
2232 7; 3; >>0xfffff000 * 2<<;
2234 for variant in be le; do
2235   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2236   AT_DATA([sys-file.sps], [dnl
2237 GET FILE='sys-file.sav'.
2239   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
2240 error: `sys-file.sav' near offset 0xd8: Record type 7 subtype 3 too large.
2242 done
2243 AT_CLEANUP
2245 AT_SETUP([unknown extension record])
2246 AT_KEYWORDS([sack synthetic system file negative])
2247 AT_DATA([sys-file.sack], [dnl
2248 dnl File header.
2249 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2250 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2252 dnl Numeric variable, no label or missing values.
2253 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2255 dnl Unknown extension record type.
2256 7; 30; 1; 1; i8 0;
2258 dnl Character encoding record.
2259 7; 20; 1; 12; "windows-1252";
2261 dnl End of dictionary.
2262 999; 0;
2264 for variant in be le; do
2265   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2266   AT_DATA([sys-file.sps], [dnl
2267 GET FILE='sys-file.sav'.
2269   AT_CHECK_UNQUOTED([pspp -O format=csv sys-file.sps], [0], [dnl
2270 "warning: \`sys-file.sav' near offset 0xd8: Unrecognized record type 7, subtype 30.  For help, please send this file to ${PACKAGE_BUGREPORT} and mention that you were using ${PACKAGE_STRING}."
2272 done
2273 AT_CLEANUP
2275 AT_SETUP([bad machine integer info size])
2276 AT_KEYWORDS([sack synthetic system file negative])
2277 AT_DATA([sys-file.sack], [dnl
2278 dnl File header.
2279 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2280 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2282 dnl Numeric variable, no label or missing values.
2283 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2285 dnl Machine integer info record.
2286 7; 3; 4; >>9<<; 1; 2; 3; -1; 1; 1; ENDIAN; 1252; >>1234<<;
2288 dnl Character encoding record.
2289 7; 20; 1; 12; "windows-1252";
2291 dnl End of dictionary.
2292 999; 0;
2294 for variant in be le; do
2295   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2296   AT_DATA([sys-file.sps], [dnl
2297 GET FILE='sys-file.sav'.
2299   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2300 "warning: `sys-file.sav' near offset 0xd8: Record type 7, subtype 3 has bad count 9 (expected 8)."
2302 done
2303 AT_CLEANUP
2305 AT_SETUP([bad machine integer info float format])
2306 AT_KEYWORDS([sack synthetic system file negative])
2307 AT_DATA([sys-file.sack], [dnl
2308 dnl File header.
2309 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2310 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2312 dnl Numeric variable, no label or missing values.
2313 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2315 dnl Machine integer info record.
2316 7; 3; 4; 8; 1; 2; 3; -1; >>2<<; 1; ENDIAN; 1252;
2318 dnl Character encoding record.
2319 7; 20; 1; 12; "windows-1252";
2321 dnl End of dictionary.
2322 999; 0;
2324 for variant in be le; do
2325   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2326   AT_DATA([sys-file.sps], [dnl
2327 GET FILE='sys-file.sav'.
2329   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
2330 error: `sys-file.sav' near offset 0xd8: Floating-point representation indicated by system file (2) differs from expected (1).
2332 done
2333 AT_CLEANUP
2335 AT_SETUP([bad machine integer info endianness])
2336 AT_KEYWORDS([sack synthetic system file negative])
2337 AT_DATA([sys-file.sack], [dnl
2338 dnl File header.
2339 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2340 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2342 dnl Numeric variable, no label or missing values.
2343 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2345 dnl Machine integer info record.
2346 7; 3; 4; 8; 1; 2; 3; -1; 1; 1; >>3<<; 1252;
2348 dnl Character encoding record.
2349 7; 20; 1; 12; "windows-1252";
2351 dnl End of dictionary.
2352 999; 0;
2354 for variant in "be 1" "le 2"; do
2355   set $variant
2356   AT_CHECK([sack --$[1] sys-file.sack > sys-file.sav])
2357   AT_DATA([sys-file.sps], [dnl
2358 GET FILE='sys-file.sav'.
2359 DISPLAY DICTIONARY.
2361   AT_CHECK_UNQUOTED([pspp -O format=csv sys-file.sps], [0], [dnl
2362 warning: \`sys-file.sav' near offset 0xd8: Integer format indicated by system file (3) differs from expected ($[2]).
2364 Table: Variables
2365 Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format
2366 num1,1,Unknown,Input,8,Right,F8.0,F8.0
2368 done
2369 AT_CLEANUP
2372 AT_SETUP([bad machine floating-point info size])
2373 AT_KEYWORDS([sack synthetic system file negative])
2374 AT_DATA([sys-file.sack], [dnl
2375 dnl File header.
2376 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2377 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2379 dnl Numeric variable, no label or missing values.
2380 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2382 dnl Machine floating-point info record.
2383 7; 4; 8; >>4<<; SYSMIS; HIGHEST; LOWEST; 0.0;
2385 dnl Character encoding record.
2386 7; 20; 1; 12; "windows-1252";
2388 dnl End of dictionary.
2389 999; 0;
2391 for variant in be le; do
2392   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2393   AT_DATA([sys-file.sps], [dnl
2394 GET FILE='sys-file.sav'.
2396   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2397 "warning: `sys-file.sav' near offset 0xd8: Record type 7, subtype 4 has bad count 4 (expected 3)."
2399 done
2400 AT_CLEANUP
2402 AT_SETUP([wrong special floating point values])
2403 AT_KEYWORDS([sack synthetic system file negative])
2404 AT_DATA([sys-file.sack], [dnl
2405 dnl File header.
2406 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2407 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2409 dnl Numeric variable, no label or missing values.
2410 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2412 dnl Machine floating-point info record.
2413 7; 4; 8; 3; >>0.0<<; >>1.0<<; >>2.0<<;
2415 dnl Character encoding record.
2416 7; 20; 1; 12; "windows-1252";
2418 dnl End of dictionary.
2419 999; 0;
2421 for variant in be le; do
2422   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2423   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2425   AT_CHECK([pspp -O format=csv sys-file.sps | sed 's/ [(].*/.../'], [0], [dnl
2426 "warning: `sys-file.sav' near offset 0xd8: File specifies unexpected value 0...
2428 "warning: `sys-file.sav' near offset 0xd8: File specifies unexpected value 1...
2430 "warning: `sys-file.sav' near offset 0xd8: File specifies unexpected value 2...
2432 done
2433 AT_CLEANUP
2435 AT_SETUP([unknown variables in variable sets])
2436 AT_KEYWORDS([sack synthetic system file negative set])
2437 AT_DATA([sys-file.sack], [dnl
2438 dnl File header.
2439 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2440 2; dnl Layout code
2441 10; dnl Nominal case size
2442 0; dnl Not compressed
2443 0; dnl Not weighted
2444 0; dnl No cases.
2445 100.0; dnl Bias.
2446 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
2447 i8 0 *3;
2449 dnl Variable Set 1
2450 2; 0; 0; 0; 0x050800 *2; i8 0x82; i8 0xa0; s6 "";
2451 2; 0; 0; 0; 0x050800 *2; s8 "B";
2452 2; 0; 0; 0; 0x050800 *2; s8 "C";
2454 dnl vs2
2455 2; 0; 0; 0; 0x050800 *2; s8 "D";
2456 2; 0; 0; 0; 0x050800 *2; s8 "E";
2457 2; 0; 0; 0; 0x050800 *2; s8 "F";
2458 2; 0; 0; 0; 0x050800 *2; s8 "G";
2460 dnl c
2461 2; 4; 0; 0; 0x010400 *2; s8 "H";
2462 2; 4; 0; 0; 0x010400 *2; s8 "I";
2463 2; 4; 0; 0; 0x010400 *2; s8 "J";
2465 dnl Machine integer info record.
2466 7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 932;
2468 7; 5; 1;
2469 COUNT(
2470   "Variable Set 1= "; i8 0x82; i8 0xa0; " "; >>"xyzzy"<<; " b c"; i8 10;
2471   "vs2=d "; >>"foo"<<; " e f g"; i8 10;);
2473 dnl Character encoding record.
2474 7; 20; 1; 9; "shift_jis";
2476 dnl Dictionary termination record.
2477 999; 0;
2479 for variant in be le; do
2480   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2481   AT_DATA([sys-file.sps], [dnl
2482 GET FILE='sys-file.sav'.
2483 DISPLAY VARIABLES.
2484 DISPLAY VARIABLE SETS.
2486   AT_CHECK([pspp --testing-mode -O box=unicode sys-file.sps], [0], [dnl
2487 warning: `sys-file.sav' near offset 0x228: Variable set Variable Set 1 contains
2488 unknown variable xyzzy.
2490 warning: `sys-file.sav' near offset 0x228: Variable set vs2 contains unknown
2491 variable foo.
2493                 Variables
2494 ╭────┬────────┬────────────┬────────────╮
2495 │Name│Position│Print Format│Write Format│
2496 ├────┼────────┼────────────┼────────────┤
2497 │あ  │       1│F8.0        │F8.0        │
2498 │b   │       2│F8.0        │F8.0        │
2499 │c   │       3│F8.0        │F8.0        │
2500 │d   │       4│F8.0        │F8.0        │
2501 │e   │       5│F8.0        │F8.0        │
2502 │f   │       6│F8.0        │F8.0        │
2503 │g   │       7│F8.0        │F8.0        │
2504 │h   │       8│A4          │A4          │
2505 │i   │       9│A4          │A4          │
2506 │j   │      10│A4          │A4          │
2507 ╰────┴────────┴────────────┴────────────╯
2509             Variable Sets
2510 ╭──────────────────────────┬────────╮
2511 │Variable Set and Position │Variable│
2512 ├──────────────────────────┼────────┤
2513 │Variable Set 1     1      │あ      │
2514 │                   2      │b       │
2515 │                   3      │c       │
2516 ├──────────────────────────┼────────┤
2517 │vs2                1      │d       │
2518 │                   2      │e       │
2519 │                   3      │f       │
2520 │                   4      │g       │
2521 ╰──────────────────────────┴────────╯
2523 done
2524 AT_CLEANUP
2526 AT_SETUP([bad mrsets name])
2527 AT_KEYWORDS([sack synthetic system file negative multiple response])
2528 AT_DATA([sys-file.sack], [dnl
2529 dnl File header.
2530 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2531 2; dnl Layout code
2532 16; dnl Nominal case size
2533 0; dnl Not compressed
2534 0; dnl Not weighted
2535 0; dnl No cases.
2536 100.0; dnl Bias.
2537 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
2538 i8 0 *3;
2540 dnl $a
2541 2; 0; 0; 0; 0x050800 *2; i8 0x82; i8 0xa0; s6 "";
2542 2; 0; 0; 0; 0x050800 *2; s8 "B";
2543 2; 0; 0; 0; 0x050800 *2; s8 "C";
2545 dnl $b
2546 2; 0; 0; 0; 0x050800 *2; s8 "D";
2547 2; 0; 0; 0; 0x050800 *2; s8 "E";
2548 2; 0; 0; 0; 0x050800 *2; s8 "F";
2549 2; 0; 0; 0; 0x050800 *2; s8 "G";
2551 dnl $c
2552 2; 4; 0; 0; 0x010400 *2; s8 "H";
2553 2; 4; 0; 0; 0x010400 *2; s8 "I";
2554 2; 4; 0; 0; 0x010400 *2; s8 "J";
2556 dnl $d
2557 2; 0; 0; 0; 0x050800 *2; s8 "K";
2558 2; 0; 0; 0; 0x050800 *2; s8 "L";
2559 2; 0; 0; 0; 0x050800 *2; s8 "M";
2561 dnl $e
2562 2; 6; 0; 0; 0x010600 *2; s8 "N";
2563 2; 6; 0; 0; 0x010600 *2; s8 "O";
2564 2; 6; 0; 0; 0x010600 *2; s8 "P";
2566 dnl Machine integer info record.
2567 7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 932;
2569 7; 7; 1;
2570 COUNT(
2571   "$a=C 10 my mcgroup "; i8 0x82; i8 0xa0; " b c"; i8 10;
2572   "b=D2 55 0  g e f d"; i8 10;
2573   "$c=D4 "; i8 0x82; i8 0xcd; i8 0x82; i8 0xa2; " 10 mdgroup #2 h i j"; i8 10);
2575 7; 19; 1;
2576 COUNT(
2577   "$d=E 1 2 34 13 third mdgroup k l m"; i8 10;
2578   "e=E 11 6 choice 0  n o p"; i8 10);
2580 dnl Character encoding record.
2581 7; 20; 1; 9; "shift_jis";
2583 dnl Dictionary termination record.
2584 999; 0;
2586 for variant in be le; do
2587   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2588   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2589 MRSETS /DISPLAY NAME=ALL.
2591   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2592 warning: `sys-file.sav': Invalid multiple response set name `b'.
2594 warning: `sys-file.sav': Invalid multiple response set name `e'.
2596 Table: Multiple Response Sets
2597 Name,Label,Encoding,Counted Value,Member Variables
2598 $a,my mcgroup,Categories,,"あ
2601 $c,mdgroup #2,Dichotomies,はい,"h
2604 $d,third mdgroup,Dichotomies,34,"k
2608 done
2609 AT_CLEANUP
2611 AT_SETUP([missing space after C in mrsets])
2612 AT_KEYWORDS([sack synthetic system file negative multiple response])
2613 AT_DATA([sys-file.sack], [dnl
2614 dnl File header.
2615 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2616 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2618 dnl Numeric variable, no label or missing values.
2619 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2621 dnl Multiple response sets.
2622 7; 7; 1; COUNT("$a=Cx");
2624 dnl Character encoding record.
2625 7; 20; 1; 12; "windows-1252";
2627 999; 0;
2629 for variant in be le; do
2630   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2631   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2633   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2634 warning: `sys-file.sav' near offset 0xd8: Missing space following `C' at offset 4 in MRSETS record.
2636 done
2637 AT_CLEANUP
2639 AT_SETUP([missing space after E in mrsets])
2640 AT_KEYWORDS([sack synthetic system file negative multiple response])
2641 AT_DATA([sys-file.sack], [dnl
2642 dnl File header.
2643 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2644 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2646 dnl Numeric variable, no label or missing values.
2647 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2649 dnl Multiple response sets.
2650 7; 7; 1; COUNT("$a=Ex");
2652 dnl Character encoding record.
2653 7; 20; 1; 12; "windows-1252";
2655 999; 0;
2657 for variant in be le; do
2658   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2659   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2661   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2662 warning: `sys-file.sav' near offset 0xd8: Missing space following `E' at offset 4 in MRSETS record.
2664 done
2665 AT_CLEANUP
2667 AT_SETUP([missing label source in mrsets])
2668 AT_KEYWORDS([sack synthetic system file negative multiple response])
2669 AT_DATA([sys-file.sack], [dnl
2670 dnl File header.
2671 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2672 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2674 dnl Numeric variable, no label or missing values.
2675 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2677 dnl Multiple response sets.
2678 7; 7; 1; COUNT("$a=E ");
2680 dnl Character encoding record.
2681 7; 20; 1; 12; "windows-1252";
2683 999; 0;
2685 for variant in be le; do
2686   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2687   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2689   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2690 warning: `sys-file.sav' near offset 0xd8: Missing label source value following `E' at offset 5 in MRSETS record.
2692 warning: `sys-file.sav' near offset 0xd8: Expecting digit at offset 5 in MRSETS record.
2694 done
2695 AT_CLEANUP
2697 AT_SETUP([unexpected label source in mrsets])
2698 AT_KEYWORDS([sack synthetic system file negative multiple response])
2699 AT_DATA([sys-file.sack], [dnl
2700 dnl File header.
2701 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2702 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2704 dnl Numeric variable, no label or missing values.
2705 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2707 dnl Multiple response sets.
2708 7; 7; 1; COUNT("$a=E 2");
2710 dnl Character encoding record.
2711 7; 20; 1; 12; "windows-1252";
2713 999; 0;
2715 for variant in be le; do
2716   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2717   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2719   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2720 warning: `sys-file.sav' near offset 0xd8: Unexpected label source value following `E' at offset 7 in MRSETS record.
2722 warning: `sys-file.sav' near offset 0xd8: Expecting digit at offset 7 in MRSETS record.
2724 done
2725 AT_CLEANUP
2727 AT_SETUP([bad type character in mrsets])
2728 AT_KEYWORDS([sack synthetic system file negative multiple response])
2729 AT_DATA([sys-file.sack], [dnl
2730 dnl File header.
2731 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2732 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2734 dnl Numeric variable, no label or missing values.
2735 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2737 dnl Multiple response sets.
2738 7; 7; 1; COUNT("$a=");
2740 dnl Character encoding record.
2741 7; 20; 1; 12; "windows-1252";
2743 999; 0;
2745 for variant in be le; do
2746   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2747   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2749   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2750 "warning: `sys-file.sav' near offset 0xd8: Missing `C', `D', or `E' at offset 3 in MRSETS record."
2752 done
2753 AT_CLEANUP
2755 AT_SETUP([bad counted string length in mrsets])
2756 AT_KEYWORDS([sack synthetic system file negative multiple response])
2757 AT_DATA([sys-file.sack], [dnl
2758 dnl File header.
2759 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2760 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2762 dnl Numeric variable, no label or missing values.
2763 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2765 dnl Multiple response sets.
2766 7; 7; 1; COUNT("$a=Dx");
2768 dnl Character encoding record.
2769 7; 20; 1; 12; "windows-1252";
2771 999; 0;
2773 for variant in be le; do
2774   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2775   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2777   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2778 warning: `sys-file.sav' near offset 0xd8: Expecting digit at offset 4 in MRSETS record.
2780 done
2781 AT_CLEANUP
2783 AT_SETUP([missing space in counted string in mrsets])
2784 AT_KEYWORDS([sack synthetic system file negative multiple response])
2785 AT_DATA([sys-file.sack], [dnl
2786 dnl File header.
2787 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2788 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2790 dnl Numeric variable, no label or missing values.
2791 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2793 dnl Multiple response sets.
2794 7; 7; 1; COUNT("$a=D1x");
2796 dnl Character encoding record.
2797 7; 20; 1; 12; "windows-1252";
2799 999; 0;
2801 for variant in be le; do
2802   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2803   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2805   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2806 warning: `sys-file.sav' near offset 0xd8: Expecting space at offset 5 in MRSETS record.
2808 done
2809 AT_CLEANUP
2811 AT_SETUP([counted string too long in mrsets])
2812 AT_KEYWORDS([sack synthetic system file negative multiple response])
2813 AT_DATA([sys-file.sack], [dnl
2814 dnl File header.
2815 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2816 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2818 dnl Numeric variable, no label or missing values.
2819 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2821 dnl Multiple response sets.
2822 7; 7; 1; COUNT("$a=D4 abc");
2824 dnl Character encoding record.
2825 7; 20; 1; 12; "windows-1252";
2827 999; 0;
2829 for variant in be le; do
2830   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2831   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2833   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2834 warning: `sys-file.sav' near offset 0xd8: 4-byte string starting at offset 6 exceeds record length 9.
2836 done
2837 AT_CLEANUP
2839 AT_SETUP([missing space after counted string in mrsets])
2840 AT_KEYWORDS([sack synthetic system file negative multiple response])
2841 AT_DATA([sys-file.sack], [dnl
2842 dnl File header.
2843 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2844 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2846 dnl Numeric variable, no label or missing values.
2847 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2849 dnl Multiple response sets.
2850 7; 7; 1; COUNT("$a=D3 abcx");
2852 dnl Character encoding record.
2853 7; 20; 1; 12; "windows-1252";
2855 999; 0;
2857 for variant in be le; do
2858   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2859   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2861   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2862 warning: `sys-file.sav' near offset 0xd8: Expecting space at offset 9 following 3-byte string.
2864 done
2865 AT_CLEANUP
2867 AT_SETUP([missing newline after variable name in mrsets])
2868 AT_KEYWORDS([sack synthetic system file negative multiple response])
2869 AT_DATA([sys-file.sack], [dnl
2870 dnl File header.
2871 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2872 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2874 dnl Numeric variable, no label or missing values.
2875 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2877 dnl Multiple response sets.
2878 7; 7; 1; COUNT("$a=C 0  NUM1");
2880 dnl Character encoding record.
2881 7; 20; 1; 12; "windows-1252";
2883 999; 0;
2885 for variant in be le; do
2886   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2887   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2889   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2890 warning: `sys-file.sav' near offset 0xd8: Missing new-line parsing variable names at offset 13 in MRSETS record.
2892 warning: `sys-file.sav': MRSET $a has only one variable.
2894 done
2895 AT_CLEANUP
2897 AT_SETUP([duplicate variable name in mrsets])
2898 AT_KEYWORDS([sack synthetic system file negative multiple response])
2899 AT_DATA([sys-file.sack], [dnl
2900 dnl File header.
2901 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2902 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2904 dnl Numeric variable, no label or missing values.
2905 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2907 dnl Multiple response sets.
2908 7; 7; 1; COUNT("$a=C 0  NUM1 NUM1"; i8 10);
2910 dnl Character encoding record.
2911 7; 20; 1; 12; "windows-1252";
2913 999; 0;
2915 for variant in be le; do
2916   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2917   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2919   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2920 warning: `sys-file.sav': MRSET $a contains duplicate variable name NUM1.
2922 warning: `sys-file.sav': MRSET $a has only one variable.
2924 done
2925 AT_CLEANUP
2927 AT_SETUP([mixed variable types in mrsets])
2928 AT_KEYWORDS([sack synthetic system file negative multiple response])
2929 AT_DATA([sys-file.sack], [dnl
2930 dnl File header.
2931 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2932 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2934 dnl Variables.
2935 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2936 2; 8; 0; 0; 0x010800 *2; s8 "STR1";
2938 dnl Multiple response sets.
2939 7; 7; 1; COUNT("$a=C 0  NUM1 STR1"; i8 10);
2941 dnl Character encoding record.
2942 7; 20; 1; 12; "windows-1252";
2944 999; 0;
2946 for variant in be le; do
2947   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2948   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2950   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2951 warning: `sys-file.sav': MRSET $a contains both string and numeric variables.
2953 warning: `sys-file.sav': MRSET $a has only one variable.
2955 done
2956 AT_CLEANUP
2958 AT_SETUP([missing newline after variable name in mrsets])
2959 AT_KEYWORDS([sack synthetic system file negative multiple response])
2960 AT_DATA([sys-file.sack], [dnl
2961 dnl File header.
2962 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2963 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2965 dnl Numeric variable, no label or missing values.
2966 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2968 dnl Multiple response sets.
2969 7; 7; 1; COUNT("$a=C 0  NUM1"; i8 10);
2971 dnl Character encoding record.
2972 7; 20; 1; 12; "windows-1252";
2974 999; 0;
2976 for variant in be le; do
2977   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2978   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2980   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2981 warning: `sys-file.sav': MRSET $a has only one variable.
2983 done
2984 AT_CLEANUP
2986 AT_SETUP([zero or one variable in mrset])
2987 AT_KEYWORDS([sack synthetic system file negative multiple response])
2988 AT_DATA([sys-file.sack], [dnl
2989 dnl File header.
2990 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2991 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2993 dnl Numeric variable, no label or missing values.
2994 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2996 dnl Multiple response sets.
2997 7; 7; 1; COUNT("$a=C 0  NUM1"; i8 10; "$b=C 0  "; i8 10);
2999 dnl Character encoding record.
3000 7; 20; 1; 12; "windows-1252";
3002 999; 0;
3004 for variant in be le; do
3005   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3006   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3008   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
3009 warning: `sys-file.sav': MRSET $a has only one variable.
3011 warning: `sys-file.sav': MRSET $b has no variables.
3013 done
3014 AT_CLEANUP
3016 AT_SETUP([wrong display parameter size])
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; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3023 dnl Numeric variable, no label or missing values.
3024 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3026 dnl Display parameters record.
3027 7; 11; >>8<<; 2; 1.0; 1.0;
3029 dnl Character encoding record.
3030 7; 20; 1; 12; "windows-1252";
3032 dnl End of dictionary.
3033 999; 0;
3035 for variant in be le; do
3036   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3037   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3039   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
3040 "warning: `sys-file.sav' near offset 0xd8: Record type 7, subtype 11 has bad size 8 (expected 4)."
3042 done
3043 AT_CLEANUP
3045 AT_SETUP([wrong display parameter count])
3046 AT_KEYWORDS([sack synthetic system file negative])
3047 AT_DATA([sys-file.sack], [dnl
3048 dnl File header.
3049 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3050 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3052 dnl Numeric variable, no label or missing values.
3053 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3055 dnl Display parameters record.
3056 7; 11; 4; >>4<<; 1; 1; 2; 2;
3058 dnl Character encoding record.
3059 7; 20; 1; 12; "windows-1252";
3061 dnl End of dictionary.
3062 999; 0;
3064 for variant in be le; do
3065   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3066   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3068   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
3069 warning: `sys-file.sav' near offset 0xd8: Extension 11 has bad count 4 (for 1 variables).
3071 done
3072 AT_CLEANUP
3074 AT_SETUP([wrong display measurement level])
3075 AT_KEYWORDS([sack synthetic system file negative])
3076 AT_DATA([sys-file.sack], [dnl
3077 dnl File header.
3078 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3079 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3081 dnl Numeric variable, no label or missing values.
3082 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3084 dnl Display parameters record.
3085 7; 11; 4; 2; >>4<<; 0;
3087 dnl Character encoding record.
3088 7; 20; 1; 12; "windows-1252";
3090 dnl End of dictionary.
3091 999; 0;
3093 for variant in be le; do
3094   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3095   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3097   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
3098 warning: `sys-file.sav' near offset 0xd8: Invalid variable display parameters for variable 0 (NUM1).  Default parameters substituted.
3100 done
3101 AT_CLEANUP
3103 AT_SETUP([wrong display alignment])
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;
3110 dnl Numeric variable, no label or missing values.
3111 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3113 dnl Display parameters record.
3114 7; 11; 4; 2; 1; >>-1<<;
3116 dnl Character encoding record.
3117 7; 20; 1; 12; "windows-1252";
3119 dnl End of dictionary.
3120 999; 0;
3122 for variant in be le; do
3123   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3124   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3126   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
3127 warning: `sys-file.sav' near offset 0xd8: Invalid variable display parameters for variable 0 (NUM1).  Default parameters substituted.
3129 done
3130 AT_CLEANUP
3132 AT_SETUP([bad variable name in variable/value pair])
3133 AT_KEYWORDS([sack synthetic system file negative])
3134 AT_DATA([sys-file.sack], [dnl
3135 dnl File header.
3136 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3137 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3139 dnl Numeric variables.
3140 2; 0; 0; 0; 0x050800 *2; s8 "LONGVARI";
3142 dnl Long variable names.
3143 7; 13; 1; COUNT (>>"xyzzy"<<);
3145 dnl Character encoding record.
3146 7; 20; 1; 12; "windows-1252";
3148 dnl Dictionary termination record.
3149 999; 0;
3151 for variant in be le; do
3152   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3153   AT_DATA([sys-file.sps], [dnl
3154 GET FILE='sys-file.sav'.
3156   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
3157 warning: `sys-file.sav' near offset 0xde: Dictionary record refers to unknown variable xyzzy.
3159 done
3160 AT_CLEANUP
3162 AT_SETUP([duplicate long variable name])
3163 AT_KEYWORDS([sack synthetic system file negative])
3164 AT_DATA([sys-file.sack], [dnl
3165 dnl File header.
3166 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3167 2; 4; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3169 dnl Numeric variables.
3170 2; 0; 0; 0; 0x050800 *2; s8 "LONGVARI";
3171 2; 0; 0; 0; 0x050800 *2; s8 "LONGVA_A";
3172 2; 0; 0; 0; 0x050800 *2; s8 "LONGVA_B";
3173 2; 0; 0; 0; 0x050800 *2; s8 "LONGVA_C";
3175 dnl Long variable names.
3176 7; 13; 1; COUNT (
3177 "LONGVARI=_Invalid"; i8 9;
3178 "LONGVARI=$Invalid"; i8 9;
3179 "LONGVARI=#Invalid"; i8 9;
3180 "LONGVA_A=LongVariableName"; i8 9;
3181 "LONGVA_B=LONGVARIABLENAME"; i8 9;
3184 dnl Character encoding record.
3185 7; 20; 1; 12; "windows-1252";
3187 dnl Dictionary termination record.
3188 999; 0;
3190 for variant in be le; do
3191   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3192   AT_DATA([sys-file.sps], [dnl
3193 GET FILE='sys-file.sav'.
3195   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
3196 warning: `sys-file.sav' near offset 0x138: Long variable mapping from LONGVARI to invalid variable name `_Invalid'.
3198 warning: `sys-file.sav' near offset 0x138: Long variable mapping from LONGVARI to invalid variable name `$Invalid'.
3200 warning: `sys-file.sav' near offset 0x138: Long variable mapping from LONGVARI to invalid variable name `#Invalid'.
3202 warning: `sys-file.sav' near offset 0x138: Duplicate long variable name `LONGVARIABLENAME'.
3204 done
3205 AT_CLEANUP
3207 AT_SETUP([bad very long string length])
3208 AT_KEYWORDS([sack synthetic system file negative])
3209 AT_DATA([sys-file.sack], [dnl
3210 dnl File header.
3211 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3212 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3214 dnl Numeric variable.
3215 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3217 dnl Very long string map.
3218 7; 14; 1; COUNT (
3219 "NUM1=00000"; i8 0; i8 9;
3220 "NUM1=00255"; i8 0; i8 9;
3221 "NUM1=00256"; i8 0; i8 9;
3224 dnl Character encoding record.
3225 7; 20; 1; 12; "windows-1252";
3227 dnl Dictionary termination record.
3228 999; 0;
3230 for variant in be le; do
3231   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3232   AT_DATA([sys-file.sps], [dnl
3233 GET FILE='sys-file.sav'.
3235   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
3236 warning: `sys-file.sav' near offset 0xd8: NUM1 listed as string of invalid length 00000 in very long string record.
3238 "warning: `sys-file.sav' near offset 0xd8: NUM1 listed in very long string record with width 00255, which requires only one segment."
3240 error: `sys-file.sav' near offset 0xd8: Very long string NUM1 overflows dictionary.
3242 done
3243 AT_CLEANUP
3245 AT_SETUP([bad very long string segment width])
3246 AT_KEYWORDS([sack synthetic system file negative])
3247 AT_DATA([sys-file.sack], [dnl
3248 dnl File header.
3249 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3250 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3252 dnl Variables.
3253 2; 255; 0; 0; 0x01ff00 *2; s8 "STR1";
3254 (2; -1; 0; 0; 0; 0; s8 "") * 31;
3255 2; >>9<<; 0; 0; 0x010900 *2; s8 "STR1_A";
3256 >>2; -1; 0; 0; 0; 0; s8 "";<<
3258 dnl Very long string map.
3259 7; 14; 1; COUNT (
3260 "STR1=00256"; i8 0; i8 9;
3263 dnl Character encoding record.
3264 7; 20; 1; 12; "windows-1252";
3266 dnl Dictionary termination record.
3267 999; 0;
3269 for variant in be le; do
3270   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3271   AT_DATA([sys-file.sps], [dnl
3272 GET FILE='sys-file.sav'.
3274   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
3275 error: `sys-file.sav' near offset 0x4f8: Very long string with width 256 has segment 1 of width 9 (expected 4).
3277 done
3278 AT_CLEANUP
3280 AT_SETUP([too many value labels])
3281 AT_KEYWORDS([sack synthetic system file negative])
3282 AT_DATA([sys-file.sack], [dnl
3283 dnl File header.
3284 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3285 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3287 dnl Numeric variable.
3288 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3289 3; >>0x7fffffff<<;
3291 for variant in be le; do
3292   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3293   AT_DATA([sys-file.sps], [dnl
3294 GET FILE='sys-file.sav'.
3296   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
3297 error: `sys-file.sav' near offset 0xd4: Invalid number of labels 2147483647.
3299 done
3300 AT_CLEANUP
3302 AT_SETUP([missing type 4 record])
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; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3309 dnl Numeric variable.
3310 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3312 dnl Value label with missing type 4 record.
3313 3; 1; 1.0; i8 3; s7 "one";
3315 dnl Character encoding record.
3316 7; 20; 1; 12; "windows-1252";
3318 dnl End of dictionary.
3319 >>999; 0<<;
3321 for variant in be le; do
3322   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3323   AT_DATA([sys-file.sps], [dnl
3324 GET FILE='sys-file.sav'.
3326   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
3327 error: `sys-file.sav' near offset 0xe8: Variable index record (type 4) does not immediately follow value label record (type 3) as it should.
3329 done
3330 AT_CLEANUP
3332 AT_SETUP([value label with no associated variables])
3333 AT_KEYWORDS([sack synthetic system file negative])
3334 AT_DATA([sys-file.sack], [dnl
3335 dnl File header.
3336 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3337 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3339 dnl Numeric variable.
3340 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3342 dnl Value label with no variables.
3343 3; 1; 1.0; i8 3; s7 "one"; 4; >>0<<;
3345 for variant in be le; do
3346   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3347   AT_DATA([sys-file.sps], [dnl
3348 GET FILE='sys-file.sav'.
3350   AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
3351 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).
3353 done
3354 AT_CLEANUP
3356 AT_SETUP([type 4 record names long string variable])
3357 AT_KEYWORDS([sack synthetic system file negative])
3358 AT_DATA([sys-file.sack], [dnl
3359 dnl File header.
3360 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3361 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3363 dnl Long string variable.
3364 2; 9; 0; 0; 0x010900 *2; s8 "STR1";
3365 2; -1; 0; 0; 0; 0; s8 "";
3367 dnl Value label that names long string variable.
3368 3; 1; s8 "xyzzy"; i8 3; s7 "one"; 4; 1; >>1<<;
3370 dnl Character encoding record.
3371 7; 20; 1; 12; "windows-1252";
3373 dnl End of dictionary.
3374 999; 0;
3376 for variant in be le; do
3377   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3378   AT_DATA([sys-file.sps], [dnl
3379 GET FILE='sys-file.sav'.
3381   AT_CHECK([pspp -O format=csv sys-file.sps], 0, [dnl
3382 warning: `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.
3384 done
3385 AT_CLEANUP
3387 AT_SETUP([value label variable indexes must be in correct range])
3388 AT_KEYWORDS([sack synthetic system file negative])
3389 AT_DATA([sys-file.sack], [dnl
3390 dnl File header.
3391 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3392 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3394 dnl Variables.
3395 2; 6; 0; 0; 0x010600 *2; s8 "STR1";
3396 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3398 dnl Value labels with bad variable indexes.
3399 3; 1; s8 "xyzzy"; i8 3; s7 "one"; 4; 2; >>3; 4;<<
3400 3; 1; s8 "xyzzy"; i8 3; s7 "one"; 4; 2; >>5; 6;<<
3401 3; 1; s8 "xyzzy"; i8 3; s7 "one"; 4; 2; >>7; 8;<<
3403 dnl Character encoding record.
3404 7; 20; 1; 12; "windows-1252";
3406 dnl End of dictionary.
3407 999; 0;
3409 for variant in be le; do
3410   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3411   AT_DATA([sys-file.sps], [dnl
3412 GET FILE='sys-file.sav'.
3414   AT_CHECK([pspp -O format=csv sys-file.sps], 0, [dnl
3415 warning: `sys-file.sav' near offset 0xf4: Value label variable index 3 not in valid range 1...2.
3417 warning: `sys-file.sav' near offset 0xf4: Value label variable index 4 not in valid range 1...2.
3419 warning: `sys-file.sav' near offset 0x11c: Value label variable index 5 not in valid range 1...2.
3421 warning: `sys-file.sav' near offset 0x11c: Value label variable index 6 not in valid range 1...2.
3423 warning: `sys-file.sav' near offset 0x144: Value label variable index 7 not in valid range 1...2.
3425 warning: `sys-file.sav': Suppressed 1 additional warnings for value labels.
3427 done
3428 AT_CLEANUP
3430 AT_SETUP([value label variable indexes must not be long string continuation])
3431 AT_KEYWORDS([sack synthetic system file negative])
3432 AT_DATA([sys-file.sack], [dnl
3433 dnl File header.
3434 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3435 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3437 dnl Long string variable.
3438 2; 9; 0; 0; 0x010900 *2; s8 "STR1";
3439 (2; -1; 0; 0; 0; 0; s8 "");
3441 dnl Value label with long string indexes.
3442 3; 1; s8 "xyzzy"; i8 3; s7 "one"; 4; 1; >>2;<<
3444 dnl Character encoding record.
3445 7; 20; 1; 12; "windows-1252";
3447 dnl End of dictionary.
3448 999; 0;
3450 for variant in be le; do
3451   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3452   AT_DATA([sys-file.sps], [dnl
3453 GET FILE='sys-file.sav'.
3455   AT_CHECK([pspp -O format=csv sys-file.sps], 0, [dnl
3456 warning: `sys-file.sav' near offset 0xf4: Value label variable index 2 refers to long string continuation.
3458 done
3459 AT_CLEANUP
3461 AT_SETUP([variables for value label must all be same type])
3462 AT_KEYWORDS([sack synthetic system file negative])
3463 AT_DATA([sys-file.sack], [dnl
3464 dnl File header.
3465 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3466 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3468 dnl Variables.
3469 2; 6; 0; 0; 0x010600 *2; s8 "STR1";
3470 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3472 dnl Value label that names numeric and string variables.
3473 3; 1; s8 "xyzzy"; i8 3; s7 "one"; 4; 2; >>1; 2<<;
3475 dnl Character encoding record.
3476 7; 20; 1; 12; "windows-1252";
3478 dnl End of dictionary.
3479 999; 0;
3481 for variant in be le; do
3482   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3483   AT_DATA([sys-file.sps], [dnl
3484 GET FILE='sys-file.sav'.
3486   AT_CHECK([pspp -O format=csv sys-file.sps], 0, [dnl
3487 "warning: `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."
3489 done
3490 AT_CLEANUP
3492 AT_SETUP([duplicate value labels type])
3493 AT_KEYWORDS([sack synthetic system file negative])
3494 AT_DATA([sys-file.sack], [dnl
3495 dnl File header.
3496 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3497 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3499 dnl Variables.
3500 2; 6; 0; 0; 0x010600 *2; s8 "STR1";
3501 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3503 dnl Duplicate value labels.
3504 3; 1; s8 "xyzzy"; i8 3; s7 "one"; 4; 2; >>1; 1<<;
3505 3; 1; 1.0; i8 3; s7 "one"; 4; 2; >>2; 2<<;
3507 dnl Character encoding record.
3508 7; 20; 1; 12; "windows-1252";
3510 dnl End of dictionary.
3511 999; 0;
3513 for variant in be le; do
3514   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3515   AT_DATA([sys-file.sps], [dnl
3516 GET FILE='sys-file.sav'.
3518   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
3519 warning: `sys-file.sav' near offset 0xf4: Duplicate value label for `xyzzy ' on STR1.
3521 warning: `sys-file.sav' near offset 0x11c: Duplicate value label for 1 on NUM1.
3523 done
3524 AT_CLEANUP
3526 AT_SETUP([missing attribute value])
3527 AT_KEYWORDS([sack synthetic system file negative])
3528 AT_DATA([sys-file.sack], [dnl
3529 dnl File header.
3530 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3531 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3533 dnl Variables.
3534 2; 0; 0; 0; 0x050800 *2; s8 "FIRSTVAR";
3536 dnl Data file attributes record.
3537 7; 17; 1; COUNT (
3538 "Attr1("
3541 dnl Variable attributes record.
3542 7; 18; 1; COUNT (
3543 "FIRSTVAR:";
3544   "fred('23'"; i8 10
3547 dnl Character encoding record.
3548 7; 20; 1; 12; "windows-1252";
3550 dnl Dictionary termination record.
3551 999; 0;
3553 for variant in be le; do
3554   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3555   AT_DATA([sys-file.sps], [dnl
3556 GET FILE='sys-file.sav'.
3558   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
3559 warning: `sys-file.sav' near offset 0xde: Error parsing attribute value Attr1[[1]].
3561 warning: `sys-file.sav' near offset 0x101: Error parsing attribute value fred[[2]].
3563 done
3564 AT_CLEANUP
3566 AT_SETUP([unquoted attribute value])
3567 AT_KEYWORDS([sack synthetic system file negative])
3568 AT_DATA([sys-file.sack], [dnl
3569 dnl File header.
3570 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3571 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3573 dnl Variables.
3574 2; 0; 0; 0; 0x050800 *2; s8 "FIRSTVAR";
3576 dnl Data file attributes record.
3577 7; 17; 1; COUNT (
3578 "Attr1(value"; i8 10;
3582 dnl Variable attributes record.
3583 7; 18; 1; COUNT (
3584 "FIRSTVAR:";
3585   "fred(23"; i8 10; ")"
3588 dnl Character encoding record.
3589 7; 20; 1; 12; "windows-1252";
3591 dnl Dictionary termination record.
3592 999; 0;
3594 for variant in be le; do
3595   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3596   AT_DATA([sys-file.sps], [dnl
3597 GET FILE='sys-file.sav'.
3599   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
3600 warning: `sys-file.sav' near offset 0xe4: Attribute value Attr1[[1]] is not quoted: value.
3602 warning: `sys-file.sav' near offset 0x106: Attribute value fred[[1]] is not quoted: 23.
3604 done
3605 AT_CLEANUP
3607 AT_SETUP([duplicate attribute name])
3608 AT_KEYWORDS([sack synthetic system file negative])
3609 AT_DATA([sys-file.sack], [dnl
3610 dnl File header.
3611 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3612 2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3614 dnl Variables.
3615 2; 0; 0; 0; 0x050800 *2; s8 "FIRSTVAR";
3617 dnl Data file attributes record.
3618 7; 17; 1; COUNT (
3619 "Attr1('value'"; i8 10; ")";
3620 "Attr1('value'"; i8 10; ")";
3623 dnl Variable attributes record.
3624 7; 18; 1; COUNT (
3625 "FIRSTVAR:";
3626   "fred('23'"; i8 10; ")";
3627   "fred('23'"; i8 10; ")";
3630 dnl Character encoding record.
3631 7; 20; 1; 12; "windows-1252";
3633 dnl Dictionary termination record.
3634 999; 0;
3636 for variant in be le; do
3637   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3638   AT_DATA([sys-file.sps], [dnl
3639 GET FILE='sys-file.sav'.
3641   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
3642 warning: `sys-file.sav' near offset 0xf6: Duplicate attribute Attr1.
3644 warning: `sys-file.sav' near offset 0x125: Duplicate attribute fred.
3646 done
3647 AT_CLEANUP
3649 AT_SETUP([bad variable name in long string value label])
3650 AT_KEYWORDS([sack synthetic system file negative])
3651 AT_DATA([sys-file.sack], [dnl
3652 dnl File header.
3653 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3654 2; 3; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3656 dnl Variables.
3657 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3658 2; 14; 0; 0; 0x010e00 *2; s8 "STR14";
3659 2; -1; 0; 0; 0; 0; s8 "";
3661 7; 21; 1; COUNT (
3662 dnl No variable named STR9.
3663 COUNT(>>"STR9"<<); 9;
3664 1; COUNT("RSTUVWXYZ"); COUNT("value label for `RSTUVWXYZ'");
3666 dnl NUM1 is numeric.
3667 COUNT(>>"NUM1"<<); 0;
3668 1; COUNT("xyz"); COUNT("value label for 1.0");
3670 dnl Wrong width for STR14.
3671 COUNT("STR14"); >>9<<;
3672 1; COUNT("RSTUVWXYZ"); COUNT("value label for `RSTUVWXYZ'");
3674 dnl Wrong width for value.
3675 COUNT("STR14"); 14;
3676 1; COUNT(>>"RSTUVWXYZ"<<); COUNT("value label for `RSTUVWXYZ'");
3678 dnl Duplicate value label.
3679 COUNT("STR14"); 14; 2;
3680 COUNT("abcdefghijklmn"); COUNT("value label for `abcdefghijklmn'");
3681 >>COUNT("abcdefghijklmn"); COUNT("another value label for `abcdefghijklmn'")<<;
3684 dnl Character encoding record.
3685 7; 20; 1; 12; "windows-1252";
3687 dnl Dictionary termination record.
3688 999; 0;
3690 for variant in be le; do
3691   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3692   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3694   AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
3695 warning: `sys-file.sav' near offset 0x128: Ignoring long string value label record for unknown variable STR9.
3697 warning: `sys-file.sav' near offset 0x164: Ignoring long string value label record for numeric variable NUM1.
3699 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).
3701 "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."
3703 warning: `sys-file.sav' near offset 0x259: Duplicate value label for `abcdefghijklmn' on str14.
3705 done
3706 AT_CLEANUP
3708 AT_SETUP([fewer data records than indicated by file header])
3709 AT_KEYWORDS([sack synthetic system file negative])
3710 AT_DATA([sys-file.sack], [dnl
3711 dnl File header.
3712 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3713 2; 2; 0; 0; >>5<<; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3715 dnl Numeric variables.
3716 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3717 2; 0; 0; 0; 0x050800 *2; s8 "NUM2";
3719 dnl Character encoding record.
3720 7; 20; 1; 12; "windows-1252";
3722 dnl Data.
3723 999; 0;
3724 1.0; 2.0;
3725 3.0; 4.0;
3726 5.0; 6.0;
3727 7.0; 8.0;
3728 dnl Missing record here.
3730 for variant in be le; do
3731   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3732   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3733 LIST.
3735   AT_CHECK([pspp -O format=csv sys-file.sps], [1],
3736    [error: Error reading case from file `sys-file.sav'.
3738 Table: Data List
3739 num1,num2
3745 done
3746 AT_CLEANUP
3748 AT_SETUP([partial data record between variables])
3749 AT_KEYWORDS([sack synthetic system file negative])
3750 AT_DATA([sys-file.sack], [dnl
3751 dnl File header.
3752 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3753 2; 2; 0; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3755 dnl Numeric variables.
3756 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3757 2; 0; 0; 0; 0x050800 *2; s8 "NUM2";
3759 dnl Character encoding record.
3760 7; 20; 1; 12; "windows-1252";
3762 dnl Data.
3763 999; 0;
3764 1.0; 2.0;
3765 3.0;
3767 for variant in be le; do
3768   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3769   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3770 LIST.
3772   AT_CHECK([pspp -O format=csv sys-file.sps], [1],
3773    [error: `sys-file.sav' near offset 0x12c: File ends in partial case.
3775 Table: Data List
3776 num1,num2
3779 done
3780 AT_CLEANUP
3782 AT_SETUP([partial data record within long string])
3783 AT_KEYWORDS([sack synthetic system file negative])
3784 AT_DATA([sys-file.sack], [dnl
3785 dnl File header.
3786 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3787 2; 2; 0; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3789 dnl Numeric variables.
3790 2; 14; 0; 0; 0x010e00 *2; s8 "STR14";
3791 2; -1; 0; 0; 0; 0; s8 "";
3793 dnl Character encoding record.
3794 7; 20; 1; 12; "windows-1252";
3796 dnl Data.
3797 999; 0;
3798 s14 "one data item";
3799 s8 "partial";
3801 for variant in be le; do
3802   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3803   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3804 LIST.
3806   AT_CHECK([pspp -O format=csv sys-file.sps], [1],
3807    [error: `sys-file.sav' near offset 0x12a: Unexpected end of file.
3809 Table: Data List
3810 str14
3811 one data item
3813 done
3814 AT_CLEANUP
3816 AT_SETUP([partial compressed data record])
3817 AT_KEYWORDS([sack synthetic system file positive])
3818 AT_DATA([sys-file.sack], [dnl
3819 dnl File header.
3820 "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3821 2; dnl Layout code
3822 6; dnl Nominal case size
3823 1; dnl Compressed
3824 0; dnl Not weighted
3825 -1; dnl Unspecified number of cases.
3826 100.0; dnl Bias.
3827 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
3828 i8 0 *3;
3830 dnl Numeric variables.
3831 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3832 2; 0; 0; 0; 0x050800 *2; s8 "NUM2";
3834 dnl String variable.
3835 2; 4; 0; 0; 0x010400 *2; s8 "STR4";
3836 2; 8; 0; 0; 0x010800 *2; s8 "STR8";
3837 2; 15; 0; 0; 0x010f00 *2; s8 "STR15";
3838 2; -1; 0; 0; 0; 0; s8 "";
3840 dnl Character encoding record.
3841 7; 20; 1; 12; "windows-1252";
3843 dnl Dictionary termination record.
3844 999; 0;
3846 dnl Compressed data.
3847 i8 1 100 254 253 254 253; i8 255 251; "abcdefgh"; s8 "0123";
3849 for variant in be le; do
3850   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3851   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3852 LIST.
3854   AT_CHECK([pspp -O format=csv sys-file.sps], [1],
3855    [error: `sys-file.sav' near offset 0x1ac: File ends in partial case.
3857 Table: Data List
3858 num1,num2,str4,str8,str15
3859 -99,0,,abcdefgh,0123
3861 done
3862 AT_CLEANUP
3864 AT_SETUP([zcompressed data - bad zheader_ofs])
3865 AT_KEYWORDS([sack synthetic system file negative zlib])
3866 zcompressed_sack | sed 's/.*zheader_ofs.*/>>i64 0<<;/' > sys-file.sack
3867 for variant in be le; do
3868   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3869   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3871   AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x194: Wrong ZLIB data header offset 0 (expected 0x194).
3873 done
3874 AT_CLEANUP
3876 AT_SETUP([zcompressed data - bad ztrailer_ofs])
3877 AT_KEYWORDS([sack synthetic system file negative zlib])
3878 zcompressed_sack | sed 's/.*ztrailer_ofs.*/>>i64 0<<;/' > sys-file.sack
3879 for variant in be le; do
3880   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3881   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3883   AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x194: Impossible ZLIB trailer offset 0x0.
3885 done
3886 AT_CLEANUP
3888 # ztrailer_len must be a multiple of 24 and at least 48,
3889 # so a value of 12 is impossible.
3890 AT_SETUP([zcompressed data - invalid ztrailer_len])
3891 AT_KEYWORDS([sack synthetic system file negative zlib])
3892 zcompressed_sack | sed 's/.*ztrailer_len.*/>>i64 12<<;/' > sys-file.sack
3893 for variant in be le; do
3894   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3895   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3897   AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x194: Invalid ZLIB trailer length 12.
3899 done
3900 AT_CLEANUP
3902 # ztrailer_ofs + ztrailer_len must be the file size.
3903 AT_SETUP([zcompressed data - wrong ztrailer_len])
3904 AT_KEYWORDS([sack synthetic system file negative zlib])
3905 zcompressed_sack | sed 's/.*ztrailer_len.*/>>i64 72<<;/' > sys-file.sack
3906 for variant in be le; do
3907   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3908   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3910   AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [warning: `sys-file.sav' near offset 0x1ac: End of ZLIB trailer (0x24d) is not file size (0x235).
3911 error: `sys-file.sav' near offset 0x21d: 72-byte ZLIB trailer specifies 1 data blocks (expected 2).
3913 done
3914 AT_CLEANUP
3916 AT_SETUP([zcompressed data - wrong ztrailer_bias])
3917 AT_KEYWORDS([sack synthetic system file negative zlib])
3918 zcompressed_sack | sed 's/.*ztrailer_bias.*/>>i64 0<<;/' > sys-file.sack
3919 for variant in be le; do
3920   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3921   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3923   AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x20d: ZLIB trailer bias (0) differs from file header bias (100.00).
3925 done
3926 AT_CLEANUP
3928 AT_SETUP([zcompressed data - wrong ztrailer_zero])
3929 AT_KEYWORDS([sack synthetic system file negative zlib])
3930 zcompressed_sack | sed 's/.*ztrailer_zero.*/>>i64 100<<;/' > sys-file.sack
3931 for variant in be le; do
3932   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3933   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3935   AT_CHECK([pspp -o pspp.csv sys-file.sps], [0], [warning: `sys-file.sav' near offset 0x215: ZLIB trailer "zero" field has nonzero value 100.
3937 done
3938 AT_CLEANUP
3940 AT_SETUP([zcompressed data - wrong block_size])
3941 AT_KEYWORDS([sack synthetic system file negative zlib])
3942 zcompressed_sack | sed 's/.*block_size.*/>>0x1000<<;/' > sys-file.sack
3943 for variant in be le; do
3944   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3945   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3947   AT_CHECK([pspp -o pspp.csv sys-file.sps], [0], [warning: `sys-file.sav' near offset 0x219: ZLIB trailer specifies unexpected 4096-byte block size.
3949 done
3950 AT_CLEANUP
3952 AT_SETUP([zcompressed data - wrong n_blocks])
3953 AT_KEYWORDS([sack synthetic system file negative zlib])
3954 zcompressed_sack | sed 's/.*n_blocks.*/>>2<<;/' > sys-file.sack
3955 for variant in be le; do
3956   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3957   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3959   AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x21d: 48-byte ZLIB trailer specifies 2 data blocks (expected 1).
3961 done
3962 AT_CLEANUP
3964 AT_SETUP([zcompressed data - wrong uncompressed_ofs])
3965 AT_KEYWORDS([sack synthetic system file negative zlib])
3966 zcompressed_sack | sed 's/.*uncompressed_ofs.*/i64 >>0x177<<;/' > sys-file.sack
3967 for variant in be le; do
3968   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3969   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3971   AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x21d: ZLIB block descriptor 0 reported uncompressed data offset 0x177, when 0x194 was expected.
3973 done
3974 AT_CLEANUP
3976 AT_SETUP([zcompressed data - wrong compressed_ofs])
3977 AT_KEYWORDS([sack synthetic system file negative zlib])
3978 zcompressed_sack | sed 's/.*@%:@ compressed_ofs.*/i64 >>0x191<<;/' > sys-file.sack
3979 for variant in be le; do
3980   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3981   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3983   AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x21d: ZLIB block descriptor 0 reported compressed data offset 0x191, when 0x1ac was expected.
3985 done
3986 AT_CLEANUP
3988 AT_SETUP([zcompressed data - compressed sizes don't add up])
3989 AT_KEYWORDS([sack synthetic system file negative zlib])
3990 AT_DATA([sys-file.sack], [dnl
3991 dnl File header.
3992 "$FL3"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
3993 2; dnl Layout code
3994 6; dnl Nominal case size
3995 2; dnl zlib compressed
3996 0; dnl Not weighted
3997 -1; dnl Unspecified number of cases.
3998 100.0; dnl Bias.
3999 "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
4000 i8 0 *3;
4002 dnl Numeric variables.
4003 2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
4004 2; 0; 0; 0; 0x050800 *2; s8 "NUM2";
4006 dnl String variable.
4007 2; 4; 0; 0; 0x010400 *2; s8 "STR4";
4008 2; 8; 0; 0; 0x010800 *2; s8 "STR8";
4009 2; 15; 0; 0; 0x010f00 *2; s8 "STR15";
4010 2; -1; 0; 0; 0; 0; s8 "";
4012 dnl Character encoding record.
4013 7; 20; 1; 12; "windows-1252";
4015 dnl Dictionary termination record.
4016 999; 0;
4018 dnl ZLIB data header.
4019 i64 0x194;    # zheader_ofs
4020 i64 0x1ac;    # ztrailer_ofs
4021 i64 72;       # ztrailer_len
4023 dnl This is where the ZLIB data blocks would go, but we don't need any to
4024 dnl provoke this message so we omit them.
4026 dnl ZLIB data trailer fixed header:
4027 i64 -100;     # ztrailer_bias
4028 i64 0;        # ztrailer_zero
4029 0x3ff000;     # block_size
4030 2;            # n_blocks
4032 dnl ZLIB block descriptor 1:
4033 i64 0x194;    # uncompressed_ofs
4034 i64 0x1ac;    # compressed_ofs
4035 0x100000;     # uncompressed_size
4036 0x12345;      # compressed_size
4038 dnl ZLIB block descriptor 2:
4039 i64 0x100194; # uncompressed_ofs
4040 i64 0x12421;  # compressed_ofs
4041 0x100000;     # uncompressed_size
4042 0x12345;      # compressed_size
4044 for variant in be le; do
4045   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
4046   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
4048   AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [warning: `sys-file.sav' near offset 0x1c4: ZLIB block descriptor 0 reported block size 0x100000, when 0x3ff000 was expected.
4049 error: `sys-file.sav' near offset 0x1dc: ZLIB block descriptor 1 reported compressed data offset 0x12421, when 0x124f1 was expected.
4051 done
4052 AT_CLEANUP
4054 AT_SETUP([zcompressed data - uncompressed_size > block_size])
4055 AT_KEYWORDS([sack synthetic system file negative zlib])
4056 zcompressed_sack | sed 's/.*uncompressed_size.*/>>0x400000<<;/' > sys-file.sack
4057 for variant in be le; do
4058   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
4059   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
4061   AT_CHECK([pspp -o pspp.csv sys-file.sps], [0], [warning: `sys-file.sav' near offset 0x21d: ZLIB block descriptor 0 reported block size 0x400000, when at most 0x3ff000 was expected.
4063 done
4064 AT_CLEANUP
4066 AT_SETUP([zcompressed data - compression expands data too much])
4067 AT_KEYWORDS([sack synthetic system file negative zlib])
4068 zcompressed_sack | sed 's/.*uncompressed_size.*/>>50<<;/
4069 s/.*@%:@ compressed_size.*/>>100<<;/' > sys-file.sack
4070 for variant in be le; do
4071   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
4072   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
4074   AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x21d: ZLIB block descriptor 0 reports compressed size 100 and uncompressed size 50.
4076 done
4077 AT_CLEANUP
4079 AT_SETUP([zcompressed data - compressed sizes don't add up])
4080 AT_KEYWORDS([sack synthetic system file negative zlib])
4081 zcompressed_sack | sed 's/.*@%:@ compressed_size.*/>>88<<;/' > sys-file.sack
4082 for variant in be le; do
4083   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
4084   AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
4086   AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x235: ZLIB trailer is at offset 0x205 but 0x204 would be expected from block descriptors.
4088 done
4089 AT_CLEANUP
4091 # CVE-2017-10791.
4092 # See also https://bugzilla.redhat.com/show_bug.cgi?id=1467004.
4093 # See also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=866890.
4094 # See also https://security-tracker.debian.org/tracker/CVE-2017-10791.
4095 # Found by team OWL337, using the collAFL fuzzer.
4096 AT_SETUP([integer overflows in long string missing values])
4097 AT_KEYWORDS([system file negative])
4098 cp $top_srcdir/tests/data/CVE-2017-10791.sav .
4099 AT_CHECK([pspp-convert -O csv -e ASCII CVE-2017-10791.sav -], [0], [], [dnl
4100 `CVE-2017-10791.sav' near offset 0x217: Extension record subtype 21 ends unexpectedly.
4102 AT_CLEANUP
4104 # CVE-2017-10792.
4105 # See also https://bugzilla.redhat.com/show_bug.cgi?id=1467005.
4106 # See also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=866890.
4107 # See also https://security-tracker.debian.org/tracker/CVE-2017-10792.
4108 # Reported by team OWL337, with fuzzer collAFL.
4109 AT_SETUP([null dereference skipping bad extension record 18])
4110 AT_KEYWORDS([system file negative])
4111 cp $top_srcdir/tests/data/CVE-2017-10792.sav .
4112 AT_CHECK([pspp-convert -O csv -e ASCII CVE-2017-10792.sav -], [0], [], [dnl
4113 `CVE-2017-10792.sav' near offset 0x1c0: Record type 7, subtype 18 has bad size 4 (expected 1).
4115 AT_CLEANUP