,,,Case Number,Value
Breaking Strain,Highest,1,12,7.00
,,2,16,6.00
-,,3,7,5.00
+,,3,14,5.00
,Lowest,1,3,1.00
,,2,3,1.00
,,3,4,1.00
Table: Extreme Values
,Manufacturer,,,Case Number,Value
-Breaking Strain,Aspeger,Highest,1,5,4.00
-,,,2,6,4.00
+Breaking Strain,Aspeger,Highest,1,6,4.00
+,,,2,5,4.00
,,,3,1,3.00
,,Lowest,1,3,1.00
,,,2,3,1.00
. 2
END DATA
-EXAMINE /x by y.
+EXAMINE /x by y
+ /MISSING = PAIRWISE
+ .
])
AT_CHECK([pspp -o pspp.csv examine.sps])
AT_CHECK([cat pspp.csv], [0], [dnl
])
AT_CLEANUP
+
+AT_SETUP([EXAMINE -- user missing values])
+AT_DATA([examine-m.sps], [dnl
+DATA LIST notable LIST /x * y *.
+BEGIN DATA.
+1 2
+9999999999 2
+9999999999 99
+END DATA.
+
+MISSING VALUES x (9999999999).
+MISSING VALUES y (99).
+
+EXAMINE
+ /VARIABLES= x y
+ /MISSING=PAIRWISE.
+])
+AT_CHECK([pspp -O format=csv examine-m.sps], [0], [dnl
+Table: Case Processing Summary
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+x,1,33.3333%,2,66.6667%,3,100%
+y,2,66.6667%,1,33.3333%,3,100%
+])
+AT_CLEANUP
+
AT_SETUP([EXAMINE -- missing values and percentiles])
AT_DATA([examine.sps], [dnl
DATA LIST LIST /X *.
EXAMINE
quality
/STATISTICS descriptives
+ /PLOT = histogram
.
])
-AT_CHECK([pspp -o pspp.csv examine.sps])
+AT_CHECK([pspp -o pspp.csv examine.sps], [0], [ignore])
dnl Ignore output -- this is just a no-crash check.
AT_CLEANUP
EXAMINE /x PLOT=HISTOGRAM.
])
-AT_CHECK([pspp -o pspp.csv examine.sps], [0], [dnl
-warning: Not creating plot because data set is empty.
+AT_CHECK([pspp -o pspp.csv examine.sps], [0], [ignore])
+dnl Ignore output -- this is just a no-crash check.
+AT_CLEANUP
+
+dnl Test that big input doesn't crash (bug 11307).
+AT_SETUP([EXAMINE -- big input doesn't crash])
+AT_DATA([examine.sps], [dnl
+INPUT PROGRAM.
+ LOOP #I=1 TO 50000.
+ COMPUTE X=NORMAL(10).
+ END CASE.
+ END LOOP.
+ END FILE.
+END INPUT PROGRAM.
+
+
+EXAMINE /x
+ /STATISTICS=DESCRIPTIVES.
+])
+AT_CHECK([pspp -o pspp.csv examine.sps])
+dnl Ignore output -- this is just a no-crash check.
+AT_CLEANUP
+
+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_DATA([make-big-input.pl],
+ [for ($i=0; $i<100000; $i++) { print "AB12\n" };
+ for ($i=0; $i<100000; $i++) { print "AB04\n" };
+])
+AT_CHECK([$PERL make-big-input.pl > large.txt])
+AT_DATA([examine.sps], [dnl
+DATA LIST FILE='large.txt' /S 1-2 (A) X 3 .
+
+
+AGGREGATE OUTFILE=* /BREAK=X /A=N.
+
+
+EXAMINE /A BY X.
])
+AT_CHECK([pspp -o pspp.csv examine.sps])
+dnl Ignore output -- this is just a no-crash check.
+AT_DATA([more-big-input.pl],
+ [for ($i=0; $i<25000; $i++) { print "AB04\nAB12\n" };
+])
+AT_CHECK([$PERL more-big-input.pl >> large.txt])
+AT_CHECK([pspp -o pspp.csv examine.sps])
dnl Ignore output -- this is just a no-crash check.
AT_CLEANUP
+
+
+dnl Test that the ID command works with non-numberic variables
+AT_SETUP([EXAMINE -- non-numeric ID])
+
+AT_DATA([examine-id.sps], [dnl
+data list notable list /x * y (a12).
+begin data.
+1 one
+2 two
+3 three
+4 four
+5 five
+6 six
+7 seven
+8 eight
+9 nine
+10 ten
+11 eleven
+12 twelve
+30 thirty
+300 threehundred
+end data.
+
+examine x
+ /statistics = extreme
+ /id = y
+ /plot = boxplot
+ .
+])
+
+AT_CHECK([pspp -O format=csv examine-id.sps], [0],
+[Table: Case Processing Summary
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+x,14,100%,0,0%,14,100%
+
+Table: Extreme Values
+,,,y,Value
+x,Highest,1,threehundred,300.00
+,,2,thirty ,30.00
+,,3,twelve ,12.00
+,,4,eleven ,11.00
+,,5,ten ,10.00
+,Lowest,1,one ,1.00
+,,2,two ,2.00
+,,3,three ,3.00
+,,4,four ,4.00
+,,5,five ,5.00
+])
+
+AT_CLEANUP
+
+dnl Test for a crash which happened on cleanup from a bad input syntax
+AT_SETUP([EXAMINE -- Bad Input])
+
+AT_DATA([examine-bad.sps], [dnl
+data list list /h * g *.
+begin data.
+1 1
+2 1
+3 1
+4 1
+5 2
+6 2
+7 2
+8 2
+9 2
+end data.
+
+EXAMINE
+ /VARIABLES= h
+ BY g
+ /STATISTICS = DESCRIPTIVES EXTREME
+ /PLOT = lkajsdas
+ .
+])
+
+AT_CHECK([pspp -o pspp.csv examine-bad.sps], [1], [ignore])
+
+AT_CLEANUP
+
+
+dnl Check the MISSING=REPORT option
+AT_SETUP([EXAMINE -- MISSING=REPORT])
+
+
+AT_DATA([examine-report.sps], [dnl
+set format = F22.0.
+data list list /x * g *.
+begin data.
+1 1
+2 1
+3 1
+4 1
+5 1
+6 1
+7 1
+8 1
+9 1
+10 2
+20 2
+30 2
+40 2
+50 2
+60 2
+70 2
+80 2
+90 2
+101 9
+201 9
+301 9
+401 9
+501 99
+601 99
+701 99
+801 99
+901 99
+1001 .
+2002 .
+3003 .
+4004 .
+end data.
+
+MISSING VALUES g (9, 99, 999).
+
+EXAMINE
+ /VARIABLES = x
+ BY g
+ /STATISTICS = EXTREME
+ /NOTOTAL
+ /MISSING = REPORT.
+])
+
+
+AT_CHECK([pspp -O format=csv examine-report.sps], [0], [dnl
+Table: Reading free-form data from INLINE.
+Variable,Format
+x,F8.0
+g,F8.0
+
+Table: Case Processing Summary
+,,Cases,,,,,
+,,Valid,,Missing,,Total,
+,g,N,Percent,N,Percent,N,Percent
+x,. (missing),4,100%,0,0%,4,100%
+,1,9,100%,0,0%,9,100%
+,2,9,100%,0,0%,9,100%
+,9 (missing),4,100%,0,0%,4,100%
+,99 (missing),5,100%,0,0%,5,100%
+
+Table: Extreme Values
+,g,,,Case Number,Value
+x,. (missing),Highest,1,31,4004
+,,,2,30,3003
+,,,3,29,2002
+,,,4,28,1001
+,,,5,0,0
+,,Lowest,1,28,1001
+,,,2,29,2002
+,,,3,30,3003
+,,,4,31,4004
+,,,5,31,4004
+,1,Highest,1,9,9
+,,,2,8,8
+,,,3,7,7
+,,,4,6,6
+,,,5,5,5
+,,Lowest,1,1,1
+,,,2,2,2
+,,,3,3,3
+,,,4,4,4
+,,,5,5,5
+,2,Highest,1,18,90
+,,,2,17,80
+,,,3,16,70
+,,,4,15,60
+,,,5,14,50
+,,Lowest,1,10,10
+,,,2,11,20
+,,,3,12,30
+,,,4,13,40
+,,,5,14,50
+,9 (missing),Highest,1,22,401
+,,,2,21,301
+,,,3,20,201
+,,,4,19,101
+,,,5,0,0
+,,Lowest,1,19,101
+,,,2,20,201
+,,,3,21,301
+,,,4,22,401
+,,,5,22,401
+,99 (missing),Highest,1,27,901
+,,,2,26,801
+,,,3,25,701
+,,,4,24,601
+,,,5,23,501
+,,Lowest,1,23,501
+,,,2,24,601
+,,,3,25,701
+,,,4,26,801
+,,,5,27,901
+])
+
+
+AT_CLEANUP
\ No newline at end of file