X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=tests%2Fdata%2Fpor-file.at;h=fb73a50ee20bb094c8854de9e0920153e2e78135;hb=c0a1222e44261bf5c75707d6203a26a0da93ead3;hp=e3ddab4bec7d33e3852f10ca5fdde4b8ed991ca3;hpb=b9fef27879f4ed4c19a612fe0f1dc2abaa623832;p=pspp diff --git a/tests/data/por-file.at b/tests/data/por-file.at index e3ddab4bec..fb73a50ee2 100644 --- a/tests/data/por-file.at +++ b/tests/data/por-file.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([portable files]) AT_SETUP([overwriting portable file]) @@ -63,3 +79,82 @@ X,Y 2,4.00 ]) AT_CLEANUP + +dnl This checks for a bug in the portable file writer that caused an infinite +dnl loop in some cases, and other problems in other cases, when a variable +dnl had value labels. +AT_SETUP([write portable file with value labels]) +AT_DATA([export.sps], [dnl +DATA LIST NOTABLE/var1 TO var5 1-5. +VALUE LABELS + /var1 1 'one' + /var2 2 'two' + /var3 3 'three' + /var4 4 'four' + /var5 5 'five'. +BEGIN DATA. +12345 +END DATA. +EXPORT OUTFILE='data.por'. +]) +AT_CHECK([pspp -O format=csv export.sps]) +AT_DATA([import.sps], [dnl +IMPORT FILE='data.por'. +EXECUTE. +DISPLAY DICTIONARY. +LIST. +]) +AT_CHECK([pspp -O format=csv import.sps], [0], [dnl +Table: Variables +Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format +VAR1,1,Nominal,Input,8,Right,F1.0,F1.0 +VAR2,2,Nominal,Input,8,Right,F1.0,F1.0 +VAR3,3,Nominal,Input,8,Right,F1.0,F1.0 +VAR4,4,Nominal,Input,8,Right,F1.0,F1.0 +VAR5,5,Nominal,Input,8,Right,F1.0,F1.0 + +Table: Value Labels +Variable Value,,Label +VAR1,1,one +VAR2,2,two +VAR3,3,three +VAR4,4,four +VAR5,5,five + +Table: Data List +VAR1,VAR2,VAR3,VAR4,VAR5 +1,2,3,4,5 +]) +AT_DATA([sys-file-info.sps], [SYSFILE INFO FILE='data.por' +]) +AT_CHECK([pspp -O format=csv sys-file-info.sps | sed '/Encoding/d +/Integer Format/d +/Real Format/d +/Created/d +/Product/d +'], [0], [dnl +Table: File Information +File,data.por +Variables,5 +Cases,Unknown +Type,SPSS Portable File +Weight,Not weighted +Compression,None + +Table: Variables +Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format +VAR1,1,Unknown,Input,8,Right,F1.0,F1.0 +VAR2,2,Unknown,Input,8,Right,F1.0,F1.0 +VAR3,3,Unknown,Input,8,Right,F1.0,F1.0 +VAR4,4,Unknown,Input,8,Right,F1.0,F1.0 +VAR5,5,Unknown,Input,8,Right,F1.0,F1.0 + +Table: Value Labels +Variable Value,,Label +VAR1,1,one +VAR2,2,two +VAR3,3,three +VAR4,4,four +VAR5,5,five +]) +AT_CLEANUP