049fc281922acecfb022fcedaf2eaeda53badc00
[pspp] / tests / output / charts.at
1 AT_BANNER([CHARTS Rudimentary run tests])
2
3 dnl Check that the charts work
4 dnl Currently, "work" means that the commands which
5 dnl should generate them, run without crashing.
6 dnl Better tests will come later (hopefully)
7
8 AT_SETUP([Examine])
9 AT_DATA([charts.sps],[
10 input program.
11 loop #i = 1 to 1000.
12  compute x  = rv.normal (56, 3) + rv.uniform (1, 1).
13  compute y  = rv.normal (6, 2) + rv.uniform (1, 2).
14  compute A  = rv.uniform (-1, 1).
15   compute A = (A > 0).
16  end case.
17 end loop.
18 end file.
19 end input program.
20
21 examine x y by a
22         /plot = histogram, npplot spreadlevel(1)
23         .
24
25 examine x y by a
26         /compare = groups
27         /plot = boxplot
28         .
29
30 examine x y by a
31         /compare = variables
32         /plot = boxplot
33         .
34 ])
35
36 AT_CHECK([pspp -O format=csv charts.sps], [0], [ignore])
37
38 AT_CLEANUP
39
40 AT_SETUP([Roc])
41 AT_DATA([roc.sps],[
42 data list list /fred * group * w *.
43 begin data.
44 99  0 1000
45 99  1 3
46 97  0 908
47 97  1 2
48 95  0 904
49 96  1 7
50 94  1 9
51 93  0 823
52 93  1 12
53 90  0 723
54 90  1 42
55 84  0 523
56 84  1 98
57 73  0 500
58 75  1 180
59 63  0 520
60 69  1 320
61 60  0 510
62 60  1 418
63 50  0 488
64 54  1 432
65 46  0 428
66 43  1 528
67 36  0 324
68 36  1 612
69 26  0 294
70 28  1 682
71 20  0 119
72 20  1 719
73 10  0 97
74 10  1 809
75 end data.
76
77 weight by w.
78
79 compute bert = fred + (group < 0.5) * 45.
80 compute charlie = fred + (group > 0.5) * 15.
81
82
83 ROC /fred bert charlie by group (0)
84         /plot = curve (reference).
85
86 ])
87
88 AT_CHECK([pspp -O format=csv roc.sps], [0], [ignore])
89
90 AT_CLEANUP
91
92
93
94
95 AT_SETUP([Scree])
96 AT_DATA([scree.sps],[
97 input program.
98 vector vec(10).
99 loop #i = 1 to 100.
100  loop #v = 1 to 3.
101  compute vec(#v) = rv.normal (0, 45).
102  end loop.
103  loop #v = 4 to 10.
104  compute vec(#v) = vec (#v - 3) + rv.normal (0, 30).
105  end loop.
106  end case.
107 end loop.
108 end file.
109 end input program.
110
111
112 factor /variables = all
113         /print initial
114         /plot = eigen.
115
116 ])
117
118 AT_CHECK([pspp -O format=csv scree.sps], [0], [ignore])
119
120 AT_CLEANUP
121
122
123 AT_SETUP([Histogram])
124 AT_DATA([histogram.sps],[
125 * This test is designed to "torture" the code which
126   generates histograms.  It is no-crash test. However
127   the code is rich in assertions, so any problems we
128   hope will be caught there.
129   
130
131 input program.
132 loop #i = 1 to 1000.
133  compute pos  = rv.normal (56, 3) + rv.uniform (1, 1).
134  compute neg  = rv.normal (-86, 2) + rv.uniform (1, 1).
135  compute pn  = rv.normal (0, 2) + rv.uniform (1, 2).
136  compute A  = rv.uniform (-1, 1).
137   compute A = (A > 0).
138  end case.
139 end loop.
140 end file.
141 end input program.
142
143
144 examine pos neg pn by a
145         /plot = histogram
146         .
147
148 frequencies pos neg pn
149         /format=notable
150         /histogram=normal.
151 ])
152
153
154 dnl The --testing-mode flag is important!!
155 AT_CHECK([pspp --testing-mode -O format=csv histogram.sps], [0], [ignore])
156
157 AT_CLEANUP