Consolidate quoting style in printed strings.
[pspp] / tests / language / dictionary / mrsets.at
1 AT_BANNER([MRSETS])
2
3 m4_define([DEFINE_MRSETS_DATA],
4   [DATA LIST NOTABLE /w x y z 1-4 a b c d 5-8 (a).
5 BEGIN DATA.
6 1234acbd
7 5678efgh
8 END DATA.])
9
10 m4_define([DEFINE_MRSETS],
11   [DEFINE_MRSETS_DATA
12
13 [VARIABLE LABEL
14     w 'duplicate variable label'
15     x 'Variable x'
16     z 'Duplicate variable label'.
17 VALUE LABELS
18     /w 1 'w value 1'
19     /y 1 'duplicate Value label'
20     /z 1 'duplicate value Label'
21     /a b c d 'a' 'burger' 'b' 'fries' 'c' 'shake' 'd' 'taco'.
22 ADD VALUE LABELS
23     /b 'b' 'Fries'
24     /c 'b' 'XXX'.
25 MRSETS
26     /MDGROUP NAME=$a
27      LABEL='First multiple dichotomy group'
28      CATEGORYLABELS=VARLABELS
29      VARIABLES=w x y z
30      VALUE=5
31     /MDGROUP NAME=$b
32      CATEGORYLABELS=COUNTEDVALUES
33      VARIABLES=z y
34      VALUE=123
35     /MDGROUP NAME=$c
36      LABELSOURCE=VARLABEL
37      CATEGORYLABELS=COUNTEDVALUES
38      VARIABLES=w x y z
39      VALUE=1
40     /MDGROUP NAME=$d
41      LABELSOURCE=VARLABEL
42      VARIABLES=a b c d
43      VALUE='c'
44     /MCGROUP NAME=$e
45      LABEL='First multiple category group'
46      VARIABLES=w x y z
47     /MCGROUP NAME=$f
48      VARIABLES=a b c d.
49 ]])
50
51 m4_define([DEFINE_MRSETS_OUTPUT],
52   [mrsets.sps:25: warning: MRSETS: Variables w and z specified as part of multiple dichotomy group $a have the same variable label.  Categories represented by these variables will not be distinguishable in output.
53
54 mrsets.sps:29: warning: MRSETS: Variable z specified as part of multiple dichotomy group $b (which has CATEGORYLABELS=COUNTEDVALUES) has no value label for its counted value.  This category will not be distinguishable in output.
55
56 mrsets.sps:29: warning: MRSETS: Variable y specified as part of multiple dichotomy group $b (which has CATEGORYLABELS=COUNTEDVALUES) has no value label for its counted value.  This category will not be distinguishable in output.
57
58 mrsets.sps:34: warning: MRSETS: Variable x specified as part of multiple dichotomy group $c (which has CATEGORYLABELS=COUNTEDVALUES) has no value label for its counted value.  This category will not be distinguishable in output.
59
60 mrsets.sps:34: warning: MRSETS: Variables y and z specified as part of multiple dichotomy group $c (which has CATEGORYLABELS=COUNTEDVALUES) have the same value label for the the group's counted value.  These categories will not be distinguishable in output.
61
62 mrsets.sps:38: warning: MRSETS: MDGROUP subcommand for group $d specifies LABELSOURCE=VARLABEL but not CATEGORYLABELS=COUNTEDVALUES.  Ignoring LABELSOURCE.
63
64 "mrsets.sps:41: warning: MRSETS: Variables specified on MCGROUP should have the same categories, but w and y (and possibly others) in multiple category group $e have different value labels for value 1."
65
66 "mrsets.sps:42: warning: MRSETS: Variables specified on MCGROUP should have the same categories, but a and c (and possibly others) in multiple category group $f have different value labels for value b."
67 ])
68
69 m4_define([MRSETS_DISPLAY_OUTPUT],
70   [Table: Multiple Response Sets
71 Name,Variables,Details
72 $a,"w
73 x
74 y
75 z
76 ","Multiple dichotomy set
77 Label: First multiple dichotomy group
78 Label source: Provided by user
79 Counted value: 5
80 Category label source: Variable labels
81 "
82 $b,"z
83 y
84 ","Multiple dichotomy set
85 Counted value: 123
86 Category label source: Value labels of counted value
87 "
88 $c,"w
89 x
90 y
91 z
92 ","Multiple dichotomy set
93 Label: duplicate variable label
94 Label source: First variable label among variables
95 Counted value: 1
96 Category label source: Value labels of counted value
97 "
98 $d,"a
99 b
100 c
101 d
102 ","Multiple dichotomy set
103 Counted value: `c'
104 Category label source: Variable labels
105 "
106 $e,"w
107 x
108 y
109 z
110 ","Multiple category set
111 Label: First multiple category group
112 "
113 $f,"a
114 b
115 c
116 d
117 ","Multiple category set
118 "
119 ])
120
121 AT_SETUP([MRSETS add, display, delete])
122 AT_DATA([mrsets.sps],
123   [DEFINE_MRSETS
124 [MRSETS
125     /DISPLAY NAME=[$a]
126     /DISPLAY NAME=ALL
127     /DELETE NAME=[$c]
128     /DISPLAY NAME=ALL
129     /DELETE NAME=ALL
130     /DISPLAY NAME=ALL.
131 ]])
132 AT_CHECK([pspp -O format=csv mrsets.sps], [0],
133   [DEFINE_MRSETS_OUTPUT
134 Table: Multiple Response Sets
135 Name,Variables,Details
136 $a,"w
137 x
138 y
139 z
140 ","Multiple dichotomy set
141 Label: First multiple dichotomy group
142 Label source: Provided by user
143 Counted value: 5
144 Category label source: Variable labels
145 "
146
147 MRSETS_DISPLAY_OUTPUT
148 Table: Multiple Response Sets
149 Name,Variables,Details
150 $a,"w
151 x
152 y
153 z
154 ","Multiple dichotomy set
155 Label: First multiple dichotomy group
156 Label source: Provided by user
157 Counted value: 5
158 Category label source: Variable labels
159 "
160 $b,"z
161 y
162 ","Multiple dichotomy set
163 Counted value: 123
164 Category label source: Value labels of counted value
165 "
166 $d,"a
167 b
168 c
169 d
170 ","Multiple dichotomy set
171 Counted value: `c'
172 Category label source: Variable labels
173 "
174 $e,"w
175 x
176 y
177 z
178 ","Multiple category set
179 Label: First multiple category group
180 "
181 $f,"a
182 b
183 c
184 d
185 ","Multiple category set
186 "
187
188 mrsets.sps:50: note: MRSETS: The active file dictionary does not contain any multiple response sets.
189 ])
190 AT_CLEANUP
191
192 AT_SETUP([MRSETS read and write])
193 AT_DATA([mrsets.sps],
194   [DEFINE_MRSETS
195 SAVE OUTFILE='mrsets.sav'.
196 ])
197 AT_CHECK([pspp -O format=csv mrsets.sps], [0], [DEFINE_MRSETS_OUTPUT])
198 AT_DATA([mrsets2.sps],
199   [GET FILE='mrsets.sav'.
200 MRSETS /DISPLAY NAME=ALL.
201 ])
202 AT_CHECK([pspp -O format=csv mrsets2.sps], [0], [MRSETS_DISPLAY_OUTPUT],
203   [], [hd mrsets.sav])
204 AT_CLEANUP
205
206 AT_SETUP([MRSETS names must begin with $])
207 AT_DATA([mrsets.sps],
208   [DEFINE_MRSETS_DATA
209 MRSETS /MCGROUP NAME=x.
210 ])
211 AT_CHECK([pspp -O format=csv mrsets.sps], [1],
212   [mrsets.sps:6: error: MRSETS: x is not a valid name for a multiple response set.  Multiple response set names must begin with `$'.
213 ])
214 AT_CLEANUP
215
216 AT_SETUP([MRSETS must have at least 2 variables])
217 AT_DATA([mrsets.sps],
218   [DEFINE_MRSETS_DATA
219 MRSETS /MCGROUP NAME=$x VARIABLES=a.
220 ])
221 AT_CHECK([pspp -O format=csv mrsets.sps], [1],
222   ["mrsets.sps:6: error: MRSETS: VARIABLES specified only variable a on MCGROUP, but at least two variables are required."
223 ])
224 AT_CLEANUP
225
226 AT_SETUP([MRSETS does not allow noninteger VALUE])
227 AT_DATA([mrsets.sps],
228   [DEFINE_MRSETS_DATA
229 MRSETS /MDGROUP VALUE=1.5.
230 ])
231 AT_CHECK([pspp -O format=csv mrsets.sps], [1],
232   [mrsets.sps:6: error: MRSETS: Numeric VALUE must be an integer.
233 ])
234 AT_CLEANUP
235
236 AT_SETUP([MRSETS requires NAME to define a group])
237 AT_DATA([mrsets.sps],
238   [DEFINE_MRSETS_DATA
239 MRSETS /MCGROUP VARIABLES=a b c.
240 ])
241 AT_CHECK([pspp -O format=csv mrsets.sps], [1],
242   [mrsets.sps:6: error: MRSETS: Required NAME specification missing from MCGROUP subcommand.
243 ])
244 AT_CLEANUP
245
246 AT_SETUP([MRSETS requires VARIABLES to define a group])
247 AT_DATA([mrsets.sps],
248   [DEFINE_MRSETS_DATA
249 MRSETS /MCGROUP NAME=$Mcgroup.
250 ])
251 AT_CHECK([pspp -O format=csv mrsets.sps], [1],
252   [mrsets.sps:6: error: MRSETS: Required VARIABLES specification missing from MCGROUP subcommand.
253 ])
254 AT_CLEANUP
255
256 AT_SETUP([MRSETS variables must be same type])
257 AT_DATA([mrsets.sps],
258   [DEFINE_MRSETS_DATA
259 MRSETS /MCGROUP NAME=$mygroup VARIABLES=a b x y.
260 ])
261 AT_CHECK([pspp -O format=csv mrsets.sps], [1],
262   [mrsets.sps:6: error: MRSETS: a and x are not the same type.  All variables in this variable list must be of the same type.  x will be omitted from the list.
263
264 mrsets.sps:6: error: MRSETS: a and y are not the same type.  All variables in this variable list must be of the same type.  y will be omitted from the list.
265 ])
266 AT_CLEANUP
267
268 AT_SETUP([MRSETS variables and VALUE must be same type])
269 AT_DATA([mrsets.sps],
270   [DEFINE_MRSETS_DATA
271 MRSETS /MDGROUP NAME=$group1 VARIABLES=a b VALUE=1.
272 MRSETS /MDGROUP NAME=$group2 VARIABLES=x y VALUE='abc'.
273 ])
274 AT_CHECK([pspp -O format=csv mrsets.sps], [1],
275   ["mrsets.sps:6: error: MRSETS: MDGROUP subcommand for group $group1 specifies a string VALUE, but the variables specified for this group are numeric."
276
277 "mrsets.sps:7: error: MRSETS: MDGROUP subcommand for group $group2 specifies a string VALUE, but the variables specified for this group are numeric."
278 ])
279 AT_CLEANUP
280
281 AT_SETUP([MRSETS VALUE must not be too wide])
282 AT_DATA([mrsets.sps],
283   [DEFINE_MRSETS_DATA
284 MRSETS /MDGROUP NAME=$group1 VARIABLES=a b VALUE='abc'.
285 ])
286 AT_CHECK([pspp -O format=csv mrsets.sps], [1],
287   ["mrsets.sps:6: error: MRSETS: VALUE string on MDGROUP subcommand for group $group1 is 3 bytes long, but it must be no longer than the narrowest variable in the group, which is a with a width of 1 bytes."
288 ])
289 AT_CLEANUP
290
291 AT_SETUP([MRSETS LABEL and LABELSOURCE are exclusive])
292 AT_DATA([mrsets.sps],
293   [DEFINE_MRSETS_DATA
294 MRSETS /MDGROUP NAME=$group1 VARIABLES=a b VALUE='a'
295                 LABEL='label' LABELSOURCE=VARLABEL.
296 ])
297 AT_CHECK([pspp -O format=csv mrsets.sps], [0],
298   [mrsets.sps:7: warning: MRSETS: MDGROUP subcommand for group $group1 specifies LABELSOURCE=VARLABEL but not CATEGORYLABELS=COUNTEDVALUES.  Ignoring LABELSOURCE.
299 ])
300 AT_CLEANUP
301
302 AT_SETUP([MRSETS DISPLAY or DELETE unknown group])
303 AT_DATA([mrsets.sps],
304   [DEFINE_MRSETS_DATA
305 [MRSETS /DISPLAY NAME=[$x].
306 MRSETS /DELETE NAME=[$y].
307 ]])
308 AT_CHECK([pspp -O format=csv mrsets.sps], [1],
309   [mrsets.sps:6: error: MRSETS: No multiple response set named $x.
310
311 mrsets.sps:7: error: MRSETS: No multiple response set named $y.
312 ])
313 AT_CLEANUP