1 dnl PSPP - a program for statistical analysis.
2 dnl Copyright (C) 2017 Free Software Foundation, Inc.
4 dnl This program is free software: you can redistribute it and/or modify
5 dnl it under the terms of the GNU General Public License as published by
6 dnl the Free Software Foundation, either version 3 of the License, or
7 dnl (at your option) any later version.
9 dnl This program is distributed in the hope that it will be useful,
10 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 dnl GNU General Public License for more details.
14 dnl You should have received a copy of the GNU General Public License
15 dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
19 AT_SETUP([GRAPH simple scatterplot])
20 AT_DATA([scatterplot.sps],[
21 * Simple Scatterplot test
25 COMPUTE Age = RV.NORMAL(40,10).
31 COMPUTE Size = Age * 3 + 50.
34 /SCATTERPLOT(BIVARIATE) = Age WITH Size.
38 AT_CHECK([pspp -O format=csv scatterplot.sps], [0], [ignore])
43 AT_SETUP([GRAPH Scatter and Histogram])
45 AT_DATA([scatterlong.sps],[
49 COMPUTE Age = RV.NORMAL(40,10).
50 COMPUTE CityNum = TRUNC(UNIFORM(2.95)).
56 COMPUTE Size = Age * 3 + 50 + 50*CityNum.
67 /SCATTERPLOT(BIVARIATE) = Age WITH Size
70 /SCATTERPLOT(BIVARIATE) = Age WITH CityNum
73 /SCATTERPLOT = CityNum WITH Age
76 /SCATTERPLOT = CityNum WITH Size
79 /SCATTERPLOT(BIVARIATE) = Age WITH Size BY City
82 /SCATTERPLOT(BIVARIATE) = Age WITH Size BY CityNum
85 /CityNum 1 'Rio' 2 'Tokyo' 0 'Mumbai'.
88 /SCATTERPLOT(BIVARIATE) = Age WITH Size BY CityNum
95 AT_CHECK([pspp -O format=pdf scatterlong.sps], [0], [ignore], [ignore])
98 AT_SETUP([GRAPH missing values don't crash])
99 AT_DATA([scatter.sps], [dnl
100 data list list /x * y *.
111 /scatterplot = x with y.
115 AT_CHECK([pspp -o pspp.pdf scatter.sps], [], [ignore])
116 dnl Ignore output -- this is just a no-crash check.
119 AT_SETUP([GRAPH missing=VARIABLE no crash])
120 AT_DATA([scatter.sps], [dnl
121 data list list /x * y *.
132 /scatterplot = x with y
138 AT_CHECK([pspp -o pspp.pdf scatter.sps], [], [ignore])
139 dnl Ignore output -- this is just a no-crash check.
142 AT_SETUP([GRAPH missing value in by variable])
143 AT_DATA([scatter.sps], [dnl
144 data list list /x * y * z *.
155 /scatterplot = x with y by z
159 /scatterplot = x with y by z.
162 AT_CHECK([pspp -o pspp.pdf scatter.sps], [0], [ignore])
163 dnl Ignore output -- this is just a no-crash check.
167 AT_SETUP([GRAPH histogram with null data])
168 AT_DATA([null-hist.sps], [dnl
180 AT_CHECK([pspp -o pspp.pdf null-hist.sps], [0], [ignore])
181 dnl Ignore output -- this is just a no-crash check.
185 AT_SETUP([GRAPH histogram all missing])
186 AT_DATA([null-hist.sps], [dnl
197 AT_CHECK([pspp null-hist.sps], [0], [ignore])
198 dnl Ignore output -- this is just a no-crash check.
204 AT_SETUP([GRAPH barcharts])
205 AT_CHECK([ln -s $top_srcdir/examples/physiology.sav .], [0])
206 AT_CHECK([ln -s $top_srcdir/examples/repairs.sav .], [0])
208 AT_DATA([barchart.sps], [dnl
209 GET FILE="physiology.sav".
211 GRAPH /BAR = COUNT BY SEX.
213 GRAPH /BAR = MEAN(height) BY SEX.
217 GET FILE="repairs.sav".
219 GRAPH /BAR = MEAN (mtbf) BY factory.
221 COMPUTE R = TRUNC(RV.UNIFORM(1,5)).
223 GRAPH /BAR = MEAN (mtbf) BY factory BY R.
226 AT_CHECK([pspp -o pspp.pdf barchart.sps], [0], [ignore])
227 dnl Ignore output -- this is just a no-crash check.
233 AT_SETUP([GRAPH barchart arity])
235 AT_DATA([barchart.sps], [dnl
236 data list notable list /x y z*.
250 * This line is invalid
251 GRAPH /BAR = COUNT(x) BY y.
254 AT_CHECK([pspp -o pspp.pdf barchart.sps], [1], [ignore])
255 dnl Ignore output -- this is just a no-crash check.
262 AT_SETUP([GRAPH barchart bad syntax])
264 AT_DATA([barchart.sps], [dnl
265 data list notable list /x y z*.
279 * This line is invalid
280 GRAPH /BAR = SCROD BY y.
283 AT_CHECK([pspp -o pspp.pdf barchart.sps], [1], [ignore])
284 dnl Ignore output -- this is just a no-crash check.
290 AT_SETUP([GRAPH barchart full])
292 AT_DATA([barchart.sps], [dnl
293 data list notable list /x y z*.
307 * This line is invalid
308 GRAPH /BAR = COUNT by z.
309 GRAPH /BAR = CUFREQ by z.
310 GRAPH /BAR = PCT by z.
311 GRAPH /BAR = CUPCT by z.
313 GRAPH /BAR = MEAN(y) BY z.
314 GRAPH /BAR = SUM(y) BY z.
315 GRAPH /BAR = MAXIMUM(y) BY z.
316 GRAPH /BAR = MINIMUM(y) BY z.
318 GRAPH /BAR = MEAN(y) BY z BY y.
319 GRAPH /BAR = SUM(y) BY z BY y.
320 GRAPH /BAR = MAXIMUM(y) BY z BY y.
321 GRAPH /BAR = MINIMUM(y) BY z BY y.
324 AT_CHECK([pspp -o pspp.pdf barchart.sps], [0], [ignore])
325 dnl Ignore output -- this is just a no-crash check.
333 AT_SETUP([GRAPH buggy syntax])
335 AT_DATA([barchart.sps], [dnl
336 data list notable list /x y z*.
343 GRAPH /BAR = MINIMUM({) BY z BY y.
346 AT_CHECK([pspp -o pspp.pdf barchart.sps], [1], [ignore])
347 dnl Ignore output -- this is just a no-crash check.
352 dnl Check that percentages are calculated with respect to the
353 dnl proper total. See bug #56247
354 AT_SETUP([GRAPH barchart percentage sub-categorical])
355 AT_DATA([barchart.sps], [dnl
356 data list list notable /penalty_favopp_x * XYdem_racethW8 * w *.
372 * /tables=penalty_favopp_x by XYdem_racethW8
373 * /format=AVALUE TABLES PIVOT
375 * /cells COUNT COLUMN TOTAL.
378 /bar=pct by penalty_favopp_x
382 /bar=pct by penalty_favopp_x by XYdem_racethW8
386 AT_CHECK([pspp --testing barchart.sps], [0], [dnl
390 Primary Categories: 4
391 Largest Category: 53.1634
393 Y Label: "Percentage"
394 Categorical Variables:
395 Var: "penalty_favopp_x"
402 Count: 53.1634; Cat: " 1.00"
403 Count: 18.7756; Cat: " 2.00"
404 Count: 12.1074; Cat: " 4.00"
405 Count: 15.9536; Cat: " 5.00"
410 Primary Categories: 4
411 Largest Category: 57.0929
413 Y Label: "Percentage"
414 Categorical Variables:
415 Var: "penalty_favopp_x"
416 Var: "XYdem_racethW8"
426 Count: 57.0929; Cat: " 1.00", " .00"
427 Count: 39.1259; Cat: " 1.00", " 1.00"
428 Count: 19.7495; Cat: " 2.00", " .00"
429 Count: 15.2966; Cat: " 2.00", " 1.00"
430 Count: 10.7195; Cat: " 4.00", " .00"
431 Count: 17.0656; Cat: " 4.00", " 1.00"
432 Count: 12.4381; Cat: " 5.00", " .00"
433 Count: 28.512; Cat: " 5.00", " 1.00"
439 AT_SETUP([GRAPH syntax errors])
440 AT_DATA([graph.sps], [dnl
441 DATA LIST LIST NOTABLE/x y z.
442 GRAPH/HISTOGRAM=x/HISTOGRAM=y.
444 GRAPH/HISTOGRAM(NORMAL **).
446 GRAPH/HISTOGRAM=x y z.
447 GRAPH/HISTOGRAM=x/BAR=y.
457 GRAPH/BAR=MEAN(x) **.
458 GRAPH/BAR=MEAN(x) BY **.
459 GRAPH/BAR=MEAN(x) BY y BY **.
460 GRAPH/HISTOGRAM=x/SCATTERPLOT=y.
461 GRAPH/SCATTERPLOT(OVERLAY).
462 GRAPH/SCATTERPLOT(MATRIX).
463 GRAPH/SCATTERPLOT(XYZ).
464 GRAPH/SCATTERPLOT(**).
465 GRAPH/SCATTERPLOT(BIVARIATE **).
466 GRAPH/SCATTERPLOT **.
467 GRAPH/SCATTERPLOT=**.
468 GRAPH/SCATTERPLOT=x y z.
469 GRAPH/SCATTERPLOT=x **.
470 GRAPH/SCATTERPLOT=x WITH **.
471 GRAPH/SCATTERPLOT=x WITH y z.
472 GRAPH/SCATTERPLOT=x WITH y BY **.
483 AT_CHECK([pspp -O format=csv graph.sps], [1], [dnl
484 "graph.sps:2.19-2.27: error: GRAPH: Only one chart type is allowed.
485 2 | GRAPH/HISTOGRAM=x/HISTOGRAM=y.
488 "graph.sps:3.17-3.18: error: GRAPH: Syntax error expecting `NORMAL)'.
489 3 | GRAPH/HISTOGRAM(**).
492 "graph.sps:4.17-4.25: error: GRAPH: Syntax error expecting `NORMAL)'.
493 4 | GRAPH/HISTOGRAM(NORMAL **).
496 "graph.sps:5.17-5.18: error: GRAPH: Syntax error expecting variable name.
497 5 | GRAPH/HISTOGRAM=**.
500 "graph.sps:6.17-6.21: error: GRAPH: Only one variable is allowed.
501 6 | GRAPH/HISTOGRAM=x y z.
504 "graph.sps:7.19-7.21: error: GRAPH: Only one chart type is allowed.
505 7 | GRAPH/HISTOGRAM=x/BAR=y.
508 "graph.sps:8.11-8.17: error: GRAPH: GROUPED is not yet implemented.
509 8 | GRAPH/BAR(GROUPED).
512 "graph.sps:9.11-9.17: error: GRAPH: STACKED is not yet implemented.
513 9 | GRAPH/BAR(STACKED).
516 "graph.sps:10.11-10.15: error: GRAPH: RANGE is not yet implemented.
517 10 | GRAPH/BAR(RANGE).
520 "graph.sps:11.11-11.12: error: GRAPH: Syntax error expecting SIMPLE, GROUPED, STACKED, or RANGE.
524 "graph.sps:12.11-12.12: error: GRAPH: Syntax error expecting `='.
528 "graph.sps:13.11-13.12: error: GRAPH: Syntax error expecting COUNT, PCT, CUFREQ, CUPCT, MEAN, SUM, MAXIMUM, or MINIMUM.
532 "graph.sps:14.16-14.17: error: GRAPH: Syntax error expecting `('.
533 14 | GRAPH/BAR=MEAN **.
536 "graph.sps:15.16-15.17: error: GRAPH: Syntax error expecting variable name.
537 15 | GRAPH/BAR=MEAN(**).
540 "graph.sps:16.17-16.18: error: GRAPH: Syntax error expecting `)'.
541 16 | GRAPH/BAR=MEAN(x**).
544 "graph.sps:17.19-17.20: error: GRAPH: Syntax error expecting `BY'.
545 17 | GRAPH/BAR=MEAN(x) **.
548 "graph.sps:18.22-18.23: error: GRAPH: Syntax error expecting variable name.
549 18 | GRAPH/BAR=MEAN(x) BY **.
552 "graph.sps:19.27-19.28: error: GRAPH: Syntax error expecting variable name.
553 19 | GRAPH/BAR=MEAN(x) BY y BY **.
556 "graph.sps:20.19-20.29: error: GRAPH: Only one chart type is allowed.
557 20 | GRAPH/HISTOGRAM=x/SCATTERPLOT=y.
560 "graph.sps:21.19-21.25: error: GRAPH: OVERLAY is not yet implemented.
561 21 | GRAPH/SCATTERPLOT(OVERLAY).
564 "graph.sps:22.19-22.24: error: GRAPH: MATRIX is not yet implemented.
565 22 | GRAPH/SCATTERPLOT(MATRIX).
568 "graph.sps:23.19-23.21: error: GRAPH: XYZ is not yet implemented.
569 23 | GRAPH/SCATTERPLOT(XYZ).
572 "graph.sps:24.19-24.20: error: GRAPH: Syntax error expecting BIVARIATE, OVERLAY, MATRIX, or XYZ.
573 24 | GRAPH/SCATTERPLOT(**).
576 "graph.sps:25.29-25.30: error: GRAPH: Syntax error expecting `)'.
577 25 | GRAPH/SCATTERPLOT(BIVARIATE **).
580 "graph.sps:26.19-26.20: error: GRAPH: Syntax error expecting `='.
581 26 | GRAPH/SCATTERPLOT **.
584 "graph.sps:27.19-27.20: error: GRAPH: Syntax error expecting variable name.
585 27 | GRAPH/SCATTERPLOT=**.
588 "graph.sps:28.19-28.23: error: GRAPH: Only one variable is allowed.
589 28 | GRAPH/SCATTERPLOT=x y z.
592 "graph.sps:29.21-29.22: error: GRAPH: Syntax error expecting `WITH'.
593 29 | GRAPH/SCATTERPLOT=x **.
596 "graph.sps:30.26-30.27: error: GRAPH: Syntax error expecting variable name.
597 30 | GRAPH/SCATTERPLOT=x WITH **.
600 "graph.sps:31.26-31.28: error: GRAPH: Only one variable is allowed.
601 31 | GRAPH/SCATTERPLOT=x WITH y z.
604 "graph.sps:32.31-32.32: error: GRAPH: Syntax error expecting variable name.
605 32 | GRAPH/SCATTERPLOT=x WITH y BY **.
608 "graph.sps:33.7-33.10: error: GRAPH: LINE is not yet implemented.
612 "graph.sps:34.7-34.9: error: GRAPH: PIE is not yet implemented.
616 "graph.sps:35.7-35.14: error: GRAPH: ERRORBAR is not yet implemented.
620 "graph.sps:36.7-36.12: error: GRAPH: PARETO is not yet implemented.
624 "graph.sps:37.7-37.11: error: GRAPH: TITLE is not yet implemented.
628 "graph.sps:38.7-38.14: error: GRAPH: SUBTITLE is not yet implemented.
632 "graph.sps:39.7-39.14: error: GRAPH: FOOTNOTE is not yet implemented.
636 "graph.sps:40.15-40.16: error: GRAPH: Syntax error expecting LISTWISE, VARIABLE, EXCLUDE, INCLUDE, REPORT, or NOREPORT.
637 40 | GRAPH/MISSING=**.
640 "graph.sps:41.8-41.9: error: GRAPH: Syntax error expecting one of the following: HISTOGRAM, BAR, SCATTERPLOT, LINE, PIE, ERRORBAR, PARETO, TITLE, SUBTITLE, FOOTNOTE, MISSING.