X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=tests%2Flanguage%2Fstats%2Fdescriptives.at;h=46fde44fd29af276f58d2edec81a2296dd3b3b1a;hb=691a034d7f2139076fa012739dffd40ef5db4a9b;hp=9cc7ca0515606fa4a6e1cacb041b2a892672d649;hpb=2c0ddcd27c6e5afa944f9eca6f5cf6e7f6e32f98;p=pspp diff --git a/tests/language/stats/descriptives.at b/tests/language/stats/descriptives.at index 9cc7ca0515..46fde44fd2 100644 --- a/tests/language/stats/descriptives.at +++ b/tests/language/stats/descriptives.at @@ -1,4 +1,19 @@ -AT_BANNER([DESCRIPTIVES procedure]) +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([DESCRIPTIVES procedure]) AT_SETUP([DESCRIPTIVES basics]) AT_DATA([descriptives.sps], @@ -276,3 +291,104 @@ group,a,b,Za,Zb 2.00,500.00,10000.00,1.10,1.10 ]) AT_CLEANUP + +dnl Ideally DESCRIPTIVES would not make temporary transformations permanent +dnl as it does now (bug #38786), so these results are imperfect. However, +dnl this test does verify that DESCRIPTIVES does not crash in this situation +dnl (as it once did). +AT_SETUP([DESCRIPTIVES -- Z scores bug with TEMPORARY]) +AT_DATA([descriptives.sps], [dnl +DATA LIST LIST NOTABLE /id abc. +BEGIN DATA. +1 3.5 +2 2.0 +3 2.0 +4 3.5 +5 3.0 +6 4.0 +7 5.0 +END DATA. + +TEMPORARY. +SELECT IF id < 7 . + +DESCRIPTIVES /VAR=abc/SAVE. +LIST. +]) +AT_CHECK([pspp -O format=csv descriptives.sps], [0], [dnl +descriptives.sps:15: warning: DESCRIPTIVES: DESCRIPTIVES with Z scores ignores TEMPORARY. Temporary transformations will be made permanent. + +Table: Mapping of variables to corresponding Z-scores. +Source,Target +abc,Zabc + +Table: Valid cases = 6; cases with missing value(s) = 0. +Variable,N,Mean,Std Dev,Minimum,Maximum +abc,6,3.00,.84,2.00,4.00 + +Table: Data List +id,abc,Zabc +1.00,3.50,.60 +2.00,2.00,-1.20 +3.00,2.00,-1.20 +4.00,3.50,.60 +5.00,3.00,.00 +6.00,4.00,1.20 +]) +AT_CLEANUP + +dnl This test was supplied by Mindaugus as part of the report for bug #42012. +AT_SETUP([DESCRIPTIVES -- Z scores with FILTER]) +AT_DATA([descriptives.sps], [dnl +DATA LIST LIST/filter1 filter2 x. +BEGIN DATA. +0,0,300 +0,1,200 +0,1,100 +1,0,5 +1,0,4 +1,1,3 +1,1,2 +1,1,1 +END DATA. + +FILTER OFF. +SPLIT FILE OFF. +DESCRIPTIVES /VARIABLES=X /SAVE. + +FILTER BY filter1. +SPLIT FILE OFF. +DESCRIPTIVES /VARIABLES=X /SAVE. + +FILTER OFF. +SORT CASES BY filter1. +SPLIT FILE BY filter1. +DESCRIPTIVES /VARIABLES=X /SAVE. + +FILTER BY filter2. +SPLIT FILE BY filter1. +DESCRIPTIVES /VARIABLES=X /SAVE. + +FILTER OFF. +SORT CASES BY filter1 filter2. +SPLIT FILE BY filter1 filter2. +DESCRIPTIVES /VARIABLES=X /SAVE. +EXECUTE. + +SPLIT FILE OFF. +LIST. +]) +AT_CHECK([pspp -o pspp.csv descriptives.sps]) +AT_CHECK([sed -n '/Table: Data List/,$p' < pspp.csv], [0], [dnl +Table: Data List +filter1,filter2,x,Zx,ZSC001,ZSC002,ZSC003,ZSC004 +.00,.00,300.00,1.94,. ,1.00,. ,. @&t@ +.00,1.00,200.00,1.07,. ,.00,.71,.71 +.00,1.00,100.00,.20,. ,-1.00,-.71,-.71 +1.00,.00,5.00,-.62,1.26,1.26,. ,.71 +1.00,.00,4.00,-.63,.63,.63,. ,-.71 +1.00,1.00,3.00,-.64,.00,.00,1.00,1.00 +1.00,1.00,2.00,-.65,-.63,-.63,.00,.00 +1.00,1.00,1.00,-.66,-1.26,-1.26,-1.00,-1.00 +]) +AT_CLEANUP