059fdfbbc34a6f83a68639c97685be70de6cffed
[pspp] / tests / language / utilities / set.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([SET])
18
19 # This crashed older versions of PSPP (bug #30682).
20 AT_SETUP([SET FORMAT to invalid output format])
21 AT_DATA([set.pspp], [dnl
22 DATA LIST LIST NOTABLE /x.
23 BEGIN DATA.
24 1
25 2
26 3
27 END DATA.
28 SET FORMAT F41.
29 DESCRIPTIVES /x.
30 ])
31 AT_CHECK([pspp -O format=csv set.pspp], [1], [dnl
32 "set.pspp:7: error: SET: Output format F41.0 specifies width 41, but F requires a width between 1 and 40."
33
34 Table: Valid cases = 3; cases with missing value(s) = 0.
35 Variable,N,Mean,Std Dev,Minimum,Maximum
36 x,3,2.00,1.00,1.00,3.00
37 ])
38 AT_CLEANUP
39
40
41 dnl This scenario was observed to erroneously free things twice
42 AT_SETUP([SET crash on invalid cc])
43 AT_DATA([set.pspp], [dnl
44 SET CCA='xxxx'.SHGW CCA.
45 ])
46
47 AT_CHECK([pspp -O format=csv set.pspp], [1], [ignore])
48 AT_CLEANUP
49
50
51
52 AT_SETUP([SET MXWARNS])
53 dnl Make sure that syntax processing stops and that
54 dnl a warning is issued when the MXWARNS figure is
55 dnl exceeded.
56 AT_DATA([set.pspp], [dnl
57 set mxwarns=2.
58 data list notable list /x (f8.2) y (f8.2).
59 begin data
60 1 2
61 3 r
62 5 x
63 q 8
64 9 9
65 3 x
66 w w
67 end data.
68
69 comment The following line should not be executed.
70 list.
71 ])
72
73 AT_CHECK([pspp -O format=csv set.pspp], [0], [dnl
74 set.pspp:5.3: warning: Data for variable y is not valid as format F: Field contents are not numeric.
75
76 set.pspp:6.3: warning: Data for variable y is not valid as format F: Field contents are not numeric.
77
78 set.pspp:7.1: warning: Data for variable x is not valid as format F: Field contents are not numeric.
79
80 note: Warnings (3) exceed limit (2).  Syntax processing will be halted.
81 ])
82
83 AT_CLEANUP
84
85
86
87
88 AT_SETUP([SET MXWARNS special case zero])
89 dnl Make sure that MXWARNS interprets zero as infinity.
90 AT_DATA([mxwarns.pspp], [dnl
91 set mxwarns=0.
92 data list notable list /x (f8.2) y (f8.2) z *.
93 begin data
94 1 2 3
95 3 r 3
96 5 x 3
97 q 8 4
98 9 9 4
99 3 x 4
100 w w 4
101 end data.
102
103 list.
104 ])
105
106 AT_CHECK([pspp -O format=csv mxwarns.pspp], [0],
107 [warning: MXWARNS set to zero.  No further warnings will be given even when potentially problematic situations are encountered.
108
109 Table: Data List
110 x,y,z
111 1.00,2.00,3.00
112 3.00,.  ,3.00
113 5.00,.  ,3.00
114 .  ,8.00,4.00
115 9.00,9.00,4.00
116 3.00,.  ,4.00
117 .  ,.  ,4.00
118 ])
119
120 AT_CLEANUP
121
122 \f
123
124 AT_BANNER([PRESERVE and RESTORE])
125
126 AT_SETUP([PRESERVE of SET FORMAT])
127 AT_DATA([set.pspp], [dnl
128 SHOW FORMAT.
129 PRESERVE.
130 SET FORMAT F10.0.
131 SHOW FORMAT
132 RESTORE.
133 SHOW FORMAT.
134 ])
135 AT_CHECK([pspp -O format=csv set.pspp], [0], [dnl
136 set.pspp:1: note: SHOW: FORMAT is F8.2.
137
138 set.pspp:5: note: SHOW: FORMAT is F10.0.
139
140 set.pspp:6: note: SHOW: FORMAT is F8.2.
141 ])
142 AT_CLEANUP