X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=tests%2Fdata%2Fsys-file-reader.at;h=dd520feed30becb9a285ccdfaf248df52630451b;hb=261e25786073840d341ffdd5c36a08b0b9e46504;hp=e181b26eb580d691ef3d54b99d5b8b1b9f4f6511;hpb=c2b953d03cc404e6edfd57f9dce96493b5ea834a;p=pspp diff --git a/tests/data/sys-file-reader.at b/tests/data/sys-file-reader.at index e181b26eb5..dd520feed3 100644 --- a/tests/data/sys-file-reader.at +++ b/tests/data/sys-file-reader.at @@ -1,3 +1,19 @@ +dnl PSPP - a program for statistical analysis. +dnl Copyright (C) 2017 Free Software Foundation, Inc. +dnl +dnl This program is free software: you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation, either version 3 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program. If not, see . +dnl AT_BANNER([system file reader - positive]) AT_SETUP([variable labels and missing values]) @@ -130,52 +146,33 @@ DISPLAY DICTIONARY. LIST. ]) AT_CHECK([pspp -o pspp.csv sys-file.sps]) - AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl -File label: PSPP synthetic test file: ôõöø - -Variable,Description,,Position -num1,Format: F8.0,,1 -num2,Label: Numeric variable 2's label (ùúû),,2 -,Format: F8.0,, -num3,Format: F8.0,,3 -,Missing Values: 1,, -num4,Label: Another numeric variable label,,4 -,Format: F8.0,, -,Missing Values: 1,, -num5,Format: F8.0,,5 -,Missing Values: 1; 2,, -num6,Format: F8.0,,6 -,Missing Values: 1; 2; 3,, -num7,Format: F8.0,,7 -,Missing Values: 1 THRU 3,, -num8,Format: F8.0,,8 -,Missing Values: 1 THRU 3; 5,, -num9,Format: F8.0,,9 -,Missing Values: 1 THRU HIGHEST; -5,, -numàèìñò,Format: F8.0,,10 -,Missing Values: LOWEST THRU 1; 5,, -str1,Format: A4,,11 -str2,Label: String variable 2's label,,12 -,Format: A4,, -str3,Format: A4,,13 -,"Missing Values: ""MISS""",, -str4,Label: Another string variable label,,14 -,Format: A4,, -,"Missing Values: ""OTHR""",, -str5,Format: A4,,15 -,"Missing Values: ""MISS""; ""OTHR""",, -str6,Format: A4,,16 -,"Missing Values: ""MISS""; ""OTHR""; ""MORE""",, -str7,Format: A11,,17 -,"Missing Values: ""first8by""",, -str8,Format: A9,,18 -,"Missing Values: ""abcdefgh""",, -str9,Format: A10,,19 -,"Missing Values: ""abcdefgh""; ""01234567""",, -str10,Format: A11,,20 -,"Missing Values: ""abcdefgh""; ""01234567""; ""0 """,, -str11,Label: 25-byte string,,21 -,Format: A25,, + AT_CHECK([cat pspp.csv], [0], [dnl +Table: File Label +Label,PSPP synthetic test file: ôõöø + +Table: Variables +Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values +num1,1,,Scale,Input,8,Right,F8.0,F8.0, +num2,2,Numeric variable 2's label (ùúû),Scale,Input,8,Right,F8.0,F8.0, +num3,3,,Scale,Input,8,Right,F8.0,F8.0,1 +num4,4,Another numeric variable label,Scale,Input,8,Right,F8.0,F8.0,1 +num5,5,,Scale,Input,8,Right,F8.0,F8.0,1; 2 +num6,6,,Scale,Input,8,Right,F8.0,F8.0,1; 2; 3 +num7,7,,Scale,Input,8,Right,F8.0,F8.0,1 THRU 3 +num8,8,,Scale,Input,8,Right,F8.0,F8.0,1 THRU 3; 5 +num9,9,,Scale,Input,8,Right,F8.0,F8.0,1 THRU HIGHEST; -5 +numàèìñò,10,,Scale,Input,8,Right,F8.0,F8.0,LOWEST THRU 1; 5 +str1,11,,Nominal,Input,4,Left,A4,A4, +str2,12,String variable 2's label,Nominal,Input,4,Left,A4,A4, +str3,13,,Nominal,Input,4,Left,A4,A4,"""MISS""" +str4,14,Another string variable label,Nominal,Input,4,Left,A4,A4,"""OTHR""" +str5,15,,Nominal,Input,4,Left,A4,A4,"""MISS""; ""OTHR""" +str6,16,,Nominal,Input,4,Left,A4,A4,"""MISS""; ""OTHR""; ""MORE""" +str7,17,,Nominal,Input,11,Left,A11,A11,"""first8by""" +str8,18,,Nominal,Input,9,Left,A9,A9,"""abcdefgh""" +str9,19,,Nominal,Input,10,Left,A10,A10,"""abcdefgh""; ""01234567""" +str10,20,,Nominal,Input,11,Left,A11,A11,"""abcdefgh""; ""01234567""; ""0 """ +str11,21,25-byte string,Nominal,Input,25,Left,A25,A25, Table: Data List num1,num2,num3,num4,num5,num6,num7,num8,num9,numàèìñò,str1,str2,str3,str4,str5,str6,str7,str8,str9,str10,str11 @@ -192,7 +189,7 @@ dnl File header. 2; dnl Layout code -1; dnl Nominal case size (unspecified) 0; dnl Not compressed -0; dnl Not weighted +0; dnl Not weighted 1; dnl 1 case. 100.0; dnl Bias. "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file"; @@ -205,11 +202,14 @@ dnl Numeric variable, variable label. 2; 0; 1; 0; 0x050800 *2; s8 "NUM2"; 26; "Numeric variable 2's label"; i8 0 *2; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl Dictionary termination record. 999; 0; dnl Data. -1.0; 2.0; +1.0; 2.0; ]) for variant in be le; do AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) @@ -219,11 +219,11 @@ DISPLAY DICTIONARY. LIST. ]) AT_CHECK([pspp -o pspp.csv sys-file.sps]) - AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl -Variable,Description,,Position -num1,Format: F8.0,,1 -num2,Label: Numeric variable 2's label,,2 -,Format: F8.0,, + AT_CHECK([cat pspp.csv], [0], [dnl +Table: Variables +Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format +num1,1,,Scale,Input,8,Right,F8.0,F8.0 +num2,2,Numeric variable 2's label,Scale,Input,8,Right,F8.0,F8.0 Table: Data List num1,num2 @@ -240,7 +240,7 @@ dnl File header. 2; dnl Layout code -1; dnl Nominal case size (unspecified) 0; dnl Not compressed -0; dnl Not weighted +0; dnl Not weighted 1; dnl 1 case. 100.0; dnl Bias. "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file"; @@ -256,11 +256,14 @@ dnl Numeric variable, variable label. dnl Machine integer info record (SPSS 13). 7; 3; 4; 8; 13; 2; 3; -1; 1; 1; ENDIAN; 1252; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl Dictionary termination record. 999; 0; dnl Data. -1.0; 2.0; +1.0; 2.0; ]) for variant in be le; do AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) @@ -270,11 +273,11 @@ DISPLAY DICTIONARY. LIST. ]) AT_CHECK([pspp -o pspp.csv sys-file.sps]) - AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl -Variable,Description,,Position -num1,Format: F8.0,,1 -num2,Label: Numeric variable 2's label,,2 -,Format: F8.0,, + AT_CHECK([cat pspp.csv], [0], [dnl +Table: Variables +Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format +num1,1,,Scale,Input,8,Right,F8.0,F8.0 +num2,2,Numeric variable 2's label,Scale,Input,8,Right,F8.0,F8.0 Table: Data List num1,num2 @@ -291,7 +294,7 @@ dnl File header. 2; dnl Layout code 22; dnl Nominal case size 0; dnl Not compressed -0; dnl Not weighted +0; dnl Not weighted 1; dnl 1 case. 100.0; dnl Bias. "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file"; @@ -403,61 +406,65 @@ GET FILE='sys-file.sav'. DISPLAY DICTIONARY. ]) AT_CHECK([pspp -o pspp.csv sys-file.sps]) - AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl -Variable,Description,,Position -num1,Format: F8.0,,1 -,1,один (in Russian), -num2,Format: F8.0,,2 -,1,one, -,2,two, -num3,Format: F8.0,,3 -,3,three, -,4,four, -num4,Format: F8.0,,4 -,5,five, -,7,seven, -,8,eight, -,9,nine, -num5,Format: F8.0,,5 -,6,six, -,7,seven, -,8,eight, -,10,ten, -str1,Format: A1,,6 -,a,value label for `a', -str2,Format: A2,,7 -,bc,value label for `bc', -,de,value label for `de', -str3,Format: A3,,8 -,fgh,value label for `fgh', -,ijk,value label for `ijk', -str4,Format: A4,,9 -,BCDE,value label for `BCDE', -,lmno,value label for `lmno', -,tuvw,value label for `tuvw', -,xyzA,value label for `xyzA', -str5,Format: A4,,10 -,FGHI,value label for `FGHI', -,pqrs,value label for `pqrs', -,tuvw,value label for `tuvw', -,xyzA,value label for `xyzA', -str6,Format: A6,,11 -,JKLMNO,value label for `JKLMNO', -str7,Format: A7,,12 -,JKLMNOP,value label for `JKLMNOP', -str8,Format: A8,,13 -,JKLMNOPQ,value label for `JKLMNOPQ', -str9ж,Format: A9,,14 -,RSTUVWXYZ,value label for `RSTUVWXYZ', -str12,Format: A12,,15 -,0123456789ab,value label for `0123456789ab', -,cdefghijklmn,value label for `cdefghijklmn', -str16,Format: A16,,16 -,EFGHIJKLMNOPQRST,value label for `EFGHIJKLMNOPQRST', -,UVWXYZ0123456789,value label for `UVWXYZ0123456789' with Cyrillic letters: `фхц', -,opqrstuvwxyzABCD,value label for `opqrstuvwxyzABCD', -str17,Format: A17,,17 -,abcdefghijklmnopq,value label for `abcdefghijklmnopq', + AT_CHECK([cat pspp.csv], [0], [dnl +Table: Variables +Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format +num1,1,Scale,Input,8,Right,F8.0,F8.0 +num2,2,Scale,Input,8,Right,F8.0,F8.0 +num3,3,Scale,Input,8,Right,F8.0,F8.0 +num4,4,Scale,Input,8,Right,F8.0,F8.0 +num5,5,Scale,Input,8,Right,F8.0,F8.0 +str1,6,Nominal,Input,1,Left,A1,A1 +str2,7,Nominal,Input,2,Left,A2,A2 +str3,8,Nominal,Input,3,Left,A3,A3 +str4,9,Nominal,Input,4,Left,A4,A4 +str5,10,Nominal,Input,4,Left,A4,A4 +str6,11,Nominal,Input,6,Left,A6,A6 +str7,12,Nominal,Input,7,Left,A7,A7 +str8,13,Nominal,Input,8,Left,A8,A8 +str9ж,14,Nominal,Input,9,Left,A9,A9 +str12,15,Nominal,Input,12,Left,A12,A12 +str16,16,Nominal,Input,16,Left,A16,A16 +str17,17,Nominal,Input,17,Left,A17,A17 + +Table: Value Labels +Variable Value,,Label +num1,1,один (in Russian) +num2,1,one +,2,two +num3,3,three +,4,four +num4,5,five +,7,seven +,8,eight +,9,nine +num5,6,six +,7,seven +,8,eight +,10,ten +str1,a,value label for `a' +str2,bc,value label for `bc' +,de,value label for `de' +str3,fgh,value label for `fgh' +,ijk,value label for `ijk' +str4,BCDE,value label for `BCDE' +,lmno,value label for `lmno' +,tuvw,value label for `tuvw' +,xyzA,value label for `xyzA' +str5,FGHI,value label for `FGHI' +,pqrs,value label for `pqrs' +,tuvw,value label for `tuvw' +,xyzA,value label for `xyzA' +str6,JKLMNO,value label for `JKLMNO' +str7,JKLMNOP,value label for `JKLMNOP' +str8,JKLMNOPQ,value label for `JKLMNOPQ' +str9ж,RSTUVWXYZ,value label for `RSTUVWXYZ' +str12,0123456789ab,value label for `0123456789ab' +,cdefghijklmn,value label for `cdefghijklmn' +str16,EFGHIJKLMNOPQRST,value label for `EFGHIJKLMNOPQRST' +,UVWXYZ0123456789,value label for `UVWXYZ0123456789' with Cyrillic letters: `фхц' +,opqrstuvwxyzABCD,value label for `opqrstuvwxyzABCD' +str17,abcdefghijklmnopq,value label for `abcdefghijklmnopq' ]) done AT_CLEANUP @@ -470,7 +477,7 @@ dnl File header. 2; dnl Layout code 1; dnl Nominal case size 0; dnl Not compressed -0; dnl Not weighted +0; dnl Not weighted 1; dnl 1 case. 100.0; dnl Bias. "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file"; @@ -509,18 +516,60 @@ LIST. ]) AT_CHECK([pspp -o pspp.csv sys-file.sps]) AT_CHECK([cat pspp.csv], [0], [dnl -Documents in the active dataset: +Table: Documents +"First line of documents +Second line of documents +abbé appliqué attaché blasé café canapé cliché consommé -First line of documents +Last line of documents" -Second line of documents +Table: Data List +num1 +1 +]) +done +AT_CLEANUP -abbé appliqué attaché blasé café canapé cliché consommé +AT_SETUP([empty document record]) +AT_KEYWORDS([sack synthetic system file positive]) +AT_DATA([sys-file.sack], [dnl +dnl File header. +"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file"; +2; dnl Layout code +1; dnl Nominal case size +0; dnl Not compressed +0; dnl Not weighted +1; dnl 1 case. +100.0; dnl Bias. +"01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file"; +i8 0 *3; + +dnl Numeric variable, no label or missing values. +2; 0; 0; 0; 0x050800 *2; s8 "NUM1"; +dnl Machine integer info record. +7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1252; + +dnl Document record. +6; 0; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; -Last line of documents +dnl Dictionary termination record. +999; 0; +dnl Data. +1.0; +]) +for variant in be le; do + AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) + AT_DATA([sys-file.sps], [dnl +GET FILE='sys-file.sav'. +LIST. +]) + AT_CHECK([pspp -o pspp.csv sys-file.sps]) + AT_CHECK([cat pspp.csv], [0], [dnl Table: Data List num1 1 @@ -536,7 +585,7 @@ dnl File header. 2; dnl Layout code 16; dnl Nominal case size 0; dnl Not compressed -0; dnl Not weighted +0; dnl Not weighted 0; dnl No cases. 100.0; dnl Bias. "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file"; @@ -598,47 +647,23 @@ MRSETS /DISPLAY NAME=ALL. AT_CHECK([pspp -o pspp.csv sys-file.sps]) AT_CHECK([cat pspp.csv], [0], [dnl Table: Multiple Response Sets -Name,Variables,Details -$a,"あ +Name,Label,Encoding,Counted Value,Member Variables +$a,my mcgroup,Categories,,"あ b -c -","Multiple category set -Label: my mcgroup -" -$b,"g +c" +$b,,Dichotomies,55,"g e f -d -","Multiple dichotomy set -Counted value: 55 -Category label source: Variable labels -" -$c,"h +d" +$c,mdgroup #2,Dichotomies,はい,"h i -j -","Multiple dichotomy set -Label: mdgroup #2 -Label source: Provided by user -Counted value: `はい' -Category label source: Variable labels -" -$d,"k +j" +$d,third mdgroup,Dichotomies,34,"k l -m -","Multiple dichotomy set -Label: third mdgroup -Label source: Provided by user -Counted value: 34 -Category label source: Value labels of counted value -" -$e,"n +m" +$e,,Dichotomies,choice,"n o -p -","Multiple dichotomy set -Label source: First variable label among variables -Counted value: `choice' -Category label source: Value labels of counted value -" +p" ]) done AT_CLEANUP @@ -668,21 +693,25 @@ dnl Numeric variables. dnl Extra product info. 7; 10; 1; COUNT ("Extra product info"; i8 13; "another line"; i8 13; "blah"); +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl Dictionary termination record. 999; 0; ]) -for variant in be le; do +for variant in be; do AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) AT_DATA([sys-file.sps], [dnl SYSFILE INFO FILE='sys-file.sav'. ]) AT_CHECK([pspp -o pspp.csv sys-file.sps]) - AT_CHECK([sed 7q pspp.csv], [0], [dnl -File:,sys-file.sav -Label:,"PSPP synthetic + AT_CHECK([sed 8q pspp.csv], [0], [dnl +Table: File Information +File,sys-file.sav +Label,"PSPP synthetic test file" -Created:,01 Jan 11 20:53:52 by $(@%:@) SPSS DATA FILE PSPP synthetic test file -Product:,"Extra product info +Created,01 Jan 11 20:53:52 by $(@%:@) SPSS DATA FILE PSPP synthetic test file +Product,"Extra product info another line blah" ]) @@ -697,7 +726,7 @@ dnl File header. 2; dnl Layout code 19; dnl Nominal case size 0; dnl Not compressed -0; dnl Not weighted +0; dnl Not weighted 0; dnl No cases. 100.0; dnl Bias. "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file"; @@ -740,6 +769,9 @@ dnl Variable display parameters 0; 1; 0; 2; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl Dictionary termination record. 999; 0; ]) @@ -751,55 +783,20 @@ DISPLAY DICTIONARY. ]) AT_CHECK([pspp -o pspp.csv sys-file.sps]) AT_CHECK([cat pspp.csv], [0], [dnl -Variable,Description,,Position -a,Format: F8.0,,1 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 8,, -b,Format: F8.0,,2 -,Measure: Ordinal,, -,Display Alignment: Left,, -,Display Width: 8,, -c,Format: F8.0,,3 -,Measure: Scale,, -,Display Alignment: Left,, -,Display Width: 8,, -d,Format: F8.0,,4 -,Measure: Nominal,, -,Display Alignment: Right,, -,Display Width: 8,, -h,Format: A3,,5 -,Measure: Ordinal,, -,Display Alignment: Right,, -,Display Width: 3,, -i,Format: A3,,6 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 3,, -j,Format: A3,,7 -,Measure: Nominal,, -,Display Alignment: Center,, -,Display Width: 3,, -k,Format: A3,,8 -,Measure: Ordinal,, -,Display Alignment: Center,, -,Display Width: 3,, -l,Format: A9,,9 -,Measure: Scale,, -,Display Alignment: Center,, -,Display Width: 9,, -m,Format: A10,,10 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 10,, -n,Format: A17,,11 -,Measure: Nominal,, -,Display Alignment: Right,, -,Display Width: 17,, -o,Format: A25,,12 -,Measure: Nominal,, -,Display Alignment: Center,, -,Display Width: 25,, +Table: Variables +Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format +a,1,Nominal,Input,8,Left,F8.0,F8.0 +b,2,Ordinal,Input,8,Left,F8.0,F8.0 +c,3,Scale,Input,8,Left,F8.0,F8.0 +d,4,Nominal,Input,8,Right,F8.0,F8.0 +h,5,Ordinal,Input,3,Right,A3,A3 +i,6,Scale,Input,3,Right,A3,A3 +j,7,Nominal,Input,3,Center,A3,A3 +k,8,Ordinal,Input,3,Center,A3,A3 +l,9,Scale,Input,9,Center,A9,A9 +m,10,Nominal,Input,10,Left,A10,A10 +n,11,Nominal,Input,17,Right,A17,A17 +o,12,Nominal,Input,25,Center,A25,A25 ]) done AT_CLEANUP @@ -812,7 +809,7 @@ dnl File header. 2; dnl Layout code 19; dnl Nominal case size 0; dnl Not compressed -0; dnl Not weighted +0; dnl Not weighted 0; dnl No cases. 100.0; dnl Bias. "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file"; @@ -855,6 +852,9 @@ dnl Variable display parameters 0; 11; 1; 0; 12; 2; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl Dictionary termination record. 999; 0; ]) @@ -866,55 +866,20 @@ DISPLAY DICTIONARY. ]) AT_CHECK([pspp -o pspp.csv sys-file.sps]) AT_CHECK([cat pspp.csv], [0], [dnl -Variable,Description,,Position -a,Format: F8.0,,1 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 1,, -b,Format: F8.0,,2 -,Measure: Ordinal,, -,Display Alignment: Left,, -,Display Width: 2,, -c,Format: F8.0,,3 -,Measure: Scale,, -,Display Alignment: Left,, -,Display Width: 3,, -d,Format: F8.0,,4 -,Measure: Nominal,, -,Display Alignment: Right,, -,Display Width: 4,, -h,Format: A3,,5 -,Measure: Ordinal,, -,Display Alignment: Right,, -,Display Width: 5,, -i,Format: A3,,6 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 6,, -j,Format: A3,,7 -,Measure: Nominal,, -,Display Alignment: Center,, -,Display Width: 7,, -k,Format: A3,,8 -,Measure: Ordinal,, -,Display Alignment: Center,, -,Display Width: 8,, -l,Format: A9,,9 -,Measure: Scale,, -,Display Alignment: Center,, -,Display Width: 9,, -m,Format: A10,,10 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 10,, -n,Format: A17,,11 -,Measure: Nominal,, -,Display Alignment: Right,, -,Display Width: 11,, -o,Format: A25,,12 -,Measure: Nominal,, -,Display Alignment: Center,, -,Display Width: 12,, +Table: Variables +Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format +a,1,Nominal,Input,1,Left,F8.0,F8.0 +b,2,Ordinal,Input,2,Left,F8.0,F8.0 +c,3,Scale,Input,3,Left,F8.0,F8.0 +d,4,Nominal,Input,4,Right,F8.0,F8.0 +h,5,Ordinal,Input,5,Right,A3,A3 +i,6,Scale,Input,6,Right,A3,A3 +j,7,Nominal,Input,7,Center,A3,A3 +k,8,Ordinal,Input,8,Center,A3,A3 +l,9,Scale,Input,9,Center,A9,A9 +m,10,Nominal,Input,10,Left,A10,A10 +n,11,Nominal,Input,11,Right,A17,A17 +o,12,Nominal,Input,12,Center,A25,A25 ]) done AT_CLEANUP @@ -927,7 +892,7 @@ dnl File header. 2; dnl Layout code 7; dnl Nominal case size 0; dnl Not compressed -0; dnl Not weighted +0; dnl Not weighted 0; dnl No cases. 100.0; dnl Bias. "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file"; @@ -972,15 +937,16 @@ GET FILE='sys-file.sav'. DISPLAY DICTIONARY. ]) AT_CHECK([pspp -o pspp.csv sys-file.sps]) - AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl -Variable,Description,,Position -LongVariableName1,Format: F8.0,,1 -LongVariableName2,Format: F8.0,,2 -LongVariableName3,Format: F8.0,,3 -LongVariableName4,Format: F8.0,,4 -Coördinate_X,Format: F8.0,,5 -Coördinate_Y,Format: F8.0,,6 -Coördinate_Z,Format: F8.0,,7 + AT_CHECK([cat pspp.csv], [0], [dnl +Table: Variables +Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format +LongVariableName1,1,Scale,Input,8,Right,F8.0,F8.0 +LongVariableName2,2,Scale,Input,8,Right,F8.0,F8.0 +LongVariableName3,3,Scale,Input,8,Right,F8.0,F8.0 +LongVariableName4,4,Scale,Input,8,Right,F8.0,F8.0 +Coördinate_X,5,Scale,Input,8,Right,F8.0,F8.0 +Coördinate_Y,6,Scale,Input,8,Right,F8.0,F8.0 +Coördinate_Z,7,Scale,Input,8,Right,F8.0,F8.0 ]) done AT_CLEANUP @@ -993,7 +959,7 @@ dnl File header. 2; dnl Layout code 109; dnl Nominal case size 0; dnl Not compressed -0; dnl Not weighted +0; dnl Not weighted 1; dnl No cases. 100.0; dnl Bias. "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file"; @@ -1041,10 +1007,11 @@ DISPLAY DICTIONARY. LIST. ]) AT_CHECK([pspp -o pspp.csv sys-file.sps]) - AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl -Variable,Description,,Position -séq256,Format: A256,,1 -str600,Format: A600,,2 + AT_CHECK([cat pspp.csv], [0], [dnl +Table: Variables +Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format +séq256,1,Nominal,Input,32,Left,A256,A256 +str600,2,Nominal,Input,32,Left,A600,A600 Table: Data List séq256,str600 @@ -1059,9 +1026,9 @@ AT_DATA([sys-file.sack], [dnl dnl File header. "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file"; 2; dnl Layout code -2; dnl Nominal case size +3; dnl Nominal case size 0; dnl Not compressed -0; dnl Not weighted +0; dnl Not weighted 0; dnl 1 case. 100.0; dnl Bias. "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file"; @@ -1070,6 +1037,7 @@ i8 0 *3; dnl Variables. 2; 0; 0; 0; 0x050800 *2; s8 "FIRSTVAR"; 2; 0; 0; 0; 0x050800 *2; s8 "SECONDVA"; +2; 0; 0; 0; 0x050800 *2; s8 "THIRDVAR"; dnl Machine integer info record. 7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1252; @@ -1078,6 +1046,7 @@ dnl Long variable names. 7; 13; 1; COUNT ( "FIRSTVAR=FirstVariable"; i8 9; "SECONDVA=S"; i8 233; "condVariable"; i8 9; +"THIRDVAR=ThirdVariable"; i8 9 ); dnl Data file attributes record. @@ -1096,6 +1065,10 @@ dnl Variable attributes record. "xyzzy('quux'"; i8 10; ")"; ); +dnl Another variable attributes record. +dnl Only system files written by "Stata 14.1/-savespss- 1.77 by S.Radyakin" +dnl include multiple variable attributes records. +7; 18; 1; COUNT ("ThirdVariable:fizz('buzz'"; i8 10; ")";); dnl Character encoding record. 7; 20; 1; 12; "windows-1252"; @@ -1111,45 +1084,30 @@ DISPLAY @ATTRIBUTES. ]) AT_CHECK([pspp -o pspp.csv sys-file.sps]) AT_CHECK([cat pspp.csv], [0], -[[Variable,Description, -FirstVariable,Custom attributes:, -,$@Role,1 +[[Table: Variable and Dataset Attributes +Variable and Name,,Value +(dataset),Attr1[1],Value1 +,Attr1[2],'déclaration' +,SécondAttr[1],123 +,SécondAttr[2],456 +FirstVariable,$@Role,1 ,adèle[1],23 ,adèle[2],34 ,bert,123 -SécondVariable,Custom attributes:, -,xyzzy,quux - -Table: Custom data file attributes. -Attribute,Value -Attr1[1],Value1 -Attr1[2],'déclaration' -SécondAttr[1],123 -SécondAttr[2],456 +SécondVariable,xyzzy,quux +ThirdVariable,fizz,buzz ]]) AT_DATA([sys-file.sps], [dnl GET FILE='sys-file.sav'. DISPLAY DICTIONARY. ]) AT_CHECK([pspp -o pspp.csv sys-file.sps]) - AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], -[[Variable,Description,,Position -FirstVariable,Format: F8.0,,1 -,Role: Output,, -,Custom attributes:,, -,adèle[1],23, -,adèle[2],34, -,bert,123, -SécondVariable,Format: F8.0,,2 -,Custom attributes:,, -,xyzzy,quux, - -Table: Custom data file attributes. -Attribute,Value -Attr1[1],Value1 -Attr1[2],'déclaration' -SécondAttr[1],123 -SécondAttr[2],456 + AT_CHECK([cat pspp.csv], [0], +[[Table: Variables +Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format +FirstVariable,1,Scale,Output,8,Right,F8.0,F8.0 +SécondVariable,2,Scale,Input,8,Right,F8.0,F8.0 +ThirdVariable,3,Scale,Input,8,Right,F8.0,F8.0 ]]) done AT_CLEANUP @@ -1206,22 +1164,18 @@ DISPLAY DICTIONARY. AT_CHECK([pspp -o pspp.csv sys-file.sps], [0], [dnl warning: `sys-file.sav': Invalid role for variable x. ]) - AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl + AT_CHECK([cat pspp.csv], [0], [dnl warning: `sys-file.sav': Invalid role for variable x. -Variable,Description,,Position -i,Format: F8.0,,1 -o,Format: F8.0,,2 -,Role: Output,, -b,Format: F8.0,,3 -,Role: Both,, -n,Format: F8.0,,4 -,Role: None,, -p,Format: F8.0,,5 -,Role: Partition,, -s,Format: F8.0,,6 -,Role: Split,, -x,Format: F8.0,,7 +Table: Variables +Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format +i,1,Scale,Input,8,Right,F8.0,F8.0 +o,2,Scale,Output,8,Right,F8.0,F8.0 +b,3,Scale,Both,8,Right,F8.0,F8.0 +n,4,Scale,None,8,Right,F8.0,F8.0 +p,5,Scale,Partition,8,Right,F8.0,F8.0 +s,6,Scale,Split,8,Right,F8.0,F8.0 +x,7,Scale,Input,8,Right,F8.0,F8.0 ]) done AT_CLEANUP @@ -1234,7 +1188,7 @@ dnl File header. 2; dnl Layout code 6; dnl Nominal case size 1; dnl Simple compression -0; dnl Not weighted +0; dnl Not weighted -1; dnl Unspecified number of cases. 100.0; dnl Bias. "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file"; @@ -1250,6 +1204,9 @@ dnl String variable. 2; 15; 0; 0; 0x010f00 *2; s8 "STR15"; 2; -1; 0; 0; 0; 0; s8 ""; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl Dictionary termination record. 999; 0; @@ -1268,18 +1225,19 @@ DISPLAY DICTIONARY. LIST. ]) AT_CHECK([pspp -o pspp.csv sys-file.sps]) - AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl -Variable,Description,,Position -num1,Format: F8.0,,1 -num2,Format: F8.0,,2 -str4,Format: A4,,3 -str8,Format: A8,,4 -str15,Format: A15,,5 + AT_CHECK([cat pspp.csv], [0], [dnl +Table: Variables +Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format +num1,1,Scale,Input,8,Right,F8.0,F8.0 +num2,2,Scale,Input,8,Right,F8.0,F8.0 +str4,3,Nominal,Input,4,Left,A4,A4 +str8,4,Nominal,Input,8,Left,A8,A8 +str15,5,Nominal,Input,15,Left,A15,A15 Table: Data List num1,num2,str4,str8,str15 --99,0,,abcdefgh,0123 @&t@ -.,151,jklm,nopqrstu,vwxyzABC @&t@ +-99,0,,abcdefgh,0123 +.,151,jklm,nopqrstu,vwxyzABC 1,2,DEFG,HIJKLMNO,PQRSTUV ]) done @@ -1293,7 +1251,7 @@ dnl File header. 2; dnl Layout code 6; dnl Nominal case size 1; dnl Simple compression. -0; dnl Not weighted +0; dnl Not weighted -1; dnl Unspecified number of cases. 0.0; dnl Bias. "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file"; @@ -1309,6 +1267,9 @@ dnl String variable. 2; 15; 0; 0; 0x010f00 *2; s8 "STR15"; 2; -1; 0; 0; 0; 0; s8 ""; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl Dictionary termination record. 999; 0; @@ -1327,18 +1288,19 @@ DISPLAY DICTIONARY. LIST. ]) AT_CHECK([pspp -o pspp.csv sys-file.sps], [0]) - AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl -Variable,Description,,Position -num1,Format: F8.0,,1 -num2,Format: F8.0,,2 -str4,Format: A4,,3 -str8,Format: A8,,4 -str15,Format: A15,,5 + AT_CHECK([cat pspp.csv], [0], [dnl +Table: Variables +Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format +num1,1,Scale,Input,8,Right,F8.0,F8.0 +num2,2,Scale,Input,8,Right,F8.0,F8.0 +str4,3,Nominal,Input,4,Left,A4,A4 +str8,4,Nominal,Input,8,Left,A8,A8 +str15,5,Nominal,Input,15,Left,A15,A15 Table: Data List num1,num2,str4,str8,str15 -1,100,,abcdefgh,0123 @&t@ -.,251,jklm,nopqrstu,vwxyzABC @&t@ +1,100,,abcdefgh,0123 +.,251,jklm,nopqrstu,vwxyzABC 101,102,DEFG,HIJKLMNO,PQRSTUV ]) done @@ -1352,7 +1314,7 @@ dnl File header. 2; dnl Layout code 6; dnl Nominal case size 1; dnl Simple compression. -0; dnl Not weighted +0; dnl Not weighted -1; dnl Unspecified number of cases. 50.0; dnl Bias. "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file"; @@ -1368,6 +1330,9 @@ dnl String variable. 2; 15; 0; 0; 0x010f00 *2; s8 "STR15"; 2; -1; 0; 0; 0; 0; s8 ""; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl Dictionary termination record. 999; 0; @@ -1385,23 +1350,24 @@ GET FILE='sys-file.sav'. DISPLAY DICTIONARY. LIST. ]) - AT_CHECK([pspp -o pspp.csv sys-file.sps], [0], + AT_CHECK([pspp -o pspp.csv sys-file.sps], [0], [warning: `sys-file.sav' near offset 0x54: Compression bias is not the usual value of 100, or system file uses unrecognized floating-point format. ]) - AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl + AT_CHECK([cat pspp.csv], [0], [dnl "warning: `sys-file.sav' near offset 0x54: Compression bias is not the usual value of 100, or system file uses unrecognized floating-point format." -Variable,Description,,Position -num1,Format: F8.0,,1 -num2,Format: F8.0,,2 -str4,Format: A4,,3 -str8,Format: A8,,4 -str15,Format: A15,,5 +Table: Variables +Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format +num1,1,Scale,Input,8,Right,F8.0,F8.0 +num2,2,Scale,Input,8,Right,F8.0,F8.0 +str4,3,Nominal,Input,4,Left,A4,A4 +str8,4,Nominal,Input,8,Left,A8,A8 +str15,5,Nominal,Input,15,Left,A15,A15 Table: Data List num1,num2,str4,str8,str15 --49,50,,abcdefgh,0123 @&t@ -.,201,jklm,nopqrstu,vwxyzABC @&t@ +-49,50,,abcdefgh,0123 +.,201,jklm,nopqrstu,vwxyzABC 51,52,DEFG,HIJKLMNO,PQRSTUV ]) done @@ -1431,12 +1397,15 @@ dnl String variable. 2; 15; 0; 0; 0x010f00 *2; s8 "STR15"; 2; -1; 0; 0; 0; 0; s8 ""; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl Dictionary termination record. 999; 0; dnl ZLIB data header. -i64 0x178; # zheader_ofs -i64 0x1e9; # ztrailer_ofs +i64 0x194; # zheader_ofs +i64 0x205; # ztrailer_ofs i64 48; # ztrailer_len dnl ZLIB data block. @@ -1465,8 +1434,8 @@ i64 0; # ztrailer_zero 1; # n_blocks dnl ZLIB block descriptor: -i64 0x178; # uncompressed_ofs -i64 0x190; # compressed_ofs +i64 0x194; # uncompressed_ofs +i64 0x1ac; # compressed_ofs 88; # uncompressed_size 89; # compressed_size EOF @@ -1484,18 +1453,19 @@ DISPLAY DICTIONARY. LIST. ]) AT_CHECK([pspp -o pspp.csv sys-file.sps]) - AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0], [dnl -Variable,Description,,Position -num1,Format: F8.0,,1 -num2,Format: F8.0,,2 -str4,Format: A4,,3 -str8,Format: A8,,4 -str15,Format: A15,,5 + AT_CHECK([cat pspp.csv], [0], [dnl +Table: Variables +Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format +num1,1,Scale,Input,8,Right,F8.0,F8.0 +num2,2,Scale,Input,8,Right,F8.0,F8.0 +str4,3,Nominal,Input,4,Left,A4,A4 +str8,4,Nominal,Input,8,Left,A8,A8 +str15,5,Nominal,Input,15,Left,A15,A15 Table: Data List num1,num2,str4,str8,str15 --99,0,,abcdefgh,0123 @&t@ -.,151,jklm,nopqrstu,vwxyzABC @&t@ +-99,0,,abcdefgh,0123 +.,151,jklm,nopqrstu,vwxyzABC 1,2,DEFG,HIJKLMNO,PQRSTUV ]) done @@ -1503,6 +1473,79 @@ AT_CLEANUP AT_BANNER([system file reader - negative]) +AT_SETUP([no variables]) +AT_KEYWORDS([sack synthetic system file negative]) +AT_DATA([sys-file.sack], [dnl +dnl File header. +"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file"; +2; dnl Layout code +0; dnl Nominal case size (empty) +0; dnl Not compressed +0; dnl Not weighted +0; dnl 0 cases. +100.0; dnl Bias. +"01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file"; +i8 0 *3; + +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + +dnl Dictionary termination record. +999; 0; +]) +for variant in be le; do + AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) + AT_DATA([sys-file.sps], [dnl +GET FILE='sys-file.sav'. +]) + AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl +sys-file.sps:1: error: GET: `sys-file.sav': Data file dictionary has no variables. +]) + + dnl At one point pspp-convert would hang forever if there were no variables, + dnl so check against regression. + AT_CHECK([pspp-convert sys-file.sav sys-file.txt]) + AT_CHECK([cat sys-file.txt], [0], [ +]) +done +AT_CLEANUP + +AT_SETUP([unspecified character encoding]) +AT_KEYWORDS([sack synthetic system file positive]) +AT_DATA([sys-file.sack], [dnl +dnl File header. +"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file"; +2; dnl Layout code +4; dnl Nominal case size +0; dnl Not compressed +0; dnl Not weighted +0; dnl No cases. +100.0; dnl Bias. +"01 Jan 11"; "20:53:52"; +"PSPP synthetic test file: "; i8 244; i8 245; i8 246; i8 248; s34 ""; +i8 0 *3; + +dnl Numeric variables. +2; 0; 0; 0; 0x050800 *2; s8 "A"; +2; 0; 0; 0; 0x050800 *2; s8 "B"; +2; 0; 0; 0; 0x050800 *2; s8 "C"; +2; 0; 0; 0; 0x050800 *2; s8 "D"; + +dnl Dictionary termination record. +999; 0; +]) +for variant in be le; do + AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) + AT_DATA([sys-file.sps], [dnl +GET 'sys-file.sav'. +]) + AT_CHECK([pspp -O format=csv sys-file.sps], [0], [stdout]) + AT_CHECK([sed 's/default encoding.*For/default encoding. For/' stdout], [0], [dnl +"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." +]) +done +AT_CLEANUP + AT_SETUP([misplaced type 4 record]) AT_KEYWORDS([sack synthetic system file negative]) AT_DATA([sys-file.sack], [dnl @@ -1520,7 +1563,7 @@ for variant in be le; do AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'. ]) - AT_CHECK([pspp -O format=csv sys-file.sps], [1], + AT_CHECK([pspp -O format=csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0xd4: Misplaced type 4 record. ]) done @@ -1543,7 +1586,7 @@ for variant in be le; do AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'. ]) - AT_CHECK([pspp -O format=csv sys-file.sps], [1], + AT_CHECK([pspp -O format=csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0xd4: Unrecognized record type 8. ]) done @@ -1559,6 +1602,9 @@ dnl File header. dnl Numeric variable. 2; 0; 0; 0; 0x050800 *2; s8 "NUM1"; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl End of dictionary. 999; 0; ]) @@ -1566,7 +1612,7 @@ for variant in be le; do AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'. ]) - AT_CHECK([pspp -O format=csv sys-file.sps], [0], + AT_CHECK([pspp -O format=csv sys-file.sps], [0], [warning: `sys-file.sav': File header claims 2 variable positions but 1 were read from file. ]) done @@ -1582,6 +1628,9 @@ dnl File header. dnl Numeric variable. 2; 0; 0; 0; 0x050800 *2; s8 >>"$UM1"<<; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl End of dictionary. 999; 0; ]) @@ -1589,8 +1638,8 @@ for variant in be le; do AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'. ]) - AT_CHECK([pspp -O format=csv sys-file.sps], [1], - [error: `sys-file.sav' near offset 0xb4: Invalid variable name `$UM1'. + AT_CHECK([pspp -O format=csv sys-file.sps], 0, + [warning: `sys-file.sav' near offset 0xb4: Renaming variable with invalid name `$UM1' to `VAR001'. ]) done AT_CLEANUP @@ -1605,6 +1654,9 @@ dnl File header. dnl Numeric variable. 2; 0; 0; 0; 0x050800 *2; s8 >>"TO"<<; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl End of dictionary. 999; 0; ]) @@ -1612,8 +1664,8 @@ for variant in be le; do AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'. ]) - AT_CHECK([pspp -O format=csv sys-file.sps], [1], - [error: `sys-file.sav' near offset 0xb4: Invalid variable name `TO'. + AT_CHECK([pspp -O format=csv sys-file.sps], 0, + [warning: `sys-file.sav' near offset 0xb4: Renaming variable with invalid name `TO' to `VAR001'. ]) done AT_CLEANUP @@ -1628,6 +1680,9 @@ dnl File header. dnl String variable with invalid width 256. 2; 256; 0; 0; 0x050800 *2; s8 "VAR1"; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl End of dictionary. 999; 0; ]) @@ -1635,7 +1690,7 @@ for variant in be le; do AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'. ]) - AT_CHECK([pspp -O format=csv sys-file.sps], [1], + AT_CHECK([pspp -O format=csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0xb4: Bad width 256 for variable VAR1. ]) done @@ -1654,6 +1709,9 @@ dnl Numeric variables. 2; 0; 0; 0; 0x050800 *2; s8 "VAR1"; 2; 0; 0; 0; 0x050800 *2; s8 "VAR1"; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl End of dictionary. 999; 0; ]) @@ -1665,15 +1723,10 @@ DISPLAY DICTIONARY. AT_CHECK([pspp -O format=csv sys-file.sps], [0], [warning: `sys-file.sav' near offset 0xd4: Renaming variable with duplicate name `VAR1' to `VAR001'. -Variable,Description,,Position -var1,Format: F8.0,,1 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -var001,Format: F8.0,,2 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, +Table: Variables +Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format +var1,1,Scale,Input,8,Right,F8.0,F8.0 +var001,2,Scale,Input,8,Right,F8.0,F8.0 ]) done AT_CLEANUP @@ -1688,6 +1741,9 @@ dnl File header. dnl Numeric variable. 2; 0; >>2<<; 0; 0x050800 *2; s8 "VAR1"; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl End of dictionary. 999; 0; ]) @@ -1695,7 +1751,7 @@ for variant in be le; do AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'. ]) - AT_CHECK([pspp -O format=csv sys-file.sps], [1], + AT_CHECK([pspp -O format=csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0xb4: Variable label indicator field is not 0 or 1. ]) done @@ -1711,6 +1767,9 @@ dnl File header. dnl Numeric variable. 2; 0; 0; >>-1<<; 0x050800 *2; s8 "VAR1"; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl End of dictionary. 999; 0; ]) @@ -1718,7 +1777,7 @@ for variant in be le; do AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'. ]) - AT_CHECK([pspp -O format=csv sys-file.sps], [1], + AT_CHECK([pspp -O format=csv sys-file.sps], [1], ["error: `sys-file.sav' near offset 0xb4: Numeric missing value indicator field is not -3, -2, 0, 1, 2, or 3." ]) done @@ -1734,6 +1793,9 @@ dnl File header. dnl String variable. 2; 8; 0; >>4<<; 0x010800 *2; s8 "VAR1"; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl End of dictionary. 999; 0; ]) @@ -1741,7 +1803,7 @@ for variant in be le; do AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'. ]) - AT_CHECK([pspp -O format=csv sys-file.sps], [1], + AT_CHECK([pspp -O format=csv sys-file.sps], [1], ["error: `sys-file.sav' near offset 0xb4: String missing value indicator field is not 0, 1, 2, or 3." ]) done @@ -1758,6 +1820,9 @@ dnl String variable. 2; 10; 0; 0; 0x010a00 *2; s8 "VAR1"; >>2; 0; 0; 0; 0x050800 *2; s8 "VAR2";<< +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl End of dictionary. 999; 0; ]) @@ -1765,7 +1830,7 @@ for variant in be le; do AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'. ]) - AT_CHECK([pspp -O format=csv sys-file.sps], [1], + AT_CHECK([pspp -O format=csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0xb4: Missing string continuation record. ]) done @@ -1792,6 +1857,9 @@ dnl String variable, numeric formats. dnl String variable, wrong width formats. 2; 4; 0; 0; >>0x010800<<; >>0x020400<<; s8 "STR2"; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl End of dictionary. 999; 0; ]) @@ -1896,24 +1964,12 @@ warning: `sys-file.sav' near offset 0x257: Ignoring long string missing value re "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." -Variable,Description,,Position -num1,Format: F8.0,,1 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -str1,Format: A9,,2 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 9,, -str2,Format: A10,,3 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 10,, -,"Missing Values: ""abcdefgh""; ""ijklmnop""; ""qrstuvwx""",, -str3,Format: A11,,4 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 11,, +Table: Variables +Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values +num1,1,Scale,Input,8,Right,F8.0,F8.0, +str1,2,Nominal,Input,9,Left,A9,A9, +str2,3,Nominal,Input,10,Left,A10,A10,"""abcdefgh""; ""ijklmnop""; ""qrstuvwx""" +str3,4,Nominal,Input,11,Left,A11,A11, ]) done AT_CLEANUP @@ -1931,6 +1987,9 @@ dnl Numeric variable. dnl String variable. 2; 4; 0; 0; 0x010400 *2; s8 "STR1"; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl End of dictionary. 999; 0; ]) @@ -1940,17 +1999,12 @@ for variant in be le; do DISPLAY DICTIONARY. ]) AT_CHECK([pspp -O format=csv sys-file.sps], [0], - [warning: `sys-file.sav': Ignoring string variable `STR1' set as weighting variable. + [warning: `sys-file.sav' near offset 0x4c: Ignoring string variable `STR1' set as weighting variable. -Variable,Description,,Position -num1,Format: F8.0,,1 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -str1,Format: A4,,2 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 4,, +Table: Variables +Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format +num1,1,Scale,Input,8,Right,F8.0,F8.0 +str1,2,Nominal,Input,4,Left,A4,A4 ]) done AT_CLEANUP @@ -1968,6 +2022,9 @@ dnl Numeric variable. dnl String variable. 2; 4; 0; 0; 0x010400 *2; s8 "STR1"; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl End of dictionary. 999; 0; ]) @@ -1975,13 +2032,13 @@ for variant in be le; do AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'. ]) - AT_CHECK([pspp -O format=csv sys-file.sps], [1], - [error: `sys-file.sav' near offset 0x4c: Variable index 3 not in valid range 1...2. + AT_CHECK([pspp -O format=csv sys-file.sps], 0, + [warning: `sys-file.sav' near offset 0x4c: Weight variable index 3 not in valid range 1...2. Treating file as unweighted. ]) done AT_CLEANUP -AT_SETUP([variable index is long string contination]) +AT_SETUP([variable index is long string continuation]) AT_KEYWORDS([sack synthetic system file negative]) AT_DATA([sys-file.sack], [dnl dnl File header. @@ -1995,6 +2052,9 @@ dnl Long string variable. 2; 9; 0; 0; 0x010900 *2; s8 "STR1"; (2; -1; 0; 0; 0; 0; s8 ""); +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl End of dictionary. 999; 0; ]) @@ -2002,8 +2062,8 @@ for variant in be le; do AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'. ]) - AT_CHECK([pspp -O format=csv sys-file.sps], [1], - [error: `sys-file.sav' near offset 0x4c: Variable index 3 refers to long string continuation. + AT_CHECK([pspp -O format=csv sys-file.sps], 0, + [warning: `sys-file.sav' near offset 0x4c: Weight variable index 3 refers to long string continuation. Treating file as unweighted. ]) done AT_CLEANUP @@ -2015,42 +2075,15 @@ dnl File header. "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file"; 2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3; -dnl Numeric variable, no label or missing values. +dnl Numeric variables, no label or missing values. 2; 0; 0; 0; 0x050800 *2; s8 "NUM1"; +2; 0; 0; 0; 0x050800 *2; s8 "NUM2"; dnl Two document records. (6; 1; s80 "One line of documents") >>* 2<<; -dnl Dictionary termination record. -999; 0; - -dnl Data. -1.0; -]) -for variant in be le; do - AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) - AT_DATA([sys-file.sps], [dnl -GET FILE='sys-file.sav'. -]) - AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl -error: `sys-file.sav' near offset 0x12c: Duplicate type 6 (document) record. -]) -done -AT_CLEANUP - - -AT_SETUP([empty document record]) -AT_KEYWORDS([sack synthetic system file negative]) -AT_DATA([sys-file.sack], [dnl -dnl File header. -"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file"; -2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3; - -dnl Numeric variable, no label or missing values. -2; 0; 0; 0; 0x050800 *2; s8 "NUM1"; - -dnl Empty document record. -6; >>0<<; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; dnl Dictionary termination record. 999; 0; @@ -2063,12 +2096,13 @@ for variant in be le; do AT_DATA([sys-file.sps], [dnl GET FILE='sys-file.sav'. ]) - AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl -error: `sys-file.sav' near offset 0xd4: Number of document lines (0) must be greater than 0 and less than 26843545. + AT_CHECK([pspp -O format=csv sys-file.sps], 0, [dnl +warning: `sys-file.sav' near offset 0x14c: Duplicate type 6 (document) record. ]) done AT_CLEANUP + AT_SETUP([extension record too large]) AT_KEYWORDS([sack synthetic system file negative]) AT_DATA([sys-file.sack], [dnl @@ -2106,6 +2140,9 @@ dnl Numeric variable, no label or missing values. dnl Unknown extension record type. 7; 30; 1; 1; i8 0; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl End of dictionary. 999; 0; ]) @@ -2114,8 +2151,8 @@ for variant in be le; do AT_DATA([sys-file.sps], [dnl GET FILE='sys-file.sav'. ]) - AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl -"warning: `sys-file.sav' near offset 0xd8: Unrecognized record type 7, subtype 30. Please send a copy of this file, and the syntax which created it to bug-gnu-pspp@gnu.org." + AT_CHECK_UNQUOTED([pspp -O format=csv sys-file.sps], [0], [dnl +"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}." ]) done AT_CLEANUP @@ -2133,6 +2170,9 @@ dnl Numeric variable, no label or missing values. dnl Machine integer info record. 7; 3; 4; >>9<<; 1; 2; 3; -1; 1; 1; ENDIAN; 1252; >>1234<<; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl End of dictionary. 999; 0; ]) @@ -2160,6 +2200,9 @@ dnl Numeric variable, no label or missing values. dnl Machine integer info record. 7; 3; 4; 8; 1; 2; 3; -1; >>2<<; 1; ENDIAN; 1252; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl End of dictionary. 999; 0; ]) @@ -2187,6 +2230,9 @@ dnl Numeric variable, no label or missing values. dnl Machine integer info record. 7; 3; 4; 8; 1; 2; 3; -1; 1; 1; >>3<<; 1252; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl End of dictionary. 999; 0; ]) @@ -2200,11 +2246,9 @@ DISPLAY DICTIONARY. AT_CHECK_UNQUOTED([pspp -O format=csv sys-file.sps], [0], [dnl warning: \`sys-file.sav' near offset 0xd8: Integer format indicated by system file (3) differs from expected ($[2]). -Variable,Description,,Position -num1,Format: F8.0,,1 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, +Table: Variables +Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format +num1,1,Scale,Input,8,Right,F8.0,F8.0 ]) done AT_CLEANUP @@ -2223,6 +2267,9 @@ dnl Numeric variable, no label or missing values. dnl Machine floating-point info record. 7; 4; 8; >>4<<; SYSMIS; HIGHEST; LOWEST; 0.0; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl End of dictionary. 999; 0; ]) @@ -2250,6 +2297,9 @@ dnl Numeric variable, no label or missing values. dnl Machine floating-point info record. 7; 4; 8; 3; >>0.0<<; >>1.0<<; >>2.0<<; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl End of dictionary. 999; 0; ]) @@ -2333,36 +2383,21 @@ for variant in be le; do MRSETS /DISPLAY NAME=ALL. ]) AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl -warning: `sys-file.sav': Multiple response set name `b' does not begin with `$'. +warning: `sys-file.sav': Invalid multiple response set name `b'. -warning: `sys-file.sav': Multiple response set name `e' does not begin with `$'. +warning: `sys-file.sav': Invalid multiple response set name `e'. Table: Multiple Response Sets -Name,Variables,Details -$a,"あ +Name,Label,Encoding,Counted Value,Member Variables +$a,my mcgroup,Categories,,"あ b -c -","Multiple category set -Label: my mcgroup -" -$c,"h +c" +$c,mdgroup #2,Dichotomies,はい,"h i -j -","Multiple dichotomy set -Label: mdgroup #2 -Label source: Provided by user -Counted value: `はい' -Category label source: Variable labels -" -$d,"k +j" +$d,third mdgroup,Dichotomies,34,"k l -m -","Multiple dichotomy set -Label: third mdgroup -Label source: Provided by user -Counted value: 34 -Category label source: Value labels of counted value -" +m" ]) done AT_CLEANUP @@ -2380,6 +2415,9 @@ dnl Numeric variable, no label or missing values. dnl Multiple response sets. 7; 7; 1; COUNT("$a=Cx"); +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + 999; 0; ]) for variant in be le; do @@ -2405,6 +2443,9 @@ dnl Numeric variable, no label or missing values. dnl Multiple response sets. 7; 7; 1; COUNT("$a=Ex"); +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + 999; 0; ]) for variant in be le; do @@ -2417,6 +2458,36 @@ warning: `sys-file.sav' near offset 0xd8: Missing space following `E' at offset done AT_CLEANUP +AT_SETUP([missing label source in mrsets]) +AT_KEYWORDS([sack synthetic system file negative multiple response]) +AT_DATA([sys-file.sack], [dnl +dnl File header. +"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file"; +2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3; + +dnl Numeric variable, no label or missing values. +2; 0; 0; 0; 0x050800 *2; s8 "NUM1"; + +dnl Multiple response sets. +7; 7; 1; COUNT("$a=E "); + +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + +999; 0; +]) +for variant in be le; do + AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) + AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'. +]) + AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl +warning: `sys-file.sav' near offset 0xd8: Missing label source value following `E' at offset 5 in MRSETS record. + +warning: `sys-file.sav' near offset 0xd8: Expecting digit at offset 5 in MRSETS record. +]) +done +AT_CLEANUP + AT_SETUP([unexpected label source in mrsets]) AT_KEYWORDS([sack synthetic system file negative multiple response]) AT_DATA([sys-file.sack], [dnl @@ -2430,6 +2501,9 @@ dnl Numeric variable, no label or missing values. dnl Multiple response sets. 7; 7; 1; COUNT("$a=E 2"); +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + 999; 0; ]) for variant in be le; do @@ -2457,6 +2531,9 @@ dnl Numeric variable, no label or missing values. dnl Multiple response sets. 7; 7; 1; COUNT("$a="); +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + 999; 0; ]) for variant in be le; do @@ -2482,6 +2559,9 @@ dnl Numeric variable, no label or missing values. dnl Multiple response sets. 7; 7; 1; COUNT("$a=Dx"); +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + 999; 0; ]) for variant in be le; do @@ -2507,6 +2587,9 @@ dnl Numeric variable, no label or missing values. dnl Multiple response sets. 7; 7; 1; COUNT("$a=D1x"); +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + 999; 0; ]) for variant in be le; do @@ -2532,6 +2615,9 @@ dnl Numeric variable, no label or missing values. dnl Multiple response sets. 7; 7; 1; COUNT("$a=D4 abc"); +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + 999; 0; ]) for variant in be le; do @@ -2557,6 +2643,9 @@ dnl Numeric variable, no label or missing values. dnl Multiple response sets. 7; 7; 1; COUNT("$a=D3 abcx"); +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + 999; 0; ]) for variant in be le; do @@ -2582,6 +2671,9 @@ dnl Numeric variable, no label or missing values. dnl Multiple response sets. 7; 7; 1; COUNT("$a=C 0 NUM1"); +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + 999; 0; ]) for variant in be le; do @@ -2609,6 +2701,9 @@ dnl Numeric variable, no label or missing values. dnl Multiple response sets. 7; 7; 1; COUNT("$a=C 0 NUM1 NUM1"; i8 10); +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + 999; 0; ]) for variant in be le; do @@ -2637,6 +2732,9 @@ dnl Variables. dnl Multiple response sets. 7; 7; 1; COUNT("$a=C 0 NUM1 STR1"; i8 10); +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + 999; 0; ]) for variant in be le; do @@ -2664,6 +2762,9 @@ dnl Numeric variable, no label or missing values. dnl Multiple response sets. 7; 7; 1; COUNT("$a=C 0 NUM1"; i8 10); +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + 999; 0; ]) for variant in be le; do @@ -2689,6 +2790,9 @@ dnl Numeric variable, no label or missing values. dnl Multiple response sets. 7; 7; 1; COUNT("$a=C 0 NUM1"; i8 10; "$b=C 0 "; i8 10); +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + 999; 0; ]) for variant in be le; do @@ -2716,6 +2820,9 @@ dnl Numeric variable, no label or missing values. dnl Display parameters record. 7; 11; >>8<<; 2; 1.0; 1.0; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl End of dictionary. 999; 0; ]) @@ -2742,6 +2849,9 @@ dnl Numeric variable, no label or missing values. dnl Display parameters record. 7; 11; 4; >>4<<; 1; 1; 2; 2; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl End of dictionary. 999; 0; ]) @@ -2768,6 +2878,9 @@ dnl Numeric variable, no label or missing values. dnl Display parameters record. 7; 11; 4; 2; >>4<<; 0; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl End of dictionary. 999; 0; ]) @@ -2794,6 +2907,9 @@ dnl Numeric variable, no label or missing values. dnl Display parameters record. 7; 11; 4; 2; 1; >>-1<<; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl End of dictionary. 999; 0; ]) @@ -2820,6 +2936,9 @@ dnl Numeric variables. dnl Long variable names. 7; 13; 1; COUNT (>>"xyzzy"<<); +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl Dictionary termination record. 999; 0; ]) @@ -2850,10 +2969,15 @@ dnl Numeric variables. dnl Long variable names. 7; 13; 1; COUNT ( "LONGVARI=_Invalid"; i8 9; +"LONGVARI=$Invalid"; i8 9; +"LONGVARI=#Invalid"; i8 9; "LONGVA_A=LongVariableName"; i8 9; "LONGVA_B=LONGVARIABLENAME"; i8 9; ); +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl Dictionary termination record. 999; 0; ]) @@ -2865,6 +2989,10 @@ GET FILE='sys-file.sav'. AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl warning: `sys-file.sav' near offset 0x138: Long variable mapping from LONGVARI to invalid variable name `_Invalid'. +warning: `sys-file.sav' near offset 0x138: Long variable mapping from LONGVARI to invalid variable name `$Invalid'. + +warning: `sys-file.sav' near offset 0x138: Long variable mapping from LONGVARI to invalid variable name `#Invalid'. + warning: `sys-file.sav' near offset 0x138: Duplicate long variable name `LONGVARIABLENAME'. ]) done @@ -2887,6 +3015,9 @@ dnl Very long string map. "NUM1=00256"; i8 0; i8 9; ); +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl Dictionary termination record. 999; 0; ]) @@ -2923,6 +3054,9 @@ dnl Very long string map. "STR1=00256"; i8 0; i8 9; ); +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl Dictionary termination record. 999; 0; ]) @@ -2938,9 +3072,6 @@ done AT_CLEANUP AT_SETUP([too many value labels]) -dnl Skip the test if multiplying a small number by INT32_MAX would not -dnl cause an overflow in size_t. -AT_SKIP_IF([test $SIZEOF_SIZE_T -gt 4]) AT_KEYWORDS([sack synthetic system file negative]) AT_DATA([sys-file.sack], [dnl dnl File header. @@ -2975,6 +3106,9 @@ dnl Numeric variable. dnl Value label with missing type 4 record. 3; 1; 1.0; i8 3; s7 "one"; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl End of dictionary. >>999; 0<<; ]) @@ -3027,6 +3161,9 @@ dnl Long string variable. dnl Value label that names long string variable. 3; 1; s8 "xyzzy"; i8 3; s7 "one"; 4; 1; >>1<<; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl End of dictionary. 999; 0; ]) @@ -3035,8 +3172,82 @@ for variant in be le; do AT_DATA([sys-file.sps], [dnl GET FILE='sys-file.sav'. ]) - AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl -error: `sys-file.sav' near offset 0xf4: Value labels may not be added to long string variables (e.g. STR1) using records types 3 and 4. + AT_CHECK([pspp -O format=csv sys-file.sps], 0, [dnl +warning: `sys-file.sav' near offset 0xf4: Value labels may not be added to long string variables (e.g. STR1) using records types 3 and 4. +]) +done +AT_CLEANUP + +AT_SETUP([value label variable indexes must be in correct range]) +AT_KEYWORDS([sack synthetic system file negative]) +AT_DATA([sys-file.sack], [dnl +dnl File header. +"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file"; +2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3; + +dnl Variables. +2; 6; 0; 0; 0x010600 *2; s8 "STR1"; +2; 0; 0; 0; 0x050800 *2; s8 "NUM1"; + +dnl Value labels with bad variable indexes. +3; 1; s8 "xyzzy"; i8 3; s7 "one"; 4; 2; >>3; 4;<< +3; 1; s8 "xyzzy"; i8 3; s7 "one"; 4; 2; >>5; 6;<< +3; 1; s8 "xyzzy"; i8 3; s7 "one"; 4; 2; >>7; 8;<< + +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + +dnl End of dictionary. +999; 0; +]) +for variant in be le; do + AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) + AT_DATA([sys-file.sps], [dnl +GET FILE='sys-file.sav'. +]) + AT_CHECK([pspp -O format=csv sys-file.sps], 0, [dnl +warning: `sys-file.sav' near offset 0xf4: Value label variable index 3 not in valid range 1...2. + +warning: `sys-file.sav' near offset 0xf4: Value label variable index 4 not in valid range 1...2. + +warning: `sys-file.sav' near offset 0x11c: Value label variable index 5 not in valid range 1...2. + +warning: `sys-file.sav' near offset 0x11c: Value label variable index 6 not in valid range 1...2. + +warning: `sys-file.sav' near offset 0x144: Value label variable index 7 not in valid range 1...2. + +warning: `sys-file.sav': Suppressed 1 additional warnings for value labels. +]) +done +AT_CLEANUP + +AT_SETUP([value label variable indexes must not be long string continuation]) +AT_KEYWORDS([sack synthetic system file negative]) +AT_DATA([sys-file.sack], [dnl +dnl File header. +"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file"; +2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3; + +dnl Long string variable. +2; 9; 0; 0; 0x010900 *2; s8 "STR1"; +(2; -1; 0; 0; 0; 0; s8 ""); + +dnl Value label with long string indexes. +3; 1; s8 "xyzzy"; i8 3; s7 "one"; 4; 1; >>2;<< + +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + +dnl End of dictionary. +999; 0; +]) +for variant in be le; do + AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) + AT_DATA([sys-file.sps], [dnl +GET FILE='sys-file.sav'. +]) + AT_CHECK([pspp -O format=csv sys-file.sps], 0, [dnl +warning: `sys-file.sav' near offset 0xf4: Value label variable index 2 refers to long string continuation. ]) done AT_CLEANUP @@ -3055,6 +3266,9 @@ dnl Variables. dnl Value label that names numeric and string variables. 3; 1; s8 "xyzzy"; i8 3; s7 "one"; 4; 2; >>1; 2<<; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl End of dictionary. 999; 0; ]) @@ -3063,8 +3277,8 @@ for variant in be le; do AT_DATA([sys-file.sps], [dnl GET FILE='sys-file.sav'. ]) - AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl -"error: `sys-file.sav' near offset 0xf4: Variables associated with value label are not all of identical type. Variable STR1 is string, but variable NUM1 is numeric." + AT_CHECK([pspp -O format=csv sys-file.sps], 0, [dnl +"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." ]) done AT_CLEANUP @@ -3084,6 +3298,9 @@ dnl Duplicate value labels. 3; 1; s8 "xyzzy"; i8 3; s7 "one"; 4; 2; >>1; 1<<; 3; 1; 1.0; i8 3; s7 "one"; 4; 2; >>2; 2<<; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl End of dictionary. 999; 0; ]) @@ -3121,6 +3338,9 @@ dnl Variable attributes record. "fred('23'"; i8 10 ); +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl Dictionary termination record. 999; 0; ]) @@ -3159,6 +3379,9 @@ dnl Variable attributes record. "fred(23"; i8 10; ")" ); +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl Dictionary termination record. 999; 0; ]) @@ -3175,6 +3398,48 @@ warning: `sys-file.sav' near offset 0x106: Attribute value fred[[1]] is not quot done AT_CLEANUP +AT_SETUP([duplicate attribute name]) +AT_KEYWORDS([sack synthetic system file negative]) +AT_DATA([sys-file.sack], [dnl +dnl File header. +"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file"; +2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3; + +dnl Variables. +2; 0; 0; 0; 0x050800 *2; s8 "FIRSTVAR"; + +dnl Data file attributes record. +7; 17; 1; COUNT ( +"Attr1('value'"; i8 10; ")"; +"Attr1('value'"; i8 10; ")"; +); + +dnl Variable attributes record. +7; 18; 1; COUNT ( +"FIRSTVAR:"; + "fred('23'"; i8 10; ")"; + "fred('23'"; i8 10; ")"; +); + +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + +dnl Dictionary termination record. +999; 0; +]) +for variant in be le; do + AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) + AT_DATA([sys-file.sps], [dnl +GET FILE='sys-file.sav'. +]) + AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl +warning: `sys-file.sav' near offset 0xf6: Duplicate attribute Attr1. + +warning: `sys-file.sav' near offset 0x125: Duplicate attribute fred. +]) +done +AT_CLEANUP + AT_SETUP([bad variable name in long string value label]) AT_KEYWORDS([sack synthetic system file negative]) AT_DATA([sys-file.sack], [dnl @@ -3210,6 +3475,9 @@ COUNT("abcdefghijklmn"); COUNT("value label for `abcdefghijklmn'"); >>COUNT("abcdefghijklmn"); COUNT("another value label for `abcdefghijklmn'")<<; ); +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl Dictionary termination record. 999; 0; ]) @@ -3242,6 +3510,9 @@ dnl Numeric variables. 2; 0; 0; 0; 0x050800 *2; s8 "NUM1"; 2; 0; 0; 0; 0x050800 *2; s8 "NUM2"; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl Data. 999; 0; 1.0; 2.0; @@ -3255,7 +3526,7 @@ for variant in be le; do AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'. LIST. ]) - AT_CHECK([pspp -O format=csv sys-file.sps], [1], + AT_CHECK([pspp -O format=csv sys-file.sps], [1], [error: Error reading case from file `sys-file.sav'. Table: Data List @@ -3279,6 +3550,9 @@ dnl Numeric variables. 2; 0; 0; 0; 0x050800 *2; s8 "NUM1"; 2; 0; 0; 0; 0x050800 *2; s8 "NUM2"; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl Data. 999; 0; 1.0; 2.0; @@ -3289,8 +3563,8 @@ for variant in be le; do AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'. LIST. ]) - AT_CHECK([pspp -O format=csv sys-file.sps], [1], - [error: `sys-file.sav' near offset 0x110: File ends in partial case. + AT_CHECK([pspp -O format=csv sys-file.sps], [1], + [error: `sys-file.sav' near offset 0x12c: File ends in partial case. Table: Data List num1,num2 @@ -3310,6 +3584,9 @@ dnl Numeric variables. 2; 14; 0; 0; 0x010e00 *2; s8 "STR14"; 2; -1; 0; 0; 0; 0; s8 ""; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl Data. 999; 0; s14 "one data item"; @@ -3320,12 +3597,12 @@ for variant in be le; do AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'. LIST. ]) - AT_CHECK([pspp -O format=csv sys-file.sps], [1], - [error: `sys-file.sav' near offset 0x10e: Unexpected end of file. + AT_CHECK([pspp -O format=csv sys-file.sps], [1], + [error: `sys-file.sav' near offset 0x12a: Unexpected end of file. Table: Data List str14 -one data item @&t@ +one data item ]) done AT_CLEANUP @@ -3338,7 +3615,7 @@ dnl File header. 2; dnl Layout code 6; dnl Nominal case size 1; dnl Compressed -0; dnl Not weighted +0; dnl Not weighted -1; dnl Unspecified number of cases. 100.0; dnl Bias. "01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file"; @@ -3354,6 +3631,9 @@ dnl String variable. 2; 15; 0; 0; 0x010f00 *2; s8 "STR15"; 2; -1; 0; 0; 0; 0; s8 ""; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl Dictionary termination record. 999; 0; @@ -3365,12 +3645,12 @@ for variant in be le; do AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'. LIST. ]) - AT_CHECK([pspp -O format=csv sys-file.sps], [1], - [error: `sys-file.sav' near offset 0x190: File ends in partial case. + AT_CHECK([pspp -O format=csv sys-file.sps], [1], + [error: `sys-file.sav' near offset 0x1ac: File ends in partial case. Table: Data List num1,num2,str4,str8,str15 --99,0,,abcdefgh,0123 @&t@ +-99,0,,abcdefgh,0123 ]) done AT_CLEANUP @@ -3382,7 +3662,7 @@ for variant in be le; do AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'. ]) - AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x178: Wrong ZLIB data header offset 0 (expected 0x178). + 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). ]) done AT_CLEANUP @@ -3394,7 +3674,7 @@ for variant in be le; do AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'. ]) - AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x178: Impossible ZLIB trailer offset 0x0. + AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x194: Impossible ZLIB trailer offset 0x0. ]) done AT_CLEANUP @@ -3408,7 +3688,7 @@ for variant in be le; do AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'. ]) - AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x178: Invalid ZLIB trailer length 12. + AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x194: Invalid ZLIB trailer length 12. ]) done AT_CLEANUP @@ -3421,8 +3701,8 @@ for variant in be le; do AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'. ]) - AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [warning: `sys-file.sav' near offset 0x190: End of ZLIB trailer (0x231) is not file size (0x219). -error: `sys-file.sav' near offset 0x201: 72-byte ZLIB trailer specifies 1 data blocks (expected 2). + 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). +error: `sys-file.sav' near offset 0x21d: 72-byte ZLIB trailer specifies 1 data blocks (expected 2). ]) done AT_CLEANUP @@ -3434,7 +3714,7 @@ for variant in be le; do AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'. ]) - AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x1f1: ZLIB trailer bias (0) differs from file header bias (100.00). + 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). ]) done AT_CLEANUP @@ -3446,7 +3726,7 @@ for variant in be le; do AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'. ]) - AT_CHECK([pspp -o pspp.csv sys-file.sps], [0], [warning: `sys-file.sav' near offset 0x1f9: ZLIB trailer "zero" field has nonzero value 100. + 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. ]) done AT_CLEANUP @@ -3458,7 +3738,7 @@ for variant in be le; do AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'. ]) - AT_CHECK([pspp -o pspp.csv sys-file.sps], [0], [warning: `sys-file.sav' near offset 0x1fd: ZLIB trailer specifies unexpected 4096-byte block size. + 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. ]) done AT_CLEANUP @@ -3470,7 +3750,7 @@ for variant in be le; do AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'. ]) - AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x201: 48-byte ZLIB trailer specifies 2 data blocks (expected 1). + 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). ]) done AT_CLEANUP @@ -3482,7 +3762,7 @@ for variant in be le; do AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'. ]) - AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x201: ZLIB block descriptor 0 reported uncompressed data offset 0x177, when 0x178 was expected. + 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. ]) done AT_CLEANUP @@ -3494,7 +3774,7 @@ for variant in be le; do AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'. ]) - AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x201: ZLIB block descriptor 0 reported compressed data offset 0x191, when 0x190 was expected. + 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. ]) done AT_CLEANUP @@ -3523,12 +3803,15 @@ dnl String variable. 2; 15; 0; 0; 0x010f00 *2; s8 "STR15"; 2; -1; 0; 0; 0; 0; s8 ""; +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + dnl Dictionary termination record. 999; 0; dnl ZLIB data header. -i64 0x178; # zheader_ofs -i64 0x190; # ztrailer_ofs +i64 0x194; # zheader_ofs +i64 0x1ac; # ztrailer_ofs i64 72; # ztrailer_len dnl This is where the ZLIB data blocks would go, but we don't need any to @@ -3541,14 +3824,14 @@ i64 0; # ztrailer_zero 2; # n_blocks dnl ZLIB block descriptor 1: -i64 0x178; # uncompressed_ofs -i64 0x190; # compressed_ofs +i64 0x194; # uncompressed_ofs +i64 0x1ac; # compressed_ofs 0x100000; # uncompressed_size 0x12345; # compressed_size dnl ZLIB block descriptor 2: -i64 0x100178; # uncompressed_ofs -i64 0x12405; # compressed_ofs +i64 0x100194; # uncompressed_ofs +i64 0x12421; # compressed_ofs 0x100000; # uncompressed_size 0x12345; # compressed_size ]) @@ -3556,8 +3839,8 @@ for variant in be le; do AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'. ]) - AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [warning: `sys-file.sav' near offset 0x1a8: ZLIB block descriptor 0 reported block size 0x100000, when 0x3ff000 was expected. -error: `sys-file.sav' near offset 0x1c0: ZLIB block descriptor 1 reported compressed data offset 0x12405, when 0x124d5 was expected. + 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. +error: `sys-file.sav' near offset 0x1dc: ZLIB block descriptor 1 reported compressed data offset 0x12421, when 0x124f1 was expected. ]) done AT_CLEANUP @@ -3569,7 +3852,7 @@ for variant in be le; do AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'. ]) - AT_CHECK([pspp -o pspp.csv sys-file.sps], [0], [warning: `sys-file.sav' near offset 0x201: ZLIB block descriptor 0 reported block size 0x400000, when at most 0x3ff000 was expected. + 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. ]) done AT_CLEANUP @@ -3582,7 +3865,7 @@ for variant in be le; do AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'. ]) - AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x201: ZLIB block descriptor 0 reports compressed size 100 and uncompressed size 50. + 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. ]) done AT_CLEANUP @@ -3594,7 +3877,33 @@ for variant in be le; do AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'. ]) - AT_CHECK([pspp -o pspp.csv sys-file.sps], [1], [error: `sys-file.sav' near offset 0x219: ZLIB trailer is at offset 0x1e9 but 0x1e8 would be expected from block descriptors. + 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. ]) done AT_CLEANUP + +# CVE-2017-10791. +# See also https://bugzilla.redhat.com/show_bug.cgi?id=1467004. +# See also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=866890. +# See also https://security-tracker.debian.org/tracker/CVE-2017-10791. +# Found by team OWL337, using the collAFL fuzzer. +AT_SETUP([integer overflows in long string missing values]) +AT_KEYWORDS([system file negative]) +cp $top_srcdir/tests/data/CVE-2017-10791.sav . +AT_CHECK([pspp-convert -O csv -e ASCII CVE-2017-10791.sav -], [0], [], [dnl +`CVE-2017-10791.sav' near offset 0x217: Extension record subtype 21 ends unexpectedly. +]) +AT_CLEANUP + +# CVE-2017-10792. +# See also https://bugzilla.redhat.com/show_bug.cgi?id=1467005. +# See also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=866890. +# See also https://security-tracker.debian.org/tracker/CVE-2017-10792. +# Reported by team OWL337, with fuzzer collAFL. +AT_SETUP([null dereference skipping bad extension record 18]) +AT_KEYWORDS([system file negative]) +cp $top_srcdir/tests/data/CVE-2017-10792.sav . +AT_CHECK([pspp-convert -O csv -e ASCII CVE-2017-10792.sav -], [0], [], [dnl +`CVE-2017-10792.sav' near offset 0x1c0: Record type 7, subtype 18 has bad size 4 (expected 1). +]) +AT_CLEANUP