X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=tests%2Fdata%2Fsys-file-reader.at;h=2cdbc330846d7cf72ebb964b9a0f683e2ba1f5c8;hb=952bce971f10482c5f2fdc64582f48aea1238f27;hp=a22ecfa56b28b7bf4c67a76bed56f4e75ad2458a;hpb=5cab4cf3322f29c0ed7134d23740e07382914f20;p=pspp diff --git a/tests/data/sys-file-reader.at b/tests/data/sys-file-reader.at index a22ecfa56b..2cdbc33084 100644 --- a/tests/data/sys-file-reader.at +++ b/tests/data/sys-file-reader.at @@ -1,16 +1,16 @@ dnl PSPP - a program for statistical analysis. dnl Copyright (C) 2017 Free Software Foundation, Inc. -dnl +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 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 dnl You should have received a copy of the GNU General Public License dnl along with this program. If not, see . dnl @@ -189,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"; @@ -209,7 +209,7 @@ 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]) @@ -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"; @@ -263,7 +263,7 @@ 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]) @@ -294,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"; @@ -477,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"; @@ -538,7 +538,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"; @@ -585,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"; @@ -699,7 +699,7 @@ dnl Character encoding record. 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'. @@ -726,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"; @@ -809,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"; @@ -892,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"; @@ -959,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"; @@ -1028,7 +1028,7 @@ dnl File header. 2; dnl Layout code 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"; @@ -1188,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"; @@ -1251,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"; @@ -1314,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"; @@ -1350,7 +1350,7 @@ 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([cat pspp.csv], [0], [dnl @@ -1563,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 @@ -1586,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 @@ -1612,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 @@ -1638,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 @@ -1664,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 @@ -1690,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 @@ -1751,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 @@ -1777,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 @@ -1803,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 @@ -1830,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 @@ -1999,7 +1999,7 @@ 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. Table: Variables Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values @@ -2032,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. @@ -2062,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 @@ -2075,18 +2075,19 @@ 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 Character encoding record. 7; 20; 1; 12; "windows-1252"; +dnl Dictionary termination record. +999; 0; + dnl Data. 1.0; ]) @@ -2095,8 +2096,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 0x12c: Duplicate type 6 (document) record. + 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 @@ -3171,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 @@ -3202,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 @@ -3451,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 @@ -3488,7 +3563,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: `sys-file.sav' near offset 0x12c: File ends in partial case. Table: Data List @@ -3522,7 +3597,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: `sys-file.sav' near offset 0x12a: Unexpected end of file. Table: Data List @@ -3540,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"; @@ -3570,7 +3645,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: `sys-file.sav' near offset 0x1ac: File ends in partial case. Table: Data List