tests: Tag all the tests that take more than about 1s as "slow".
[pspp] / tests / output / charts.at
1 dnl PSPP - a program for statistical analysis.
2 dnl Copyright (C) 2017 Free Software Foundation, Inc.
3 dnl 
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.
8 dnl 
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.
13 dnl 
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/>.
16 dnl
17 AT_BANNER([CHARTS Rudimentary run tests])
18
19 dnl Check that the charts work
20 dnl Currently, "work" means that the commands which
21 dnl should generate them, run without crashing.
22 dnl Better tests will come later (hopefully)
23
24 AT_SETUP([Examine])
25 AT_KEYWORDS([slow])
26 AT_DATA([charts.sps],[
27 input program.
28 loop #i = 1 to 1000.
29  compute x  = rv.normal (56, 3) + rv.uniform (1, 1).
30  compute y  = rv.normal (6, 2) + rv.uniform (1, 2).
31  compute A  = rv.uniform (-1, 1).
32   compute A = (A > 0).
33  end case.
34 end loop.
35 end file.
36 end input program.
37
38 examine x y by a
39         /plot = histogram, npplot spreadlevel(1)
40         .
41
42 examine x y by a
43         /compare = groups
44         /plot = boxplot
45         .
46
47 examine x y by a
48         /compare = variables
49         /plot = boxplot
50         .
51 ])
52
53 AT_CHECK([pspp -o pspp.txt charts.sps], [0], [ignore])
54
55 AT_CLEANUP
56
57 AT_SETUP([Roc])
58 AT_DATA([roc.sps],[
59 data list list /fred * group * w *.
60 begin data.
61 99  0 1000
62 99  1 3
63 97  0 908
64 97  1 2
65 95  0 904
66 96  1 7
67 94  1 9
68 93  0 823
69 93  1 12
70 90  0 723
71 90  1 42
72 84  0 523
73 84  1 98
74 73  0 500
75 75  1 180
76 63  0 520
77 69  1 320
78 60  0 510
79 60  1 418
80 50  0 488
81 54  1 432
82 46  0 428
83 43  1 528
84 36  0 324
85 36  1 612
86 26  0 294
87 28  1 682
88 20  0 119
89 20  1 719
90 10  0 97
91 10  1 809
92 end data.
93
94 weight by w.
95
96 compute bert = fred + (group < 0.5) * 45.
97 compute charlie = fred + (group > 0.5) * 15.
98
99
100 ROC /fred bert charlie by group (0)
101         /plot = curve (reference).
102
103 ])
104
105 AT_CHECK([pspp -o pspp.txt roc.sps], [0], [ignore])
106
107 AT_CLEANUP
108
109
110
111
112 AT_SETUP([Scree])
113 AT_DATA([scree.sps],[
114 input program.
115 vector vec(10).
116 loop #i = 1 to 100.
117  loop #v = 1 to 3.
118  compute vec(#v) = rv.normal (0, 45).
119  end loop.
120  loop #v = 4 to 10.
121  compute vec(#v) = vec (#v - 3) + rv.normal (0, 30).
122  end loop.
123  end case.
124 end loop.
125 end file.
126 end input program.
127
128
129 factor /variables = all
130         /print initial
131         /plot = eigen.
132
133 ])
134
135 AT_CHECK([pspp -o pspp.txt scree.sps], [0], [ignore])
136
137 AT_CLEANUP
138
139
140 AT_SETUP([Histogram])
141 AT_DATA([histogram.sps],[
142 * This test is designed to "torture" the code which
143   generates histograms.  It is no-crash test. However
144   the code is rich in assertions, so any problems we
145   hope will be caught there.
146   
147
148 input program.
149 loop #i = 1 to 1000.
150  compute pos  = rv.normal (56, 3) + rv.uniform (1, 1).
151  compute neg  = rv.normal (-86, 2) + rv.uniform (1, 1).
152  compute pn  = rv.normal (0, 2) + rv.uniform (1, 2).
153  compute A  = rv.uniform (-1, 1).
154   compute A = (A > 0).
155  end case.
156 end loop.
157 end file.
158 end input program.
159
160
161 examine pos neg pn by a
162         /plot = histogram
163         .
164
165 frequencies pos neg pn
166         /format=notable
167         /histogram=normal.
168 ])
169
170
171 dnl The --testing-mode flag is important!!
172 AT_CHECK([pspp --testing-mode -o pspp.txt histogram.sps], [0], [ignore])
173
174 AT_CLEANUP
175
176
177 AT_SETUP([FREQUENCIES charts])
178 AT_DATA([xxx.sps],[
179 DATA LIST LIST /nationality (A10)  religion (A20) gender (A8).
180 BEGIN DATA.
181 Australian  Sikh      Male
182 Australian  Sikh      Male
183 Australian  Sikh      Male
184 Australian  Sikh      Male
185 British     Zoroastrian Female
186 British     Buddist   Female
187 British     Buddist   Female
188 British      Zoroastrian Female
189 German      Muslim    Male
190 German      Christian Male
191 German      Christian Female
192 German      Christian Male
193 German      Zoroastrian Female
194 German      Sikh   Female
195 German      Muslim Female
196 German      Pastafarian Female
197 German      "Jedi Knight" Female
198 Belgian     Sikh      Male
199 French       Muslim      Male
200 French       Muslim      Male
201 French       Christian      Male
202 END DATA.
203
204
205 FREQUENCIES /VARIABLES=religion nationality /BARCHART /PIECHART. 
206 ])
207
208
209 AT_CHECK([pspp  -o pspp.txt xxx.sps], [0], [ignore])
210
211 AT_CLEANUP
212
213
214
215 AT_SETUP([CROSSTABS charts])
216 AT_DATA([xxx.sps],[
217 DATA LIST LIST /nationality (A10)  religion (A20) gender (A8).
218 BEGIN DATA.
219 Australian  Sikh      Male
220 Australian  Sikh      Male
221 Australian  Sikh      Male
222 Australian  Sikh      Male
223 British     Zoroastrian Female
224 British     Buddist   Female
225 British     Buddist   Female
226 British      Zoroastrian Female
227 German      Muslim    Male
228 German      Christian Male
229 German      Christian Female
230 German      Christian Male
231 German      Zoroastrian Female
232 German      Sikh   Female
233 German      Muslim Female
234 German      Pastafarian Female
235 German      "Jedi Knight" Female
236 Belgian     Sikh      Male
237 French       Muslim      Male
238 French       Muslim      Male
239 French       Christian      Male
240 END DATA.
241
242
243 CROSSTABS 
244           /tables = nationality by religion by gender
245           /tables = nationality by religion
246           /tables = religion by gender
247           /tables = nationality by religion by gender
248           /barchart.
249 ])
250
251
252 AT_CHECK([pspp  -o pspp.txt xxx.sps], [0], [ignore])
253
254 AT_CLEANUP
255
256
257
258
259 AT_SETUP([BOXPLOT Empty])
260 AT_DATA([bp.sps],[
261 DATA LIST LIST /X * Y * .
262 BEGIN DATA
263 1
264 2
265 2
266 2
267 3
268 END DATA
269
270 EXAMINE
271     /VARIABLES = Y
272     /PLOT = BOXPLOT.
273 ])
274
275
276 AT_CHECK([pspp -o pspp.txt bp.sps], [0], [ignore])
277
278 AT_CLEANUP
279
280
281
282
283
284
285
286
287
288