+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 <http://www.gnu.org/licenses/>.
+dnl
AT_BANNER([EXAMINE])
AT_SETUP([EXAMINE])
+AT_KEYWORDS([categorical categoricals])
AT_DATA([examine.sps], [
DATA LIST LIST /QUALITY * W * BRAND * .
BEGIN DATA
AT_CLEANUP
AT_SETUP([EXAMINE -- extremes])
+AT_KEYWORDS([categorical categoricals])
AT_DATA([examine.sps], [dnl
data list free /V1 W
begin data.
AT_SETUP([EXAMINE -- extremes with fractional weights])
+AT_KEYWORDS([categorical categoricals])
AT_DATA([extreme.sps], [dnl
set format=F20.3.
data list notable list /w * x *.
dnl In particular test that it behaves properly when there are only
dnl a few cases.
AT_SETUP([EXAMINE -- percentiles])
+AT_KEYWORDS([categorical categoricals])
AT_DATA([examine.sps], [dnl
DATA LIST LIST /X *.
BEGIN DATA.
AT_CLEANUP
AT_SETUP([EXAMINE -- missing values])
+AT_KEYWORDS([categorical categoricals])
AT_DATA([examine.sps], [dnl
DATA LIST LIST /x * y *.
BEGIN DATA.
AT_SETUP([EXAMINE -- user missing values])
+AT_KEYWORDS([categorical categoricals])
AT_DATA([examine-m.sps], [dnl
DATA LIST notable LIST /x * y *.
BEGIN DATA.
AT_CLEANUP
AT_SETUP([EXAMINE -- missing values and percentiles])
+AT_KEYWORDS([categorical categoricals])
AT_DATA([examine.sps], [dnl
DATA LIST LIST /X *.
BEGIN DATA.
dnl Tests the trimmed mean calculation in the case
dnl where the data is weighted towards the centre.
AT_SETUP([EXAMINE -- trimmed mean])
+AT_KEYWORDS([categorical categoricals])
AT_DATA([examine.sps], [dnl
DATA LIST LIST /X * C *.
BEGIN DATA.
AT_CLEANUP
AT_SETUP([EXAMINE -- crash bug])
+AT_KEYWORDS([categorical categoricals])
AT_DATA([examine.sps], [dnl
data list list /a * x * y *.
begin data.
dnl Test that two consecutive EXAMINE commands don't crash PSPP.
AT_SETUP([EXAMINE -- consecutive runs don't crash])
+AT_KEYWORDS([categorical categoricals])
AT_DATA([examine.sps], [dnl
data list list /y * z *.
begin data.
dnl Test that /DESCRIPTIVES does not crash in presence of missing values.
AT_SETUP([EXAMINE -- missing values don't crash])
+AT_KEYWORDS([categorical categoricals])
AT_DATA([examine.sps], [dnl
data list list /x * y *.
begin data.
dnl Test that having only a single case doesn't crash.
AT_SETUP([EXAMINE -- single case doesn't crash])
+AT_KEYWORDS([categorical categoricals])
AT_DATA([examine.sps], [dnl
DATA LIST LIST /quality * .
BEGIN DATA
dnl Test that all-missing data doesn't crash.
AT_SETUP([EXAMINE -- all-missing data doesn't crash])
+AT_KEYWORDS([categorical categoricals])
AT_DATA([examine.sps], [dnl
DATA LIST LIST /x *.
BEGIN DATA.
.
END DATA.
-EXAMINE /x PLOT=HISTOGRAM.
+EXAMINE /x
+ PLOT=HISTOGRAM BOXPLOT NPPLOT SPREADLEVEL(1) ALL
+ /ID=x
+ /STATISTICS = DESCRIPTIVES EXTREME (5) ALL
+ /PERCENTILE=AEMPIRICAL
+ .
])
AT_CHECK([pspp -o pspp.csv examine.sps], [0], [ignore])
dnl Ignore output -- this is just a no-crash check.
dnl Test that big input doesn't crash (bug 11307).
AT_SETUP([EXAMINE -- big input doesn't crash])
+AT_KEYWORDS([categorical categoricals])
AT_DATA([examine.sps], [dnl
INPUT PROGRAM.
LOOP #I=1 TO 50000.
dnl Another test that big input doesn't crash.
dnl The actual bug that this checks for has been lost.
AT_SETUP([EXAMINE -- big input doesn't crash 2])
+AT_KEYWORDS([categorical categoricals])
AT_DATA([make-big-input.pl],
[for ($i=0; $i<100000; $i++) { print "AB12\n" };
for ($i=0; $i<100000; $i++) { print "AB04\n" };
dnl Test that the ID command works with non-numberic variables
AT_SETUP([EXAMINE -- non-numeric ID])
+AT_KEYWORDS([categorical categoricals])
AT_DATA([examine-id.sps], [dnl
data list notable list /x * y (a12).
dnl Test for a crash which happened on cleanup from a bad input syntax
AT_SETUP([EXAMINE -- Bad Input])
+AT_KEYWORDS([categorical categoricals])
AT_DATA([examine-bad.sps], [dnl
data list list /h * g *.
dnl Check the MISSING=REPORT option
AT_SETUP([EXAMINE -- MISSING=REPORT])
-
+AT_KEYWORDS([categorical categoricals])
AT_DATA([examine-report.sps], [dnl
set format = F22.0.
dnl dataset and comparing with "real" results kindly
dnl provided by Olaf Nöhring
AT_SETUP([EXAMINE -- sample unweighted])
+AT_KEYWORDS([categorical categoricals])
AT_DATA([sample.sps], [dnl
set format = F22.4.
dnl Test for a crash which happened on bad input syntax
AT_SETUP([EXAMINE -- Empty Parentheses])
+AT_KEYWORDS([categorical categoricals])
AT_DATA([examine-empty-parens.sps], [dnl
DATA LIST notable LIST /X *
AT_CHECK([pspp -o pspp.csv examine-empty-parens.sps], [1], [ignore])
AT_CLEANUP
+
+
+
+
+dnl Test for another crash which happened on bad input syntax
+AT_SETUP([EXAMINE -- Bad variable])
+AT_KEYWORDS([categorical categoricals])
+
+AT_DATA([examine-bad-variable.sps], [dnl
+data list list /h * g *.
+begin data.
+3 1
+4 1
+5 2
+end data.
+
+EXAMINE
+ /VARIABLES/ h
+ BY g
+ .
+])
+
+AT_CHECK([pspp -o pspp.csv examine-bad-variable.sps], [1], [ignore])
+
+AT_CLEANUP
+
+
+
+dnl Test for yet another crash. This time for extremes vs. missing weight values.\0
+AT_SETUP([EXAMINE -- Extremes vs. Missing Weights])
+AT_KEYWORDS([categorical categoricals])
+
+AT_DATA([examine-missing-weights.sps], [dnl
+data list notable list /h * g *.
+begin data.
+3 1
+4 .
+5 1
+2 1
+end data.
+
+WEIGHT BY g.
+
+EXAMINE h
+ /STATISTICS extreme(3)
+ .
+])
+
+AT_CHECK([pspp -O format=csv examine-missing-weights.sps], [0], [dnl
+"examine-missing-weights.sps:13: warning: EXAMINE: At least one case in the data file had a weight value that was user-missing, system-missing, zero, or negative. These case(s) were ignored."
+
+Table: Case Processing Summary
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+h,3.00,100%,.00,0%,3.00,100%
+
+Table: Extreme Values
+,,,Case Number,Value
+h,Highest,1,3,5.00
+,,2,2,4.00
+,,3,1,3.00
+,Lowest,1,4,2.00
+,,2,1,3.00
+,,3,2,4.00
+])
+
+AT_CLEANUP
+
+
+