X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=tests%2Fdata%2Fsys-file.at;h=3eaa0c51238dcc11ca960d6d38753a309ac68172;hb=691a034d7f2139076fa012739dffd40ef5db4a9b;hp=c321180a72d8f9ddf7ff523a4890c6bf654d0caf;hpb=b9fef27879f4ed4c19a612fe0f1dc2abaa623832;p=pspp diff --git a/tests/data/sys-file.at b/tests/data/sys-file.at index c321180a72..3eaa0c5123 100644 --- a/tests/data/sys-file.at +++ b/tests/data/sys-file.at @@ -1,9 +1,27 @@ -AT_BANNER([system files]) +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 files]) # Also tests that long variable names are preserved by SAVE and GET. AT_SETUP([write and read numeric data]) AT_KEYWORDS([SAVE GET system file]) -AT_DATA([sysfile.sps], [dnl +for variant in 'UNCOMPRESSED $FL2' 'ZCOMPRESSED $FL3'; do + set $variant + compression=$1 magic=$2 + cat >sysfile.sps <sysfile.sps < /dev/null | od | sed '1q' > com.txt]) -dnl Allow big- or little-endian format. +dnl Make sure file really was compressd, allowing big- or little-endian format. +AT_CHECK([dd if=com.sav bs=1 skip=72 count=4 2> /dev/null > com.sav.subset]) +od com.sav.subset AT_CHECK( - [(echo '0000000 000000 000001' | diff com.txt -) || - (echo '0000000 000001 000000' | diff com.txt -)], [0], + [(printf '\000\000\000\001' | cmp -l com.sav.subset -) || + (printf '\001\000\000\000' | cmp -l com.sav.subset -)], [0], [ignore]) -AT_CAPTURE_FILE([com.txt]) AT_CLEANUP AT_SETUP([overwriting system file]) @@ -125,7 +198,7 @@ LIST. ]) AT_CHECK([pspp -O format=csv save3.sps], [0], [dnl Table: Data List -X,Y +x,y 3,9.00 ]) AT_CLEANUP @@ -196,11 +269,11 @@ LIST. ]) AT_CHECK([pspp -o pspp.csv get.sps]) AT_CHECK([cat pspp.csv], [0], [dnl -Variable,Label,,Position -cont,continents of the world,,1 -size,sq km,,2 -pop,population,,3 -count,number of countries,,4 +Variable,Label,Position +cont,continents of the world,1 +size,sq km,2 +pop,population,3 +count,number of countries,4 Table: Data List cont,size,pop,count @@ -258,29 +331,21 @@ AT_BANNER([system files -- very long strings]) AT_SETUP([read very long strings written by SPSS 13]) AT_CHECK([cp $top_srcdir/tests/data/v13.sav .]) AT_DATA([sys-file.sps], [dnl -GET FILE='v13.sav'. +GET FILE='v13.sav' ENCODING='utf-8'. DISPLAY VARIABLES. LIST. ]) AT_CHECK([pspp -o pspp.csv sys-file.sps]) AT_CHECK([cat pspp.csv], [0], [dnl -Variable,Description,,Position -N,Format: F8.2,,1 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 10,, -A255,Format: A255,,2 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 32,, -A258,Format: A258,,3 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 32,, -A2000,Format: A2000,,4 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 32,, +Variable,Description,Position +N,"Format: F8.2 +Display Width: 10",1 +A255,"Format: A255 +Display Width: 32",2 +A258,"Format: A258 +Display Width: 32",3 +A2000,"Format: A2000 +Display Width: 32",4 Table: Data List N,A255,A258,A2000 @@ -292,29 +357,21 @@ AT_CLEANUP AT_SETUP([read very long strings written by SPSS 14]) AT_CHECK([cp $top_srcdir/tests/data/v14.sav .]) AT_DATA([sys-file.sps], [dnl -GET FILE='v14.sav'. +GET FILE='v14.sav' ENCODING='utf-8'. DISPLAY VARIABLES. LIST. ]) AT_CHECK([pspp -o pspp.csv sys-file.sps]) AT_CHECK([cat pspp.csv], [0], [dnl -Variable,Description,,Position -vl255,Format: A255,,1 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 26,, -vl256,Format: A256,,2 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 26,, -vl1335,Format: A1335,,3 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 26,, -vl2000,Format: A2000,,4 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 26,, +Variable,Description,Position +vl255,"Format: A255 +Display Width: 26",1 +vl256,"Format: A256 +Display Width: 26",2 +vl1335,"Format: A1335 +Display Width: 26",3 +vl2000,"Format: A2000 +Display Width: 26",4 Table: Data List vl255,vl256,vl1335,vl2000 @@ -358,25 +415,84 @@ EXECUTE. ]) AT_CHECK([pspp -o pspp.csv get.sps]) AT_CHECK([cat pspp.csv], [0], [dnl -Variable,Description,,Position -a,Format: A10,,1 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 10,, -b,Format: A256,,2 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 32,, -c,Format: A200,,3 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 32,, -d,Format: A32767,,4 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 32,, +Variable,Description,Position +a,Format: A10,1 +b,Format: A256,2 +c,Format: A200,3 +d,Format: A32767,4 ]) AT_CLEANUP]) VLS_WRITE([UNCOMPRESSED]) VLS_WRITE([COMPRESSED]) + +dnl This test writes non-ASCII characters to most of the string fields in +dnl a .sav file and demonstrates that they are properly read back in. +dnl XXX mrsets tests are missing. +AT_SETUP([system file character encoding]) +AT_CHECK([i18n-test supports_encodings windows-1252]) +AT_DATA([save.sps], [dnl +SET LOCALE='windows-1252'. +DATA LIST LIST NOTABLE /àéîöçxyzabc * roué (A9) croûton (A1000). +FILE LABEL 'clientèle confrère cortège crèche'. +DOCUMENT coördinate smörgåsbord +épée séance soufflé soirée +jalapeño vicuña. +VALUE LABEL + /àéîöçxyzabc 1 'éclair élan' + /roué 'abcdefghi' 'sauté précis'. +VARIABLE LABEL + roué 'Provençal soupçon'. +DATAFILE ATTRIBUTE + ATTRIBUTE=Furtwängler('kindergärtner'). +VARIABLE ATTRIBUTE + VARIABLES=àéîöçxyzabc + ATTRIBUTE=Atatürk('Düsseldorf Gewürztraminer'). +BEGIN DATA. +1 a x +2 b y +3 c z +END DATA. +SAVE OUTFILE='foo.sav'. +]) +AT_CHECK([pspp -O format=csv save.sps]) +AT_DATA([get.sps], [dnl +GET FILE='foo.sav'. +DISPLAY FILE LABEL. +DISPLAY DOCUMENTS. +DISPLAY DICTIONARY. +]) +AT_CHECK([pspp -o pspp.csv get.sps]) +AT_CHECK([[sed 's/(Entered [^)]*)/(Entered )/' pspp.csv]], [0], [dnl +File label: clientèle confrère cortège crèche + +Documents in the active dataset: + +DOCUMENT coördinate smörgåsbord + +épée séance soufflé soirée + +jalapeño vicuña. + +(Entered ) + +Variable,Description,Position +àéîöçxyzabc,"Format: F8.2 + +Value,Label +1.00,éclair élan + +Attribute,Value +Atatürk,Düsseldorf Gewürztraminer",1 +roué,"Label: Provençal soupçon +Format: A9 + +Value,Label +abcdefghi,sauté précis",2 +croûton,Format: A1000,3 + +Table: Custom data file attributes. +Attribute,Value +Furtwängler,kindergärtner +]) +AT_CLEANUP