X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=tests%2Fdata%2Fsys-file-reader.at;h=1a376bdc631c1329d400ea85eeb1a601bb945d5e;hb=d7ab350db46e9e410119723b14a6f2783279bd2a;hp=ca45de3792770e57e628ec1ea41ae2cfe908b9cc;hpb=de8fc417b1268addaa8b65f7be78c80c61bc0b7d;p=pspp diff --git a/tests/data/sys-file-reader.at b/tests/data/sys-file-reader.at index ca45de3792..1a376bdc63 100644 --- a/tests/data/sys-file-reader.at +++ b/tests/data/sys-file-reader.at @@ -131,7 +131,7 @@ 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 +numàèìñò,Format: F8.0,,10 ,Missing Values: LOWEST THRU 1; 5,, str1,Format: A4,,11 str2,String variable 2's label,,12 @@ -151,7 +151,7 @@ str8,25-byte string,,18 ,Format: A25,, Table: Data List -num1,num2,num3,num4,num5,num6,num7,num8,num9,numÀÈÌÑÒ,str1,str2,str3,str4,str5,str6,str7,str8 +num1,num2,num3,num4,num5,num6,num7,num8,num9,numàèìñò,str1,str2,str3,str4,str5,str6,str7,str8 1,2,3,4,5,6,7,8,9,10,abcd,efgh,ijkl,mnop,qrst,uvwx,yzABCDEFGHI,JKLMNOPQRSTUVWXYZ01234567 ]) done @@ -1014,11 +1014,11 @@ 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 +séq256,Format: A256,,1 str600,Format: A600,,2 Table: Data List -sÉq256,str600 +séq256,str600 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@a,abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#abcdefghijklmnopqrstuvwxyz ]) done @@ -1062,6 +1062,7 @@ dnl Variable attributes record. "FirstVariable:"; "ad"; i8 232; "le('23'"; i8 10; "'34'"; i8 10; ")"; "bert('123'"; i8 10; ")"; + "$@Role('1'"; i8 10; ")"; "/S"; i8 233; "condVariable:"; "xyzzy('quux'"; i8 10; ")"; ); @@ -1074,36 +1075,138 @@ dnl Dictionary termination record. 999; 0; ]) for variant in \ - "be c7cae57af35662acec3b945abcf7927c" \ - "le eb6b4ab9c27bfa0daa49bf2770bccb70" + "be 7fff0c04f697adf45f55d8be4aaa8712" \ + "le 7331339199344aa58bc60d7d05d538a7" do set $variant AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2] ]) AT_DATA([sys-file.sps], [dnl GET FILE='sys-file.sav'. -DISPLAY ATTRIBUTES. +DISPLAY @ATTRIBUTES. ]) AT_CHECK([pspp -o pspp.csv sys-file.sps]) AT_CHECK([cat pspp.csv], [0], [[Variable,Description, FirstVariable,Custom attributes:, -,bert,123 +,$@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 +]]) + 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 ]]) done AT_CLEANUP +AT_SETUP([variable roles]) +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 +7; dnl Nominal case size +0; dnl Not compressed +0; dnl Not weighted +0; dnl 1 case. +100.0; dnl Bias. +"01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file"; +i8 0 *3; + +dnl Variables. +2; 0; 0; 0; 0x050800 *2; s8 "I"; +2; 0; 0; 0; 0x050800 *2; s8 "O"; +2; 0; 0; 0; 0x050800 *2; s8 "B"; +2; 0; 0; 0; 0x050800 *2; s8 "N"; +2; 0; 0; 0; 0x050800 *2; s8 "P"; +2; 0; 0; 0; 0x050800 *2; s8 "S"; +2; 0; 0; 0; 0x050800 *2; s8 "X"; + +dnl Machine integer info record. +7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1252; + +dnl Variable attributes record. +7; 18; 1; COUNT ( +"I:$@Role('0'"; i8 10; ")"; +"/O:$@Role('1'"; i8 10; ")"; +"/B:$@Role('2'"; i8 10; ")"; +"/N:$@Role('3'"; i8 10; ")"; +"/P:$@Role('4'"; i8 10; ")"; +"/S:$@Role('5'"; i8 10; ")"; +"/X:$@Role('6'"; i8 10; ")"; +); + +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + +dnl Dictionary termination record. +999; 0; +]) +for variant in \ + "be b08b39cd005682f680d132d272f5158d" \ + "le 176e4ac91197f5cb8732258033cfabdc" +do + set $variant + AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2] +]) + AT_DATA([sys-file.sps], [dnl +GET FILE='sys-file.sav'. +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 +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 +]) +done +AT_CLEANUP + AT_SETUP([compressed data]) AT_KEYWORDS([sack synthetic system file positive]) AT_DATA([sys-file.sack], [dnl @@ -1612,40 +1715,17 @@ do done AT_CLEANUP -AT_SETUP([unknown variable format]) +AT_SETUP([invalid variable format]) 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 Numeric variable. -2; 0; 0; 0; >>0xff0800<< *2; s8 "VAR1"; - -dnl End of dictionary. -999; 0; -]) -for variant in \ - "be fcf94b3ff11b7e2ff50c226b609cff1e" \ - "le 88fc97cc80d5a170e53a7cc89e204b0d" -do - set $variant - AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2] -]) - 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 0xc0: Unknown variable format 255. -]) -done -AT_CLEANUP +2; 4; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3; -AT_SETUP([invalid numeric variable format]) -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; 3; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3; +dnl Numeric variable, invalid format types. +dnl No warning is issued for type 0 because it has been observed in real +dnl system files. +2; 0; 0; 0; >>0xff0800; 0<<; s8 "NUM1"; dnl Numeric variable, string formats. 2; 0; 0; 0; >>0x010800<<; >>0x021000<<; s8 "VAR1"; @@ -1660,26 +1740,28 @@ dnl End of dictionary. 999; 0; ]) for variant in \ - "be 0c36a39ec9118eb4a83f10a9483b5a37" \ - "le 1d498d60eeb2c88e0479f113fb3ffe4b" + "be c6ef5d8fded46443aba89adfafe15cad" \ + "le fccaf1764c973892f2d5adbcc2c36fb7" do set $variant AT_CHECK_UNQUOTED([sack --$[1] sys-file.sack > sys-file.sav], [0], [], [$[2] ]) AT_DATA([sys-file.sps], [GET FILE='sys-file.sav'. ]) - AT_CHECK([pspp -O format=csv sys-file.sps], [0], - [warning: `sys-file.sav' near offset 0xc0: Numeric variable VAR1 has invalid print format A8. + AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl +warning: `sys-file.sav' near offset 0xc0: Variable NUM1 with width 0 has invalid print format 0xff0800. -warning: `sys-file.sav' near offset 0xc4: Numeric variable VAR1 has invalid write format AHEX16. +warning: `sys-file.sav' near offset 0xe0: Variable VAR1 with width 0 has invalid print format 0x10800. -warning: `sys-file.sav' near offset 0xe0: String variable STR1 has invalid print format F8.0. +warning: `sys-file.sav' near offset 0xe4: Variable VAR1 with width 0 has invalid write format 0x21000. -warning: `sys-file.sav' near offset 0xe4: String variable STR1 has invalid write format E10.1. +warning: `sys-file.sav' near offset 0x100: Variable STR1 with width 4 has invalid print format 0x50800. -warning: `sys-file.sav' near offset 0x100: String variable STR2 has invalid print format A8. +warning: `sys-file.sav' near offset 0x104: Variable STR1 with width 4 has invalid write format 0x110a01. -warning: `sys-file.sav' near offset 0x104: String variable STR2 has invalid write format AHEX4. +warning: `sys-file.sav' near offset 0x120: Variable STR2 with width 4 has invalid print format 0x10800. + +warning: `sys-file.sav' near offset 0x124: Variable STR2 with width 4 has invalid write format 0x20400. ]) done AT_CLEANUP @@ -2065,12 +2147,12 @@ do ]) 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: File specifies unexpected value 0 as SYSMIS. + AT_CHECK([pspp -O format=csv sys-file.sps | sed 's/ [(].*/.../'], [0], [dnl +"warning: `sys-file.sav' near offset 0xd8: File specifies unexpected value 0... -warning: `sys-file.sav' near offset 0xd8: File specifies unexpected value 1 as HIGHEST. +"warning: `sys-file.sav' near offset 0xd8: File specifies unexpected value 1... -warning: `sys-file.sav' near offset 0xd8: File specifies unexpected value 2 as LOWEST. +"warning: `sys-file.sav' near offset 0xd8: File specifies unexpected value 2... ]) done AT_CLEANUP @@ -2375,7 +2457,7 @@ do 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 new-line parsing variable names at offset 14 in MRSETS record. +warning: `sys-file.sav' near offset 0xd8: Missing new-line parsing variable names at offset 13 in MRSETS record. warning: `sys-file.sav' near offset 0xd8: MRSET $a has only 1 variables. ]) @@ -3007,9 +3089,9 @@ do GET FILE='sys-file.sav'. ]) AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl -warning: `sys-file.sav' near offset 0xdf: Error parsing attribute value Attr1[[1]]. +warning: `sys-file.sav' near offset 0xde: Error parsing attribute value Attr1[[1]]. -warning: `sys-file.sav' near offset 0x102: Error parsing attribute value fred[[2]]. +warning: `sys-file.sav' near offset 0x101: Error parsing attribute value fred[[2]]. ]) done AT_CLEANUP