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