X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=tests%2Flanguage%2Fstats%2Fautorecode.at;h=fdd7c33e6bfe6c8de63d87bff76237a2455ebc88;hb=c70c924972443e3ec2713e421815cbf959af2582;hp=c3d8d3cc7745e4ca2396059a46640eec58bb0a3b;hpb=dfe6c9dc498c67115aa489adeb8c7a74a5e5b0ad;p=pspp diff --git a/tests/language/stats/autorecode.at b/tests/language/stats/autorecode.at index c3d8d3cc77..fdd7c33e6b 100644 --- a/tests/language/stats/autorecode.at +++ b/tests/language/stats/autorecode.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([AUTORECODE procedure]) AT_SETUP([AUTORECODE numbers and short strings]) @@ -87,23 +103,18 @@ oojars ,5.00,1.00 thingummies ,6.00,3.00 oojimiflips ,7.00,2.00 -Variable,Description,,Position -s,Format: A16,,1 -,Measure: Nominal,, -,Display Alignment: Left,, -,Display Width: 16,, -x,Format: F8.2,,2 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -new,Format: F8.2,,3 -,Measure: Scale,, -,Display Alignment: Right,, -,Display Width: 8,, -,1.00,oojars, -,2.00,oojimiflips, -,3.00,thingummies, -,4.00,widgets, +Table: Variables +Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values +s,1,,Nominal,Input,16,Left,A16,A16, +x,2,,Scale,Input,8,Right,F8.2,F8.2, +new,3,,Scale,Input,8,Right,F8.2,F8.2, + +Table: Value Labels +Variable,Value,Label +new,1.00,oojars +,2.00,oojimiflips +,3.00,thingummies +,4.00,widgets ]) AT_CLEANUP @@ -237,3 +248,78 @@ a,b,c,y ]) AT_CLEANUP + +dnl AUTORECODE had a use-after-free error when TEMPORARY was in use. +dnl Bug #32757. +AT_SETUP([AUTORECODE with TEMPORARY]) +AT_DATA([autorecode.sps], + [data list /X 1-5(a) Y 7. +begin data. +lasdj 1 +asdfk 0 +asdfj 2 +asdfj 1 +asdfk 2 +asdfj 9 +lajks 9 +asdfk 0 +asdfk 1 +end data. + +temporary. +select if y > 1. +autorecode x y into A B/descend. +list. +]) +AT_CHECK([pspp -O format=csv autorecode.sps], [0], + [Table: Reading 1 record from INLINE. +Variable,Record,Columns,Format +X,1,1- 5,A5 +Y,1,7- 7,F1.0 + +Table: Data List +X,Y,A,B +lasdj,1,. ,. @&t@ +asdfk,0,2.00,. @&t@ +asdfj,2,3.00,2.00 +asdfj,1,3.00,. @&t@ +asdfk,2,2.00,2.00 +asdfj,9,3.00,1.00 +lajks,9,1.00,1.00 +asdfk,0,2.00,. @&t@ +asdfk,1,2.00,. @&t@ +]) +AT_CLEANUP + + +dnl For compatibility, make sure that /INTO (with leading slash) is accepted +dnl (bug #48762) +AT_SETUP([AUTORECODE with /INTO]) +AT_DATA([autorecode.sps], + [data list list notable /x . +begin data. +1 +8 +-901 +4 +1 +99 +8 +end data. + +autorecode x /into y. + +list. +]) +AT_CHECK([pspp -O format=csv autorecode.sps], [0], +[Table: Data List +x,y +1.00,2.00 +8.00,4.00 +-901.00,1.00 +4.00,3.00 +1.00,2.00 +99.00,5.00 +8.00,4.00 +]) +AT_CLEANUP