1dnl PSPP - a program for statistical analysis.
2dnl Copyright (C) 2017 Free Software Foundation, Inc.
3dnl
4dnl This program is free software: you can redistribute it and/or modify
5dnl it under the terms of the GNU General Public License as published by
6dnl the Free Software Foundation, either version 3 of the License, or
7dnl (at your option) any later version.
8dnl
9dnl This program is distributed in the hope that it will be useful,
10dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12dnl GNU General Public License for more details.
13dnl
14dnl You should have received a copy of the GNU General Public License
15dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
16dnl
17AT_BANNER([system file reader - positive])
18
19AT_SETUP([variable labels and missing values])
20AT_KEYWORDS([sack synthetic system file positive])
21AT_DATA([sys-file.sack], [dnl
22dnl File header.
23"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
242; dnl Layout code
2528; dnl Nominal case size
260; dnl Not compressed
270; dnl Not weighted
281; dnl 1 case.
29100.0; dnl Bias.
30"01 Jan 11"; "20:53:52";
31"PSPP synthetic test file: "; i8 244; i8 245; i8 246; i8 248; s34 "";
32i8 0 *3;
33
34dnl Numeric variable, no label or missing values.
352; 0; 0; 0; 0x050800 *2; s8 "NUM1";
36
37dnl Numeric variable, variable label.
382; 0; 1; 0; 0x050800 *2; s8 "NUM2";
3932; "Numeric variable 2's label ("; i8 249; i8 250; i8 251; ")";
40
41dnl Numeric variable, one missing value.
422; 0; 0; 1; 0x050800 *2; s8 "NUM3";
431.0;
44
45dnl Numeric variable, variable label and missing value.
462; 0; 1; 1; 0x050800 *2; s8 "NUM4";
4730; "Another numeric variable label"; i8 0 * 2;
481.0;
49
50dnl Numeric variable, two missing values.
512; 0; 0; 2; 0x050800 *2; s8 "NUM5"; 1.0; 2.0;
52
53dnl Numeric variable, three missing values.
542; 0; 0; 3; 0x050800 *2; s8 "NUM6"; 1.0; 2.0; 3.0;
55
56dnl Numeric variable, range of missing values.
572; 0; 0; -2; 0x050800 *2; s8 "NUM7"; 1.0; 3.0;
58
59dnl Numeric variables, range of missing values plus discrete value.
602; 0; 0; -3; 0x050800 *2; s8 "NUM8"; 1.0; 3.0; 5.0;
612; 0; 0; -3; 0x050800 *2; s8 "NUM9"; 1.0; HIGHEST; -5.0;
622; 0; 0; -3; 0x050800 *2; "NUM"; i8 192; i8 200; i8 204; i8 209; i8 210;
63LOWEST; 1.0; 5.0;
64
65dnl String variable, no label or missing values.
662; 4; 0; 0; 0x010400 *2; s8 "STR1";
67
68dnl String variable, variable label.
692; 4; 1; 0; 0x010400 *2; s8 "STR2";
7025; "String variable 2's label"; i8 0 * 3;
71
72dnl String variable, one missing value.
732; 4; 0; 1; 0x010400 *2; s8 "STR3"; s8 "MISS";
74
75dnl String variable, variable label and missing value.
762; 4; 1; 1; 0x010400 *2; s8 "STR4";
7729; "Another string variable label"; i8 0 * 3;
78s8 "OTHR";
79
80dnl String variable, two missing values.
812; 4; 0; 2; 0x010400 *2; s8 "STR5"; s8 "MISS"; s8 "OTHR";
82
83dnl String variable, three missing values.
842; 4; 0; 3; 0x010400 *2; s8 "STR6"; s8 "MISS"; s8 "OTHR"; s8 "MORE";
85
86dnl Long string variable, one missing value.
87dnl (This is not how SPSS represents missing values for long strings--it
88dnl uses a separate record as shown later below--but old versions of PSPP
89dnl did use this representation so we continue supporting it for backward
90dnl compatibility.
912; 11; 0; 1; 0x010b00 *2; s8 "STR7"; "first8by";
922; -1; 0; 0; 0; 0; s8 "";
93
94dnl Long string variables that will have missing values added with a
95dnl later record.
962; 9; 0; 0; 0x010900 *2; s8 "STR8";
972; -1; 0; 0; 0; 0; s8 "";
982; 10; 0; 0; 0x010a00 *2; s8 "STR9";
992; -1; 0; 0; 0; 0; s8 "";
1002; 11; 0; 0; 0x010b00 *2; s8 "STR10";
1012; -1; 0; 0; 0; 0; s8 "";
102
103dnl Long string variable, value label.
1042; 25; 1; 0; 0x011900 *2; s8 "STR11"; 14; "25-byte string"; i8 0 * 2;
105( 2; -1; 0; 0; 0; 0; s8 ""; ) * 2;
106dnl Variable label fields on continuation records have been spotted in system
107dnl files created by "SPSS Power Macintosh Release 6.1".
1082; -1; 1; 0; 0; 0; s8 ""; 20; "dummy variable label";
109
110dnl Machine integer info record.
1117; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1252;
112
113dnl Machine floating-point info record.
1147; 4; 8; 3; SYSMIS; HIGHEST; LOWEST;
115
116dnl Long string variable missing values record.
1177; 22; 1; COUNT (
118dnl One missing value for STR8.
119COUNT("STR8"); i8 1; 8; "abcdefgh";
120
121dnl Two missing values for STR9.
122COUNT("STR9"); i8 2; 8; "abcdefgh"; 8; "01234567";
123
124dnl Three missing values for STR9.
125COUNT("STR10"); i8 3; 8; "abcdefgh"; 8; "01234567"; 8; "0       ";
126);
127
128dnl Character encoding record.
1297; 20; 1; 12; "windows-1252";
130
131dnl Dictionary termination record.
132999; 0;
133
134dnl Data.
1351.0; 2.0; 3.0; 4.0; 5.0; 6.0; 7.0; 8.0; 9.0; 10.0;
136s8 "abcd"; s8 "efgh"; s8 "ijkl"; s8 "mnop"; s8 "qrst"; s8 "uvwx";
137s16 "yzABCDEFGHI"; s16 "JKLMNOPQR"; s16 "STUVWXYZ01";
138s16 "23456789abc"; s32 "defghijklmnopqstuvwxyzABC";
139])
140for variant in be le; do
141  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
142  AT_DATA([sys-file.sps], [dnl
143GET FILE='sys-file.sav'.
144DISPLAY FILE LABEL.
145DISPLAY DICTIONARY.
146LIST.
147])
148  AT_CHECK([pspp -o pspp.csv sys-file.sps])
149  AT_CHECK([cat pspp.csv], [0], [dnl
150Table: File Label
151Label,PSPP synthetic test file: ôõöø
152
153Table: Variables
154Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
155num1,1,,Scale,Input,8,Right,F8.0,F8.0,
156num2,2,Numeric variable 2's label (ùúû),Scale,Input,8,Right,F8.0,F8.0,
157num3,3,,Scale,Input,8,Right,F8.0,F8.0,1
158num4,4,Another numeric variable label,Scale,Input,8,Right,F8.0,F8.0,1
159num5,5,,Scale,Input,8,Right,F8.0,F8.0,1; 2
160num6,6,,Scale,Input,8,Right,F8.0,F8.0,1; 2; 3
161num7,7,,Scale,Input,8,Right,F8.0,F8.0,1 THRU 3
162num8,8,,Scale,Input,8,Right,F8.0,F8.0,1 THRU 3; 5
163num9,9,,Scale,Input,8,Right,F8.0,F8.0,1 THRU HIGHEST; -5
164numàèìñò,10,,Scale,Input,8,Right,F8.0,F8.0,LOWEST THRU 1; 5
165str1,11,,Nominal,Input,4,Left,A4,A4,
166str2,12,String variable 2's label,Nominal,Input,4,Left,A4,A4,
167str3,13,,Nominal,Input,4,Left,A4,A4,"""MISS"""
168str4,14,Another string variable label,Nominal,Input,4,Left,A4,A4,"""OTHR"""
169str5,15,,Nominal,Input,4,Left,A4,A4,"""MISS""; ""OTHR"""
170str6,16,,Nominal,Input,4,Left,A4,A4,"""MISS""; ""OTHR""; ""MORE"""
171str7,17,,Nominal,Input,11,Left,A11,A11,"""first8by"""
172str8,18,,Nominal,Input,9,Left,A9,A9,"""abcdefgh"""
173str9,19,,Nominal,Input,10,Left,A10,A10,"""abcdefgh""; ""01234567"""
174str10,20,,Nominal,Input,11,Left,A11,A11,"""abcdefgh""; ""01234567""; ""0       """
175str11,21,25-byte string,Nominal,Input,25,Left,A25,A25,
176
177Table: Data List
178num1,num2,num3,num4,num5,num6,num7,num8,num9,numàèìñò,str1,str2,str3,str4,str5,str6,str7,str8,str9,str10,str11
1791,2,3,4,5,6,7,8,9,10,abcd,efgh,ijkl,mnop,qrst,uvwx,yzABCDEFGHI,JKLMNOPQR,STUVWXYZ01,23456789abc,defghijklmnopqstuvwxyzABC
180])
181done
182AT_CLEANUP
183
184AT_SETUP([unspecified number of variable positions])
185AT_KEYWORDS([sack synthetic system file positive])
186AT_DATA([sys-file.sack], [dnl
187dnl File header.
188"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
1892; dnl Layout code
190-1; dnl Nominal case size (unspecified)
1910; dnl Not compressed
1920; dnl Not weighted
1931; dnl 1 case.
194100.0; dnl Bias.
195"01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
196i8 0 *3;
197
198dnl Numeric variable, no label or missing values.
1992; 0; 0; 0; 0x050800 *2; s8 "NUM1";
200
201dnl Numeric variable, variable label.
2022; 0; 1; 0; 0x050800 *2; s8 "NUM2";
20326; "Numeric variable 2's label"; i8 0 *2;
204
205dnl Character encoding record.
2067; 20; 1; 12; "windows-1252";
207
208dnl Dictionary termination record.
209999; 0;
210
211dnl Data.
2121.0; 2.0;
213])
214for variant in be le; do
215  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
216  AT_DATA([sys-file.sps], [dnl
217GET FILE='sys-file.sav'.
218DISPLAY DICTIONARY.
219LIST.
220])
221  AT_CHECK([pspp -o pspp.csv sys-file.sps])
222  AT_CHECK([cat pspp.csv], [0], [dnl
223Table: Variables
224Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
225num1,1,,Scale,Input,8,Right,F8.0,F8.0,
226num2,2,Numeric variable 2's label,Scale,Input,8,Right,F8.0,F8.0,
227
228Table: Data List
229num1,num2
2301,2
231])
232done
233AT_CLEANUP
234
235AT_SETUP([wrong number of variable positions but version 13])
236AT_KEYWORDS([sack synthetic system file positive])
237AT_DATA([sys-file.sack], [dnl
238dnl File header.
239"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2402; dnl Layout code
241-1; dnl Nominal case size (unspecified)
2420; dnl Not compressed
2430; dnl Not weighted
2441; dnl 1 case.
245100.0; dnl Bias.
246"01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
247i8 0 *3;
248
249dnl Numeric variable, no label or missing values.
2502; 0; 0; 0; 0x050800 *2; s8 "NUM1";
251
252dnl Numeric variable, variable label.
2532; 0; 1; 0; 0x050800 *2; s8 "NUM2";
25426; "Numeric variable 2's label"; i8 0 *2;
255
256dnl Machine integer info record (SPSS 13).
2577; 3; 4; 8; 13; 2; 3; -1; 1; 1; ENDIAN; 1252;
258
259dnl Character encoding record.
2607; 20; 1; 12; "windows-1252";
261
262dnl Dictionary termination record.
263999; 0;
264
265dnl Data.
2661.0; 2.0;
267])
268for variant in be le; do
269  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
270  AT_DATA([sys-file.sps], [dnl
271GET FILE='sys-file.sav'.
272DISPLAY DICTIONARY.
273LIST.
274])
275  AT_CHECK([pspp -o pspp.csv sys-file.sps])
276  AT_CHECK([cat pspp.csv], [0], [dnl
277Table: Variables
278Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
279num1,1,,Scale,Input,8,Right,F8.0,F8.0,
280num2,2,Numeric variable 2's label,Scale,Input,8,Right,F8.0,F8.0,
281
282Table: Data List
283num1,num2
2841,2
285])
286done
287AT_CLEANUP
288
289AT_SETUP([value labels])
290AT_KEYWORDS([sack synthetic system file positive])
291AT_DATA([sys-file.sack], [dnl
292dnl File header.
293"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
2942; dnl Layout code
29522; dnl Nominal case size
2960; dnl Not compressed
2970; dnl Not weighted
2981; dnl 1 case.
299100.0; dnl Bias.
300"01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
301i8 0 *3;
302
303dnl Numeric variables.
3042; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3052; 0; 0; 0; 0x050800 *2; s8 "NUM2";
3062; 0; 0; 0; 0x050800 *2; s8 "NUM3";
3072; 0; 0; 0; 0x050800 *2; s8 "NUM4";
3082; 0; 0; 0; 0x050800 *2; s8 "NUM5";
309
310dnl String variables.
3112; 1; 0; 0; 0x010100 *2; s8 "STR1"; dnl index 6
3122; 2; 0; 0; 0x010200 *2; s8 "STR2"; dnl index 7
3132; 3; 0; 0; 0x010300 *2; s8 "STR3"; dnl index 8
3142; 4; 0; 0; 0x010400 *2; s8 "STR4"; dnl index 9
3152; 4; 0; 0; 0x010400 *2; s8 "STR5"; dnl index 10
3162; 6; 0; 0; 0x010600 *2; s8 "STR6"; dnl index 11
3172; 7; 0; 0; 0x010700 *2; s8 "STR7"; dnl index 12
3182; 8; 0; 0; 0x010800 *2; s8 "STR8"; dnl index 13
3192; 9; 0; 0; 0x010900 *2; "STR9"; i8 230; s3 ""; dnl index 14
3202; -1; 0; 0; 0; 0; s8 "";
3212; 12; 0; 0; 0x010c00 *2; s8 "STR12"; dnl index 16
3222; -1; 0; 0; 0; 0; s8 "";
3232; 16; 0; 0; 0x011000 *2; s8 "STR16"; dnl index 18
3242; -1; 0; 0; 0; 0; s8 "";
3252; 17; 0; 0; 0x011100 *2; s8 "STR17"; dnl index 20
326( 2; -1; 0; 0; 0; 0; s8 ""; ) * 2;
327
328dnl One value label for NUM1.
3293; 1; 1.0; i8 17; i8 238; i8 228; i8 232; i8 237; s19 " (in Russian)"; 4; 1; 1;
330
331dnl Two value labels for NUM2, as a single pair of type 3 and type 4 records.
3323; 2; 1.0; i8 3; s7 "one"; 2.0; i8 3; s7 "two"; 4; 1; 2;
333
334dnl Two value labels for NUM3, as two pairs of type 3 and type 4 records.
3353; 1; 3.0; i8 5; s7 "three"; 4; 1; 3;
3363; 1; 4.0; i8 4; s7 "four"; 4; 1; 3;
337
338dnl Two common value labels for NUM4 and NUM5, plus two different ones for each.
3393; 1; 5.0; i8 4; s7 "five"; 4; 1; 4;
3403; 1; 6.0; i8 3; s7 "six"; 4; 1; 5;
3413; 2; 7.0; i8 5; s7 "seven"; 8.0; i8 5; s7 "eight"; 4; 2; 4; 5;
3423; 1; 9.0; i8 4; s7 "nine"; 4; 1; 4;
3433; 1; 10.0; i8 3; s7 "ten"; 4; 1; 5;
344
345dnl One value label for STR1.
3463; 1; s8 "a"; i8 19; s23 "value label for `a'"; 4; 1; 6;
347
348dnl Two value labels for STR2, as a single pair of type 3 and type 4 records.
3493; 2;
350s8 "bc"; i8 20; s23 "value label for `bc'";
351s8 "de"; i8 20; s23 "value label for `de'";
3524; 1; 7;
353
354dnl Two value labels for STR3, as two pairs of type 3 and type 4 records.
3553; 1; s8 "fgh"; i8 21; s23 "value label for `fgh'"; 4; 1; 8;
3563; 1; s8 "ijk"; i8 21; s23 "value label for `ijk'"; 4; 1; 8;
357
358dnl Two common value labels for STR4 and STR5, plus two different ones for each.
3593; 1; s8 "lmno"; i8 22; s23 "value label for `lmno'"; 4; 1; 9;
3603; 1; s8 "pqrs"; i8 22; s23 "value label for `pqrs'"; 4; 1; 10;
3613; 2;
362s8 "tuvw"; i8 22; s23 "value label for `tuvw'";
363s8 "xyzA"; i8 22; s23 "value label for `xyzA'";
3644; 2; 9; 10;
3653; 1; s8 "BCDE"; i8 22; s23 "value label for `BCDE'"; 4; 1; 9;
3663; 1; s8 "FGHI"; i8 22; s23 "value label for `FGHI'"; 4; 1; 10;
367
368dnl One value label for STR6, STR7, STR8.
3693; 1; s8 "JKLMNO"; i8 24; s31 "value label for `JKLMNO'"; 4; 1; 11;
3703; 1; s8 "JKLMNOP"; i8 25; s31 "value label for `JKLMNOP'"; 4; 1; 12;
3713; 1; s8 "JKLMNOPQ"; i8 26; s31 "value label for `JKLMNOPQ'"; 4; 1; 13;
372
373dnl Machine integer info record.
3747; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1251;
375
376dnl Character encoding record.
3777; 20; 1; 12; "windows-1251";
378
3797; 21; 1; COUNT (
380dnl One value label for STR9ж,
381COUNT("STR9"; i8 230); 9; 1; COUNT("RSTUVWXYZ"); COUNT("value label for `RSTUVWXYZ'");
382
383dnl Two value labels for STR12.
384COUNT("STR12"); 12; 2;
385COUNT("0123456789ab"); COUNT("value label for `0123456789ab'");
386COUNT("cdefghijklmn"); COUNT("value label for `cdefghijklmn'");
387
388dnl Three value labels for STR16.
389COUNT("STR16"); 16; 3;
390COUNT("opqrstuvwxyzABCD"); COUNT("value label for `opqrstuvwxyzABCD'");
391COUNT("EFGHIJKLMNOPQRST"); COUNT("value label for `EFGHIJKLMNOPQRST'");
392COUNT("UVWXYZ0123456789"); COUNT("value label for `UVWXYZ0123456789' with Cyrillic letters: `"; i8 244; i8 245; i8 246; "'");
393
394dnl One value label for STR17.
395COUNT("STR17"); 17; 1;
396COUNT("abcdefghijklmnopq"); COUNT("value label for `abcdefghijklmnopq'");
397);
398
399dnl Dictionary termination record.
400999; 0;
401])
402for variant in be le; do
403  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
404  AT_DATA([sys-file.sps], [dnl
405GET FILE='sys-file.sav'.
406DISPLAY DICTIONARY.
407])
408  AT_CHECK([pspp -o pspp.csv sys-file.sps])
409  AT_CHECK([cat pspp.csv], [0], [dnl
410Table: Variables
411Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
412num1,1,,Scale,Input,8,Right,F8.0,F8.0,
413num2,2,,Scale,Input,8,Right,F8.0,F8.0,
414num3,3,,Scale,Input,8,Right,F8.0,F8.0,
415num4,4,,Scale,Input,8,Right,F8.0,F8.0,
416num5,5,,Scale,Input,8,Right,F8.0,F8.0,
417str1,6,,Nominal,Input,1,Left,A1,A1,
418str2,7,,Nominal,Input,2,Left,A2,A2,
419str3,8,,Nominal,Input,3,Left,A3,A3,
420str4,9,,Nominal,Input,4,Left,A4,A4,
421str5,10,,Nominal,Input,4,Left,A4,A4,
422str6,11,,Nominal,Input,6,Left,A6,A6,
423str7,12,,Nominal,Input,7,Left,A7,A7,
424str8,13,,Nominal,Input,8,Left,A8,A8,
425str9ж,14,,Nominal,Input,9,Left,A9,A9,
426str12,15,,Nominal,Input,12,Left,A12,A12,
427str16,16,,Nominal,Input,16,Left,A16,A16,
428str17,17,,Nominal,Input,17,Left,A17,A17,
429
430Table: Value Labels
431Variable Value,,Label
432num1,1,один (in Russian)
433num2,1,one
434,2,two
435num3,3,three
436,4,four
437num4,5,five
438,7,seven
439,8,eight
440,9,nine
441num5,6,six
442,7,seven
443,8,eight
444,10,ten
445str1,a,value label for `a'
446str2,bc,value label for `bc'
447,de,value label for `de'
448str3,fgh,value label for `fgh'
449,ijk,value label for `ijk'
450str4,BCDE,value label for `BCDE'
451,lmno,value label for `lmno'
452,tuvw,value label for `tuvw'
453,xyzA,value label for `xyzA'
454str5,FGHI,value label for `FGHI'
455,pqrs,value label for `pqrs'
456,tuvw,value label for `tuvw'
457,xyzA,value label for `xyzA'
458str6,JKLMNO,value label for `JKLMNO'
459str7,JKLMNOP,value label for `JKLMNOP'
460str8,JKLMNOPQ,value label for `JKLMNOPQ'
461str9ж,RSTUVWXYZ,value label for `RSTUVWXYZ'
462str12,0123456789ab,value label for `0123456789ab'
463,cdefghijklmn,value label for `cdefghijklmn'
464str16,EFGHIJKLMNOPQRST,value label for `EFGHIJKLMNOPQRST'
465,UVWXYZ0123456789,value label for `UVWXYZ0123456789' with Cyrillic letters: `фхц'
466,opqrstuvwxyzABCD,value label for `opqrstuvwxyzABCD'
467str17,abcdefghijklmnopq,value label for `abcdefghijklmnopq'
468])
469done
470AT_CLEANUP
471
472AT_SETUP([documents])
473AT_KEYWORDS([sack synthetic system file positive])
474AT_DATA([sys-file.sack], [dnl
475dnl File header.
476"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
4772; dnl Layout code
4781; dnl Nominal case size
4790; dnl Not compressed
4800; dnl Not weighted
4811; dnl 1 case.
482100.0; dnl Bias.
483"01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
484i8 0 *3;
485
486dnl Numeric variable, no label or missing values.
4872; 0; 0; 0; 0x050800 *2; s8 "NUM1";
488
489dnl Machine integer info record.
4907; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1252;
491
492dnl Document record.
4936; 5;
494s80 "First line of documents";
495s80 "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;
497s25 "";
498s80 "";
499s80 "Last line of documents";
500
501dnl Character encoding record.
5027; 20; 1; 12; "windows-1252";
503
504dnl Dictionary termination record.
505999; 0;
506
507dnl Data.
5081.0;
509])
510for variant in be le; do
511  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
512  AT_DATA([sys-file.sps], [dnl
513GET FILE='sys-file.sav'.
514DISPLAY DOCUMENTS.
515LIST.
516])
517  AT_CHECK([pspp -o pspp.csv sys-file.sps])
518  AT_CHECK([cat pspp.csv], [0], [dnl
519Table: Documents
520"First line of documents
521Second line of documents
522abbé appliqué attaché blasé café canapé cliché consommé
523
524Last line of documents"
525
526Table: Data List
527num1
5281
529])
530done
531AT_CLEANUP
532
533AT_SETUP([empty document record])
534AT_KEYWORDS([sack synthetic system file positive])
535AT_DATA([sys-file.sack], [dnl
536dnl File header.
537"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
5382; dnl Layout code
5391; dnl Nominal case size
5400; dnl Not compressed
5410; dnl Not weighted
5421; dnl 1 case.
543100.0; dnl Bias.
544"01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
545i8 0 *3;
546
547dnl Numeric variable, no label or missing values.
5482; 0; 0; 0; 0x050800 *2; s8 "NUM1";
549
550dnl Machine integer info record.
5517; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1252;
552
553dnl Document record.
5546; 0;
555
556dnl Character encoding record.
5577; 20; 1; 12; "windows-1252";
558
559dnl Dictionary termination record.
560999; 0;
561
562dnl Data.
5631.0;
564])
565for variant in be le; do
566  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
567  AT_DATA([sys-file.sps], [dnl
568GET FILE='sys-file.sav'.
569LIST.
570])
571  AT_CHECK([pspp -o pspp.csv sys-file.sps])
572  AT_CHECK([cat pspp.csv], [0], [dnl
573Table: Data List
574num1
5751
576])
577done
578AT_CLEANUP
579
580AT_SETUP([multiple response sets])
581AT_KEYWORDS([sack synthetic system file positive])
582AT_DATA([sys-file.sack], [dnl
583dnl File header.
584"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
5852; dnl Layout code
58616; dnl Nominal case size
5870; dnl Not compressed
5880; dnl Not weighted
5890; dnl No cases.
590100.0; dnl Bias.
591"01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
592i8 0 *3;
593
594dnl $a
5952; 0; 0; 0; 0x050800 *2; i8 0x82; i8 0xa0; s6 "";
5962; 0; 0; 0; 0x050800 *2; s8 "B";
5972; 0; 0; 0; 0x050800 *2; s8 "C";
598
599dnl $b
6002; 0; 0; 0; 0x050800 *2; s8 "D";
6012; 0; 0; 0; 0x050800 *2; s8 "E";
6022; 0; 0; 0; 0x050800 *2; s8 "F";
6032; 0; 0; 0; 0x050800 *2; s8 "G";
604
605dnl $c
6062; 4; 0; 0; 0x010400 *2; s8 "H";
6072; 4; 0; 0; 0x010400 *2; s8 "I";
6082; 4; 0; 0; 0x010400 *2; s8 "J";
609
610dnl $d
6112; 0; 0; 0; 0x050800 *2; s8 "K";
6122; 0; 0; 0; 0x050800 *2; s8 "L";
6132; 0; 0; 0; 0x050800 *2; s8 "M";
614
615dnl $e
6162; 6; 0; 0; 0x010600 *2; s8 "N";
6172; 6; 0; 0; 0x010600 *2; s8 "O";
6182; 6; 0; 0; 0x010600 *2; s8 "P";
619
620dnl Machine integer info record.
6217; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 932;
622
6237; 7; 1;
624COUNT(
625  "$a=C 10 my mcgroup "; i8 0x82; i8 0xa0; " b c"; i8 10;
626  "$b=D2 55 0  g e f d"; i8 10; i8 10;
627  "$c=D4 "; i8 0x82; i8 0xcd; i8 0x82; i8 0xa2; " 10 mdgroup #2 h i j"; i8 10);
628
6297; 19; 1;
630COUNT(
631  i8 10;
632  "$d=E 1 2 34 13 third mdgroup k l m"; i8 10;
633  "$e=E 11 6 choice 0  n o p"; i8 10; i8 10; i8 10; i8 10);
634
635dnl Character encoding record.
6367; 20; 1; 9; "shift_jis";
637
638dnl Dictionary termination record.
639999; 0;
640])
641for variant in be le; do
642  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
643  AT_DATA([sys-file.sps], [dnl
644GET FILE='sys-file.sav'.
645MRSETS /DISPLAY NAME=ALL.
646])
647  AT_CHECK([pspp -o pspp.csv sys-file.sps])
648  AT_CHECK([cat pspp.csv], [0], [dnl
649Table: Multiple Response Sets
650Name,Label,Encoding,Counted Value,Member Variables
651$a,my mcgroup,Categories,,"あ
652b
653c"
654$b,,Dichotomies,55,"g
655e
656f
657d"
658$c,mdgroup #2,Dichotomies,はい,"h
659i
660j"
661$d,third mdgroup,Dichotomies,34,"k
662l
663m"
664$e,,Dichotomies,choice,"n
665o
666p"
667])
668done
669AT_CLEANUP
670
671dnl Also checks for handling of CR-only line ends in file label and
672dnl extra product info.
673AT_SETUP([extra product info])
674AT_KEYWORDS([sack synthetic system file positive])
675AT_DATA([sys-file.sack], [dnl
676dnl File header.
677"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
6782; dnl Layout code
6794; dnl Nominal case size
6800; dnl Not compressed
6810; dnl Not weighted
6820; dnl No cases.
683100.0; dnl Bias.
684"01 Jan 11"; "20:53:52"; "PSPP synthetic"; i8 13; s49 "test file";
685i8 0 *3;
686
687dnl Numeric variables.
6882; 0; 0; 0; 0x050800 *2; s8 "A";
6892; 0; 0; 0; 0x050800 *2; s8 "B";
6902; 0; 0; 0; 0x050800 *2; s8 "C";
6912; 0; 0; 0; 0x050800 *2; s8 "D";
692
693dnl Extra product info.
6947; 10; 1; COUNT ("Extra product info"; i8 13; "another line"; i8 13; "blah");
695
696dnl Character encoding record.
6977; 20; 1; 12; "windows-1252";
698
699dnl Dictionary termination record.
700999; 0;
701])
702for variant in be; do
703  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
704  AT_DATA([sys-file.sps], [dnl
705SYSFILE INFO FILE='sys-file.sav'.
706])
707  AT_CHECK([pspp -o pspp.csv sys-file.sps])
708  AT_CHECK([sed 8q pspp.csv], [0], [dnl
709Table: File Information
710File,sys-file.sav
711Label,"PSPP synthetic
712test file"
713Created,01 Jan 11 20:53:52 by $(@%:@) SPSS DATA FILE PSPP synthetic test file
714Product,"Extra product info
715another line
716blah"
717])
718done
719AT_CLEANUP
720
721AT_SETUP([variable display parameters, without width])
722AT_KEYWORDS([sack synthetic system file positive])
723AT_DATA([sys-file.sack], [dnl
724dnl File header.
725"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
7262; dnl Layout code
72719; dnl Nominal case size
7280; dnl Not compressed
7290; dnl Not weighted
7300; dnl No cases.
731100.0; dnl Bias.
732"01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
733i8 0 *3;
734
735dnl Numeric variables.
7362; 0; 0; 0; 0x050800 *2; s8 "A";
7372; 0; 0; 0; 0x050800 *2; s8 "B";
7382; 0; 0; 0; 0x050800 *2; s8 "C";
7392; 0; 0; 0; 0x050800 *2; s8 "D";
740
741dnl Short string variables.
7422; 3; 0; 0; 0x010300 *2; s8 "H";
7432; 3; 0; 0; 0x010300 *2; s8 "I";
7442; 3; 0; 0; 0x010300 *2; s8 "J";
7452; 3; 0; 0; 0x010300 *2; s8 "K";
746
747dnl Long string variables.
7482; 9; 0; 0; 0x010900 *2; s8 "L";
7492; -1; 0; 0; 0; 0; s8 "";
7502; 10; 0; 0; 0x010a00 *2; s8 "M";
7512; -1; 0; 0; 0; 0; s8 "";
7522; 17; 0; 0; 0x011100 *2; s8 "N";
753( 2; -1; 0; 0; 0; 0; s8 "" ) * 2;
7542; 25; 0; 0; 0x011900 *2; s8 "O";
755( 2; -1; 0; 0; 0; 0; s8 "" ) * 3;
756
757dnl Variable display parameters
7587; 11; 4; 24;
7591; 0;
7602; 0;
7613; 0;
7621; 1;
7632; 1;
7643; 1;
7651; 2;
7662; 2;
7673; 2;
7680; 0;
7690; 1;
7700; 2;
771
772dnl Character encoding record.
7737; 20; 1; 12; "windows-1252";
774
775dnl Dictionary termination record.
776999; 0;
777])
778for variant in be le; do
779  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
780  AT_DATA([sys-file.sps], [dnl
781GET FILE='sys-file.sav'.
782DISPLAY DICTIONARY.
783])
784  AT_CHECK([pspp -o pspp.csv sys-file.sps])
785  AT_CHECK([cat pspp.csv], [0], [dnl
786Table: Variables
787Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
788a,1,,Nominal,Input,8,Left,F8.0,F8.0,
789b,2,,Ordinal,Input,8,Left,F8.0,F8.0,
790c,3,,Scale,Input,8,Left,F8.0,F8.0,
791d,4,,Nominal,Input,8,Right,F8.0,F8.0,
792h,5,,Ordinal,Input,3,Right,A3,A3,
793i,6,,Scale,Input,3,Right,A3,A3,
794j,7,,Nominal,Input,3,Center,A3,A3,
795k,8,,Ordinal,Input,3,Center,A3,A3,
796l,9,,Scale,Input,9,Center,A9,A9,
797m,10,,Nominal,Input,10,Left,A10,A10,
798n,11,,Nominal,Input,17,Right,A17,A17,
799o,12,,Nominal,Input,25,Center,A25,A25,
800])
801done
802AT_CLEANUP
803
804AT_SETUP([variable display parameters, with width])
805AT_KEYWORDS([sack synthetic system file positive])
806AT_DATA([sys-file.sack], [dnl
807dnl File header.
808"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
8092; dnl Layout code
81019; dnl Nominal case size
8110; dnl Not compressed
8120; dnl Not weighted
8130; dnl No cases.
814100.0; dnl Bias.
815"01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
816i8 0 *3;
817
818dnl Numeric variables.
8192; 0; 0; 0; 0x050800 *2; s8 "A";
8202; 0; 0; 0; 0x050800 *2; s8 "B";
8212; 0; 0; 0; 0x050800 *2; s8 "C";
8222; 0; 0; 0; 0x050800 *2; s8 "D";
823
824dnl Short string variables.
8252; 3; 0; 0; 0x010300 *2; s8 "H";
8262; 3; 0; 0; 0x010300 *2; s8 "I";
8272; 3; 0; 0; 0x010300 *2; s8 "J";
8282; 3; 0; 0; 0x010300 *2; s8 "K";
829
830dnl Long string variables.
8312; 9; 0; 0; 0x010900 *2; s8 "L";
8322; -1; 0; 0; 0; 0; s8 "";
8332; 10; 0; 0; 0x010a00 *2; s8 "M";
8342; -1; 0; 0; 0; 0; s8 "";
8352; 17; 0; 0; 0x011100 *2; s8 "N";
836( 2; -1; 0; 0; 0; 0; s8 "" ) * 2;
8372; 25; 0; 0; 0x011900 *2; s8 "O";
838( 2; -1; 0; 0; 0; 0; s8 "" ) * 3;
839
840dnl Variable display parameters
8417; 11; 4; 36;
8421; 1; 0;
8432; 2; 0;
8443; 3; 0;
8451; 4; 1;
8462; 5; 1;
8473; 6; 1;
8481; 7; 2;
8492; 8; 2;
8503; 9; 2;
8510; 10; 0;
8520; 11; 1;
8530; 12; 2;
854
855dnl Character encoding record.
8567; 20; 1; 12; "windows-1252";
857
858dnl Dictionary termination record.
859999; 0;
860])
861for variant in be le; do
862  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
863  AT_DATA([sys-file.sps], [dnl
864GET FILE='sys-file.sav'.
865DISPLAY DICTIONARY.
866])
867  AT_CHECK([pspp -o pspp.csv sys-file.sps])
868  AT_CHECK([cat pspp.csv], [0], [dnl
869Table: Variables
870Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
871a,1,,Nominal,Input,1,Left,F8.0,F8.0,
872b,2,,Ordinal,Input,2,Left,F8.0,F8.0,
873c,3,,Scale,Input,3,Left,F8.0,F8.0,
874d,4,,Nominal,Input,4,Right,F8.0,F8.0,
875h,5,,Ordinal,Input,5,Right,A3,A3,
876i,6,,Scale,Input,6,Right,A3,A3,
877j,7,,Nominal,Input,7,Center,A3,A3,
878k,8,,Ordinal,Input,8,Center,A3,A3,
879l,9,,Scale,Input,9,Center,A9,A9,
880m,10,,Nominal,Input,10,Left,A10,A10,
881n,11,,Nominal,Input,11,Right,A17,A17,
882o,12,,Nominal,Input,12,Center,A25,A25,
883])
884done
885AT_CLEANUP
886
887AT_SETUP([long variable names])
888AT_KEYWORDS([sack synthetic system file positive])
889AT_DATA([sys-file.sack], [dnl
890dnl File header.
891"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
8922; dnl Layout code
8937; dnl Nominal case size
8940; dnl Not compressed
8950; dnl Not weighted
8960; dnl No cases.
897100.0; dnl Bias.
898"01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
899i8 0 *3;
900
901dnl Numeric variables.
9022; 0; 0; 0; 0x050800 *2; s8 "LONGVARI";
9032; 0; 0; 0; 0x050800 *2; s8 "LONGVA_A";
9042; 0; 0; 0; 0x050800 *2; s8 "LONGVA_B";
9052; 0; 0; 0; 0x050800 *2; s8 "LONGVA_C";
9062; 0; 0; 0; 0x050800 *2; "CO"; i8 214; "RDINA";
9072; 0; 0; 0; 0x050800 *2; "CO"; i8 214; "RDI_A";
9082; 0; 0; 0; 0x050800 *2; "CO"; i8 214; "RDI_B";
909
910dnl Machine integer info record.
9117; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1252;
912
913dnl Machine floating-point info record.
9147; 4; 8; 3; SYSMIS; HIGHEST; LOWEST;
915
916dnl Long variable names.
9177; 13; 1; COUNT (
918"LONGVARI=LongVariableName1"; i8 9;
919"LONGVA_A=LongVariableName2"; i8 9;
920"LONGVA_B=LongVariableName3"; i8 9;
921"LONGVA_C=LongVariableName4"; i8 9;
922"CO"; i8 214; "RDINA=Co"; i8 246; "rdinate_X"; i8 9;
923"CO"; i8 214; "RDI_A=Co"; i8 246; "rdinate_Y"; i8 9;
924"CO"; i8 214; "RDI_B=Co"; i8 246; "rdinate_Z";
925);
926
927dnl Character encoding record.
9287; 20; 1; 12; "windows-1252";
929
930dnl Dictionary termination record.
931999; 0;
932])
933for variant in be le; do
934  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
935  AT_DATA([sys-file.sps], [dnl
936GET FILE='sys-file.sav'.
937DISPLAY DICTIONARY.
938])
939  AT_CHECK([pspp -o pspp.csv sys-file.sps])
940  AT_CHECK([cat pspp.csv], [0], [dnl
941Table: Variables
942Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
943LongVariableName1,1,,Scale,Input,8,Right,F8.0,F8.0,
944LongVariableName2,2,,Scale,Input,8,Right,F8.0,F8.0,
945LongVariableName3,3,,Scale,Input,8,Right,F8.0,F8.0,
946LongVariableName4,4,,Scale,Input,8,Right,F8.0,F8.0,
947Coördinate_X,5,,Scale,Input,8,Right,F8.0,F8.0,
948Coördinate_Y,6,,Scale,Input,8,Right,F8.0,F8.0,
949Coördinate_Z,7,,Scale,Input,8,Right,F8.0,F8.0,
950])
951done
952AT_CLEANUP
953
954AT_SETUP([very long strings])
955AT_KEYWORDS([sack synthetic system file positive])
956AT_DATA([sys-file.sack], [dnl
957dnl File header.
958"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
9592; dnl Layout code
960109; dnl Nominal case size
9610; dnl Not compressed
9620; dnl Not weighted
9631; dnl No cases.
964100.0; dnl Bias.
965"01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
966i8 0 *3;
967
968dnl 256-byte string.
9692; 255; 0; 0; 0x01FF00 *2; "S"; i8 201; s6 "Q256";
970(2; -1; 0; 0; 0; 0; s8 "") * 31;
9712; 4; 0; 0; 0x010400 *2; "S"; i8 201; "Q256_1";
972
973dnl 600-byte string.
9742; 255; 0; 0; 0x01FF00 *2; s8 "STR600";
975(2; -1; 0; 0; 0; 0; s8 "") * 31;
9762; 255; 0; 0; 0x01FF00 *2; s8 "STR600_1";
977(2; -1; 0; 0; 0; 0; s8 "") * 31;
9782; 96; 0; 0; 0x016000 *2; s8 "STR600_2";
979(2; -1; 0; 0; 0; 0; s8 "") * 11;
980
981dnl Machine integer info record.
9827; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1252;
983
984dnl Very long string record.
9857; 14; 1; COUNT (
986"S"; i8 201; "Q256=00256"; i8 0; i8 9;
987"STR600=00600"; i8 0; i8 9;
988);
989
990dnl Character encoding record.
9917; 20; 1; 12; "windows-1252";
992
993dnl Dictionary termination record.
994999; 0;
995
996dnl Data.
997"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#" * 4;
998"abcdefgh";
999"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#" * 9;
1000"abcdefghijklmnopqrstuvwxyzABCDEF";
1001])
1002for variant in be le; do
1003  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1004  AT_DATA([sys-file.sps], [dnl
1005GET FILE='sys-file.sav'.
1006DISPLAY DICTIONARY.
1007LIST.
1008])
1009  AT_CHECK([pspp -o pspp.csv sys-file.sps])
1010  AT_CHECK([cat pspp.csv], [0], [dnl
1011Table: Variables
1012Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
1013séq256,1,,Nominal,Input,32,Left,A256,A256,
1014str600,2,,Nominal,Input,32,Left,A600,A600,
1015
1016Table: Data List
1017séq256,str600
1018abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@a,abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyz
1019])
1020done
1021AT_CLEANUP
1022
1023AT_SETUP([data file and variable attributes])
1024AT_KEYWORDS([sack synthetic system file positive])
1025AT_DATA([sys-file.sack], [dnl
1026dnl File header.
1027"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
10282; dnl Layout code
10293; dnl Nominal case size
10300; dnl Not compressed
10310; dnl Not weighted
10320; dnl 1 case.
1033100.0; dnl Bias.
1034"01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
1035i8 0 *3;
1036
1037dnl Variables.
10382; 0; 0; 0; 0x050800 *2; s8 "FIRSTVAR";
10392; 0; 0; 0; 0x050800 *2; s8 "SECONDVA";
10402; 0; 0; 0; 0x050800 *2; s8 "THIRDVAR";
1041
1042dnl Machine integer info record.
10437; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1252;
1044
1045dnl Long variable names.
10467; 13; 1; COUNT (
1047"FIRSTVAR=FirstVariable"; i8 9;
1048"SECONDVA=S"; i8 233; "condVariable"; i8 9;
1049"THIRDVAR=ThirdVariable"; i8 9
1050);
1051
1052dnl Data file attributes record.
10537; 17; 1; COUNT (
1054"Attr1('Value1'"; i8 10; "''d"; i8 233; "claration''"; i8 10; ")";
1055"S"; i8 233; "condAttr('123'"; i8 10; "'456'"; i8 10; ")";
1056);
1057
1058dnl Variable attributes record.
10597; 18; 1; COUNT (
1060"FirstVariable:";
1061  "ad"; i8 232; "le('23'"; i8 10; "'34'"; i8 10; ")";
1062  "bert('123'"; i8 10; ")";
1063  "$@Role('1'"; i8 10; ")";
1064"/S"; i8 233; "condVariable:";
1065  "xyzzy('quux'"; i8 10; ")";
1066);
1067
1068dnl Another variable attributes record.
1069dnl Only system files written by "Stata 14.1/-savespss- 1.77 by S.Radyakin"
1070dnl include multiple variable attributes records.
10717; 18; 1; COUNT ("ThirdVariable:fizz('buzz'"; i8 10; ")";);
1072
1073dnl Character encoding record.
10747; 20; 1; 12; "windows-1252";
1075
1076dnl Dictionary termination record.
1077999; 0;
1078])
1079for variant in be le; do
1080  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1081  AT_DATA([sys-file.sps], [dnl
1082GET FILE='sys-file.sav'.
1083DISPLAY @ATTRIBUTES.
1084])
1085  AT_CHECK([pspp -o pspp.csv sys-file.sps])
1086  AT_CHECK([cat pspp.csv], [0],
1087[[Table: Variable and Dataset Attributes
1088Variable and Name,,Value
1089(dataset),Attr1[1],Value1
1090,Attr1[2],'déclaration'
1091,SécondAttr[1],123
1092,SécondAttr[2],456
1093FirstVariable,$@Role,1
1094,adèle[1],23
1095,adèle[2],34
1096,bert,123
1097SécondVariable,xyzzy,quux
1098ThirdVariable,fizz,buzz
1099]])
1100  AT_DATA([sys-file.sps], [dnl
1101GET FILE='sys-file.sav'.
1102DISPLAY DICTIONARY.
1103])
1104  AT_CHECK([pspp -o pspp.csv sys-file.sps])
1105  AT_CHECK([cat pspp.csv], [0],
1106[[Table: Variables
1107Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
1108FirstVariable,1,,Scale,Output,8,Right,F8.0,F8.0,
1109SécondVariable,2,,Scale,Input,8,Right,F8.0,F8.0,
1110ThirdVariable,3,,Scale,Input,8,Right,F8.0,F8.0,
1111]])
1112done
1113AT_CLEANUP
1114
1115AT_SETUP([variable roles])
1116AT_KEYWORDS([sack synthetic system file positive])
1117AT_DATA([sys-file.sack], [dnl
1118dnl File header.
1119"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
11202; dnl Layout code
11217; dnl Nominal case size
11220; dnl Not compressed
11230; dnl Not weighted
11240; dnl 1 case.
1125100.0; dnl Bias.
1126"01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
1127i8 0 *3;
1128
1129dnl Variables.
11302; 0; 0; 0; 0x050800 *2; s8 "I";
11312; 0; 0; 0; 0x050800 *2; s8 "O";
11322; 0; 0; 0; 0x050800 *2; s8 "B";
11332; 0; 0; 0; 0x050800 *2; s8 "N";
11342; 0; 0; 0; 0x050800 *2; s8 "P";
11352; 0; 0; 0; 0x050800 *2; s8 "S";
11362; 0; 0; 0; 0x050800 *2; s8 "X";
1137
1138dnl Machine integer info record.
11397; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1252;
1140
1141dnl Variable attributes record.
11427; 18; 1; COUNT (
1143"I:$@Role('0'"; i8 10; ")";
1144"/O:$@Role('1'"; i8 10; ")";
1145"/B:$@Role('2'"; i8 10; ")";
1146"/N:$@Role('3'"; i8 10; ")";
1147"/P:$@Role('4'"; i8 10; ")";
1148"/S:$@Role('5'"; i8 10; ")";
1149"/X:$@Role('6'"; i8 10; ")";
1150);
1151
1152dnl Character encoding record.
11537; 20; 1; 12; "windows-1252";
1154
1155dnl Dictionary termination record.
1156999; 0;
1157])
1158for variant in be le; do
1159  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1160  AT_DATA([sys-file.sps], [dnl
1161GET FILE='sys-file.sav'.
1162DISPLAY DICTIONARY.
1163])
1164  AT_CHECK([pspp -o pspp.csv sys-file.sps], [0], [dnl
1165warning: `sys-file.sav': Invalid role for variable x.
1166])
1167  AT_CHECK([cat pspp.csv], [0], [dnl
1168warning: `sys-file.sav': Invalid role for variable x.
1169
1170Table: Variables
1171Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
1172i,1,,Scale,Input,8,Right,F8.0,F8.0,
1173o,2,,Scale,Output,8,Right,F8.0,F8.0,
1174b,3,,Scale,Both,8,Right,F8.0,F8.0,
1175n,4,,Scale,None,8,Right,F8.0,F8.0,
1176p,5,,Scale,Partition,8,Right,F8.0,F8.0,
1177s,6,,Scale,Split,8,Right,F8.0,F8.0,
1178x,7,,Scale,Input,8,Right,F8.0,F8.0,
1179])
1180done
1181AT_CLEANUP
1182
1183AT_SETUP([compressed data])
1184AT_KEYWORDS([sack synthetic system file positive])
1185AT_DATA([sys-file.sack], [dnl
1186dnl File header.
1187"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
11882; dnl Layout code
11896; dnl Nominal case size
11901; dnl Simple compression
11910; dnl Not weighted
1192-1; dnl Unspecified number of cases.
1193100.0; dnl Bias.
1194"01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
1195i8 0 *3;
1196
1197dnl Numeric variables.
11982; 0; 0; 0; 0x050800 *2; s8 "NUM1";
11992; 0; 0; 0; 0x050800 *2; s8 "NUM2";
1200
1201dnl String variable.
12022; 4; 0; 0; 0x010400 *2; s8 "STR4";
12032; 8; 0; 0; 0x010800 *2; s8 "STR8";
12042; 15; 0; 0; 0x010f00 *2; s8 "STR15";
12052; -1; 0; 0; 0; 0; s8 "";
1206
1207dnl Character encoding record.
12087; 20; 1; 12; "windows-1252";
1209
1210dnl Dictionary termination record.
1211999; 0;
1212
1213dnl Compressed data.
1214i8 1 100 254 253 254 253; i8 255 251; "abcdefgh"; s8 "0123";
1215i8 253 253 253 254; i8 101 102 253 253; s8 "jklm"; s8 "nopqrstu";
1216s8 "vwxyzABC"; s8 "DEFG"; s8 "HIJKLMNO";
1217i8 254 253 252 0 0 0 0 0; s8 "PQRSTUVW";
1218
1219])
1220for variant in be le; do
1221  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1222  AT_DATA([sys-file.sps], [dnl
1223GET FILE='sys-file.sav'.
1224DISPLAY DICTIONARY.
1225LIST.
1226])
1227  AT_CHECK([pspp -o pspp.csv sys-file.sps])
1228  AT_CHECK([cat pspp.csv], [0], [dnl
1229Table: Variables
1230Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
1231num1,1,,Scale,Input,8,Right,F8.0,F8.0,
1232num2,2,,Scale,Input,8,Right,F8.0,F8.0,
1233str4,3,,Nominal,Input,4,Left,A4,A4,
1234str8,4,,Nominal,Input,8,Left,A8,A8,
1235str15,5,,Nominal,Input,15,Left,A15,A15,
1236
1237Table: Data List
1238num1,num2,str4,str8,str15
1239-99,0,,abcdefgh,0123
1240.,151,jklm,nopqrstu,vwxyzABC
12411,2,DEFG,HIJKLMNO,PQRSTUV
1242])
1243done
1244AT_CLEANUP
1245
1246AT_SETUP([compressed data, zero bias])
1247AT_KEYWORDS([sack synthetic system file positive])
1248AT_DATA([sys-file.sack], [dnl
1249dnl File header.
1250"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
12512; dnl Layout code
12526; dnl Nominal case size
12531; dnl Simple compression.
12540; dnl Not weighted
1255-1; dnl Unspecified number of cases.
12560.0; dnl Bias.
1257"01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
1258i8 0 *3;
1259
1260dnl Numeric variables.
12612; 0; 0; 0; 0x050800 *2; s8 "NUM1";
12622; 0; 0; 0; 0x050800 *2; s8 "NUM2";
1263
1264dnl String variable.
12652; 4; 0; 0; 0x010400 *2; s8 "STR4";
12662; 8; 0; 0; 0x010800 *2; s8 "STR8";
12672; 15; 0; 0; 0x010f00 *2; s8 "STR15";
12682; -1; 0; 0; 0; 0; s8 "";
1269
1270dnl Character encoding record.
12717; 20; 1; 12; "windows-1252";
1272
1273dnl Dictionary termination record.
1274999; 0;
1275
1276dnl Compressed data.
1277i8 1 100 254 253 254 253; i8 255 251; "abcdefgh"; s8 "0123";
1278i8 253 253 253 254; i8 101 102 253 253; s8 "jklm"; s8 "nopqrstu";
1279s8 "vwxyzABC"; s8 "DEFG"; s8 "HIJKLMNO";
1280i8 254 253 252 0 0 0 0 0; s8 "PQRSTUVW";
1281
1282])
1283for variant in be le; do
1284  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1285  AT_DATA([sys-file.sps], [dnl
1286GET FILE='sys-file.sav'.
1287DISPLAY DICTIONARY.
1288LIST.
1289])
1290  AT_CHECK([pspp -o pspp.csv sys-file.sps], [0])
1291  AT_CHECK([cat pspp.csv], [0], [dnl
1292Table: Variables
1293Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
1294num1,1,,Scale,Input,8,Right,F8.0,F8.0,
1295num2,2,,Scale,Input,8,Right,F8.0,F8.0,
1296str4,3,,Nominal,Input,4,Left,A4,A4,
1297str8,4,,Nominal,Input,8,Left,A8,A8,
1298str15,5,,Nominal,Input,15,Left,A15,A15,
1299
1300Table: Data List
1301num1,num2,str4,str8,str15
13021,100,,abcdefgh,0123
1303.,251,jklm,nopqrstu,vwxyzABC
1304101,102,DEFG,HIJKLMNO,PQRSTUV
1305])
1306done
1307AT_CLEANUP
1308
1309AT_SETUP([compressed data, other bias])
1310AT_KEYWORDS([sack synthetic system file positive])
1311AT_DATA([sys-file.sack], [dnl
1312dnl File header.
1313"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
13142; dnl Layout code
13156; dnl Nominal case size
13161; dnl Simple compression.
13170; dnl Not weighted
1318-1; dnl Unspecified number of cases.
131950.0; dnl Bias.
1320"01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
1321i8 0 *3;
1322
1323dnl Numeric variables.
13242; 0; 0; 0; 0x050800 *2; s8 "NUM1";
13252; 0; 0; 0; 0x050800 *2; s8 "NUM2";
1326
1327dnl String variable.
13282; 4; 0; 0; 0x010400 *2; s8 "STR4";
13292; 8; 0; 0; 0x010800 *2; s8 "STR8";
13302; 15; 0; 0; 0x010f00 *2; s8 "STR15";
13312; -1; 0; 0; 0; 0; s8 "";
1332
1333dnl Character encoding record.
13347; 20; 1; 12; "windows-1252";
1335
1336dnl Dictionary termination record.
1337999; 0;
1338
1339dnl Compressed data.
1340i8 1 100 254 253 254 253; i8 255 251; "abcdefgh"; s8 "0123";
1341i8 253 253 253 254; i8 101 102 253 253; s8 "jklm"; s8 "nopqrstu";
1342s8 "vwxyzABC"; s8 "DEFG"; s8 "HIJKLMNO";
1343i8 254 253 252 0 0 0 0 0; s8 "PQRSTUVW";
1344
1345])
1346for variant in be le; do
1347  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1348  AT_DATA([sys-file.sps], [dnl
1349GET FILE='sys-file.sav'.
1350DISPLAY DICTIONARY.
1351LIST.
1352])
1353  AT_CHECK([pspp -o pspp.csv sys-file.sps], [0],
1354    [warning: `sys-file.sav' near offset 0x54: Compression bias is not the usual value of 100, or system file uses unrecognized floating-point format.
1355])
1356  AT_CHECK([cat pspp.csv], [0], [dnl
1357"warning: `sys-file.sav' near offset 0x54: Compression bias is not the usual value of 100, or system file uses unrecognized floating-point format."
1358
1359Table: Variables
1360Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
1361num1,1,,Scale,Input,8,Right,F8.0,F8.0,
1362num2,2,,Scale,Input,8,Right,F8.0,F8.0,
1363str4,3,,Nominal,Input,4,Left,A4,A4,
1364str8,4,,Nominal,Input,8,Left,A8,A8,
1365str15,5,,Nominal,Input,15,Left,A15,A15,
1366
1367Table: Data List
1368num1,num2,str4,str8,str15
1369-49,50,,abcdefgh,0123
1370.,201,jklm,nopqrstu,vwxyzABC
137151,52,DEFG,HIJKLMNO,PQRSTUV
1372])
1373done
1374AT_CLEANUP
1375
1376m4_divert_push([PREPARE_TESTS])
1377zcompressed_sack () {
1378    cat <<'EOF'
1379dnl File header.
1380"$FL3"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
13812; dnl Layout code
13826; dnl Nominal case size
13832; dnl zlib compressed
13840; dnl Not weighted
1385-1; dnl Unspecified number of cases.
1386100.0; dnl Bias.
1387"01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
1388i8 0 *3;
1389
1390dnl Numeric variables.
13912; 0; 0; 0; 0x050800 *2; s8 "NUM1";
13922; 0; 0; 0; 0x050800 *2; s8 "NUM2";
1393
1394dnl String variable.
13952; 4; 0; 0; 0x010400 *2; s8 "STR4";
13962; 8; 0; 0; 0x010800 *2; s8 "STR8";
13972; 15; 0; 0; 0x010f00 *2; s8 "STR15";
13982; -1; 0; 0; 0; 0; s8 "";
1399
1400dnl Character encoding record.
14017; 20; 1; 12; "windows-1252";
1402
1403dnl Dictionary termination record.
1404999; 0;
1405
1406dnl ZLIB data header.
1407i64 0x194;    # zheader_ofs
1408i64 0x205;    # ztrailer_ofs
1409i64 48;       # ztrailer_len
1410
1411dnl ZLIB data block.
1412dnl
1413dnl This is the compressed form of:
1414dnl
1415dnl 01 64 fe fd fe fd ff fb  61 62 63 64 65 66 67 68  |.d......abcdefgh|
1416dnl 30 31 32 33 20 20 20 20  fd fd fd fe 65 66 fd fd  |0123    ....ef..|
1417dnl 6a 6b 6c 6d 20 20 20 20  6e 6f 70 71 72 73 74 75  |jklm    nopqrstu|
1418dnl 76 77 78 79 7a 41 42 43  44 45 46 47 20 20 20 20  |vwxyzABCDEFG    |
1419dnl 48 49 4a 4b 4c 4d 4e 4f  fe fd fc 00 00 00 00 00  |HIJKLMNO........|
1420dnl 50 51 52 53 54 55 56 57                           |PQRSTUVW|
1421dnl
1422dnl which is the data from the "compressed data" test.
1423hex "78 01 63 4c f9 f7 f7 df  df ff bf 13 93 92 53 52";
1424hex "d3 d2 33 0c 0c 8d 8c 15  80 e0 ef df bf ff 52 d3";
1425hex "fe fe cd ca ce c9 05 f1  f3 f2 0b 0a 8b 8a 4b 4a";
1426hex "cb ca 2b 2a ab 1c 9d 9c  5d 5c dd dc 41 e2 1e 9e";
1427hex "5e de 3e be 7e fe ff fe  fe 61 00 81 80 c0 a0 e0";
1428hex "90 d0 b0 70 00 0f 3f 23  d7";
1429
1430dnl ZLIB data trailer fixed header:
1431i64 -100;     # ztrailer_bias
1432i64 0;        # ztrailer_zero
14330x3ff000;     # block_size
14341;            # n_blocks
1435
1436dnl ZLIB block descriptor:
1437i64 0x194;    # uncompressed_ofs
1438i64 0x1ac;    # compressed_ofs
143988;           # uncompressed_size
144089;           # compressed_size
1441EOF
1442}
1443m4_divert_pop([PREPARE_TESTS])
1444
1445AT_SETUP([zcompressed data])
1446AT_KEYWORDS([sack synthetic system file positive zlib])
1447zcompressed_sack > sys-file.sack
1448for variant in be le; do
1449  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1450  AT_DATA([sys-file.sps], [dnl
1451GET FILE='sys-file.sav'.
1452DISPLAY DICTIONARY.
1453LIST.
1454])
1455  AT_CHECK([pspp -o pspp.csv sys-file.sps])
1456  AT_CHECK([cat pspp.csv], [0], [dnl
1457Table: Variables
1458Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
1459num1,1,,Scale,Input,8,Right,F8.0,F8.0,
1460num2,2,,Scale,Input,8,Right,F8.0,F8.0,
1461str4,3,,Nominal,Input,4,Left,A4,A4,
1462str8,4,,Nominal,Input,8,Left,A8,A8,
1463str15,5,,Nominal,Input,15,Left,A15,A15,
1464
1465Table: Data List
1466num1,num2,str4,str8,str15
1467-99,0,,abcdefgh,0123
1468.,151,jklm,nopqrstu,vwxyzABC
14691,2,DEFG,HIJKLMNO,PQRSTUV
1470])
1471done
1472AT_CLEANUP
1473
1474AT_BANNER([system file reader - negative])
1475
1476AT_SETUP([no variables])
1477AT_KEYWORDS([sack synthetic system file negative])
1478AT_DATA([sys-file.sack], [dnl
1479dnl File header.
1480"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
14812; dnl Layout code
14820; dnl Nominal case size (empty)
14830; dnl Not compressed
14840; dnl Not weighted
14850; dnl 0 cases.
1486100.0; dnl Bias.
1487"01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
1488i8 0 *3;
1489
1490dnl Character encoding record.
14917; 20; 1; 12; "windows-1252";
1492
1493dnl Dictionary termination record.
1494999; 0;
1495])
1496for variant in be le; do
1497  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1498  AT_DATA([sys-file.sps], [dnl
1499GET FILE='sys-file.sav'.
1500])
1501  AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
1502sys-file.sps:1: error: GET: `sys-file.sav': Data file dictionary has no variables.
1503])
1504
1505  dnl At one point pspp-convert would hang forever if there were no variables,
1506  dnl so check against regression.
1507  AT_CHECK([pspp-convert sys-file.sav sys-file.txt])
1508  AT_CHECK([cat sys-file.txt], [0], [
1509])
1510done
1511AT_CLEANUP
1512
1513AT_SETUP([unspecified character encoding])
1514AT_KEYWORDS([sack synthetic system file positive])
1515AT_DATA([sys-file.sack], [dnl
1516dnl File header.
1517"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
15182; dnl Layout code
15194; dnl Nominal case size
15200; dnl Not compressed
15210; dnl Not weighted
15220; dnl No cases.
1523100.0; dnl Bias.
1524"01 Jan 11"; "20:53:52";
1525"PSPP synthetic test file: "; i8 244; i8 245; i8 246; i8 248; s34 "";
1526i8 0 *3;
1527
1528dnl Numeric variables.
15292; 0; 0; 0; 0x050800 *2; s8 "A";
15302; 0; 0; 0; 0x050800 *2; s8 "B";
15312; 0; 0; 0; 0x050800 *2; s8 "C";
15322; 0; 0; 0; 0x050800 *2; s8 "D";
1533
1534dnl Dictionary termination record.
1535999; 0;
1536])
1537for variant in be le; do
1538  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1539  AT_DATA([sys-file.sps], [dnl
1540GET 'sys-file.sav'.
1541])
1542  AT_CHECK([pspp -O format=csv sys-file.sps], [0], [stdout])
1543  AT_CHECK([sed 's/default encoding.*For/default encoding.  For/' stdout], [0], [dnl
1544"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."
1545])
1546done
1547AT_CLEANUP
1548
1549AT_SETUP([misplaced type 4 record])
1550AT_KEYWORDS([sack synthetic system file negative])
1551AT_DATA([sys-file.sack], [dnl
1552dnl File header.
1553"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
15542; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1555
1556dnl Numeric variable.
15572; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1558
1559dnl Type 4 record.
1560>>4<<;
1561])
1562for variant in be le; do
1563  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1564  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1565])
1566  AT_CHECK([pspp -O format=csv sys-file.sps], [1],
1567   [error: `sys-file.sav' near offset 0xd4: Misplaced type 4 record.
1568])
1569done
1570AT_CLEANUP
1571
1572AT_SETUP([bad record type])
1573AT_KEYWORDS([sack synthetic system file negative])
1574AT_DATA([sys-file.sack], [dnl
1575dnl File header.
1576"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
15772; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1578
1579dnl Numeric variable.
15802; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1581
1582dnl Type 8 record (not a valid type).
1583>>8<<;
1584])
1585for variant in be le; do
1586  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1587  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1588])
1589  AT_CHECK([pspp -O format=csv sys-file.sps], [1],
1590   [error: `sys-file.sav' near offset 0xd4: Unrecognized record type 8.
1591])
1592done
1593AT_CLEANUP
1594
1595AT_SETUP([wrong number of variable positions])
1596AT_KEYWORDS([sack synthetic system file negative])
1597AT_DATA([sys-file.sack], [dnl
1598dnl File header.
1599"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
16002; >>2<<; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1601
1602dnl Numeric variable.
16032; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1604
1605dnl Character encoding record.
16067; 20; 1; 12; "windows-1252";
1607
1608dnl End of dictionary.
1609999; 0;
1610])
1611for variant in be le; do
1612  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1613  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1614])
1615  AT_CHECK([pspp -O format=csv sys-file.sps], [0],
1616   [warning: `sys-file.sav': File header claims 2 variable positions but 1 were read from file.
1617])
1618done
1619AT_CLEANUP
1620
1621AT_SETUP([variable name may not begin with `#'])
1622AT_KEYWORDS([sack synthetic system file negative])
1623AT_DATA([sys-file.sack], [dnl
1624dnl File header.
1625"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
16262; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1627
1628dnl Numeric variable.
16292; 0; 0; 0; 0x050800 *2; s8 >>"$UM1"<<;
1630
1631dnl Character encoding record.
16327; 20; 1; 12; "windows-1252";
1633
1634dnl End of dictionary.
1635999; 0;
1636])
1637for variant in be le; do
1638  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1639  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1640])
1641  AT_CHECK([pspp -O format=csv sys-file.sps], 0,
1642   [warning: `sys-file.sav' near offset 0xb4: Renaming variable with invalid name `$UM1' to `VAR001'.
1643])
1644done
1645AT_CLEANUP
1646
1647AT_SETUP([variable name may not be reserved word])
1648AT_KEYWORDS([sack synthetic system file negative])
1649AT_DATA([sys-file.sack], [dnl
1650dnl File header.
1651"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
16522; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1653
1654dnl Numeric variable.
16552; 0; 0; 0; 0x050800 *2; s8 >>"TO"<<;
1656
1657dnl Character encoding record.
16587; 20; 1; 12; "windows-1252";
1659
1660dnl End of dictionary.
1661999; 0;
1662])
1663for variant in be le; do
1664  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1665  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1666])
1667  AT_CHECK([pspp -O format=csv sys-file.sps], 0,
1668   [warning: `sys-file.sav' near offset 0xb4: Renaming variable with invalid name `TO' to `VAR001'.
1669])
1670done
1671AT_CLEANUP
1672
1673AT_SETUP([variable width must be between 0 and 255])
1674AT_KEYWORDS([sack synthetic system file negative])
1675AT_DATA([sys-file.sack], [dnl
1676dnl File header.
1677"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
16782; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1679
1680dnl String variable with invalid width 256.
16812; 256; 0; 0; 0x050800 *2; s8 "VAR1";
1682
1683dnl Character encoding record.
16847; 20; 1; 12; "windows-1252";
1685
1686dnl End of dictionary.
1687999; 0;
1688])
1689for variant in be le; do
1690  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1691  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1692])
1693  AT_CHECK([pspp -O format=csv sys-file.sps], [1],
1694   [error: `sys-file.sav' near offset 0xb4: Bad width 256 for variable VAR1.
1695])
1696done
1697AT_CLEANUP
1698
1699dnl SPSS-generated system file can contain duplicate variable names
1700dnl (see bug #41475).
1701AT_SETUP([duplicate variable name])
1702AT_KEYWORDS([sack synthetic system file negative])
1703AT_DATA([sys-file.sack], [dnl
1704dnl File header.
1705"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
17062; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1707
1708dnl Numeric variables.
17092; 0; 0; 0; 0x050800 *2; s8 "VAR1";
17102; 0; 0; 0; 0x050800 *2; s8 "VAR1";
1711
1712dnl Character encoding record.
17137; 20; 1; 12; "windows-1252";
1714
1715dnl End of dictionary.
1716999; 0;
1717])
1718for variant in be le; do
1719  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1720  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1721DISPLAY DICTIONARY.
1722])
1723  AT_CHECK([pspp -O format=csv sys-file.sps], [0],
1724   [warning: `sys-file.sav' near offset 0xd4: Renaming variable with duplicate name `VAR1' to `VAR001'.
1725
1726Table: Variables
1727Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
1728var1,1,,Scale,Input,8,Right,F8.0,F8.0,
1729var001,2,,Scale,Input,8,Right,F8.0,F8.0,
1730])
1731done
1732AT_CLEANUP
1733
1734AT_SETUP([variable label indicator not 0 or 1])
1735AT_KEYWORDS([sack synthetic system file negative])
1736AT_DATA([sys-file.sack], [dnl
1737dnl File header.
1738"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
17392; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1740
1741dnl Numeric variable.
17422; 0; >>2<<; 0; 0x050800 *2; s8 "VAR1";
1743
1744dnl Character encoding record.
17457; 20; 1; 12; "windows-1252";
1746
1747dnl End of dictionary.
1748999; 0;
1749])
1750for variant in be le; do
1751  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1752  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1753])
1754  AT_CHECK([pspp -O format=csv sys-file.sps], [1],
1755   [error: `sys-file.sav' near offset 0xb4: Variable label indicator field is not 0 or 1.
1756])
1757done
1758AT_CLEANUP
1759
1760AT_SETUP([invalid numeric missing value indicator])
1761AT_KEYWORDS([sack synthetic system file negative])
1762AT_DATA([sys-file.sack], [dnl
1763dnl File header.
1764"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
17652; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1766
1767dnl Numeric variable.
17682; 0; 0; >>-1<<; 0x050800 *2; s8 "VAR1";
1769
1770dnl Character encoding record.
17717; 20; 1; 12; "windows-1252";
1772
1773dnl End of dictionary.
1774999; 0;
1775])
1776for variant in be le; do
1777  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1778  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1779])
1780  AT_CHECK([pspp -O format=csv sys-file.sps], [1],
1781   ["error: `sys-file.sav' near offset 0xb4: Numeric missing value indicator field is not -3, -2, 0, 1, 2, or 3."
1782])
1783done
1784AT_CLEANUP
1785
1786AT_SETUP([invalid string missing value indicator])
1787AT_KEYWORDS([sack synthetic system file negative])
1788AT_DATA([sys-file.sack], [dnl
1789dnl File header.
1790"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
17912; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1792
1793dnl String variable.
17942; 8; 0; >>4<<; 0x010800 *2; s8 "VAR1";
1795
1796dnl Character encoding record.
17977; 20; 1; 12; "windows-1252";
1798
1799dnl End of dictionary.
1800999; 0;
1801])
1802for variant in be le; do
1803  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1804  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1805])
1806  AT_CHECK([pspp -O format=csv sys-file.sps], [1],
1807   ["error: `sys-file.sav' near offset 0xb4: String missing value indicator field is not 0, 1, 2, or 3."
1808])
1809done
1810AT_CLEANUP
1811
1812AT_SETUP([missing string continuation record])
1813AT_KEYWORDS([sack synthetic system file negative])
1814AT_DATA([sys-file.sack], [dnl
1815dnl File header.
1816"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
18172; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1818
1819dnl String variable.
18202; 10; 0; 0; 0x010a00 *2; s8 "VAR1";
1821>>2; 0; 0; 0; 0x050800 *2; s8 "VAR2";<<
1822
1823dnl Character encoding record.
18247; 20; 1; 12; "windows-1252";
1825
1826dnl End of dictionary.
1827999; 0;
1828])
1829for variant in be le; do
1830  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1831  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1832])
1833  AT_CHECK([pspp -O format=csv sys-file.sps], [1],
1834   [error: `sys-file.sav' near offset 0xb4: Missing string continuation record.
1835])
1836done
1837AT_CLEANUP
1838
1839AT_SETUP([invalid variable format])
1840AT_KEYWORDS([sack synthetic system file negative])
1841AT_DATA([sys-file.sack], [dnl
1842dnl File header.
1843"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
18442; 4; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1845
1846dnl Numeric variable, invalid format types.
1847dnl No warning is issued for type 0 because it has been observed in real
1848dnl system files.
18492; 0; 0; 0; >>0xff0800; 0<<; s8 "NUM1";
1850
1851dnl Numeric variable, string formats.
18522; 0; 0; 0; >>0x010800<<; >>0x021000<<; s8 "VAR1";
1853
1854dnl String variable, numeric formats.
18552; 4; 0; 0; >>0x050800<<; >>0x110a01<<; s8 "STR1";
1856
1857dnl String variable, wrong width formats.
18582; 4; 0; 0; >>0x010800<<; >>0x020400<<; s8 "STR2";
1859
1860dnl Character encoding record.
18617; 20; 1; 12; "windows-1252";
1862
1863dnl End of dictionary.
1864999; 0;
1865])
1866for variant in be le; do
1867  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1868  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1869])
1870  AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
1871warning: `sys-file.sav' near offset 0xc0: Variable NUM1 with width 0 has invalid print format 0xff0800.
1872
1873warning: `sys-file.sav' near offset 0xe0: Variable VAR1 with width 0 has invalid print format 0x10800.
1874
1875warning: `sys-file.sav' near offset 0xe4: Variable VAR1 with width 0 has invalid write format 0x21000.
1876
1877warning: `sys-file.sav' near offset 0x100: Variable STR1 with width 4 has invalid print format 0x50800.
1878
1879warning: `sys-file.sav' near offset 0x104: Variable STR1 with width 4 has invalid write format 0x110a01.
1880
1881warning: `sys-file.sav' near offset 0x120: Variable STR2 with width 4 has invalid print format 0x10800.
1882
1883warning: `sys-file.sav' near offset 0x124: Variable STR2 with width 4 has invalid write format 0x20400.
1884])
1885done
1886AT_CLEANUP
1887
1888AT_SETUP([invalid long string missing values])
1889AT_KEYWORDS([sack synthetic system file negative])
1890AT_DATA([sys-file.sack], [dnl
1891dnl File header.
1892"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
18932; dnl Layout code
18947; dnl Nominal case size
18950; dnl Not compressed
18960; dnl Not weighted
18971; dnl 1 case.
1898100.0; dnl Bias.
1899"01 Jan 11"; "20:53:52";
1900"PSPP synthetic test file: "; i8 244; i8 245; i8 246; i8 248; s34 "";
1901i8 0 *3;
1902
1903dnl One numeric variable.
19042; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1905
1906dnl Long string variables that will have missing values added with a
1907dnl later record.
19082; 9; 0; 0; 0x010900 *2; s8 "STR1";
19092; -1; 0; 0; 0; 0; s8 "";
19102; 10; 0; 0; 0x010a00 *2; s8 "STR2";
19112; -1; 0; 0; 0; 0; s8 "";
19122; 11; 0; 0; 0x010b00 *2; s8 "STR3";
19132; -1; 0; 0; 0; 0; s8 "";
1914
1915dnl Machine integer info record.
19167; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1252;
1917
1918dnl Machine floating-point info record.
19197; 4; 8; 3; SYSMIS; HIGHEST; LOWEST;
1920
1921dnl Long string variable missing values record.
19227; 22; 1; COUNT (
1923dnl Zero missing values (not allowed) for STR1 .
1924COUNT("STR1"); i8 >>0<<;
1925
1926dnl Four missing values (not allowed) for STR2.
1927COUNT("STR2"); i8 4;
19288; "abcdefgh"; 8; "ijklmnop"; 8; "qrstuvwx"; 8; "yz012345";
1929
1930dnl Missing values for unknown variable
1931COUNT(>>"Nonexistent"<<); i8 1; 8; "abcdefgh";
1932
1933dnl Missing values for numeric variable
1934COUNT(>>"NUM1"<<); i8 1; 8; "abcdefgh";
1935
1936dnl Too long missing value
1937COUNT("STR3"); i8 1; >>COUNT("abcdefghijkl")<<;
1938);
1939
1940dnl Character encoding record.
19417; 20; 1; 12; "windows-1252";
1942
1943dnl Dictionary termination record.
1944999; 0;
1945s8 "abcd"; s8 "efgh"; s8 "ijkl"; s8 "mnop"; s8 "qrst"; s8 "uvwx";
1946s16 "yzABCDEFGHI"; s16 "JKLMNOPQR"; s16 "STUVWXYZ01";
1947s16 "23456789abc"; s32 "defghijklmnopqstuvwxyzABC";
1948])
1949
1950for variant in be le; do
1951  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1952  AT_DATA([sys-file.sps], [dnl
1953GET FILE='sys-file.sav'.
1954DISPLAY DICTIONARY.
1955])
1956  AT_CHECK([pspp -O format=csv sys-file.sps], [0],
1957   ["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."
1958
1959"warning: `sys-file.sav' near offset 0x201: Long string missing values record says variable STR2 has 4 missing values, but only 1 to 3 missing values are allowed."
1960
1961warning: `sys-file.sav' near offset 0x242: Ignoring long string missing value record for unknown variable Nonexistent.
1962
1963warning: `sys-file.sav' near offset 0x257: Ignoring long string missing value record for numeric variable NUM1.
1964
1965"warning: `sys-file.sav' near offset 0x270: Ignoring long string missing value 0 for variable str3, with width 11, that has bad value width 12."
1966
1967Table: Variables
1968Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
1969num1,1,,Scale,Input,8,Right,F8.0,F8.0,
1970str1,2,,Nominal,Input,9,Left,A9,A9,
1971str2,3,,Nominal,Input,10,Left,A10,A10,"""abcdefgh""; ""ijklmnop""; ""qrstuvwx"""
1972str3,4,,Nominal,Input,11,Left,A11,A11,
1973])
1974done
1975AT_CLEANUP
1976
1977AT_SETUP([weighting variable must be numeric])
1978AT_KEYWORDS([sack synthetic system file negative])
1979AT_DATA([sys-file.sack], [dnl
1980dnl File header.
1981"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
19822; 2; 1; >>2<<; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
1983
1984dnl Numeric variable.
19852; 0; 0; 0; 0x050800 *2; s8 "NUM1";
1986
1987dnl String variable.
19882; 4; 0; 0; 0x010400 *2; s8 "STR1";
1989
1990dnl Character encoding record.
19917; 20; 1; 12; "windows-1252";
1992
1993dnl End of dictionary.
1994999; 0;
1995])
1996for variant in be le; do
1997  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
1998  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
1999DISPLAY DICTIONARY.
2000])
2001  AT_CHECK([pspp -O format=csv sys-file.sps], [0],
2002   [warning: `sys-file.sav' near offset 0x4c: Ignoring string variable `STR1' set as weighting variable.
2003
2004Table: Variables
2005Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
2006num1,1,,Scale,Input,8,Right,F8.0,F8.0,
2007str1,2,,Nominal,Input,4,Left,A4,A4,
2008])
2009done
2010AT_CLEANUP
2011
2012AT_SETUP([bad weighting variable index])
2013AT_KEYWORDS([sack synthetic system file negative])
2014AT_DATA([sys-file.sack], [dnl
2015dnl File header.
2016"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
20172; 2; 1; >>3<<; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2018
2019dnl Numeric variable.
20202; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2021
2022dnl String variable.
20232; 4; 0; 0; 0x010400 *2; s8 "STR1";
2024
2025dnl Character encoding record.
20267; 20; 1; 12; "windows-1252";
2027
2028dnl End of dictionary.
2029999; 0;
2030])
2031for variant in be le; do
2032  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2033  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2034])
2035  AT_CHECK([pspp -O format=csv sys-file.sps], 0,
2036   [warning: `sys-file.sav' near offset 0x4c: Weight variable index 3 not in valid range 1...2.  Treating file as unweighted.
2037])
2038done
2039AT_CLEANUP
2040
2041AT_SETUP([variable index is long string continuation])
2042AT_KEYWORDS([sack synthetic system file negative])
2043AT_DATA([sys-file.sack], [dnl
2044dnl File header.
2045"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
20462; 3; 1; >>3<<; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2047
2048dnl Numeric variable.
20492; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2050
2051dnl Long string variable.
20522; 9; 0; 0; 0x010900 *2; s8 "STR1";
2053(2; -1; 0; 0; 0; 0; s8 "");
2054
2055dnl Character encoding record.
20567; 20; 1; 12; "windows-1252";
2057
2058dnl End of dictionary.
2059999; 0;
2060])
2061for variant in be le; do
2062  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2063  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2064])
2065  AT_CHECK([pspp -O format=csv sys-file.sps], 0,
2066   [warning: `sys-file.sav' near offset 0x4c: Weight variable index 3 refers to long string continuation.  Treating file as unweighted.
2067])
2068done
2069AT_CLEANUP
2070
2071AT_SETUP([multiple documents records])
2072AT_KEYWORDS([sack synthetic system file negative])
2073AT_DATA([sys-file.sack], [dnl
2074dnl File header.
2075"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
20762; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2077
2078dnl Numeric variables, no label or missing values.
20792; 0; 0; 0; 0x050800 *2; s8 "NUM1";
20802; 0; 0; 0; 0x050800 *2; s8 "NUM2";
2081
2082dnl Two document records.
2083(6; 1; s80 "One line of documents") >>* 2<<;
2084
2085dnl Character encoding record.
20867; 20; 1; 12; "windows-1252";
2087
2088dnl Dictionary termination record.
2089999; 0;
2090
2091dnl Data.
20921.0;
2093])
2094for variant in be le; do
2095  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2096  AT_DATA([sys-file.sps], [dnl
2097GET FILE='sys-file.sav'.
2098])
2099  AT_CHECK([pspp -O format=csv sys-file.sps], 0, [dnl
2100warning: `sys-file.sav' near offset 0x14c: Duplicate type 6 (document) record.
2101])
2102done
2103AT_CLEANUP
2104
2105
2106AT_SETUP([extension record too large])
2107AT_KEYWORDS([sack synthetic system file negative])
2108AT_DATA([sys-file.sack], [dnl
2109dnl File header.
2110"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
21112; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2112
2113dnl Numeric variable, no label or missing values.
21142; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2115
2116dnl Too-large extension record.
21177; 3; >>0xfffff000 * 2<<;
2118])
2119for variant in be le; do
2120  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2121  AT_DATA([sys-file.sps], [dnl
2122GET FILE='sys-file.sav'.
2123])
2124  AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
2125error: `sys-file.sav' near offset 0xd8: Record type 7 subtype 3 too large.
2126])
2127done
2128AT_CLEANUP
2129
2130AT_SETUP([unknown extension record])
2131AT_KEYWORDS([sack synthetic system file negative])
2132AT_DATA([sys-file.sack], [dnl
2133dnl File header.
2134"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
21352; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2136
2137dnl Numeric variable, no label or missing values.
21382; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2139
2140dnl Unknown extension record type.
21417; 30; 1; 1; i8 0;
2142
2143dnl Character encoding record.
21447; 20; 1; 12; "windows-1252";
2145
2146dnl End of dictionary.
2147999; 0;
2148])
2149for variant in be le; do
2150  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2151  AT_DATA([sys-file.sps], [dnl
2152GET FILE='sys-file.sav'.
2153])
2154  AT_CHECK_UNQUOTED([pspp -O format=csv sys-file.sps], [0], [dnl
2155"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}."
2156])
2157done
2158AT_CLEANUP
2159
2160AT_SETUP([bad machine integer info size])
2161AT_KEYWORDS([sack synthetic system file negative])
2162AT_DATA([sys-file.sack], [dnl
2163dnl File header.
2164"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
21652; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2166
2167dnl Numeric variable, no label or missing values.
21682; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2169
2170dnl Machine integer info record.
21717; 3; 4; >>9<<; 1; 2; 3; -1; 1; 1; ENDIAN; 1252; >>1234<<;
2172
2173dnl Character encoding record.
21747; 20; 1; 12; "windows-1252";
2175
2176dnl End of dictionary.
2177999; 0;
2178])
2179for variant in be le; do
2180  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2181  AT_DATA([sys-file.sps], [dnl
2182GET FILE='sys-file.sav'.
2183])
2184  AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2185"warning: `sys-file.sav' near offset 0xd8: Record type 7, subtype 3 has bad count 9 (expected 8)."
2186])
2187done
2188AT_CLEANUP
2189
2190AT_SETUP([bad machine integer info float format])
2191AT_KEYWORDS([sack synthetic system file negative])
2192AT_DATA([sys-file.sack], [dnl
2193dnl File header.
2194"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
21952; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2196
2197dnl Numeric variable, no label or missing values.
21982; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2199
2200dnl Machine integer info record.
22017; 3; 4; 8; 1; 2; 3; -1; >>2<<; 1; ENDIAN; 1252;
2202
2203dnl Character encoding record.
22047; 20; 1; 12; "windows-1252";
2205
2206dnl End of dictionary.
2207999; 0;
2208])
2209for variant in be le; do
2210  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2211  AT_DATA([sys-file.sps], [dnl
2212GET FILE='sys-file.sav'.
2213])
2214  AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
2215error: `sys-file.sav' near offset 0xd8: Floating-point representation indicated by system file (2) differs from expected (1).
2216])
2217done
2218AT_CLEANUP
2219
2220AT_SETUP([bad machine integer info endianness])
2221AT_KEYWORDS([sack synthetic system file negative])
2222AT_DATA([sys-file.sack], [dnl
2223dnl File header.
2224"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
22252; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2226
2227dnl Numeric variable, no label or missing values.
22282; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2229
2230dnl Machine integer info record.
22317; 3; 4; 8; 1; 2; 3; -1; 1; 1; >>3<<; 1252;
2232
2233dnl Character encoding record.
22347; 20; 1; 12; "windows-1252";
2235
2236dnl End of dictionary.
2237999; 0;
2238])
2239for variant in "be 1" "le 2"; do
2240  set $variant
2241  AT_CHECK([sack --$[1] sys-file.sack > sys-file.sav])
2242  AT_DATA([sys-file.sps], [dnl
2243GET FILE='sys-file.sav'.
2244DISPLAY DICTIONARY.
2245])
2246  AT_CHECK_UNQUOTED([pspp -O format=csv sys-file.sps], [0], [dnl
2247warning: \`sys-file.sav' near offset 0xd8: Integer format indicated by system file (3) differs from expected ($[2]).
2248
2249Table: Variables
2250Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
2251num1,1,,Scale,Input,8,Right,F8.0,F8.0,
2252])
2253done
2254AT_CLEANUP
2255
2256
2257AT_SETUP([bad machine floating-point info size])
2258AT_KEYWORDS([sack synthetic system file negative])
2259AT_DATA([sys-file.sack], [dnl
2260dnl File header.
2261"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
22622; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2263
2264dnl Numeric variable, no label or missing values.
22652; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2266
2267dnl Machine floating-point info record.
22687; 4; 8; >>4<<; SYSMIS; HIGHEST; LOWEST; 0.0;
2269
2270dnl Character encoding record.
22717; 20; 1; 12; "windows-1252";
2272
2273dnl End of dictionary.
2274999; 0;
2275])
2276for variant in be le; do
2277  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2278  AT_DATA([sys-file.sps], [dnl
2279GET FILE='sys-file.sav'.
2280])
2281  AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2282"warning: `sys-file.sav' near offset 0xd8: Record type 7, subtype 4 has bad count 4 (expected 3)."
2283])
2284done
2285AT_CLEANUP
2286
2287AT_SETUP([wrong special floating point values])
2288AT_KEYWORDS([sack synthetic system file negative])
2289AT_DATA([sys-file.sack], [dnl
2290dnl File header.
2291"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
22922; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2293
2294dnl Numeric variable, no label or missing values.
22952; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2296
2297dnl Machine floating-point info record.
22987; 4; 8; 3; >>0.0<<; >>1.0<<; >>2.0<<;
2299
2300dnl Character encoding record.
23017; 20; 1; 12; "windows-1252";
2302
2303dnl End of dictionary.
2304999; 0;
2305])
2306for variant in be le; do
2307  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2308  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2309])
2310  AT_CHECK([pspp -O format=csv sys-file.sps | sed 's/ [(].*/.../'], [0], [dnl
2311"warning: `sys-file.sav' near offset 0xd8: File specifies unexpected value 0...
2312
2313"warning: `sys-file.sav' near offset 0xd8: File specifies unexpected value 1...
2314
2315"warning: `sys-file.sav' near offset 0xd8: File specifies unexpected value 2...
2316])
2317done
2318AT_CLEANUP
2319
2320AT_SETUP([bad mrsets name])
2321AT_KEYWORDS([sack synthetic system file negative multiple response])
2322AT_DATA([sys-file.sack], [dnl
2323dnl File header.
2324"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
23252; dnl Layout code
232616; dnl Nominal case size
23270; dnl Not compressed
23280; dnl Not weighted
23290; dnl No cases.
2330100.0; dnl Bias.
2331"01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
2332i8 0 *3;
2333
2334dnl $a
23352; 0; 0; 0; 0x050800 *2; i8 0x82; i8 0xa0; s6 "";
23362; 0; 0; 0; 0x050800 *2; s8 "B";
23372; 0; 0; 0; 0x050800 *2; s8 "C";
2338
2339dnl $b
23402; 0; 0; 0; 0x050800 *2; s8 "D";
23412; 0; 0; 0; 0x050800 *2; s8 "E";
23422; 0; 0; 0; 0x050800 *2; s8 "F";
23432; 0; 0; 0; 0x050800 *2; s8 "G";
2344
2345dnl $c
23462; 4; 0; 0; 0x010400 *2; s8 "H";
23472; 4; 0; 0; 0x010400 *2; s8 "I";
23482; 4; 0; 0; 0x010400 *2; s8 "J";
2349
2350dnl $d
23512; 0; 0; 0; 0x050800 *2; s8 "K";
23522; 0; 0; 0; 0x050800 *2; s8 "L";
23532; 0; 0; 0; 0x050800 *2; s8 "M";
2354
2355dnl $e
23562; 6; 0; 0; 0x010600 *2; s8 "N";
23572; 6; 0; 0; 0x010600 *2; s8 "O";
23582; 6; 0; 0; 0x010600 *2; s8 "P";
2359
2360dnl Machine integer info record.
23617; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 932;
2362
23637; 7; 1;
2364COUNT(
2365  "$a=C 10 my mcgroup "; i8 0x82; i8 0xa0; " b c"; i8 10;
2366  "b=D2 55 0  g e f d"; i8 10;
2367  "$c=D4 "; i8 0x82; i8 0xcd; i8 0x82; i8 0xa2; " 10 mdgroup #2 h i j"; i8 10);
2368
23697; 19; 1;
2370COUNT(
2371  "$d=E 1 2 34 13 third mdgroup k l m"; i8 10;
2372  "e=E 11 6 choice 0  n o p"; i8 10);
2373
2374dnl Character encoding record.
23757; 20; 1; 9; "shift_jis";
2376
2377dnl Dictionary termination record.
2378999; 0;
2379])
2380for variant in be le; do
2381  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2382  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2383MRSETS /DISPLAY NAME=ALL.
2384])
2385  AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2386warning: `sys-file.sav': Invalid multiple response set name `b'.
2387
2388warning: `sys-file.sav': Invalid multiple response set name `e'.
2389
2390Table: Multiple Response Sets
2391Name,Label,Encoding,Counted Value,Member Variables
2392$a,my mcgroup,Categories,,"あ
2393b
2394c"
2395$c,mdgroup #2,Dichotomies,はい,"h
2396i
2397j"
2398$d,third mdgroup,Dichotomies,34,"k
2399l
2400m"
2401])
2402done
2403AT_CLEANUP
2404
2405AT_SETUP([missing space after C in mrsets])
2406AT_KEYWORDS([sack synthetic system file negative multiple response])
2407AT_DATA([sys-file.sack], [dnl
2408dnl File header.
2409"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
24102; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2411
2412dnl Numeric variable, no label or missing values.
24132; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2414
2415dnl Multiple response sets.
24167; 7; 1; COUNT("$a=Cx");
2417
2418dnl Character encoding record.
24197; 20; 1; 12; "windows-1252";
2420
2421999; 0;
2422])
2423for variant in be le; do
2424  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2425  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2426])
2427  AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2428warning: `sys-file.sav' near offset 0xd8: Missing space following `C' at offset 4 in MRSETS record.
2429])
2430done
2431AT_CLEANUP
2432
2433AT_SETUP([missing space after E in mrsets])
2434AT_KEYWORDS([sack synthetic system file negative multiple response])
2435AT_DATA([sys-file.sack], [dnl
2436dnl File header.
2437"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
24382; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2439
2440dnl Numeric variable, no label or missing values.
24412; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2442
2443dnl Multiple response sets.
24447; 7; 1; COUNT("$a=Ex");
2445
2446dnl Character encoding record.
24477; 20; 1; 12; "windows-1252";
2448
2449999; 0;
2450])
2451for variant in be le; do
2452  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2453  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2454])
2455  AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2456warning: `sys-file.sav' near offset 0xd8: Missing space following `E' at offset 4 in MRSETS record.
2457])
2458done
2459AT_CLEANUP
2460
2461AT_SETUP([missing label source in mrsets])
2462AT_KEYWORDS([sack synthetic system file negative multiple response])
2463AT_DATA([sys-file.sack], [dnl
2464dnl File header.
2465"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
24662; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2467
2468dnl Numeric variable, no label or missing values.
24692; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2470
2471dnl Multiple response sets.
24727; 7; 1; COUNT("$a=E ");
2473
2474dnl Character encoding record.
24757; 20; 1; 12; "windows-1252";
2476
2477999; 0;
2478])
2479for variant in be le; do
2480  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2481  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2482])
2483  AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2484warning: `sys-file.sav' near offset 0xd8: Missing label source value following `E' at offset 5 in MRSETS record.
2485
2486warning: `sys-file.sav' near offset 0xd8: Expecting digit at offset 5 in MRSETS record.
2487])
2488done
2489AT_CLEANUP
2490
2491AT_SETUP([unexpected label source in mrsets])
2492AT_KEYWORDS([sack synthetic system file negative multiple response])
2493AT_DATA([sys-file.sack], [dnl
2494dnl File header.
2495"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
24962; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2497
2498dnl Numeric variable, no label or missing values.
24992; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2500
2501dnl Multiple response sets.
25027; 7; 1; COUNT("$a=E 2");
2503
2504dnl Character encoding record.
25057; 20; 1; 12; "windows-1252";
2506
2507999; 0;
2508])
2509for variant in be le; do
2510  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2511  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2512])
2513  AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2514warning: `sys-file.sav' near offset 0xd8: Unexpected label source value following `E' at offset 7 in MRSETS record.
2515
2516warning: `sys-file.sav' near offset 0xd8: Expecting digit at offset 7 in MRSETS record.
2517])
2518done
2519AT_CLEANUP
2520
2521AT_SETUP([bad type character in mrsets])
2522AT_KEYWORDS([sack synthetic system file negative multiple response])
2523AT_DATA([sys-file.sack], [dnl
2524dnl File header.
2525"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
25262; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2527
2528dnl Numeric variable, no label or missing values.
25292; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2530
2531dnl Multiple response sets.
25327; 7; 1; COUNT("$a=");
2533
2534dnl Character encoding record.
25357; 20; 1; 12; "windows-1252";
2536
2537999; 0;
2538])
2539for variant in be le; do
2540  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2541  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2542])
2543  AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2544"warning: `sys-file.sav' near offset 0xd8: Missing `C', `D', or `E' at offset 3 in MRSETS record."
2545])
2546done
2547AT_CLEANUP
2548
2549AT_SETUP([bad counted string length in mrsets])
2550AT_KEYWORDS([sack synthetic system file negative multiple response])
2551AT_DATA([sys-file.sack], [dnl
2552dnl File header.
2553"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
25542; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2555
2556dnl Numeric variable, no label or missing values.
25572; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2558
2559dnl Multiple response sets.
25607; 7; 1; COUNT("$a=Dx");
2561
2562dnl Character encoding record.
25637; 20; 1; 12; "windows-1252";
2564
2565999; 0;
2566])
2567for variant in be le; do
2568  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2569  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2570])
2571  AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2572warning: `sys-file.sav' near offset 0xd8: Expecting digit at offset 4 in MRSETS record.
2573])
2574done
2575AT_CLEANUP
2576
2577AT_SETUP([missing space in counted string in mrsets])
2578AT_KEYWORDS([sack synthetic system file negative multiple response])
2579AT_DATA([sys-file.sack], [dnl
2580dnl File header.
2581"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
25822; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2583
2584dnl Numeric variable, no label or missing values.
25852; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2586
2587dnl Multiple response sets.
25887; 7; 1; COUNT("$a=D1x");
2589
2590dnl Character encoding record.
25917; 20; 1; 12; "windows-1252";
2592
2593999; 0;
2594])
2595for variant in be le; do
2596  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2597  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2598])
2599  AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2600warning: `sys-file.sav' near offset 0xd8: Expecting space at offset 5 in MRSETS record.
2601])
2602done
2603AT_CLEANUP
2604
2605AT_SETUP([counted string too long in mrsets])
2606AT_KEYWORDS([sack synthetic system file negative multiple response])
2607AT_DATA([sys-file.sack], [dnl
2608dnl File header.
2609"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
26102; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2611
2612dnl Numeric variable, no label or missing values.
26132; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2614
2615dnl Multiple response sets.
26167; 7; 1; COUNT("$a=D4 abc");
2617
2618dnl Character encoding record.
26197; 20; 1; 12; "windows-1252";
2620
2621999; 0;
2622])
2623for variant in be le; do
2624  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2625  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2626])
2627  AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2628warning: `sys-file.sav' near offset 0xd8: 4-byte string starting at offset 6 exceeds record length 9.
2629])
2630done
2631AT_CLEANUP
2632
2633AT_SETUP([missing space after counted string in mrsets])
2634AT_KEYWORDS([sack synthetic system file negative multiple response])
2635AT_DATA([sys-file.sack], [dnl
2636dnl File header.
2637"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
26382; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2639
2640dnl Numeric variable, no label or missing values.
26412; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2642
2643dnl Multiple response sets.
26447; 7; 1; COUNT("$a=D3 abcx");
2645
2646dnl Character encoding record.
26477; 20; 1; 12; "windows-1252";
2648
2649999; 0;
2650])
2651for variant in be le; do
2652  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2653  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2654])
2655  AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2656warning: `sys-file.sav' near offset 0xd8: Expecting space at offset 9 following 3-byte string.
2657])
2658done
2659AT_CLEANUP
2660
2661AT_SETUP([missing newline after variable name in mrsets])
2662AT_KEYWORDS([sack synthetic system file negative multiple response])
2663AT_DATA([sys-file.sack], [dnl
2664dnl File header.
2665"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
26662; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2667
2668dnl Numeric variable, no label or missing values.
26692; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2670
2671dnl Multiple response sets.
26727; 7; 1; COUNT("$a=C 0  NUM1");
2673
2674dnl Character encoding record.
26757; 20; 1; 12; "windows-1252";
2676
2677999; 0;
2678])
2679for variant in be le; do
2680  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2681  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2682])
2683  AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2684warning: `sys-file.sav' near offset 0xd8: Missing new-line parsing variable names at offset 13 in MRSETS record.
2685
2686warning: `sys-file.sav': MRSET $a has only one variable.
2687])
2688done
2689AT_CLEANUP
2690
2691AT_SETUP([duplicate variable name in mrsets])
2692AT_KEYWORDS([sack synthetic system file negative multiple response])
2693AT_DATA([sys-file.sack], [dnl
2694dnl File header.
2695"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
26962; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2697
2698dnl Numeric variable, no label or missing values.
26992; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2700
2701dnl Multiple response sets.
27027; 7; 1; COUNT("$a=C 0  NUM1 NUM1"; i8 10);
2703
2704dnl Character encoding record.
27057; 20; 1; 12; "windows-1252";
2706
2707999; 0;
2708])
2709for variant in be le; do
2710  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2711  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2712])
2713  AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2714warning: `sys-file.sav': MRSET $a contains duplicate variable name NUM1.
2715
2716warning: `sys-file.sav': MRSET $a has only one variable.
2717])
2718done
2719AT_CLEANUP
2720
2721AT_SETUP([mixed variable types in mrsets])
2722AT_KEYWORDS([sack synthetic system file negative multiple response])
2723AT_DATA([sys-file.sack], [dnl
2724dnl File header.
2725"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
27262; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2727
2728dnl Variables.
27292; 0; 0; 0; 0x050800 *2; s8 "NUM1";
27302; 8; 0; 0; 0x010800 *2; s8 "STR1";
2731
2732dnl Multiple response sets.
27337; 7; 1; COUNT("$a=C 0  NUM1 STR1"; i8 10);
2734
2735dnl Character encoding record.
27367; 20; 1; 12; "windows-1252";
2737
2738999; 0;
2739])
2740for variant in be le; do
2741  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2742  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2743])
2744  AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2745warning: `sys-file.sav': MRSET $a contains both string and numeric variables.
2746
2747warning: `sys-file.sav': MRSET $a has only one variable.
2748])
2749done
2750AT_CLEANUP
2751
2752AT_SETUP([missing newline after variable name in mrsets])
2753AT_KEYWORDS([sack synthetic system file negative multiple response])
2754AT_DATA([sys-file.sack], [dnl
2755dnl File header.
2756"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
27572; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2758
2759dnl Numeric variable, no label or missing values.
27602; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2761
2762dnl Multiple response sets.
27637; 7; 1; COUNT("$a=C 0  NUM1"; i8 10);
2764
2765dnl Character encoding record.
27667; 20; 1; 12; "windows-1252";
2767
2768999; 0;
2769])
2770for variant in be le; do
2771  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2772  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2773])
2774  AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2775warning: `sys-file.sav': MRSET $a has only one variable.
2776])
2777done
2778AT_CLEANUP
2779
2780AT_SETUP([zero or one variable in mrset])
2781AT_KEYWORDS([sack synthetic system file negative multiple response])
2782AT_DATA([sys-file.sack], [dnl
2783dnl File header.
2784"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
27852; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2786
2787dnl Numeric variable, no label or missing values.
27882; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2789
2790dnl Multiple response sets.
27917; 7; 1; COUNT("$a=C 0  NUM1"; i8 10; "$b=C 0  "; i8 10);
2792
2793dnl Character encoding record.
27947; 20; 1; 12; "windows-1252";
2795
2796999; 0;
2797])
2798for variant in be le; do
2799  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2800  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2801])
2802  AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2803warning: `sys-file.sav': MRSET $a has only one variable.
2804
2805warning: `sys-file.sav': MRSET $b has no variables.
2806])
2807done
2808AT_CLEANUP
2809
2810AT_SETUP([wrong display parameter size])
2811AT_KEYWORDS([sack synthetic system file negative])
2812AT_DATA([sys-file.sack], [dnl
2813dnl File header.
2814"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
28152; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2816
2817dnl Numeric variable, no label or missing values.
28182; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2819
2820dnl Display parameters record.
28217; 11; >>8<<; 2; 1.0; 1.0;
2822
2823dnl Character encoding record.
28247; 20; 1; 12; "windows-1252";
2825
2826dnl End of dictionary.
2827999; 0;
2828])
2829for 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'.
2832])
2833  AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2834"warning: `sys-file.sav' near offset 0xd8: Record type 7, subtype 11 has bad size 8 (expected 4)."
2835])
2836done
2837AT_CLEANUP
2838
2839AT_SETUP([wrong display parameter count])
2840AT_KEYWORDS([sack synthetic system file negative])
2841AT_DATA([sys-file.sack], [dnl
2842dnl File header.
2843"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
28442; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2845
2846dnl Numeric variable, no label or missing values.
28472; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2848
2849dnl Display parameters record.
28507; 11; 4; >>4<<; 1; 1; 2; 2;
2851
2852dnl Character encoding record.
28537; 20; 1; 12; "windows-1252";
2854
2855dnl End of dictionary.
2856999; 0;
2857])
2858for variant in be le; do
2859  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2860  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2861])
2862  AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2863warning: `sys-file.sav' near offset 0xd8: Extension 11 has bad count 4 (for 1 variables).
2864])
2865done
2866AT_CLEANUP
2867
2868AT_SETUP([wrong display measurement level])
2869AT_KEYWORDS([sack synthetic system file negative])
2870AT_DATA([sys-file.sack], [dnl
2871dnl File header.
2872"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
28732; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2874
2875dnl Numeric variable, no label or missing values.
28762; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2877
2878dnl Display parameters record.
28797; 11; 4; 2; >>4<<; 0;
2880
2881dnl Character encoding record.
28827; 20; 1; 12; "windows-1252";
2883
2884dnl End of dictionary.
2885999; 0;
2886])
2887for variant in be le; do
2888  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2889  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2890])
2891  AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2892warning: `sys-file.sav' near offset 0xd8: Invalid variable display parameters for variable 0 (NUM1).  Default parameters substituted.
2893])
2894done
2895AT_CLEANUP
2896
2897AT_SETUP([wrong display alignment])
2898AT_KEYWORDS([sack synthetic system file negative])
2899AT_DATA([sys-file.sack], [dnl
2900dnl File header.
2901"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
29022; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2903
2904dnl Numeric variable, no label or missing values.
29052; 0; 0; 0; 0x050800 *2; s8 "NUM1";
2906
2907dnl Display parameters record.
29087; 11; 4; 2; 1; >>-1<<;
2909
2910dnl Character encoding record.
29117; 20; 1; 12; "windows-1252";
2912
2913dnl End of dictionary.
2914999; 0;
2915])
2916for variant in be le; do
2917  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2918  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
2919])
2920  AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2921warning: `sys-file.sav' near offset 0xd8: Invalid variable display parameters for variable 0 (NUM1).  Default parameters substituted.
2922])
2923done
2924AT_CLEANUP
2925
2926AT_SETUP([bad variable name in variable/value pair])
2927AT_KEYWORDS([sack synthetic system file negative])
2928AT_DATA([sys-file.sack], [dnl
2929dnl File header.
2930"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
29312; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2932
2933dnl Numeric variables.
29342; 0; 0; 0; 0x050800 *2; s8 "LONGVARI";
2935
2936dnl Long variable names.
29377; 13; 1; COUNT (>>"xyzzy"<<);
2938
2939dnl Character encoding record.
29407; 20; 1; 12; "windows-1252";
2941
2942dnl Dictionary termination record.
2943999; 0;
2944])
2945for variant in be le; do
2946  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2947  AT_DATA([sys-file.sps], [dnl
2948GET FILE='sys-file.sav'.
2949])
2950  AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2951warning: `sys-file.sav' near offset 0xde: Dictionary record refers to unknown variable xyzzy.
2952])
2953done
2954AT_CLEANUP
2955
2956AT_SETUP([duplicate long variable name])
2957AT_KEYWORDS([sack synthetic system file negative])
2958AT_DATA([sys-file.sack], [dnl
2959dnl File header.
2960"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
29612; 4; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
2962
2963dnl Numeric variables.
29642; 0; 0; 0; 0x050800 *2; s8 "LONGVARI";
29652; 0; 0; 0; 0x050800 *2; s8 "LONGVA_A";
29662; 0; 0; 0; 0x050800 *2; s8 "LONGVA_B";
29672; 0; 0; 0; 0x050800 *2; s8 "LONGVA_C";
2968
2969dnl Long variable names.
29707; 13; 1; COUNT (
2971"LONGVARI=_Invalid"; i8 9;
2972"LONGVARI=$Invalid"; i8 9;
2973"LONGVARI=#Invalid"; i8 9;
2974"LONGVA_A=LongVariableName"; i8 9;
2975"LONGVA_B=LONGVARIABLENAME"; i8 9;
2976);
2977
2978dnl Character encoding record.
29797; 20; 1; 12; "windows-1252";
2980
2981dnl Dictionary termination record.
2982999; 0;
2983])
2984for variant in be le; do
2985  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
2986  AT_DATA([sys-file.sps], [dnl
2987GET FILE='sys-file.sav'.
2988])
2989  AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
2990warning: `sys-file.sav' near offset 0x138: Long variable mapping from LONGVARI to invalid variable name `_Invalid'.
2991
2992warning: `sys-file.sav' near offset 0x138: Long variable mapping from LONGVARI to invalid variable name `$Invalid'.
2993
2994warning: `sys-file.sav' near offset 0x138: Long variable mapping from LONGVARI to invalid variable name `#Invalid'.
2995
2996warning: `sys-file.sav' near offset 0x138: Duplicate long variable name `LONGVARIABLENAME'.
2997])
2998done
2999AT_CLEANUP
3000
3001AT_SETUP([bad very long string length])
3002AT_KEYWORDS([sack synthetic system file negative])
3003AT_DATA([sys-file.sack], [dnl
3004dnl File header.
3005"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
30062; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3007
3008dnl Numeric variable.
30092; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3010
3011dnl Very long string map.
30127; 14; 1; COUNT (
3013"NUM1=00000"; i8 0; i8 9;
3014"NUM1=00255"; i8 0; i8 9;
3015"NUM1=00256"; i8 0; i8 9;
3016);
3017
3018dnl Character encoding record.
30197; 20; 1; 12; "windows-1252";
3020
3021dnl Dictionary termination record.
3022999; 0;
3023])
3024for variant in be le; do
3025  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3026  AT_DATA([sys-file.sps], [dnl
3027GET FILE='sys-file.sav'.
3028])
3029  AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
3030warning: `sys-file.sav' near offset 0xd8: NUM1 listed as string of invalid length 00000 in very long string record.
3031
3032"warning: `sys-file.sav' near offset 0xd8: NUM1 listed in very long string record with width 00255, which requires only one segment."
3033
3034error: `sys-file.sav' near offset 0xd8: Very long string NUM1 overflows dictionary.
3035])
3036done
3037AT_CLEANUP
3038
3039AT_SETUP([bad very long string segment width])
3040AT_KEYWORDS([sack synthetic system file negative])
3041AT_DATA([sys-file.sack], [dnl
3042dnl File header.
3043"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
30442; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3045
3046dnl Variables.
30472; 255; 0; 0; 0x01ff00 *2; s8 "STR1";
3048(2; -1; 0; 0; 0; 0; s8 "") * 31;
30492; >>9<<; 0; 0; 0x010900 *2; s8 "STR1_A";
3050>>2; -1; 0; 0; 0; 0; s8 "";<<
3051
3052dnl Very long string map.
30537; 14; 1; COUNT (
3054"STR1=00256"; i8 0; i8 9;
3055);
3056
3057dnl Character encoding record.
30587; 20; 1; 12; "windows-1252";
3059
3060dnl Dictionary termination record.
3061999; 0;
3062])
3063for variant in be le; do
3064  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3065  AT_DATA([sys-file.sps], [dnl
3066GET FILE='sys-file.sav'.
3067])
3068  AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
3069error: `sys-file.sav' near offset 0x4f8: Very long string with width 256 has segment 1 of width 9 (expected 4).
3070])
3071done
3072AT_CLEANUP
3073
3074AT_SETUP([too many value labels])
3075AT_KEYWORDS([sack synthetic system file negative])
3076AT_DATA([sys-file.sack], [dnl
3077dnl File header.
3078"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
30792; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3080
3081dnl Numeric variable.
30822; 0; 0; 0; 0x050800 *2; s8 "NUM1";
30833; >>0x7fffffff<<;
3084])
3085for variant in be le; do
3086  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3087  AT_DATA([sys-file.sps], [dnl
3088GET FILE='sys-file.sav'.
3089])
3090  AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
3091error: `sys-file.sav' near offset 0xd4: Invalid number of labels 2147483647.
3092])
3093done
3094AT_CLEANUP
3095
3096AT_SETUP([missing type 4 record])
3097AT_KEYWORDS([sack synthetic system file negative])
3098AT_DATA([sys-file.sack], [dnl
3099dnl File header.
3100"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
31012; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3102
3103dnl Numeric variable.
31042; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3105
3106dnl Value label with missing type 4 record.
31073; 1; 1.0; i8 3; s7 "one";
3108
3109dnl Character encoding record.
31107; 20; 1; 12; "windows-1252";
3111
3112dnl End of dictionary.
3113>>999; 0<<;
3114])
3115for variant in be le; do
3116  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3117  AT_DATA([sys-file.sps], [dnl
3118GET FILE='sys-file.sav'.
3119])
3120  AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
3121error: `sys-file.sav' near offset 0xe8: Variable index record (type 4) does not immediately follow value label record (type 3) as it should.
3122])
3123done
3124AT_CLEANUP
3125
3126AT_SETUP([value label with no associated variables])
3127AT_KEYWORDS([sack synthetic system file negative])
3128AT_DATA([sys-file.sack], [dnl
3129dnl File header.
3130"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
31312; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3132
3133dnl Numeric variable.
31342; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3135
3136dnl Value label with no variables.
31373; 1; 1.0; i8 3; s7 "one"; 4; >>0<<;
3138])
3139for variant in be le; do
3140  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3141  AT_DATA([sys-file.sps], [dnl
3142GET FILE='sys-file.sav'.
3143])
3144  AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl
3145error: `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).
3146])
3147done
3148AT_CLEANUP
3149
3150AT_SETUP([type 4 record names long string variable])
3151AT_KEYWORDS([sack synthetic system file negative])
3152AT_DATA([sys-file.sack], [dnl
3153dnl File header.
3154"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
31552; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3156
3157dnl Long string variable.
31582; 9; 0; 0; 0x010900 *2; s8 "STR1";
31592; -1; 0; 0; 0; 0; s8 "";
3160
3161dnl Value label that names long string variable.
31623; 1; s8 "xyzzy"; i8 3; s7 "one"; 4; 1; >>1<<;
3163
3164dnl Character encoding record.
31657; 20; 1; 12; "windows-1252";
3166
3167dnl End of dictionary.
3168999; 0;
3169])
3170for variant in be le; do
3171  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3172  AT_DATA([sys-file.sps], [dnl
3173GET FILE='sys-file.sav'.
3174])
3175  AT_CHECK([pspp -O format=csv sys-file.sps], 0, [dnl
3176warning: `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.
3177])
3178done
3179AT_CLEANUP
3180
3181AT_SETUP([value label variable indexes must be in correct range])
3182AT_KEYWORDS([sack synthetic system file negative])
3183AT_DATA([sys-file.sack], [dnl
3184dnl File header.
3185"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
31862; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3187
3188dnl Variables.
31892; 6; 0; 0; 0x010600 *2; s8 "STR1";
31902; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3191
3192dnl Value labels with bad variable indexes.
31933; 1; s8 "xyzzy"; i8 3; s7 "one"; 4; 2; >>3; 4;<<
31943; 1; s8 "xyzzy"; i8 3; s7 "one"; 4; 2; >>5; 6;<<
31953; 1; s8 "xyzzy"; i8 3; s7 "one"; 4; 2; >>7; 8;<<
3196
3197dnl Character encoding record.
31987; 20; 1; 12; "windows-1252";
3199
3200dnl End of dictionary.
3201999; 0;
3202])
3203for variant in be le; do
3204  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3205  AT_DATA([sys-file.sps], [dnl
3206GET FILE='sys-file.sav'.
3207])
3208  AT_CHECK([pspp -O format=csv sys-file.sps], 0, [dnl
3209warning: `sys-file.sav' near offset 0xf4: Value label variable index 3 not in valid range 1...2.
3210
3211warning: `sys-file.sav' near offset 0xf4: Value label variable index 4 not in valid range 1...2.
3212
3213warning: `sys-file.sav' near offset 0x11c: Value label variable index 5 not in valid range 1...2.
3214
3215warning: `sys-file.sav' near offset 0x11c: Value label variable index 6 not in valid range 1...2.
3216
3217warning: `sys-file.sav' near offset 0x144: Value label variable index 7 not in valid range 1...2.
3218
3219warning: `sys-file.sav': Suppressed 1 additional warnings for value labels.
3220])
3221done
3222AT_CLEANUP
3223
3224AT_SETUP([value label variable indexes must not be long string continuation])
3225AT_KEYWORDS([sack synthetic system file negative])
3226AT_DATA([sys-file.sack], [dnl
3227dnl File header.
3228"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
32292; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3230
3231dnl Long string variable.
32322; 9; 0; 0; 0x010900 *2; s8 "STR1";
3233(2; -1; 0; 0; 0; 0; s8 "");
3234
3235dnl Value label with long string indexes.
32363; 1; s8 "xyzzy"; i8 3; s7 "one"; 4; 1; >>2;<<
3237
3238dnl Character encoding record.
32397; 20; 1; 12; "windows-1252";
3240
3241dnl End of dictionary.
3242999; 0;
3243])
3244for variant in be le; do
3245  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3246  AT_DATA([sys-file.sps], [dnl
3247GET FILE='sys-file.sav'.
3248])
3249  AT_CHECK([pspp -O format=csv sys-file.sps], 0, [dnl
3250warning: `sys-file.sav' near offset 0xf4: Value label variable index 2 refers to long string continuation.
3251])
3252done
3253AT_CLEANUP
3254
3255AT_SETUP([variables for value label must all be same type])
3256AT_KEYWORDS([sack synthetic system file negative])
3257AT_DATA([sys-file.sack], [dnl
3258dnl File header.
3259"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
32602; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3261
3262dnl Variables.
32632; 6; 0; 0; 0x010600 *2; s8 "STR1";
32642; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3265
3266dnl Value label that names numeric and string variables.
32673; 1; s8 "xyzzy"; i8 3; s7 "one"; 4; 2; >>1; 2<<;
3268
3269dnl Character encoding record.
32707; 20; 1; 12; "windows-1252";
3271
3272dnl End of dictionary.
3273999; 0;
3274])
3275for variant in be le; do
3276  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3277  AT_DATA([sys-file.sps], [dnl
3278GET FILE='sys-file.sav'.
3279])
3280  AT_CHECK([pspp -O format=csv sys-file.sps], 0, [dnl
3281"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."
3282])
3283done
3284AT_CLEANUP
3285
3286AT_SETUP([duplicate value labels type])
3287AT_KEYWORDS([sack synthetic system file negative])
3288AT_DATA([sys-file.sack], [dnl
3289dnl File header.
3290"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
32912; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3292
3293dnl Variables.
32942; 6; 0; 0; 0x010600 *2; s8 "STR1";
32952; 0; 0; 0; 0x050800 *2; s8 "NUM1";
3296
3297dnl Duplicate value labels.
32983; 1; s8 "xyzzy"; i8 3; s7 "one"; 4; 2; >>1; 1<<;
32993; 1; 1.0; i8 3; s7 "one"; 4; 2; >>2; 2<<;
3300
3301dnl Character encoding record.
33027; 20; 1; 12; "windows-1252";
3303
3304dnl End of dictionary.
3305999; 0;
3306])
3307for variant in be le; do
3308  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3309  AT_DATA([sys-file.sps], [dnl
3310GET FILE='sys-file.sav'.
3311])
3312  AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
3313warning: `sys-file.sav' near offset 0xf4: Duplicate value label for `xyzzy ' on STR1.
3314
3315warning: `sys-file.sav' near offset 0x11c: Duplicate value label for 1 on NUM1.
3316])
3317done
3318AT_CLEANUP
3319
3320AT_SETUP([missing attribute value])
3321AT_KEYWORDS([sack synthetic system file negative])
3322AT_DATA([sys-file.sack], [dnl
3323dnl File header.
3324"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
33252; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3326
3327dnl Variables.
33282; 0; 0; 0; 0x050800 *2; s8 "FIRSTVAR";
3329
3330dnl Data file attributes record.
33317; 17; 1; COUNT (
3332"Attr1("
3333);
3334
3335dnl Variable attributes record.
33367; 18; 1; COUNT (
3337"FIRSTVAR:";
3338  "fred('23'"; i8 10
3339);
3340
3341dnl Character encoding record.
33427; 20; 1; 12; "windows-1252";
3343
3344dnl Dictionary termination record.
3345999; 0;
3346])
3347for variant in be le; do
3348  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3349  AT_DATA([sys-file.sps], [dnl
3350GET FILE='sys-file.sav'.
3351])
3352  AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
3353warning: `sys-file.sav' near offset 0xde: Error parsing attribute value Attr1[[1]].
3354
3355warning: `sys-file.sav' near offset 0x101: Error parsing attribute value fred[[2]].
3356])
3357done
3358AT_CLEANUP
3359
3360AT_SETUP([unquoted attribute value])
3361AT_KEYWORDS([sack synthetic system file negative])
3362AT_DATA([sys-file.sack], [dnl
3363dnl File header.
3364"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
33652; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3366
3367dnl Variables.
33682; 0; 0; 0; 0x050800 *2; s8 "FIRSTVAR";
3369
3370dnl Data file attributes record.
33717; 17; 1; COUNT (
3372"Attr1(value"; i8 10;
3373")"
3374);
3375
3376dnl Variable attributes record.
33777; 18; 1; COUNT (
3378"FIRSTVAR:";
3379  "fred(23"; i8 10; ")"
3380);
3381
3382dnl Character encoding record.
33837; 20; 1; 12; "windows-1252";
3384
3385dnl Dictionary termination record.
3386999; 0;
3387])
3388for variant in be le; do
3389  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3390  AT_DATA([sys-file.sps], [dnl
3391GET FILE='sys-file.sav'.
3392])
3393  AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
3394warning: `sys-file.sav' near offset 0xe4: Attribute value Attr1[[1]] is not quoted: value.
3395
3396warning: `sys-file.sav' near offset 0x106: Attribute value fred[[1]] is not quoted: 23.
3397])
3398done
3399AT_CLEANUP
3400
3401AT_SETUP([duplicate attribute name])
3402AT_KEYWORDS([sack synthetic system file negative])
3403AT_DATA([sys-file.sack], [dnl
3404dnl File header.
3405"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
34062; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3407
3408dnl Variables.
34092; 0; 0; 0; 0x050800 *2; s8 "FIRSTVAR";
3410
3411dnl Data file attributes record.
34127; 17; 1; COUNT (
3413"Attr1('value'"; i8 10; ")";
3414"Attr1('value'"; i8 10; ")";
3415);
3416
3417dnl Variable attributes record.
34187; 18; 1; COUNT (
3419"FIRSTVAR:";
3420  "fred('23'"; i8 10; ")";
3421  "fred('23'"; i8 10; ")";
3422);
3423
3424dnl Character encoding record.
34257; 20; 1; 12; "windows-1252";
3426
3427dnl Dictionary termination record.
3428999; 0;
3429])
3430for variant in be le; do
3431  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3432  AT_DATA([sys-file.sps], [dnl
3433GET FILE='sys-file.sav'.
3434])
3435  AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
3436warning: `sys-file.sav' near offset 0xf6: Duplicate attribute Attr1.
3437
3438warning: `sys-file.sav' near offset 0x125: Duplicate attribute fred.
3439])
3440done
3441AT_CLEANUP
3442
3443AT_SETUP([bad variable name in long string value label])
3444AT_KEYWORDS([sack synthetic system file negative])
3445AT_DATA([sys-file.sack], [dnl
3446dnl File header.
3447"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
34482; 3; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3449
3450dnl Variables.
34512; 0; 0; 0; 0x050800 *2; s8 "NUM1";
34522; 14; 0; 0; 0x010e00 *2; s8 "STR14";
34532; -1; 0; 0; 0; 0; s8 "";
3454
34557; 21; 1; COUNT (
3456dnl No variable named STR9.
3457COUNT(>>"STR9"<<); 9;
34581; COUNT("RSTUVWXYZ"); COUNT("value label for `RSTUVWXYZ'");
3459
3460dnl NUM1 is numeric.
3461COUNT(>>"NUM1"<<); 0;
34621; COUNT("xyz"); COUNT("value label for 1.0");
3463
3464dnl Wrong width for STR14.
3465COUNT("STR14"); >>9<<;
34661; COUNT("RSTUVWXYZ"); COUNT("value label for `RSTUVWXYZ'");
3467
3468dnl Wrong width for value.
3469COUNT("STR14"); 14;
34701; COUNT(>>"RSTUVWXYZ"<<); COUNT("value label for `RSTUVWXYZ'");
3471
3472dnl Duplicate value label.
3473COUNT("STR14"); 14; 2;
3474COUNT("abcdefghijklmn"); COUNT("value label for `abcdefghijklmn'");
3475>>COUNT("abcdefghijklmn"); COUNT("another value label for `abcdefghijklmn'")<<;
3476);
3477
3478dnl Character encoding record.
34797; 20; 1; 12; "windows-1252";
3480
3481dnl Dictionary termination record.
3482999; 0;
3483])
3484for variant in be le; do
3485  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3486  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3487])
3488  AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl
3489warning: `sys-file.sav' near offset 0x128: Ignoring long string value label record for unknown variable STR9.
3490
3491warning: `sys-file.sav' near offset 0x164: Ignoring long string value label record for numeric variable NUM1.
3492
3493warning: `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).
3494
3495"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."
3496
3497warning: `sys-file.sav' near offset 0x259: Duplicate value label for `abcdefghijklmn' on str14.
3498])
3499done
3500AT_CLEANUP
3501
3502AT_SETUP([fewer data records than indicated by file header])
3503AT_KEYWORDS([sack synthetic system file negative])
3504AT_DATA([sys-file.sack], [dnl
3505dnl File header.
3506"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
35072; 2; 0; 0; >>5<<; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3508
3509dnl Numeric variables.
35102; 0; 0; 0; 0x050800 *2; s8 "NUM1";
35112; 0; 0; 0; 0x050800 *2; s8 "NUM2";
3512
3513dnl Character encoding record.
35147; 20; 1; 12; "windows-1252";
3515
3516dnl Data.
3517999; 0;
35181.0; 2.0;
35193.0; 4.0;
35205.0; 6.0;
35217.0; 8.0;
3522dnl Missing record here.
3523])
3524for variant in be le; do
3525  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3526  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3527LIST.
3528])
3529  AT_CHECK([pspp -O format=csv sys-file.sps], [1],
3530   [error: Error reading case from file `sys-file.sav'.
3531
3532Table: Data List
3533num1,num2
35341,2
35353,4
35365,6
35377,8
3538])
3539done
3540AT_CLEANUP
3541
3542AT_SETUP([partial data record between variables])
3543AT_KEYWORDS([sack synthetic system file negative])
3544AT_DATA([sys-file.sack], [dnl
3545dnl File header.
3546"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
35472; 2; 0; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3548
3549dnl Numeric variables.
35502; 0; 0; 0; 0x050800 *2; s8 "NUM1";
35512; 0; 0; 0; 0x050800 *2; s8 "NUM2";
3552
3553dnl Character encoding record.
35547; 20; 1; 12; "windows-1252";
3555
3556dnl Data.
3557999; 0;
35581.0; 2.0;
35593.0;
3560])
3561for variant in be le; do
3562  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3563  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3564LIST.
3565])
3566  AT_CHECK([pspp -O format=csv sys-file.sps], [1],
3567   [error: `sys-file.sav' near offset 0x12c: File ends in partial case.
3568
3569Table: Data List
3570num1,num2
35711,2
3572])
3573done
3574AT_CLEANUP
3575
3576AT_SETUP([partial data record within long string])
3577AT_KEYWORDS([sack synthetic system file negative])
3578AT_DATA([sys-file.sack], [dnl
3579dnl File header.
3580"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
35812; 2; 0; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
3582
3583dnl Numeric variables.
35842; 14; 0; 0; 0x010e00 *2; s8 "STR14";
35852; -1; 0; 0; 0; 0; s8 "";
3586
3587dnl Character encoding record.
35887; 20; 1; 12; "windows-1252";
3589
3590dnl Data.
3591999; 0;
3592s14 "one data item";
3593s8 "partial";
3594])
3595for variant in be le; do
3596  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3597  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3598LIST.
3599])
3600  AT_CHECK([pspp -O format=csv sys-file.sps], [1],
3601   [error: `sys-file.sav' near offset 0x12a: Unexpected end of file.
3602
3603Table: Data List
3604str14
3605one data item
3606])
3607done
3608AT_CLEANUP
3609
3610AT_SETUP([partial compressed data record])
3611AT_KEYWORDS([sack synthetic system file positive])
3612AT_DATA([sys-file.sack], [dnl
3613dnl File header.
3614"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
36152; dnl Layout code
36166; dnl Nominal case size
36171; dnl Compressed
36180; dnl Not weighted
3619-1; dnl Unspecified number of cases.
3620100.0; dnl Bias.
3621"01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
3622i8 0 *3;
3623
3624dnl Numeric variables.
36252; 0; 0; 0; 0x050800 *2; s8 "NUM1";
36262; 0; 0; 0; 0x050800 *2; s8 "NUM2";
3627
3628dnl String variable.
36292; 4; 0; 0; 0x010400 *2; s8 "STR4";
36302; 8; 0; 0; 0x010800 *2; s8 "STR8";
36312; 15; 0; 0; 0x010f00 *2; s8 "STR15";
36322; -1; 0; 0; 0; 0; s8 "";
3633
3634dnl Character encoding record.
36357; 20; 1; 12; "windows-1252";
3636
3637dnl Dictionary termination record.
3638999; 0;
3639
3640dnl Compressed data.
3641i8 1 100 254 253 254 253; i8 255 251; "abcdefgh"; s8 "0123";
3642])
3643for variant in be le; do
3644  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3645  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3646LIST.
3647])
3648  AT_CHECK([pspp -O format=csv sys-file.sps], [1],
3649   [error: `sys-file.sav' near offset 0x1ac: File ends in partial case.
3650
3651Table: Data List
3652num1,num2,str4,str8,str15
3653-99,0,,abcdefgh,0123
3654])
3655done
3656AT_CLEANUP
3657
3658AT_SETUP([zcompressed data - bad zheader_ofs])
3659AT_KEYWORDS([sack synthetic system file negative zlib])
3660zcompressed_sack | sed 's/.*zheader_ofs.*/>>i64 0<<;/' > sys-file.sack
3661for variant in be le; do
3662  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3663  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3664])
3665  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).
3666])
3667done
3668AT_CLEANUP
3669
3670AT_SETUP([zcompressed data - bad ztrailer_ofs])
3671AT_KEYWORDS([sack synthetic system file negative zlib])
3672zcompressed_sack | sed 's/.*ztrailer_ofs.*/>>i64 0<<;/' > sys-file.sack
3673for variant in be le; do
3674  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3675  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3676])
3677  AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x194: Impossible ZLIB trailer offset 0x0.
3678])
3679done
3680AT_CLEANUP
3681
3682# ztrailer_len must be a multiple of 24 and at least 48,
3683# so a value of 12 is impossible.
3684AT_SETUP([zcompressed data - invalid ztrailer_len])
3685AT_KEYWORDS([sack synthetic system file negative zlib])
3686zcompressed_sack | sed 's/.*ztrailer_len.*/>>i64 12<<;/' > sys-file.sack
3687for variant in be le; do
3688  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3689  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3690])
3691  AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x194: Invalid ZLIB trailer length 12.
3692])
3693done
3694AT_CLEANUP
3695
3696# ztrailer_ofs + ztrailer_len must be the file size.
3697AT_SETUP([zcompressed data - wrong ztrailer_len])
3698AT_KEYWORDS([sack synthetic system file negative zlib])
3699zcompressed_sack | sed 's/.*ztrailer_len.*/>>i64 72<<;/' > sys-file.sack
3700for variant in be le; do
3701  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3702  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3703])
3704  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).
3705error: `sys-file.sav' near offset 0x21d: 72-byte ZLIB trailer specifies 1 data blocks (expected 2).
3706])
3707done
3708AT_CLEANUP
3709
3710AT_SETUP([zcompressed data - wrong ztrailer_bias])
3711AT_KEYWORDS([sack synthetic system file negative zlib])
3712zcompressed_sack | sed 's/.*ztrailer_bias.*/>>i64 0<<;/' > sys-file.sack
3713for variant in be le; do
3714  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3715  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3716])
3717  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).
3718])
3719done
3720AT_CLEANUP
3721
3722AT_SETUP([zcompressed data - wrong ztrailer_zero])
3723AT_KEYWORDS([sack synthetic system file negative zlib])
3724zcompressed_sack | sed 's/.*ztrailer_zero.*/>>i64 100<<;/' > sys-file.sack
3725for variant in be le; do
3726  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3727  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3728])
3729  AT_CHECK([pspp -o pspp.csv sys-file.sps], [0], [warning: `sys-file.sav' near offset 0x215: ZLIB trailer "zero" field has nonzero value 100.
3730])
3731done
3732AT_CLEANUP
3733
3734AT_SETUP([zcompressed data - wrong block_size])
3735AT_KEYWORDS([sack synthetic system file negative zlib])
3736zcompressed_sack | sed 's/.*block_size.*/>>0x1000<<;/' > sys-file.sack
3737for variant in be le; do
3738  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3739  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3740])
3741  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.
3742])
3743done
3744AT_CLEANUP
3745
3746AT_SETUP([zcompressed data - wrong n_blocks])
3747AT_KEYWORDS([sack synthetic system file negative zlib])
3748zcompressed_sack | sed 's/.*n_blocks.*/>>2<<;/' > sys-file.sack
3749for variant in be le; do
3750  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3751  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3752])
3753  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).
3754])
3755done
3756AT_CLEANUP
3757
3758AT_SETUP([zcompressed data - wrong uncompressed_ofs])
3759AT_KEYWORDS([sack synthetic system file negative zlib])
3760zcompressed_sack | sed 's/.*uncompressed_ofs.*/i64 >>0x177<<;/' > sys-file.sack
3761for variant in be le; do
3762  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3763  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3764])
3765  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.
3766])
3767done
3768AT_CLEANUP
3769
3770AT_SETUP([zcompressed data - wrong compressed_ofs])
3771AT_KEYWORDS([sack synthetic system file negative zlib])
3772zcompressed_sack | sed 's/.*@%:@ compressed_ofs.*/i64 >>0x191<<;/' > sys-file.sack
3773for variant in be le; do
3774  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3775  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3776])
3777  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.
3778])
3779done
3780AT_CLEANUP
3781
3782AT_SETUP([zcompressed data - compressed sizes don't add up])
3783AT_KEYWORDS([sack synthetic system file negative zlib])
3784AT_DATA([sys-file.sack], [dnl
3785dnl File header.
3786"$FL3"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
37872; dnl Layout code
37886; dnl Nominal case size
37892; dnl zlib compressed
37900; dnl Not weighted
3791-1; dnl Unspecified number of cases.
3792100.0; dnl Bias.
3793"01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file";
3794i8 0 *3;
3795
3796dnl Numeric variables.
37972; 0; 0; 0; 0x050800 *2; s8 "NUM1";
37982; 0; 0; 0; 0x050800 *2; s8 "NUM2";
3799
3800dnl String variable.
38012; 4; 0; 0; 0x010400 *2; s8 "STR4";
38022; 8; 0; 0; 0x010800 *2; s8 "STR8";
38032; 15; 0; 0; 0x010f00 *2; s8 "STR15";
38042; -1; 0; 0; 0; 0; s8 "";
3805
3806dnl Character encoding record.
38077; 20; 1; 12; "windows-1252";
3808
3809dnl Dictionary termination record.
3810999; 0;
3811
3812dnl ZLIB data header.
3813i64 0x194;    # zheader_ofs
3814i64 0x1ac;    # ztrailer_ofs
3815i64 72;       # ztrailer_len
3816
3817dnl This is where the ZLIB data blocks would go, but we don't need any to
3818dnl provoke this message so we omit them.
3819
3820dnl ZLIB data trailer fixed header:
3821i64 -100;     # ztrailer_bias
3822i64 0;        # ztrailer_zero
38230x3ff000;     # block_size
38242;            # n_blocks
3825
3826dnl ZLIB block descriptor 1:
3827i64 0x194;    # uncompressed_ofs
3828i64 0x1ac;    # compressed_ofs
38290x100000;     # uncompressed_size
38300x12345;      # compressed_size
3831
3832dnl ZLIB block descriptor 2:
3833i64 0x100194; # uncompressed_ofs
3834i64 0x12421;  # compressed_ofs
38350x100000;     # uncompressed_size
38360x12345;      # compressed_size
3837])
3838for variant in be le; do
3839  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3840  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3841])
3842  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.
3843error: `sys-file.sav' near offset 0x1dc: ZLIB block descriptor 1 reported compressed data offset 0x12421, when 0x124f1 was expected.
3844])
3845done
3846AT_CLEANUP
3847
3848AT_SETUP([zcompressed data - uncompressed_size > block_size])
3849AT_KEYWORDS([sack synthetic system file negative zlib])
3850zcompressed_sack | sed 's/.*uncompressed_size.*/>>0x400000<<;/' > sys-file.sack
3851for variant in be le; do
3852  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3853  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3854])
3855  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.
3856])
3857done
3858AT_CLEANUP
3859
3860AT_SETUP([zcompressed data - compression expands data too much])
3861AT_KEYWORDS([sack synthetic system file negative zlib])
3862zcompressed_sack | sed 's/.*uncompressed_size.*/>>50<<;/
3863s/.*@%:@ compressed_size.*/>>100<<;/' > sys-file.sack
3864for variant in be le; do
3865  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3866  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3867])
3868  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.
3869])
3870done
3871AT_CLEANUP
3872
3873AT_SETUP([zcompressed data - compressed sizes don't add up])
3874AT_KEYWORDS([sack synthetic system file negative zlib])
3875zcompressed_sack | sed 's/.*@%:@ compressed_size.*/>>88<<;/' > sys-file.sack
3876for variant in be le; do
3877  AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
3878  AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'.
3879])
3880  AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x235: ZLIB trailer is at offset 0x205 but 0x204 would be expected from block descriptors.
3881])
3882done
3883AT_CLEANUP
3884
3885# CVE-2017-10791.
3886# See also https://bugzilla.redhat.com/show_bug.cgi?id=1467004.
3887# See also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=866890.
3888# See also https://security-tracker.debian.org/tracker/CVE-2017-10791.
3889# Found by team OWL337, using the collAFL fuzzer.
3890AT_SETUP([integer overflows in long string missing values])
3891AT_KEYWORDS([system file negative])
3892cp $top_srcdir/tests/data/CVE-2017-10791.sav .
3893AT_CHECK([pspp-convert -O csv -e ASCII CVE-2017-10791.sav -], [0], [], [dnl
3894`CVE-2017-10791.sav' near offset 0x217: Extension record subtype 21 ends unexpectedly.
3895])
3896AT_CLEANUP
3897
3898# CVE-2017-10792.
3899# See also https://bugzilla.redhat.com/show_bug.cgi?id=1467005.
3900# See also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=866890.
3901# See also https://security-tracker.debian.org/tracker/CVE-2017-10792.
3902# Reported by team OWL337, with fuzzer collAFL.
3903AT_SETUP([null dereference skipping bad extension record 18])
3904AT_KEYWORDS([system file negative])
3905cp $top_srcdir/tests/data/CVE-2017-10792.sav .
3906AT_CHECK([pspp-convert -O csv -e ASCII CVE-2017-10792.sav -], [0], [], [dnl
3907`CVE-2017-10792.sav' near offset 0x1c0: Record type 7, subtype 18 has bad size 4 (expected 1).
3908])
3909AT_CLEANUP
3910