FREQUENCIES: Reimplement FORMAT=LIMIT feature.
[pspp] / tests / language / stats / frequencies.at
index 12255d64db3c7d3835f142f504f6c2518ba70635..0d6433c5b938c7eb25bdea3a3bb2367b987d6b4d 100644 (file)
@@ -18,7 +18,7 @@ quux 5 8
 END DATA.
 EXECUTE.
 
-FREQUENCIES /VAR = name.
+FREQUENCIES /VAR = name/ORDER=ANALYSIS.
 ])
 AT_CHECK([pspp -O format=csv frequencies.sps], [0], [dnl
 Table: name
@@ -43,7 +43,7 @@ begin data.
 3 4
 end data.
 
-frequencies v1 v2/statistics=none.
+frequencies v1 v2/statistics=none/ORDER=VARIABLE.
 frequencies v1 v2/statistics=none.
 ])
 AT_CHECK([pspp -O format=csv frequencies.sps], [0],
@@ -81,6 +81,29 @@ Total,,4,100.0,100.0,
 ])
 AT_CLEANUP
 
+# Test that the LIMIT specification works.
+AT_SETUP([FREQUENCIES with LIMIT])
+AT_DATA([frequencies.sps],
+  [data list free /v1 v2.
+begin data.
+0 1
+2 5
+4 3
+3 5
+end data.
+
+frequencies v1 v2/statistics=none/FORMAT=LIMIT(3).
+])
+AT_CHECK([pspp -O format=csv frequencies.sps], [0], [dnl
+Table: v2
+Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
+,1.00,1,25.00,25.00,25.00
+,3.00,1,25.00,25.00,50.00
+,5.00,2,50.00,50.00,100.00
+Total,,4,100.0,100.0,
+])
+AT_CLEANUP
+
 # Tests for a bug where PSPP would crash when a FREQUENCIES command
 # was used with the HTML output driver.
 AT_SETUP([FREQUENCIES HTML output crash])
@@ -672,3 +695,47 @@ Minimum,,10.00
 Maximum,,3000000.00
 ])
 AT_CLEANUP
+
+
+
+AT_SETUP([FREQUENCIES no valid data])
+AT_DATA([empty.sps], [dnl
+data list notable list /x *.
+begin data.
+.
+.
+.
+end data.
+
+FREQUENCIES
+       /VARIABLES = x
+       /STATISTICS = ALL
+       .
+])
+
+AT_CHECK([pspp empty.sps -O format=csv], [0],  [dnl
+Table: x
+Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
+,.  ,3,100.00,Missing,
+Total,,3,100.0,100.0,
+
+Table: x
+N,Valid,0
+,Missing,3
+Mean,,.
+S.E. Mean,,.
+Mode,,.
+Std Dev,,.
+Variance,,.
+Kurtosis,,.
+S.E. Kurt,,.
+Skewness,,.
+S.E. Skew,,.
+Range,,.
+Minimum,,.
+Maximum,,.
+Sum,,.
+Percentiles,,.
+])
+
+AT_CLEANUP