better tests
[pspp] / tests / language / expressions / evaluate.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 m4_define([CHECK_EXPR_EVAL],
17   [AT_SETUP([expressions - $1])
18    AT_KEYWORDS([expression])
19    AT_DATA([evaluate.sps],
20      [set mxwarn 1000.
21 set mxerr 1000.
22 set epoch 1940.
23 m4_foreach([check], [m4_shift($@)],
24                  [DEBUG EVALUATE NOOPT m4_argn(4, check)/[]m4_car(check).
25 DEBUG EVALUATE m4_argn(4, check)/[]m4_car(check).
26 ])])
27    AT_CAPTURE_FILE([evaluate.sps])
28    m4_pushdef([i], [3])
29    AT_CHECK([pspp --testing-mode -O format=csv evaluate.sps],
30      [m4_if(m4_bregexp([m4_foreach([check], [m4_shift($@)], [m4_argn(3, check)])], [error:]), [-1], [0], [1])],
31      [stdout])
32    AT_DATA([expout], [m4_foreach([check], [m4_shift($@)],
33         [m4_define([i], m4_incr(i))dnl
34 m4_if(m4_argn(3, check), [], [], [evaluate.sps:[]i[]: m4_argn(3, check)
35 ])dnl
36 m4_argn(2, check)
37 m4_define([i], m4_incr(i))dnl
38 m4_if(m4_argn(3, check), [], [], [evaluate.sps:[]i[]: m4_argn(3, check)
39 ])dnl
40 m4_argn(2, check)
41 ])])
42    AT_CHECK([[sed '
43 # Transform "file:line.column:" into plain "file:line:",
44 # because column numbers change between opt and noopt versions.
45 s/\(evaluate.sps:[0-9]\{1,\}\)\.[0-9]\{1,\}:/\1:/
46
47 # Remove leading or trailing quotes and un-double CSV quotes.
48 s/^"//
49 s/"$//
50 s/""/"/g
51 # "
52
53 # Delete blank lines
54 /^$/d' stdout]],
55      [0], [expout], [])
56    m4_popdef([i])
57    AT_CLEANUP])
58
59 AT_BANNER([expressions])
60
61 AT_SETUP([expressions - numeric syntax])
62 AT_KEYWORDS([expression expressions evaluate])
63 AT_DATA([evaluate-base.sps], [
64 DEBUG EVALUATE opt/1e2.
65 DEBUG EVALUATE opt/1e+2.
66 DEBUG EVALUATE opt/1e-2.
67 DEBUG EVALUATE opt/1e-99.
68 ])
69
70 for opt in '' 'NOOPT '; do
71     sed "s/opt/$opt/" < evaluate-base.sps > evaluate.sps
72     AT_CHECK([pspp --testing-mode evaluate.sps], [0], [dnl
73 1e2 => 100.00
74
75 1e+2 => 100.00
76
77 1e-2 => 0.01
78
79 1e-99 => 0.00
80 ])
81 done
82 AT_CLEANUP
83
84 AT_SETUP([expressions - coercion to and from Boolean])
85 AT_KEYWORDS([expression expressions evaluate])
86 AT_DATA([evaluate-base.sps], [
87 DEBUG EVALUATE SET opt.
88 DEBUG EVALUATE/0 AND 1.
89 DEBUG EVALUATE/$true AND 1.
90 DEBUG EVALUATE/1 OR $false.
91 DEBUG EVALUATE/1 OR $sysmis.
92 DEBUG EVALUATE/2 OR $sysmis.
93 DEBUG EVALUATE/1 AND 3.
94 ])
95
96 for opt in OPT NOOPT; do
97     sed "s/opt/$opt/" < evaluate-base.sps > evaluate.sps
98     AT_CHECK([pspp --testing-mode evaluate.sps], [1], [dnl
99 0 AND 1 => false
100
101 $true AND 1 => true
102
103 1 OR $false => true
104
105 1 OR $sysmis => true
106
107 evaluate.sps:7.16-7.27: error: DEBUG EVALUATE: The operands of OR must have
108 value 0 or 1.
109     7 | DEBUG EVALUATE/2 OR $sysmis.
110       |                ^~~~~~~~~~~~
111
112 evaluate.sps:7.16: note: DEBUG EVALUATE: This operand with unexpected value 2
113 will be treated as 0.
114     7 | DEBUG EVALUATE/2 OR $sysmis.
115       |                ^
116
117 2 OR $sysmis => sysmis
118
119 evaluate.sps:8.16-8.22: error: DEBUG EVALUATE: The operands of AND must have
120 value 0 or 1.
121     8 | DEBUG EVALUATE/1 AND 3.
122       |                ^~~~~~~
123
124 evaluate.sps:8.22: note: DEBUG EVALUATE: This operand with unexpected value 3
125 will be treated as 0.
126     8 | DEBUG EVALUATE/1 AND 3.
127       |                      ^
128
129 1 AND 3 => false
130 ])
131 done
132 AT_CLEANUP
133
134 AT_SETUP([expressions - addition and subtraction])
135 AT_KEYWORDS([expression expressions evaluate])
136 AT_DATA([evaluate-base.sps], [
137 DEBUG EVALUATE SET opt.
138 DEBUG EVALUATE /1 + $true.
139 DEBUG EVALUATE /$sysmis + 1.
140 DEBUG EVALUATE /7676 + $sysmis.
141 DEBUG EVALUATE /1 +3 - 2 +4 - 5.
142 DEBUG EVALUATE /$true - 4/3.
143 DEBUG EVALUATE /1 - 2.
144 DEBUG EVALUATE /52 -23.
145
146 DEBUG EVALUATE /('foo') + 5.
147 DEBUG EVALUATE /('foo') + ('bar').   /* Concatenation requires CONCAT.
148 DEBUG EVALUATE /'foo' + 'bar'.       /* Lexical concatenation succeeds.
149
150 DEBUG EVALUATE /'string' - 1e10.
151 DEBUG EVALUATE /9.5 - ''.
152
153 DEBUG EVALUATE /F2.0 + 3.
154 ])
155
156 for opt in OPT NOOPT; do
157     sed "s/opt/$opt/" < evaluate-base.sps > evaluate.sps
158     AT_CHECK([pspp --testing-mode evaluate.sps], [1], [dnl
159 1 + $true => 2.00
160
161 $sysmis + 1 => sysmis
162
163 7676 + $sysmis => sysmis
164
165 1 +3 - 2 +4 - 5 => 1.00
166
167 $true - 4/3 => -0.33
168
169 1 - 2 => -1.00
170
171 52 -23 => 29.00
172
173 evaluate.sps:11.18-11.27: error: DEBUG EVALUATE: Both operands of + must be
174 numeric.
175    11 | DEBUG EVALUATE /('foo') + 5.
176       |                  ^~~~~~~~~~
177
178 evaluate.sps:11.18-11.22: note: DEBUG EVALUATE: This operand has type 'string'.
179    11 | DEBUG EVALUATE /('foo') + 5.
180       |                  ^~~~~
181
182 evaluate.sps:11.27: note: DEBUG EVALUATE: This operand has type 'number'.
183    11 | DEBUG EVALUATE /('foo') + 5.
184       |                           ^
185
186 ('foo') + 5 => error
187
188 evaluate.sps:12.18-12.32: error: DEBUG EVALUATE: Both operands of + must be
189 numeric.
190    12 | DEBUG EVALUATE /('foo') + ('bar').   /* Concatenation requires CONCAT.
191       |                  ^~~~~~~~~~~~~~~
192
193 evaluate.sps:12.18-12.22: note: DEBUG EVALUATE: This operand has type 'string'.
194    12 | DEBUG EVALUATE /('foo') + ('bar').   /* Concatenation requires CONCAT.
195       |                  ^~~~~
196
197 evaluate.sps:12.28-12.32: note: DEBUG EVALUATE: This operand has type 'string'.
198    12 | DEBUG EVALUATE /('foo') + ('bar').   /* Concatenation requires CONCAT.
199       |                            ^~~~~
200
201 ('foo') + ('bar') => error
202
203 'foo' + 'bar' => "foobar"
204
205 evaluate.sps:15.17-15.31: error: DEBUG EVALUATE: Both operands of - must be
206 numeric.
207    15 | DEBUG EVALUATE /'string' - 1e10.
208       |                 ^~~~~~~~~~~~~~~
209
210 evaluate.sps:15.17-15.24: note: DEBUG EVALUATE: This operand has type 'string'.
211    15 | DEBUG EVALUATE /'string' - 1e10.
212       |                 ^~~~~~~~
213
214 evaluate.sps:15.26-15.31: note: DEBUG EVALUATE: This operand has type 'number'.
215    15 | DEBUG EVALUATE /'string' - 1e10.
216       |                          ^~~~~~
217
218 'string' - 1e10 => error
219
220 evaluate.sps:16.17-16.24: error: DEBUG EVALUATE: Both operands of - must be
221 numeric.
222    16 | DEBUG EVALUATE /9.5 - ''.
223       |                 ^~~~~~~~
224
225 evaluate.sps:16.17-16.19: note: DEBUG EVALUATE: This operand has type 'number'.
226    16 | DEBUG EVALUATE /9.5 - ''.
227       |                 ^~~
228
229 evaluate.sps:16.23-16.24: note: DEBUG EVALUATE: This operand has type 'string'.
230    16 | DEBUG EVALUATE /9.5 - ''.
231       |                       ^~
232
233 9.5 - '' => error
234
235 evaluate.sps:18.17-18.24: error: DEBUG EVALUATE: Both operands of + must be
236 numeric.
237    18 | DEBUG EVALUATE /F2.0 + 3.
238       |                 ^~~~~~~~
239
240 evaluate.sps:18.17-18.20: note: DEBUG EVALUATE: This operand has type 'format'.
241    18 | DEBUG EVALUATE /F2.0 + 3.
242       |                 ^~~~
243
244 evaluate.sps:18.24: note: DEBUG EVALUATE: This operand has type 'number'.
245    18 | DEBUG EVALUATE /F2.0 + 3.
246       |                        ^
247
248 F2.0 + 3 => error
249 ])
250 done
251 AT_CLEANUP
252
253 AT_SETUP([expressions - multiplication and division])
254 AT_KEYWORDS([expression expressions evaluate])
255 AT_DATA([evaluate-base.sps], [
256 DEBUG EVALUATE SET opt.
257 DEBUG EVALUATE /5 * 10.
258 DEBUG EVALUATE /10 * $true.
259 DEBUG EVALUATE /$true * 5.
260 DEBUG EVALUATE /1.5 * $true.
261 DEBUG EVALUATE /$sysmis * 15.
262 DEBUG EVALUATE /8.5 / $sysmis.
263 DEBUG EVALUATE /2 * 5 / 10.
264 DEBUG EVALUATE /1 / 2.
265 DEBUG EVALUATE /2 / 5.
266 DEBUG EVALUATE /12 / 3 / 2.
267
268 DEBUG EVALUATE /'x' * 1.
269 DEBUG EVALUATE /2 / 'x'.
270 ])
271
272 for opt in OPT NOOPT; do
273     sed "s/opt/$opt/" < evaluate-base.sps > evaluate.sps
274     AT_CHECK([pspp --testing-mode evaluate.sps], [1], [dnl
275 5 * 10 => 50.00
276
277 10 * $true => 10.00
278
279 $true * 5 => 5.00
280
281 1.5 * $true => 1.50
282
283 $sysmis * 15 => sysmis
284
285 8.5 / $sysmis => sysmis
286
287 2 * 5 / 10 => 1.00
288
289 1 / 2 => 0.50
290
291 2 / 5 => 0.40
292
293 12 / 3 / 2 => 2.00
294
295 evaluate.sps:14.17-14.23: error: DEBUG EVALUATE: Both operands of * must be
296 numeric.
297    14 | DEBUG EVALUATE /'x' * 1.
298       |                 ^~~~~~~
299
300 evaluate.sps:14.17-14.19: note: DEBUG EVALUATE: This operand has type 'string'.
301    14 | DEBUG EVALUATE /'x' * 1.
302       |                 ^~~
303
304 evaluate.sps:14.23: note: DEBUG EVALUATE: This operand has type 'number'.
305    14 | DEBUG EVALUATE /'x' * 1.
306       |                       ^
307
308 'x' * 1 => error
309
310 evaluate.sps:15.17-15.23: error: DEBUG EVALUATE: Both operands of / must be
311 numeric.
312    15 | DEBUG EVALUATE /2 / 'x'.
313       |                 ^~~~~~~
314
315 evaluate.sps:15.17: note: DEBUG EVALUATE: This operand has type 'number'.
316    15 | DEBUG EVALUATE /2 / 'x'.
317       |                 ^
318
319 evaluate.sps:15.21-15.23: note: DEBUG EVALUATE: This operand has type 'string'.
320    15 | DEBUG EVALUATE /2 / 'x'.
321       |                     ^~~
322
323 2 / 'x' => error
324 ])
325 done
326 AT_CLEANUP
327
328 CHECK_EXPR_EVAL([exponentiation],
329   [[2**8], [256.00]],
330   [[(2**3)**4], [4096.00]],
331   [[2**3**4], [4096.00],
332    [warning: DEBUG EVALUATE: The exponentiation operator (`**') is left-associative, even though right-associative semantics are more useful.  That is, `a**b**c' equals `(a**b)**c', not as `a**(b**c)'.  To disable this warning, insert parentheses.]])
333
334 CHECK_EXPR_EVAL([unary minus],
335   [[2+-3], [-1.00]],
336   [[2*-3], [-6.00]],
337   [[-3**2], [-9.00]],
338   [[(-3)**2], [9.00]],
339   [[2**-1], [0.50]],
340   [[0**0], [sysmis]],
341   [[0**-1], [sysmis]],
342   [[(-3)**1.5], [sysmis]])
343
344 CHECK_EXPR_EVAL([AND truth table],
345   [[$false AND $false], [false]],
346   [[$false AND $true], [false]],
347   [[$false AND $sysmis], [false]],
348   [[$true AND $false], [false]],
349   [[$true AND $true], [true]],
350   [[$true AND $sysmis], [sysmis]],
351   [[$sysmis AND $false], [false]],
352   [[$sysmis AND $true], [sysmis]],
353   [[$sysmis AND $sysmis], [sysmis]],
354   [[$false & $false], [false]],
355   [[$false & $true], [false]],
356   [[$false & $sysmis], [false]],
357   [[$true & $false], [false]],
358   [[$true & $true], [true]],
359   [[$true & $sysmis], [sysmis]],
360   [[$sysmis & $false], [false]],
361   [[$sysmis & $true], [sysmis]],
362   [[$sysmis & $sysmis], [sysmis]])
363
364 CHECK_EXPR_EVAL([OR truth table],
365   [[$false OR $false], [false]],
366   [[$false OR $true], [true]],
367   [[$false OR $sysmis], [sysmis]],
368   [[$true OR $false], [true]],
369   [[$true OR $true], [true]],
370   [[$true OR $sysmis], [true]],
371   [[$sysmis OR $false], [sysmis]],
372   [[$sysmis OR $true], [true]],
373   [[$sysmis OR $sysmis], [sysmis]],
374   [[$false | $false], [false]],
375   [[$false | $true], [true]],
376   [[$false | $sysmis], [sysmis]],
377   [[$true | $false], [true]],
378   [[$true | $true], [true]],
379   [[$true | $sysmis], [true]],
380   [[$sysmis | $false], [sysmis]],
381   [[$sysmis | $true], [true]],
382   [[$sysmis | $sysmis], [sysmis]])
383
384 CHECK_EXPR_EVAL([NOT truth table],
385   [[not $false], [true]],
386   [[not 0], [true]],
387   [[not 2.5], [true],
388    [error: DEBUG EVALUATE: An operand of the logical negation (`NOT') operator was found to have a value other than 0 (false), 1 (true), or the system-missing value.  The result was forced to 0.]],
389   [[not $true], [false]],
390   [[not 1], [false]],
391   [[not $sysmis], [sysmis]],
392   [[~ $false], [true]],
393   [[~ 0], [true]],
394   [[~ 2.5], [true],
395    [error: DEBUG EVALUATE: An operand of the logical negation (`NOT') operator was found to have a value other than 0 (false), 1 (true), or the system-missing value.  The result was forced to 0.]],
396   [[~ $true], [false]],
397   [[~ 1], [false]],
398   [[~ $sysmis], [sysmis]])
399
400 CHECK_EXPR_EVAL([= <= <],
401   [[1 eq 1], [true]],
402   [[1 = 1], [true]],
403   [[1 eq 2], [false]],
404   [[2 = 3], [false]],
405   [[1 eq 'foobar'], [error],
406    [error: DEBUG EVALUATE: Type mismatch while applying numeric equality (`EQ') operator: cannot convert string to number.]],
407   [[5 eq 'foobar'], [error],
408    [error: DEBUG EVALUATE: Type mismatch while applying numeric equality (`EQ') operator: cannot convert string to number.]],
409   [['baz' = 10], [error],
410    [error: DEBUG EVALUATE: Type mismatch while applying string equality (`=') operator: cannot convert number to string.]],
411   [['quux' = 5.55], [error],
412    [error: DEBUG EVALUATE: Type mismatch while applying string equality (`=') operator: cannot convert number to string.]],
413   [['foobar' = 'foobar'], [true]],
414   [['quux' = 'bar'], [false]],
415   [['bar   ' = 'bar'], [true]],
416   [['asdf         ' = 'asdf  '], [true]],
417   [['asdfj   ' = 'asdf'], [false]],
418 dnl Check precedence:
419   [[1 + 2 = 3], [true]],
420   [[1 >= 2 = 2 ge 3], [false],
421    [warning: DEBUG EVALUATE: Chaining relational operators (e.g. `a < b < c') will not produce the mathematically expected result.  Use the AND logical operator to fix the problem (e.g. `a < b AND b < c').  If chaining is really intended, parentheses will disable this warning (e.g. `(a < b) < c'.)]],
422 dnl Mathematically true:
423   [[3 ne 2 ~= 1], [false],
424    [warning: DEBUG EVALUATE: Chaining relational operators (e.g. `a < b < c') will not produce the mathematically expected result.  Use the AND logical operator to fix the problem (e.g. `a < b AND b < c').  If chaining is really intended, parentheses will disable this warning (e.g. `(a < b) < c'.)]],
425   [[3 > 2 > 1], [false],
426    [warning: DEBUG EVALUATE: Chaining relational operators (e.g. `a < b < c') will not produce the mathematically expected result.  Use the AND logical operator to fix the problem (e.g. `a < b AND b < c').  If chaining is really intended, parentheses will disable this warning (e.g. `(a < b) < c'.)]],
427
428   [[1 <= 2], [true]],
429   [[2.5 <= 1.5], [false]],
430   [[1 le 2], [true]],
431   [[2 <= 2], [true]],
432   [[2 le 2], [true]],
433 dnl Make sure <= token can't be split:
434   [[2 < = 2], [error],
435    [error: DEBUG EVALUATE: Syntax error at `='.]],
436   [[1 <= 'foobar'], [error],
437    [error: DEBUG EVALUATE: Type mismatch while applying numeric less-than-or-equal-to (`<=') operator: cannot convert string to number.]],
438   [[5 <= 'foobar'], [error],
439    [error: DEBUG EVALUATE: Type mismatch while applying numeric less-than-or-equal-to (`<=') operator: cannot convert string to number.]],
440   [['baz' <= 10], [error],
441    [error: DEBUG EVALUATE: Type mismatch while applying string less-than-or-equal-to (`<=') operator: cannot convert number to string.]],
442   [['quux' <= 5.55], [error],
443    [error: DEBUG EVALUATE: Type mismatch while applying string less-than-or-equal-to (`<=') operator: cannot convert number to string.]],
444   [['0123' <= '0123'], [true]],
445   [['0123' <= '0124'], [true]],
446   [['0124' le '0123'], [false]],
447   [['0123  ' <= '0123'], [true]],
448   [['0123' le '0123  '], [true]],
449
450   [[1 < 2], [true]],
451   [[2.5 < 1.5], [false]],
452   [[3.5 lt 4], [true]],
453   [[4 lt 3.5], [false]],
454   [[1 lt 'foobar'], [error],
455    [error: DEBUG EVALUATE: Type mismatch while applying numeric less than (`<') operator: cannot convert string to number.]],
456   [[5 lt 'foobar'], [error],
457    [error: DEBUG EVALUATE: Type mismatch while applying numeric less than (`<') operator: cannot convert string to number.]],
458   [['baz' < 10], [error],
459    [error: DEBUG EVALUATE: Type mismatch while applying string less than (`<') operator: cannot convert number to string.]],
460   [['quux' < 5.55], [error],
461    [error: DEBUG EVALUATE: Type mismatch while applying string less than (`<') operator: cannot convert number to string.]],
462   [['0123' lt '0123'], [false]],
463   [['0123' < '0124'], [true]],
464   [['0124' lt '0123'], [false]],
465   [['0123  ' < '0123'], [false]],
466   [['0123' lt '0123  '], [false]])
467
468 CHECK_EXPR_EVAL([>= > <>],
469   [[1 >= 2], [false]],
470   [[2.5 >= 1.5], [true]],
471   [[1 ge 2], [false]],
472   [[2 >= 2], [true]],
473   [[2 ge 2], [true]],
474 dnl Make sure >= token can't be split:
475   [[2 > = 2], [error],
476    [error: DEBUG EVALUATE: Syntax error at `='.]],
477   [[1 >= 'foobar'], [error],
478    [error: DEBUG EVALUATE: Type mismatch while applying numeric greater-than-or-equal-to (`>=') operator: cannot convert string to number.]],
479   [[5 ge 'foobar'], [error],
480    [error: DEBUG EVALUATE: Type mismatch while applying numeric greater-than-or-equal-to (`>=') operator: cannot convert string to number.]],
481   [['baz' ge 10], [error],
482    [error: DEBUG EVALUATE: Type mismatch while applying string greater-than-or-equal-to (`>=') operator: cannot convert number to string.]],
483   [['quux' >= 5.55], [error],
484    [error: DEBUG EVALUATE: Type mismatch while applying string greater-than-or-equal-to (`>=') operator: cannot convert number to string.]],
485   [['0123' ge '0123'], [true]],
486   [['0123' >= '0124'], [false]],
487   [['0124' >= '0123'], [true]],
488   [['0123  ' ge '0123'], [true]],
489   [['0123' >= '0123  '], [true]],
490
491   [[1 > 2], [false]],
492   [[2.5 > 1.5], [true]],
493   [[3.5 gt 4], [false]],
494   [[4 gt 3.5], [true]],
495   [[1 gt 'foobar'], [error],
496    [error: DEBUG EVALUATE: Type mismatch while applying numeric greater than (`>') operator: cannot convert string to number.]],
497   [[5 gt 'foobar'], [error],
498    [error: DEBUG EVALUATE: Type mismatch while applying numeric greater than (`>') operator: cannot convert string to number.]],
499   [['baz' > 10], [error],
500    [error: DEBUG EVALUATE: Type mismatch while applying string greater than (`>') operator: cannot convert number to string.]],
501   [['quux' > 5.55], [error],
502    [error: DEBUG EVALUATE: Type mismatch while applying string greater than (`>') operator: cannot convert number to string.]],
503   [['0123' gt '0123'], [false]],
504   [['0123' > '0124'], [false]],
505   [['0124' gt '0123'], [true]],
506   [['0123  ' > '0123'], [false]],
507   [['0123' gt '0123  '], [false]],
508
509   [[1 ne 1], [false]],
510   [[1 ~= 1], [false]],
511   [[1 <> 2], [true]],
512   [[2 ne 3], [true]],
513   [[1 ~= 'foobar'], [error],
514    [error: DEBUG EVALUATE: Type mismatch while applying numeric inequality (`<>') operator: cannot convert string to number.]],
515   [[5 <> 'foobar'], [error],
516    [error: DEBUG EVALUATE: Type mismatch while applying numeric inequality (`<>') operator: cannot convert string to number.]],
517   [['baz' ne 10], [error],
518    [error: DEBUG EVALUATE: Type mismatch while applying string inequality (`<>') operator: cannot convert number to string.]],
519   [['quux' ~= 5.55], [error],
520    [error: DEBUG EVALUATE: Type mismatch while applying string inequality (`<>') operator: cannot convert number to string.]],
521   [['foobar' <> 'foobar'], [false]],
522   [['quux' ne 'bar'], [true]],
523   [['bar   ' <> 'bar'], [false]],
524   [['asdf         ' ~= 'asdf  '], [false]],
525   [['asdfj   ' ne 'asdf'], [true]],
526 dnl <> token can't be split:
527   [[1 < > 1], [error],
528    [error: DEBUG EVALUATE: Syntax error at `>'.]],
529 dnl # ~= token can't be split:
530   [[1 ~ = 1], [error],
531    [error: DEBUG EVALUATE: Syntax error at `~': expecting end of command.]])
532
533 CHECK_EXPR_EVAL([exp lg10 ln sqrt abs mod mod10 rnd trunc],
534   [[exp(10)], [22026.47]],
535   [[exp('x')], [error],
536    [error: DEBUG EVALUATE: Type mismatch invoking EXP(number) as exp(string).]],
537
538   [[lg10(500)], [2.70]],
539   [[lg10('x')], [error],
540    [error: DEBUG EVALUATE: Type mismatch invoking LG10(number) as lg10(string).]],
541
542   [[ln(10)], [2.30]],
543   [[ln('x')], [error],
544    [error: DEBUG EVALUATE: Type mismatch invoking LN(number) as ln(string).]],
545
546   [[sqrt(500)], [22.36]],
547   [[sqrt('x')], [error],
548    [error: DEBUG EVALUATE: Type mismatch invoking SQRT(number) as sqrt(string).]],
549
550   [[abs(-10.5)], [10.50]],
551   [[abs(-55.79)], [55.79]],
552   [[abs(22)], [22.00]],
553   [[abs(0)], [0.00]],
554
555   [[mod(55.5, 2)], [1.50]],
556   [[mod(-55.5, 2)], [-1.50]],
557   [[mod(55.5, -2)], [1.50]],
558   [[mod(-55.5, -2)], [-1.50]],
559   [[mod('a', 2)], [error],
560    [error: DEBUG EVALUATE: Type mismatch invoking MOD(number, number) as mod(string, number).]],
561   [[mod(2, 'a')], [error],
562    [error: DEBUG EVALUATE: Type mismatch invoking MOD(number, number) as mod(number, string).]],
563   [[mod('a', 'b')], [error],
564    [error: DEBUG EVALUATE: Type mismatch invoking MOD(number, number) as mod(string, string).]],
565
566   [[mod10(55.5)], [5.50]],
567   [[mod10(-55.5)], [-5.50]],
568   [[mod10('x')], [error],
569    [error: DEBUG EVALUATE: Type mismatch invoking MOD10(number) as mod10(string).]],
570
571   [[rnd(5.4)], [5.00]],
572   [[rnd(5.6)], [6.00]],
573   [[rnd(-5.4)], [-5.00]],
574   [[rnd(-5.6)], [-6.00]],
575   [[rnd(5.56, .1)], [5.60]],
576   [[rnd(-5.56, .1)], [-5.60]],
577   [[rnd(.5)], [1.00]],
578   [[rnd(.5 - 2**-53)], [1.00]],
579   [[rnd(.5 - 2**-52)], [1.00]],
580   [[rnd(.5 - 2**-51)], [1.00]],
581   [[rnd(.5 - 2**-45)], [0.00]],
582   [[rnd(.5 - 2**-45, 1, 10)], [1.00]],
583   [[rnd('x')], [error],
584    [error: DEBUG EVALUATE: Function invocation rnd(string) does not match any known function.  Candidates are:
585 RND(number)
586 RND(number, number)
587 RND(number, number, number).]],
588
589   [[trunc(1.2)], [1.00]],
590   [[trunc(1.9)], [1.00]],
591   [[trunc(-1.2)], [-1.00]],
592   [[trunc(-1.9)], [-1.00]],
593   [[trunc(5.06, .1)], [5.00]],
594   [[trunc(-5.06, .1)], [-5.00]],
595   [[trunc(1)], [1.00]],
596   [[trunc(1 - 2**-53)], [1.00]],
597   [[trunc(1 - 2**-52)], [1.00]],
598   [[trunc(1 - 2**-51)], [1.00]],
599   [[trunc(1 - 2**-45)], [0.00]],
600   [[trunc(1 - 2**-45, 1, 10)], [1.00]],
601   [[trunc('x')], [error],
602    [error: DEBUG EVALUATE: Function invocation trunc(string) does not match any known function.  Candidates are:
603 TRUNC(number)
604 TRUNC(number, number)
605 TRUNC(number, number, number).]])
606
607 CHECK_EXPR_EVAL([acos arsin artan cos sin tan],
608   [[acos(.5) / 3.14159 * 180], [60.00]],
609   [[arcos(.75) / 3.14159 * 180], [41.41]],
610   [[arcos(-.5) / 3.14159 * 180], [120.00]],
611   [[acos(-.75) / 3.14159 * 180], [138.59]],
612   [[acos(-1) / 3.14159 * 180], [180.00]],
613   [[arcos(1) / 3.14159 * 180], [0.00]],
614   [[acos(-1.01)], [sysmis]],
615   [[arcos(1.01)], [sysmis]],
616   [[acos('x')], [error],
617    [error: DEBUG EVALUATE: Type mismatch invoking ACOS(number) as acos(string).]],
618
619   [[arsin(.5) / 3.14159 * 180], [30.00]],
620   [[asin(.25) / 3.14159 * 180], [14.48]],
621   [[arsin(-.5) / 3.14159 * 180], [-30.00]],
622   [[asin(-.25) / 3.14159 * 180], [-14.48]],
623   [[arsin(-1.01)], [sysmis]],
624   [[asin(1.01)], [sysmis]],
625   [[arsin('x')], [error],
626    [error: DEBUG EVALUATE: Type mismatch invoking ARSIN(number) as arsin(string).]],
627
628   [[artan(1) / 3.14159 * 180], [45.00]],
629   [[atan(10) / 3.14159 * 180], [84.29]],
630   [[artan(-1) / 3.14159 * 180], [-45.00]],
631   [[atan(-10) / 3.14159 * 180], [-84.29]],
632   [[artan('x')], [error],
633    [error: DEBUG EVALUATE: Type mismatch invoking ARTAN(number) as artan(string).]],
634
635   [[cos(60 / 180 * 3.14159)], [0.50]],
636   [[cos(45 / 180 * 3.14159)], [0.71]],
637   [[cos(30 / 180 * 3.14159)], [0.87]],
638   [[cos(15 / 180 * 3.14159)], [0.97]],
639   [[cos(-60 / 180 * 3.14159)], [0.50]],
640   [[cos(-45 / 180 * 3.14159)], [0.71]],
641   [[cos(-30 / 180 * 3.14159)], [0.87]],
642   [[cos(-15 / 180 * 3.14159)], [0.97]],
643   [[cos(123 / 180 * 3.14159)], [-0.54]],
644   [[cos(321 / 180 * 3.14159)], [0.78]],
645   [[cos('x')], [error],
646    [error: DEBUG EVALUATE: Type mismatch invoking COS(number) as cos(string).]],
647
648   [[sin(60 / 180 * 3.14159)], [0.87]],
649   [[sin(45 / 180 * 3.14159)], [0.71]],
650   [[sin(30 / 180 * 3.14159)], [0.50]],
651   [[sin(15 / 180 * 3.14159)], [0.26]],
652   [[sin(-60 / 180 * 3.14159)], [-0.87]],
653   [[sin(-45 / 180 * 3.14159)], [-0.71]],
654   [[sin(-30 / 180 * 3.14159)], [-0.50]],
655   [[sin(-15 / 180 * 3.14159)], [-0.26]],
656   [[sin(123 / 180 * 3.14159)], [0.84]],
657   [[sin(321 / 180 * 3.14159)], [-0.63]],
658   [[sin('x')], [error],
659    [error: DEBUG EVALUATE: Type mismatch invoking SIN(number) as sin(string).]],
660
661   [[tan(60 / 180 * 3.14159)], [1.73]],
662   [[tan(45 / 180 * 3.14159)], [1.00]],
663   [[tan(30 / 180 * 3.14159)], [0.58]],
664   [[tan(15 / 180 * 3.14159)], [0.27]],
665   [[tan(-60 / 180 * 3.14159)], [-1.73]],
666   [[tan(-45 / 180 * 3.14159)], [-1.00]],
667   [[tan(-30 / 180 * 3.14159)], [-0.58]],
668   [[tan(-15 / 180 * 3.14159)], [-0.27]],
669   [[tan(123 / 180 * 3.14159)], [-1.54]],
670   [[tan(321 / 180 * 3.14159)], [-0.81]],
671   [[tan('x')], [error],
672    [error: DEBUG EVALUATE: Type mismatch invoking TAN(number) as tan(string).]])
673 # FIXME: a variable name as the argument to SYSMIS is a special case
674 # that we don't yet test.  We also can't test VALUE this way.
675 CHECK_EXPR_EVAL([missing nmiss nvalid sysmis any range max min],
676   [[missing(10)], [false]],
677   [[missing($sysmis)], [true]],
678   [[missing(asin(1.01))], [true]],
679   [[missing(asin(.5))], [false]],
680   [[missing('    ')], [error],
681    [error: DEBUG EVALUATE: Type mismatch invoking MISSING(number) as missing(string).]],
682
683   [[nmiss($sysmis)], [1.00]],
684   [[nmiss(0)], [0.00]],
685   [[nmiss($sysmis, $sysmis, $sysmis)], [3.00]],
686   [[nmiss(1, 2, 3, 4)], [0.00]],
687   [[nmiss(1, $sysmis, $sysmis, 2, 2, $sysmis, $sysmis, 3, 4)], [4.00]],
688
689   [[nvalid($sysmis)], [0.00]],
690   [[nvalid(0)], [1.00]],
691   [[nvalid($sysmis, $sysmis, $sysmis)], [0.00]],
692   [[nvalid(1, 2, 3, 4)], [4.00]],
693   [[nvalid(1, $sysmis, $sysmis, 2, 2, $sysmis, $sysmis, 3, 4)], [5.00]],
694
695   [[sysmis(10)], [false]],
696   [[sysmis($sysmis)], [true]],
697   [[sysmis(asin(1.01))], [true]],
698   [[sysmis(asin(.5))], [false]],
699   [[sysmis('    ')], [error],
700    [error: DEBUG EVALUATE: Function invocation sysmis(string) does not match any known function.  Candidates are:
701 SYSMIS(num_variable)
702 SYSMIS(number).]],
703
704   [[any($sysmis, 1, $sysmis, 3)], [sysmis]],
705   [[any(1, 1, 2, 3)], [true]],
706   [[any(1, $true, 2, 3)], [true]],
707   [[any(1, $false, 2, 3)], [false]],
708   [[any(2, 1, 2, 3)], [true]],
709   [[any(3, 1, 2, 3)], [true]],
710   [[any(5, 1, 2, 3)], [false]],
711   [[any(1, 1, 1, 1)], [true]],
712   [[any($sysmis, 1, 1, 1)], [sysmis]],
713   [[any(1, $sysmis, $sysmis, $sysmis)], [sysmis]],
714   [[any($sysmis, $sysmis, $sysmis, $sysmis)], [sysmis]],
715   [[any(1)], [error],
716    [error: DEBUG EVALUATE: Function invocation any(number) does not match any known function.  Candidates are:
717 ANY(number, number[, number]...)
718 ANY(string, string[, string]...).]],
719   [[any('1', 2, 3, 4)], [error],
720    [error: DEBUG EVALUATE: Function invocation any(string, number, number, number) does not match any known function.  Candidates are:
721 ANY(number, number[, number]...)
722 ANY(string, string[, string]...).]],
723   [[any(1, '2', 3, 4)], [error],
724    [error: DEBUG EVALUATE: Function invocation any(number, string, number, number) does not match any known function.  Candidates are:
725 ANY(number, number[, number]...)
726 ANY(string, string[, string]...).]],
727   [[any(1, 2, '3', 4)], [error],
728    [error: DEBUG EVALUATE: Function invocation any(number, number, string, number) does not match any known function.  Candidates are:
729 ANY(number, number[, number]...)
730 ANY(string, string[, string]...).]],
731   [[any(1, 2, 3, '4')], [error],
732    [error: DEBUG EVALUATE: Function invocation any(number, number, number, string) does not match any known function.  Candidates are:
733 ANY(number, number[, number]...)
734 ANY(string, string[, string]...).]],
735
736   [[any('', 'a', '', 'c')], [true]],
737   [[any('a', 'a', 'b', 'c')], [true]],
738   [[any('b', 'a', 'b', 'c')], [true]],
739   [[any('c', 'a', 'b', 'c')], [true]],
740   [[any('e', 'a', 'b', 'c')], [false]],
741   [[any('a', 'a', 'a', 'a')], [true]],
742   [[any('', 'a', 'a', 'a')], [false]],
743   [[any('a', '', '', '')], [false]],
744   [[any('a')], [error],
745    [error: DEBUG EVALUATE: Function invocation any(string) does not match any known function.  Candidates are:
746 ANY(number, number[, number]...)
747 ANY(string, string[, string]...).]],
748   [[any('a', 'a  ', 'b', 'c')], [true]],
749   [[any('b   ', 'a', 'b', 'c')], [true]],
750   [[any('c   ', 'a', 'b', 'c     ')], [true]],
751   [[any(a10, 'b', 'c', 'd')], [error],
752    [error: DEBUG EVALUATE: Function invocation any(format, string, string, string) does not match any known function.  Candidates are:
753 ANY(number, number[, number]...)
754 ANY(string, string[, string]...).]],
755   [[any('a', b, 'c', 'd')], [error],
756    [error: DEBUG EVALUATE: Unknown identifier b.]],
757   [[any('a', 'b', c, 'd')], [error],
758    [error: DEBUG EVALUATE: Unknown identifier c.]],
759   [[any('a', 'b', 'c', d)], [error],
760    [error: DEBUG EVALUATE: Unknown identifier d.]],
761
762   [[range(5, 1, 10)], [true]],
763   [[range(1, 1, 10)], [true]],
764   [[range(10, 1, 10)], [true]],
765   [[range(-1, 1, 10)], [false]],
766   [[range(12, 1, 10)], [false]],
767   [[range($sysmis, 1, 10)], [sysmis]],
768   [[range(5, 1, $sysmis)], [sysmis]],
769   [[range(5, $sysmis, 10)], [sysmis]],
770   [[range($sysmis, $sysmis, 10)], [sysmis ]],
771   [[range($sysmis, 1, $sysmis)], [sysmis]],
772   [[range($sysmis, $sysmis, $sysmis)], [sysmis]],
773   [[range(0, 1, 8, 10, 18)], [false]],
774   [[range(1, 1, 8, 10, 18)], [true]],
775   [[range(6, 1, 8, 10, 18)], [true]],
776   [[range(8, 1, 8, 10, 18)], [true]],
777   [[range(9, 1, 8, 10, 18)], [false]],
778   [[range(10, 1, 8, 10, 18)], [true]],
779   [[range(13, 1, 8, 10, 18)], [true]],
780   [[range(16, 1, 8, 10, 18)], [true]],
781   [[range(18, 1, 8, 10, 18)], [true]],
782   [[range(20, 1, 8, 10, 18)], [false]],
783   [[range(1)], [error],
784    [error: DEBUG EVALUATE: Function invocation range(number) does not match any known function.  Candidates are:
785 RANGE(number, number, number[, number, number]...)
786 RANGE(string, string, string[, string, string]...).]],
787   [[range(1, 2)], [error],
788    [error: DEBUG EVALUATE: RANGE(number, number, number[, number, number]...) must have an odd number of arguments.]],
789   [[range(1, 2, 3, 4)], [error],
790    [error: DEBUG EVALUATE: RANGE(number, number, number[, number, number]...) must have an odd number of arguments.]],
791   [[range(1, 2, 3, 4, 5, 6)], [error],
792    [error: DEBUG EVALUATE: RANGE(number, number, number[, number, number]...) must have an odd number of arguments.]],
793   [[range('1', 2, 3)], [error],
794    [error: DEBUG EVALUATE: Function invocation range(string, number, number) does not match any known function.  Candidates are:
795 RANGE(number, number, number[, number, number]...)
796 RANGE(string, string, string[, string, string]...).]],
797   [[range(1, '2', 3)], [error],
798    [error: DEBUG EVALUATE: Function invocation range(number, string, number) does not match any known function.  Candidates are:
799 RANGE(number, number, number[, number, number]...)
800 RANGE(string, string, string[, string, string]...).]],
801   [[range(1, 2, '3')], [error],
802    [error: DEBUG EVALUATE: Function invocation range(number, number, string) does not match any known function.  Candidates are:
803 RANGE(number, number, number[, number, number]...)
804 RANGE(string, string, string[, string, string]...).]],
805
806   [[range('123', '111', '888')], [true]],
807   [[range('111', '111', '888')], [true]],
808   [[range('888', '111', '888')], [true]],
809   [[range('110', '111', '888')], [false]],
810   [[range('889', '111', '888')], [false]],
811   [[range('000', '111', '888')], [false]],
812   [[range('999', '111', '888')], [false]],
813   [[range('123   ', '111', '888')], [true]],
814   [[range('123', '111   ', '888')], [true]],
815   [[range('123', '111', '888   ')], [true]],
816   [[range('123', '111    ', '888   ')], [true]],
817   [[range('00', '01', '08', '10', '18')], [false]],
818   [[range('01', '01', '08', '10', '18')], [true]],
819   [[range('06', '01', '08', '10', '18')], [true]],
820   [[range('08', '01', '08', '10', '18')], [true]],
821   [[range('09', '01', '08', '10', '18')], [false]],
822   [[range('10', '01', '08', '10', '18')], [true]],
823   [[range('15', '01', '08', '10', '18')], [true]],
824   [[range('18', '01', '08', '10', '18')], [true]],
825   [[range('19', '01', '08', '10', '18')], [false]],
826   [[range('1')], [error],
827    [error: DEBUG EVALUATE: Function invocation range(string) does not match any known function.  Candidates are:
828 RANGE(number, number, number[, number, number]...)
829 RANGE(string, string, string[, string, string]...).]],
830   [[range('1', '2')], [error],
831    [error: DEBUG EVALUATE: RANGE(string, string, string[, string, string]...) must have an odd number of arguments.]],
832   [[range('1', '2', '3', '4')], [error],
833    [error: DEBUG EVALUATE: RANGE(string, string, string[, string, string]...) must have an odd number of arguments.]],
834   [[range('1', '2', '3', '4', '5', '6')], [error],
835    [error: DEBUG EVALUATE: RANGE(string, string, string[, string, string]...) must have an odd number of arguments.]],
836   [[range(1, '2', '3')], [error],
837    [error: DEBUG EVALUATE: Function invocation range(number, string, string) does not match any known function.  Candidates are:
838 RANGE(number, number, number[, number, number]...)
839 RANGE(string, string, string[, string, string]...).]],
840   [[range('1', 2, '3')], [error],
841    [error: DEBUG EVALUATE: Function invocation range(string, number, string) does not match any known function.  Candidates are:
842 RANGE(number, number, number[, number, number]...)
843 RANGE(string, string, string[, string, string]...).]],
844   [[range('1', '2', 3)], [error],
845    [error: DEBUG EVALUATE: Function invocation range(string, string, number) does not match any known function.  Candidates are:
846 RANGE(number, number, number[, number, number]...)
847 RANGE(string, string, string[, string, string]...).]],
848
849   [[max(1, 2, 3, 4, 5)], [5.00]],
850   [[max(1, $sysmis, 2, 3, $sysmis, 4, 5)], [5.00]],
851   [[max(1, 2)], [2.00]],
852   [[max()], [error],
853    [error: DEBUG EVALUATE: Function invocation max() does not match any known function.  Candidates are:
854 MAX(number[, number]...)
855 MAX(string[, string]...).]],
856   [[max(1)], [1.00]],
857   [[max(1, $sysmis)], [1.00]],
858   [[max(1, 2, 3, $sysmis)], [3.00]],
859   [[max.4(1, 2, 3, $sysmis)], [sysmis]],
860   [[max.4(1, 2, 3)], [error],
861    [error: DEBUG EVALUATE: For MAX(number[, number]...) with 3 arguments, at most 3 (not 4) may be required to be valid.]],
862
863   [[max("2", "3", "5", "1", "4")], ["5"]],
864   [[max("1", "2")], ["2"]],
865   [[max("1")], ["1"]],
866
867   [[min(1, 2, 3, 4, 5)], [1.00]],
868   [[min(1, $sysmis, 2, 3, $sysmis, 4, 5)], [1.00]],
869   [[min(1, 2)], [1.00]],
870   [[min()], [error],
871    [error: DEBUG EVALUATE: Function invocation min() does not match any known function.  Candidates are:
872 MIN(number[, number]...)
873 MIN(string[, string]...).]],
874   [[min(1)], [1.00]],
875   [[min(1, $sysmis)], [1.00]],
876   [[min(1, 2, 3, $sysmis)], [1.00]],
877   [[min.4(1, 2, 3, $sysmis)], [sysmis]],
878   [[min.4(1, 2, 3)], [error],
879    [error: DEBUG EVALUATE: For MIN(number[, number]...) with 3 arguments, at most 3 (not 4) may be required to be valid.]],
880
881   [[min("2", "3", "5", "1", "4")], ["1"]],
882   [[min("1", "2")], ["1"]],
883   [[min("1")], ["1"]])
884
885 CHECK_EXPR_EVAL([cfvar mean median sd sum variance],
886   [[cfvar(1, 2, 3, 4, 5)], [0.53]],
887   [[cfvar(1, $sysmis, 2, 3, $sysmis, 4, 5)], [0.53]],
888   [[cfvar(1, 2)], [0.47]],
889   [[cfvar(1)], [error],
890    [error: DEBUG EVALUATE: Type mismatch invoking CFVAR(number, number[, number]...) as cfvar(number).]],
891   [[cfvar(1, $sysmis)], [sysmis]],
892   [[cfvar(1, 2, 3, $sysmis)], [0.50]],
893   [[cfvar.4(1, 2, 3, $sysmis)], [sysmis]],
894   [[cfvar.4(1, 2, 3)], [error],
895    [error: DEBUG EVALUATE: For CFVAR(number, number[, number]...) with 3 arguments, at most 3 (not 4) may be required to be valid.]],
896   [[cfvar('x')], [error],
897    [error: DEBUG EVALUATE: Type mismatch invoking CFVAR(number, number[, number]...) as cfvar(string).]],
898   [[cfvar('x', 1, 2, 3)], [error],
899    [error: DEBUG EVALUATE: Type mismatch invoking CFVAR(number, number[, number]...) as cfvar(string, number, number, number).]],
900
901   [[mean(1, 2, 3, 4, 5)], [3.00]],
902   [[mean(1, $sysmis, 2, 3, $sysmis, 4, 5)], [3.00]],
903   [[mean(1, 2)], [1.50]],
904   [[mean()], [error],
905    [error: DEBUG EVALUATE: Type mismatch invoking MEAN(number[, number]...) as mean().]],
906   [[mean(1)], [1.00]],
907   [[mean(1, $sysmis)], [1.00]],
908   [[mean(1, 2, 3, $sysmis)], [2.00]],
909   [[mean.4(1, 2, 3, $sysmis)], [sysmis]],
910   [[mean.4(1, 2, 3)], [error],
911    [error: DEBUG EVALUATE: For MEAN(number[, number]...) with 3 arguments, at most 3 (not 4) may be required to be valid.]],
912
913   [[median(1, 2, 3, 4, 5)], [3.00]],
914   [[median(2, 3, 4, 5, 1)], [3.00]],
915   [[median(2, 3, 4, 1, 5)], [3.00]],
916   [[median(2, 1, 4, 5, 3)], [3.00]],
917   [[median(1, 2, 3, 4)], [2.50]],
918   [[median(2, 3, 1, 4)], [2.50]],
919   [[median(2, 3, 4, 1)], [2.50]],
920   [[median(2, 1, 4, 3)], [2.50]],
921   [[median(1, $sysmis, 3, 4, 5)], [3.50]],
922   [[median(2, 3, 4, 5, $sysmis, 1)], [3.00]],
923   [[median($sysmis, $sysmis, $sysmis, 2, 3, 4, 1, 5)], [3.00]],
924   [[median(1, 2, 3)], [2.00]],
925   [[median(1)], [1.00]],
926   [[median(1, 2)], [1.50]],
927   [[median(1, 2, $sysmis)], [1.50]],
928   [[median(1, $sysmis, $sysmis)], [1.00]],
929   [[median($sysmis, $sysmis, $sysmis)], [sysmis]],
930   [[median.3(1, 2, $sysmis)], [sysmis]],
931   [[median.2(1, $sysmis)], [sysmis]],
932
933   [[sd(1, 2, 3, 4, 5)], [1.58]],
934   [[sd(1, $sysmis, 2, 3, $sysmis, 4, 5)], [1.58]],
935   [[sd(1, 2)], [0.71]],
936   [[sd(1)], [error],
937    [error: DEBUG EVALUATE: Type mismatch invoking SD(number, number[, number]...) as sd(number).]],
938   [[sd(1, $sysmis)], [sysmis]],
939   [[sd(1, 2, 3, $sysmis)], [1.00]],
940   [[sd.4(1, 2, 3, $sysmis)], [sysmis]],
941   [[sd.4(1, 2, 3)], [error],
942    [error: DEBUG EVALUATE: For SD(number, number[, number]...) with 3 arguments, at most 3 (not 4) may be required to be valid.]],
943   [[sd('x')], [error],
944    [error: DEBUG EVALUATE: Type mismatch invoking SD(number, number[, number]...) as sd(string).]],
945   [[sd('x', 1, 2, 3)], [error],
946    [error: DEBUG EVALUATE: Type mismatch invoking SD(number, number[, number]...) as sd(string, number, number, number).]],
947
948   [[sum(1, 2, 3, 4, 5)], [15.00]],
949   [[sum(1, $sysmis, 2, 3, $sysmis, 4, 5)], [15.00]],
950   [[sum(1, 2)], [3.00]],
951   [[sum()], [error],
952    [error: DEBUG EVALUATE: Type mismatch invoking SUM(number[, number]...) as sum().]],
953   [[sum(1)], [1.00]],
954   [[sum(1, $sysmis)], [1.00]],
955   [[sum(1, 2, 3, $sysmis)], [6.00]],
956   [[sum.4(1, 2, 3, $sysmis)], [sysmis]],
957   [[sum.4(1, 2, 3)], [error],
958    [error: DEBUG EVALUATE: For SUM(number[, number]...) with 3 arguments, at most 3 (not 4) may be required to be valid.]],
959
960   [[variance(1, 2, 3, 4, 5)], [2.50]],
961   [[variance(1, $sysmis, 2, 3, $sysmis, 4, 5)], [2.50]],
962   [[variance(1, 2)], [0.50]],
963   [[variance(1)], [error],
964    [error: DEBUG EVALUATE: Type mismatch invoking VARIANCE(number, number[, number]...) as variance(number).]],
965   [[variance(1, $sysmis)], [sysmis]],
966   [[variance(1, 2, 3, $sysmis)], [1.00]],
967   [[variance.4(1, 2, 3, $sysmis)], [sysmis]],
968   [[variance.4(1, 2, 3)], [error],
969    [error: DEBUG EVALUATE: For VARIANCE(number, number[, number]...) with 3 arguments, at most 3 (not 4) may be required to be valid.]],
970   [[variance('x')], [error],
971    [error: DEBUG EVALUATE: Type mismatch invoking VARIANCE(number, number[, number]...) as variance(string).]],
972   [[variance('x', 1, 2, 3)], [error],
973    [error: DEBUG EVALUATE: Type mismatch invoking VARIANCE(number, number[, number]...) as variance(string, number, number, number).]])
974
975 CHECK_EXPR_EVAL([concat index rindex length lower],
976   [[concat('')], [""]],
977   [[concat('a', 'b')], ["ab"]],
978   [[concat('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h')], ["abcdefgh"]],
979   [[concat('abcdefgh', 'ijklmnopq')], ["abcdefghijklmnopq"]],
980   [[concat('a', 1)], [error],
981    [error: DEBUG EVALUATE: Type mismatch invoking CONCAT(string[, string]...) as concat(string, number).]],
982   [[concat(1, 2)], [error],
983    [error: DEBUG EVALUATE: Type mismatch invoking CONCAT(string[, string]...) as concat(number, number).]],
984
985   [[index('abcbcde', 'bc')], [2.00]],
986   [[index('abcbcde', 'bcd')], [4.00]],
987   [[index('abcbcde', 'bcbc')], [2.00]],
988   [[index('abcdefgh', 'abc')], [1.00]],
989   [[index('abcdefgh', 'bcd')], [2.00]],
990   [[index('abcdefgh', 'cde')], [3.00]],
991   [[index('abcdefgh', 'def')], [4.00]],
992   [[index('abcdefgh', 'efg')], [5.00]],
993   [[index('abcdefgh', 'fgh')], [6.00]],
994   [[index('abcdefgh', 'fghi')], [0.00]],
995   [[index('abcdefgh', 'x')], [0.00]],
996   [[index('abcdefgh', 'abch')], [0.00]],
997   [[index('banana', 'na')], [3.00]],
998   [[index('banana', 'ana')], [2.00]],
999   [[index('', 'x')], [0.00]],
1000   [[index('', '')], [sysmis]],
1001   [[index('abcdefgh', '')], [sysmis]],
1002   [[index('abcdefgh', 'alkjsfdjlskalkjfa')], [0.00]],
1003
1004   [[index('abcbcde', 'bc', 1)], [2.00]],
1005   [[index('abcbcde', 'dc', 1)], [3.00]],
1006   [[index('abcbcde', 'abc', 1)], [1.00]],
1007   [[index('abcbcde', 'bc', 2)], [2.00]],
1008   [[index('abcbcde', 'dc', 2)], [0.00]],
1009   [[index('abcbcde', 'abc', 1)], [1.00]],
1010   [[index('abcbcde', 'bccb', 2)], [2.00]],
1011   [[index('abcbcde', 'bcbc', 2)], [2.00]],
1012   [[index('abcbcde', 'bcbc', $sysmis)], [sysmis]],
1013
1014   [[rindex('abcbcde', 'bc')], [4.00]],
1015   [[rindex('abcbcde', 'bcd')], [4.00]],
1016   [[rindex('abcbcde', 'bcbc')], [2.00]],
1017   [[rindex('abcdefgh', 'abc')], [1.00]],
1018   [[rindex('abcdefgh', 'bcd')], [2.00]],
1019   [[rindex('abcdefgh', 'cde')], [3.00]],
1020   [[rindex('abcdefgh', 'def')], [4.00]],
1021   [[rindex('abcdefgh', 'efg')], [5.00]],
1022   [[rindex('abcdefgh', 'fgh')], [6.00]],
1023   [[rindex('abcdefgh', 'fghi')], [0.00]],
1024   [[rindex('abcdefgh', 'x')], [0.00]],
1025   [[rindex('abcdefgh', 'abch')], [0.00]],
1026   [[rindex('banana', 'na')], [5.00]],
1027   [[rindex('banana', 'ana')], [4.00]],
1028   [[rindex('', 'x')], [0.00]],
1029   [[rindex('', '')], [sysmis]],
1030   [[rindex('abcdefgh', '')], [sysmis]],
1031   [[rindex('abcdefgh', 'alkjsfdjlskalkjfa')], [0.00]],
1032
1033   [[rindex('abcbcde', 'bc', 1)], [5.00]],
1034   [[rindex('abcbcde', 'dc', 1)], [6.00]],
1035   [[rindex('abcbcde', 'abc', 1)], [5.00]],
1036   [[rindex('abcbcde', 'bc', 2)], [4.00]],
1037   [[rindex('abcbcde', 'dc', 2)], [0.00]],
1038   [[rindex('abcbcde', 'abc', 1)], [5.00]],
1039   [[rindex('abcbcde', 'bccb', 2)], [4.00]],
1040   [[rindex('abcbcde', 'bcbc', 2)], [4.00]],
1041   [[rindex('abcbcde', 'bcbc', 0)], [sysmis]],
1042   [[rindex('abcbcde', 'bcbc', $sysmis)], [sysmis]],
1043   [[rindex('abcbcde', 'bcbcg', 2)], [sysmis]],
1044   [[rindex('abcbcde', 'bcbcg', $sysmis)], [sysmis]],
1045   [[rindex('abcbcde', 'bcbcg', 'x')], [error],
1046    [error: DEBUG EVALUATE: Function invocation rindex(string, string, string) does not match any known function.  Candidates are:
1047 RINDEX(string, string)
1048 RINDEX(string, string, number).]],
1049   [[rindex(1, 'bcdfkjl', 2)], [error],
1050    [error: DEBUG EVALUATE: Function invocation rindex(number, string, number) does not match any known function.  Candidates are:
1051 RINDEX(string, string)
1052 RINDEX(string, string, number).]],
1053   [[rindex('aksj', 2, 2)], [error],
1054    [error: DEBUG EVALUATE: Function invocation rindex(string, number, number) does not match any known function.  Candidates are:
1055 RINDEX(string, string)
1056 RINDEX(string, string, number).]],
1057   [[rindex(1, 2, 3)], [error],
1058    [error: DEBUG EVALUATE: Function invocation rindex(number, number, number) does not match any known function.  Candidates are:
1059 RINDEX(string, string)
1060 RINDEX(string, string, number).]],
1061   [[rindex(1, 2, '3')], [error],
1062    [error: DEBUG EVALUATE: Function invocation rindex(number, number, string) does not match any known function.  Candidates are:
1063 RINDEX(string, string)
1064 RINDEX(string, string, number).]],
1065
1066   [[length('')], [0.00]],
1067   [[length('a')], [1.00]],
1068   [[length('xy')], [2.00]],
1069   [[length('adsf    ')], [8.00]],
1070   [[length('abcdefghijkl')], [12.00]],
1071   [[length(0)], [error],
1072    [error: DEBUG EVALUATE: Type mismatch invoking LENGTH(string) as length(number).]],
1073   [[length($sysmis)], [error],
1074    [error: DEBUG EVALUATE: Type mismatch invoking LENGTH(string) as length(number).]],
1075
1076   [[lower('ABCDEFGHIJKLMNOPQRSTUVWXYZ!@%&*089')], ["abcdefghijklmnopqrstuvwxyz!@%&*089"]],
1077   [[lower('')], [""]],
1078   [[lower(1)], [error],
1079    [error: DEBUG EVALUATE: Type mismatch invoking LOWER(string) as lower(number).]])
1080
1081 CHECK_EXPR_EVAL([replace],
1082   [[replace('banana', 'an', 'AN')], ["bANANa"]],
1083   [[replace('banana', 'an', 'a')], ["baaa"]],
1084   [[replace('banana', 'an', '')], ["ba"]],
1085   [[replace('banana', 'na', '')], ["ba"]],
1086   [[replace('banana', 'ba', 'BA')], ["BAnana"]],
1087   [[replace('banana', 'na', 'xyzzy')], ["baxyzzyxyzzy"]],
1088   [[replace('banana', 'an', 'xyzzy', 1)], ["bxyzzyana"]],
1089   [[replace('banana', 'an', 'xyzzy', 1.5)], ["bxyzzyana"]],
1090   [[replace('banana', 'bananana', 'xyzzy')], ["banana"]],
1091   [[replace('banana', '', 'xyzzy')], ["banana"]],
1092   [[replace('banana', 'ba', '', 0)], ["banana"]],
1093   [[replace('banana', 'ba', '', -1)], ["banana"]],
1094   [[replace('banana', 'ba', '', $sysmis)], ["banana"]])
1095
1096 CHECK_EXPR_EVAL([lpad number ltrim lpad rtrim rpad string strunc substr upcase],
1097   [[lpad('abc', -1)], [""]],
1098   [[lpad('abc', 0)], ["abc"]],
1099   [[lpad('abc', 2)], ["abc"]],
1100   [[lpad('abc', 3)], ["abc"]],
1101   [[lpad('abc', 10)], ["       abc"]],
1102   [[lpad('abc', 32768)], [""]],
1103   [[lpad('abc', $sysmis)], [""]],
1104   [[lpad('abc', -1, '*')], [""]],
1105   [[lpad('abc', 0, '*')], ["abc"]],
1106   [[lpad('abc', 2, '*')], ["abc"]],
1107   [[lpad('abc', 3, '*')], ["abc"]],
1108   [[lpad('abc', 10, '*')], ["*******abc"]],
1109   [[lpad('abc', 32768, '*')], [""]],
1110   [[lpad('abc', $sysmis, '*')], [""]],
1111   [[lpad('abc', $sysmis, '')], [""]],
1112   [[lpad('abc', $sysmis, 'xy')], [""]],
1113   [[lpad(0, 10)], [error],
1114    [error: DEBUG EVALUATE: Function invocation lpad(number, number) does not match any known function.  Candidates are:
1115 LPAD(string, number)
1116 LPAD(string, number, string).]],
1117   [[lpad('abc', 'def')], [error],
1118    [error: DEBUG EVALUATE: Function invocation lpad(string, string) does not match any known function.  Candidates are:
1119 LPAD(string, number)
1120 LPAD(string, number, string).]],
1121   [[lpad(0, 10, ' ')], [error],
1122    [error: DEBUG EVALUATE: Function invocation lpad(number, number, string) does not match any known function.  Candidates are:
1123 LPAD(string, number)
1124 LPAD(string, number, string).]],
1125   [[lpad('abc', 'def', ' ')], [error],
1126    [error: DEBUG EVALUATE: Function invocation lpad(string, string, string) does not match any known function.  Candidates are:
1127 LPAD(string, number)
1128 LPAD(string, number, string).]],
1129   [[lpad('x', 5, 0)], [error],
1130    [error: DEBUG EVALUATE: Function invocation lpad(string, number, number) does not match any known function.  Candidates are:
1131 LPAD(string, number)
1132 LPAD(string, number, string).]],
1133   [[lpad('x', 5, 2)], [error],
1134    [error: DEBUG EVALUATE: Function invocation lpad(string, number, number) does not match any known function.  Candidates are:
1135 LPAD(string, number)
1136 LPAD(string, number, string).]],
1137
1138   [[number("123", f3.0)], [123.00]],
1139   [[number(" 123", f3.0)], [12.00]],
1140   [[number("123", f3.1)], [12.30]],
1141   [[number("   ", f3.1)], [sysmis]],
1142   [[number("123", a8)], [error],
1143    [error: DEBUG EVALUATE: Type mismatch invoking NUMBER(string, num_input_format) as number(string, format).]],
1144 dnl CCA is not an input format:
1145   [[number("123", cca1.2)], [error],
1146    [error: DEBUG EVALUATE: Type mismatch invoking NUMBER(string, num_input_format) as number(string, format).]],
1147
1148   [[ltrim('   abc')], ["abc"]],
1149   [[rtrim('   abc   ')], ["   abc"]],
1150   [[ltrim('abc')], ["abc"]],
1151   [[ltrim('     abc')], ["      abc"]],
1152   [[ltrim('    ')], [""]],
1153   [[ltrim('')], [""]],
1154   [[ltrim(8)], [error],
1155    [error: DEBUG EVALUATE: Function invocation ltrim(number) does not match any known function.  Candidates are:
1156 LTRIM(string)
1157 LTRIM(string, string).]],
1158   [[ltrim('***abc', '*')], ["abc"]],
1159   [[ltrim('abc', '*')], ["abc"]],
1160   [[ltrim('*abc', '*')], ["abc"]],
1161   [[ltrim('', '*')], [""]],
1162   [[ltrim(8, '*')], [error],
1163    [error: DEBUG EVALUATE: Function invocation ltrim(number, string) does not match any known function.  Candidates are:
1164 LTRIM(string)
1165 LTRIM(string, string).]],
1166   [[ltrim(' x', 8)], [error],
1167    [error: DEBUG EVALUATE: Function invocation ltrim(string, number) does not match any known function.  Candidates are:
1168 LTRIM(string)
1169 LTRIM(string, string).]],
1170   [[ltrim(8, 9)], [error],
1171    [error: DEBUG EVALUATE: Function invocation ltrim(number, number) does not match any known function.  Candidates are:
1172 LTRIM(string)
1173 LTRIM(string, string).]],
1174
1175   [[rpad('abc', -1)], [""]],
1176   [[rpad('abc', 0)], ["abc"]],
1177   [[rpad('abc', 2)], ["abc"]],
1178   [[rpad('abc', 3)], ["abc"]],
1179   [[rpad('abc', 10)], ["abc       "]],
1180   [[rpad('abc', 32768)], [""]],
1181   [[rpad('abc', $sysmis)], [""]],
1182   [[rpad('abc', -1, '*')], [""]],
1183   [[rpad('abc', 0, '*')], ["abc"]],
1184   [[rpad('abc', 2, '*')], ["abc"]],
1185   [[rpad('abc', 3, '*')], ["abc"]],
1186   [[rpad('abc', 10, '*')], ["abc*******"]],
1187   [[rpad('abc', 32768, '*')], [""]],
1188   [[rpad('abc', $sysmis, '*')], [""]],
1189   [[rpad('abc', $sysmis, '')], [""]],
1190   [[rpad('abc', $sysmis, 'xy')], [""]],
1191   [[rpad(0, 10)], [error],
1192    [error: DEBUG EVALUATE: Function invocation rpad(number, number) does not match any known function.  Candidates are:
1193 RPAD(string, number)
1194 RPAD(string, number, string).]],
1195   [[rpad('abc', 'def')], [error],
1196    [error: DEBUG EVALUATE: Function invocation rpad(string, string) does not match any known function.  Candidates are:
1197 RPAD(string, number)
1198 RPAD(string, number, string).]],
1199   [[rpad(0, 10, ' ')], [error],
1200    [error: DEBUG EVALUATE: Function invocation rpad(number, number, string) does not match any known function.  Candidates are:
1201 RPAD(string, number)
1202 RPAD(string, number, string).]],
1203   [[rpad('abc', 'def', ' ')], [error],
1204    [error: DEBUG EVALUATE: Function invocation rpad(string, string, string) does not match any known function.  Candidates are:
1205 RPAD(string, number)
1206 RPAD(string, number, string).]],
1207   [[rpad('x', 5, 0)], [error],
1208    [error: DEBUG EVALUATE: Function invocation rpad(string, number, number) does not match any known function.  Candidates are:
1209 RPAD(string, number)
1210 RPAD(string, number, string).]],
1211   [[rpad('x', 5, 2)], [error],
1212    [error: DEBUG EVALUATE: Function invocation rpad(string, number, number) does not match any known function.  Candidates are:
1213 RPAD(string, number)
1214 RPAD(string, number, string).]],
1215
1216   [[rtrim('abc   ')], ["abc"]],
1217   [[rtrim('   abc   ')], ["   abc"]],
1218   [[rtrim('abc')], ["abc"]],
1219   [[rtrim('abc  ')], ["abc      "]],
1220   [[rtrim('    ')], [""]],
1221   [[rtrim('')], [""]],
1222   [[rtrim(8)], [error],
1223    [error: DEBUG EVALUATE: Function invocation rtrim(number) does not match any known function.  Candidates are:
1224 RTRIM(string)
1225 RTRIM(string, string).]],
1226   [[rtrim('abc***', '*')], ["abc"]],
1227   [[rtrim('abc', '*')], ["abc"]],
1228   [[rtrim('abc*', '*')], ["abc"]],
1229   [[rtrim('', '*')], [""]],
1230   [[rtrim(8, '*')], [error],
1231    [error: DEBUG EVALUATE: Function invocation rtrim(number, string) does not match any known function.  Candidates are:
1232 RTRIM(string)
1233 RTRIM(string, string).]],
1234   [[rtrim(' x', 8)], [error],
1235    [error: DEBUG EVALUATE: Function invocation rtrim(string, number) does not match any known function.  Candidates are:
1236 RTRIM(string)
1237 RTRIM(string, string).]],
1238   [[rtrim(8, 9)], [error],
1239    [error: DEBUG EVALUATE: Function invocation rtrim(number, number) does not match any known function.  Candidates are:
1240 RTRIM(string)
1241 RTRIM(string, string).]],
1242
1243   [[string(123.56, f5.1)], ["123.6"]],
1244   [[string($sysmis, f5.1)], ["   . "]],
1245   [[string("abc", A5)], [error],
1246    [error: DEBUG EVALUATE: Type mismatch invoking STRING(number, num_output_format) as string(string, format).]],
1247 dnl E has a minimum width of 6 on output:
1248   [[string(123, e1)], [error],
1249    [error: DEBUG EVALUATE: Type mismatch invoking STRING(number, num_output_format) as string(number, format).]],
1250   [[string(123, e6.0)], ["1E+002"]],
1251
1252   [[strunc('a c   ', 9)], ["a c"]],
1253   [[strunc('a c   ', 7)], ["a c"]],
1254   [[strunc('a c   ', 6)], ["a c"]],
1255   [[strunc('a c   ', 5)], ["a c"]],
1256   [[strunc('a c   ', 4)], ["a c"]],
1257   [[strunc('a c   ', 3)], ["a c"]],
1258   [[strunc('a c   ', 2)], ["a"]],
1259   [[strunc('a c   ', 1)], ["a"]],
1260   [[strunc('a c   ', 0)], [""]],
1261   [[strunc('a c   ', -1)], [""]],
1262   [[strunc('a c   ', $sysmis)], [""]],
1263   [[strunc('  abc  ', 9)], ["  abc"]],
1264   [[strunc('  abc  ', 8)], ["  abc"]],
1265   [[strunc('  abc  ', 7)], ["  abc"]],
1266   [[strunc('  abc  ', 6)], ["  abc"]],
1267   [[strunc('  abc  ', 5)], ["  abc"]],
1268   [[strunc('  abc  ', 4)], ["  ab"]],
1269   [[strunc('  abc  ', 3)], ["  a"]],
1270   [[strunc('  abc  ', 2)], [""]],
1271   [[strunc('  abc  ', 1)], [""]],
1272   [[strunc('  abc  ', -1)], [""]],
1273   [[strunc('  abc  ', $sysmis)], [""]],
1274
1275   [[substr('abcdefgh', -5)], [""]],
1276   [[substr('abcdefgh', 0)], [""]],
1277   [[substr('abcdefgh', 1)], ["abcdefgh"]],
1278   [[substr('abcdefgh', 3)], ["cdefgh"]],
1279   [[substr('abcdefgh', 5)], ["efgh"]],
1280   [[substr('abcdefgh', 6)], ["fgh"]],
1281   [[substr('abcdefgh', 7)], ["gh"]],
1282   [[substr('abcdefgh', 8)], ["h"]],
1283   [[substr('abcdefgh', 9)], [""]],
1284   [[substr('abcdefgh', 10)], [""]],
1285   [[substr('abcdefgh', 20)], [""]],
1286   [[substr('abcdefgh', $sysmis)], [""]],
1287   [[substr(0, 10)], [error],
1288    [error: DEBUG EVALUATE: Function invocation substr(number, number) does not match any known function.  Candidates are:
1289 SUBSTR(string, number)
1290 SUBSTR(string, number, number).]],
1291   [[substr('abcd', 'abc')], [error],
1292    [error: DEBUG EVALUATE: Function invocation substr(string, string) does not match any known function.  Candidates are:
1293 SUBSTR(string, number)
1294 SUBSTR(string, number, number).]],
1295   [[substr(0, 'abc')], [error],
1296    [error: DEBUG EVALUATE: Function invocation substr(number, string) does not match any known function.  Candidates are:
1297 SUBSTR(string, number)
1298 SUBSTR(string, number, number).]],
1299
1300   [[substr('abcdefgh', 0, 0)], [""]],
1301   [[substr('abcdefgh', 3, 0)], [""]],
1302   [[substr('abcdefgh', 5, 0)], [""]],
1303   [[substr('abcdefgh', 9, 0)], [""]],
1304   [[substr('abcdefgh', 0, 1)], [""]],
1305   [[substr('abcdefgh', 0, 5)], [""]],
1306   [[substr('abcdefgh', 1, 8)], ["abcdefgh"]],
1307   [[substr('abcdefgh', 1, 10)], ["abcdefgh"]],
1308   [[substr('abcdefgh', 1, 20)], ["abcdefgh"]],
1309   [[substr('abcdefgh', 3, 4)], ["cdef"]],
1310   [[substr('abcdefgh', 5, 2)], ["ef"]],
1311   [[substr('abcdefgh', 6, 1)], ["f"]],
1312   [[substr('abcdefgh', 7, 10)], ["gh"]],
1313   [[substr('abcdefgh', 8, 1)], ["h"]],
1314   [[substr('abcdefgh', 8, 2)], ["h"]],
1315   [[substr('abcdefgh', 9, 11)], [""]],
1316   [[substr('abcdefgh', 10, 52)], [""]],
1317   [[substr('abcdefgh', 20, 1)], [""]],
1318   [[substr('abcdefgh', $sysmis, 2)], [""]],
1319   [[substr('abcdefgh', 9, $sysmis)], [""]],
1320   [[substr('abcdefgh', $sysmis, $sysmis)], [""]],
1321   [[substr('abc', 1, 'x')], [error],
1322    [error: DEBUG EVALUATE: Function invocation substr(string, number, string) does not match any known function.  Candidates are:
1323 SUBSTR(string, number)
1324 SUBSTR(string, number, number).]],
1325   [[substr(0, 10, 1)], [error],
1326    [error: DEBUG EVALUATE: Function invocation substr(number, number, number) does not match any known function.  Candidates are:
1327 SUBSTR(string, number)
1328 SUBSTR(string, number, number).]],
1329   [[substr(0, 10, 'x')], [error],
1330    [error: DEBUG EVALUATE: Function invocation substr(number, number, string) does not match any known function.  Candidates are:
1331 SUBSTR(string, number)
1332 SUBSTR(string, number, number).]],
1333   [[substr('abcd', 'abc', 0)], [error],
1334    [error: DEBUG EVALUATE: Function invocation substr(string, string, number) does not match any known function.  Candidates are:
1335 SUBSTR(string, number)
1336 SUBSTR(string, number, number).]],
1337   [[substr('abcd', 'abc', 'j')], [error],
1338    [error: DEBUG EVALUATE: Function invocation substr(string, string, string) does not match any known function.  Candidates are:
1339 SUBSTR(string, number)
1340 SUBSTR(string, number, number).]],
1341   [[substr(0, 'abc', 4)], [error],
1342    [error: DEBUG EVALUATE: Function invocation substr(number, string, number) does not match any known function.  Candidates are:
1343 SUBSTR(string, number)
1344 SUBSTR(string, number, number).]],
1345   [[substr(0, 'abc', 'k')], [error],
1346    [error: DEBUG EVALUATE: Function invocation substr(number, string, string) does not match any known function.  Candidates are:
1347 SUBSTR(string, number)
1348 SUBSTR(string, number, number).]],
1349
1350   [[upcase('abcdefghijklmnopqrstuvwxyz!@%&*089')], ["ABCDEFGHIJKLMNOPQRSTUVWXYZ!@%&*089"]],
1351   [[upcase('')], [""]],
1352   [[upcase(1)], [error],
1353    [error: DEBUG EVALUATE: Type mismatch invoking UPCASE(string) as upcase(number).]])
1354
1355 CHECK_EXPR_EVAL([time ctime date yrmoda],
1356   [[time.days(1)], [86400.00]],
1357   [[time.days(-1)], [-86400.00]],
1358   [[time.days(0.5)], [43200.00]],
1359   [[time.days('x')], [error],
1360    [error: DEBUG EVALUATE: Type mismatch invoking TIME.DAYS(number) as time.days(string).]],
1361   [[time.days($sysmis)], [sysmis]],
1362
1363   [[time.hms(4,50,38)], [17438.00]],
1364   [[time.hms(12,31,35)], [45095.00]],
1365   [[time.hms(12,47,53)], [46073.00]],
1366   [[time.hms(1,26,0)], [5160.00]],
1367   [[time.hms(20,58,11)], [75491.00]],
1368   [[time.hms(7,36,5)], [27365.00]],
1369   [[time.hms(15,43,49)], [56629.00]],
1370   [[time.hms(4,25,9)], [15909.00]],
1371   [[time.hms(6,49,27)], [24567.00]],
1372   [[time.hms(2,57,52)], [10672.00]],
1373   [[time.hms(16,45,44)], [60344.00]],
1374   [[time.hms(21,30,57)], [77457.00]],
1375   [[time.hms(22,30,4)], [81004.00]],
1376   [[time.hms(1,56,51)], [7011.00]],
1377   [[time.hms(5, 6, 7)], [18367.00]],
1378   [[time.hms(5, 6, 0)], [18360.00]],
1379   [[time.hms(5, 0, 7)], [18007.00]],
1380   [[time.hms(0, 6, 7)], [367.00]],
1381   [[time.hms(-5, 6, -7)], [sysmis],
1382    [warning: DEBUG EVALUATE: TIME.HMS cannot mix positive and negative arguments.]],
1383   [[time.hms(-5, 5, -7)], [sysmis],
1384    [warning: DEBUG EVALUATE: TIME.HMS cannot mix positive and negative arguments.]],
1385   [[time.hms($sysmis, 6, 7)], [sysmis]],
1386   [[time.hms(5, $sysmis, 7)], [sysmis]],
1387   [[time.hms(5, $sysmis, 7)], [sysmis]],
1388   [[time.hms($sysmis, $sysmis, 7)], [sysmis]],
1389   [[time.hms(5, $sysmis, $sysmis)], [sysmis]],
1390   [[time.hms($sysmis, $sysmis, 7)], [sysmis]],
1391   [[time.hms($sysmis, $sysmis, $sysmis)], [sysmis]],
1392
1393   [[ctime.days(106272)], [1.23]],
1394   [[ctime.hours(106272)], [29.52]],
1395   [[ctime.minutes(106272)], [1771.20]],
1396   [[ctime.seconds(106272)], [106272.00]],
1397   [[ctime.days(-106272)], [-1.23]],
1398   [[ctime.hours(-106272)], [-29.52]],
1399   [[ctime.minutes(-106272)], [-1771.20]],
1400   [[ctime.seconds(-106272)], [-106272.00]],
1401   [[ctime.days($sysmis)], [sysmis]],
1402   [[ctime.hours($sysmis)], [sysmis]],
1403   [[ctime.minutes($sysmis)], [sysmis]],
1404   [[ctime.seconds($sysmis)], [sysmis]],
1405   [[ctime.days('a')], [error],
1406    [error: DEBUG EVALUATE: Type mismatch invoking CTIME.DAYS(number) as ctime.days(string).]],
1407   [[ctime.hours('b')], [error],
1408    [error: DEBUG EVALUATE: Type mismatch invoking CTIME.HOURS(number) as ctime.hours(string).]],
1409   [[ctime.minutes('c')], [error],
1410    [error: DEBUG EVALUATE: Type mismatch invoking CTIME.MINUTES(number) as ctime.minutes(string).]],
1411   [[ctime.seconds('d')], [error],
1412    [error: DEBUG EVALUATE: Type mismatch invoking CTIME.SECONDS(number) as ctime.seconds(string).]],
1413
1414   [[ctime.days(date.dmy(15,10,1582))], [1.00]],
1415   [[ctime.days(date.dmy(6,9,1719))], [50000.00]],
1416   [[ctime.days(date.dmy(24,1,1583))], [102.00]],
1417   [[ctime.days(date.dmy(14,12,1585))], [1157.00]],
1418   [[ctime.days(date.dmy(26,11,1621))], [14288.00]],
1419   [[ctime.days(date.dmy(25,12,1821))], [87365.00]],
1420   [[ctime.days(date.dmy(3,12,1882))], [109623.00]],
1421   [[ctime.days(date.dmy(6,4,2002))], [153211.00]],
1422   [[ctime.days(date.dmy(19,12,1999))], [152372.00]],
1423   [[ctime.days(date.dmy(1,10,1978))], [144623.00]],
1424   [[ctime.days(date.dmy(0,10,1978))], [144622.00]],
1425   [[ctime.days(date.dmy(32,10,1978))], [sysmis],
1426    [error: DEBUG EVALUATE: Day 32 is not in acceptable range of 0 to 31.]],
1427   [[ctime.days(date.dmy(31,0,1978))], [144349.00]],
1428   [[ctime.days(date.dmy(31,13,1978))], [144745.00]],
1429   [[ctime.days(date.dmy($sysmis,10,1978))], [sysmis]],
1430   [[ctime.days(date.dmy(31,$sysmis,1978))], [sysmis]],
1431   [[ctime.days(date.dmy(31,10,$sysmis))], [sysmis]],
1432   [[ctime.days(date.dmy($sysmis,$sysmis,1978))], [sysmis]],
1433   [[ctime.days(date.dmy(31,$sysmis,$sysmis))], [sysmis]],
1434   [[ctime.days(date.dmy($sysmis,10,$sysmis))], [sysmis]],
1435   [[ctime.days(date.dmy($sysmis,$sysmis,$sysmis))], [sysmis]],
1436   [[date.dmy('a',1,2)], [error],
1437    [error: DEBUG EVALUATE: Type mismatch invoking DATE.DMY(number, number, number) as date.dmy(string, number, number).]],
1438   [[date.dmy(1,'a',2)], [error],
1439    [error: DEBUG EVALUATE: Type mismatch invoking DATE.DMY(number, number, number) as date.dmy(number, string, number).]],
1440   [[date.dmy(1,2,'a')], [error],
1441    [error: DEBUG EVALUATE: Type mismatch invoking DATE.DMY(number, number, number) as date.dmy(number, number, string).]],
1442 dnl FIXME: check out-of-range and nearly out-of-range values
1443 dnl
1444   [[yrmoda(1582,10,15)], [1.00]],
1445   [[yrmoda(1719,9,6)], [50000.00]],
1446   [[yrmoda(1583,1,24)], [102.00]],
1447   [[yrmoda(1585,12,14)], [1157.00]],
1448   [[yrmoda(1621,11,26)], [14288.00]],
1449   [[yrmoda(1821,12,25)], [87365.00]],
1450   [[yrmoda(1882,12,3)], [109623.00]],
1451   [[yrmoda(2002,4,6)], [153211.00]],
1452   [[yrmoda(1999,12,19)], [152372.00]],
1453   [[yrmoda(1978,10,1)], [144623.00]],
1454   [[yrmoda(1978,10,0)], [144622.00]],
1455   [[yrmoda(1978,10,32)], [sysmis],
1456    [error: DEBUG EVALUATE: Day 32 is not in acceptable range of 0 to 31.]],
1457   [[yrmoda(1978,0,31)], [144349.00]],
1458   [[yrmoda(1978,13,31)], [144745.00]],
1459   [[yrmoda(1978,10,$sysmis)], [sysmis]],
1460   [[yrmoda(1978,$sysmis,31)], [sysmis]],
1461   [[yrmoda($sysmis,10,31)], [sysmis]],
1462   [[yrmoda(1978,$sysmis,$sysmis)], [sysmis]],
1463   [[yrmoda($sysmis,$sysmis,31)], [sysmis]],
1464   [[yrmoda($sysmis,10,$sysmis)], [sysmis]],
1465   [[yrmoda($sysmis,$sysmis,$sysmis)], [sysmis]],
1466   [[yrmoda('a',1,2)], [error],
1467    [error: DEBUG EVALUATE: Type mismatch invoking YRMODA(number, number, number) as yrmoda(string, number, number).]],
1468   [[yrmoda(1,'a',2)], [error],
1469    [error: DEBUG EVALUATE: Type mismatch invoking YRMODA(number, number, number) as yrmoda(number, string, number).]],
1470   [[yrmoda(1,2,'a')], [error],
1471    [error: DEBUG EVALUATE: Type mismatch invoking YRMODA(number, number, number) as yrmoda(number, number, string).]],
1472 dnl FIXME: check out-of-range and nearly out-of-range values
1473 dnl
1474   [[ctime.days(date.mdy(6,10,1648)) + 577735], [601716.00]],
1475   [[ctime.days(date.mdy(6,30,1680)) + 577735], [613424.00]],
1476   [[ctime.days(date.mdy(7,24,1716)) + 577735], [626596.00]],
1477   [[ctime.days(date.mdy(6,19,1768)) + 577735], [645554.00]],
1478   [[ctime.days(date.mdy(8,2,1819)) + 577735], [664224.00]],
1479   [[ctime.days(date.mdy(3,27,1839)) + 577735], [671401.00]],
1480   [[ctime.days(date.mdy(4,19,1903)) + 577735], [694799.00]],
1481   [[ctime.days(date.mdy(8,25,1929)) + 577735], [704424.00]],
1482   [[ctime.days(date.mdy(9,29,1941)) + 577735], [708842.00]],
1483   [[ctime.days(date.mdy(4,19,1943)) + 577735], [709409.00]],
1484   [[ctime.days(date.mdy(10,7,1943)) + 577735], [709580.00]],
1485   [[ctime.days(date.mdy(3,17,1992)) + 577735], [727274.00]],
1486   [[ctime.days(date.mdy(2,25,1996)) + 577735], [728714.00]],
1487   [[ctime.days(date.mdy(11,10,2038)) + 577735], [744313.00]],
1488   [[ctime.days(date.mdy(7,18,2094)) + 577735], [764652.00]],
1489 dnl FIXME: check out-of-range and nearly out-of-range values
1490 dnl
1491   [[ctime.days(date.mdy(10,15,1582))], [1.00]],
1492   [[ctime.days(date.mdy(9,6,1719))], [50000.00]],
1493   [[ctime.days(date.mdy(1,24,1583))], [102.00]],
1494   [[ctime.days(date.mdy(12,14,1585))], [1157.00]],
1495   [[ctime.days(date.mdy(11,26,1621))], [14288.00]],
1496   [[ctime.days(date.mdy(12,25,1821))], [87365.00]],
1497   [[ctime.days(date.mdy(12,3,1882))], [109623.00]],
1498   [[ctime.days(date.mdy(4,6,2002))], [153211.00]],
1499   [[ctime.days(date.mdy(12,19,1999))], [152372.00]],
1500   [[ctime.days(date.mdy(10,1,1978))], [144623.00]],
1501   [[ctime.days(date.mdy(10,0,1978))], [144622.00]],
1502   [[ctime.days(date.mdy(10,32,1978))], [sysmis],
1503    [error: DEBUG EVALUATE: Day 32 is not in acceptable range of 0 to 31.]],
1504   [[ctime.days(date.mdy(0,31,1978))], [144349.00]],
1505   [[ctime.days(date.mdy(13,31,1978))], [144745.00]],
1506   [[ctime.days(date.mdy(10,$sysmis,1978))], [sysmis]],
1507   [[ctime.days(date.mdy($sysmis,31,1978))], [sysmis]],
1508   [[ctime.days(date.mdy(10,31,$sysmis))], [sysmis]],
1509   [[ctime.days(date.mdy($sysmis,$sysmis,1978))], [sysmis]],
1510   [[ctime.days(date.mdy($sysmis,31,$sysmis))], [sysmis]],
1511   [[ctime.days(date.mdy(10,$sysmis,$sysmis))], [sysmis]],
1512   [[ctime.days(date.mdy($sysmis,$sysmis,$sysmis))], [sysmis]],
1513   [[date.mdy('a',1,2)], [error],
1514    [error: DEBUG EVALUATE: Type mismatch invoking DATE.MDY(number, number, number) as date.mdy(string, number, number).]],
1515   [[date.mdy(1,'a',2)], [error],
1516    [error: DEBUG EVALUATE: Type mismatch invoking DATE.MDY(number, number, number) as date.mdy(number, string, number).]],
1517   [[date.mdy(1,2,'a')], [error],
1518    [error: DEBUG EVALUATE: Type mismatch invoking DATE.MDY(number, number, number) as date.mdy(number, number, string).]],
1519   [[ctime.days(date.mdy(0,0,0))], [152353.00]],
1520   [[ctime.days(date.mdy(0,0,999))], [sysmis],
1521    [error: DEBUG EVALUATE: Date 0998-12-0 is before the earliest acceptable date of 1582-10-15.]],
1522   [[date.mdy(1,1,1582)], [sysmis],
1523    [error: DEBUG EVALUATE: Date 1582-1-1 is before the earliest acceptable date of 1582-10-15.]],
1524   [[date.mdy(10,14,1582)], [sysmis],
1525    [error: DEBUG EVALUATE: Date 1582-10-14 is before the earliest acceptable date of 1582-10-15.]],
1526   [[date.mdy(10,15,1582)], [86400.00]],
1527
1528   [[ctime.days(date.moyr(1,2000))], [152385.00]],
1529   [[ctime.days(date.moyr(2,2000))], [152416.00]],
1530   [[ctime.days(date.moyr(3,2000))], [152445.00]],
1531   [[ctime.days(date.moyr(4,2000))], [152476.00]],
1532   [[ctime.days(date.moyr(5,2000))], [152506.00]],
1533   [[ctime.days(date.moyr(13,2000))], [152751.00]],
1534   [[ctime.days(date.moyr(14,2000))], [sysmis],
1535    [error: DEBUG EVALUATE: Month 14 is not in acceptable range of 0 to 13.]],
1536   [[ctime.days(date.moyr($sysmis,2000))], [sysmis]],
1537   [[ctime.days(date.moyr(1,$sysmis))], [sysmis]],
1538   [[ctime.days(date.moyr($sysmis,$sysmis))], [sysmis]],
1539   [[date.moyr('a',2000)], [error],
1540    [error: DEBUG EVALUATE: Type mismatch invoking DATE.MOYR(number, number) as date.moyr(string, number).]],
1541   [[date.moyr(5,'a')], [error],
1542    [error: DEBUG EVALUATE: Type mismatch invoking DATE.MOYR(number, number) as date.moyr(number, string).]],
1543   [[date.moyr('a','b')], [error],
1544    [error: DEBUG EVALUATE: Type mismatch invoking DATE.MOYR(number, number) as date.moyr(string, string).]],
1545
1546   [[ctime.days(date.qyr(1,2000))], [152385.00]],
1547   [[ctime.days(date.qyr(2,2000))], [152476.00]],
1548   [[ctime.days(date.qyr(5,2000))], [sysmis],
1549    [warning: DEBUG EVALUATE: The first argument to DATE.QYR must be 1, 2, 3, or 4.]],
1550   [[ctime.days(date.qyr(6,2000))], [sysmis],
1551    [warning: DEBUG EVALUATE: The first argument to DATE.QYR must be 1, 2, 3, or 4.]],
1552   [[ctime.days(date.qyr($sysmis,2000))], [sysmis]],
1553   [[ctime.days(date.qyr(1,$sysmis))], [sysmis]],
1554   [[ctime.days(date.qyr($sysmis,$sysmis))], [sysmis]],
1555   [[date.qyr('a',2000)], [error],
1556    [error: DEBUG EVALUATE: Type mismatch invoking DATE.QYR(number, number) as date.qyr(string, number).]],
1557   [[date.qyr(5,'a')], [error],
1558    [error: DEBUG EVALUATE: Type mismatch invoking DATE.QYR(number, number) as date.qyr(number, string).]],
1559   [[date.qyr('a','b')], [error],
1560    [error: DEBUG EVALUATE: Type mismatch invoking DATE.QYR(number, number) as date.qyr(string, string).]],
1561
1562   [[ctime.days(date.wkyr(1,2000))], [152385.00]],
1563   [[ctime.days(date.wkyr(15,1999))], [152118.00]],
1564   [[ctime.days(date.wkyr(36,1999))], [152265.00]],
1565   [[ctime.days(date.wkyr(54,1999))], [sysmis],
1566    [error: DEBUG EVALUATE: The week argument to DATE.WKYR is outside the acceptable range of 1 to 53.  The result will be system-missing.]],
1567   [[ctime.days(date.wkyr($sysmis,1999))], [sysmis]],
1568   [[ctime.days(date.wkyr(1,$sysmis))], [sysmis]],
1569   [[ctime.days(date.wkyr($sysmis,$sysmis))], [sysmis]],
1570   [[date.wkyr('a',1999)], [error],
1571    [error: DEBUG EVALUATE: Type mismatch invoking DATE.WKYR(number, number) as date.wkyr(string, number).]],
1572   [[date.wkyr(5,'a')], [error],
1573    [error: DEBUG EVALUATE: Type mismatch invoking DATE.WKYR(number, number) as date.wkyr(number, string).]],
1574   [[date.wkyr('a','b')], [error],
1575    [error: DEBUG EVALUATE: Type mismatch invoking DATE.WKYR(number, number) as date.wkyr(string, string).]],
1576
1577   [[ctime.days(date.yrday(2000,1))], [152385.00]],
1578   [[ctime.days(date.yrday(2000,100))], [152484.00]],
1579   [[ctime.days(date.yrday(2000,253))], [152637.00]],
1580   [[ctime.days(date.yrday(2000,500))], [sysmis],
1581    [error: DEBUG EVALUATE: The day argument to DATE.YRDAY is outside the acceptable range of 1 to 366.  The result will be system-missing.]],
1582   [[ctime.days(date.yrday(2000,-100))], [sysmis],
1583    [error: DEBUG EVALUATE: The day argument to DATE.YRDAY is outside the acceptable range of 1 to 366.  The result will be system-missing.]],
1584   [[ctime.days(date.yrday(1999,$sysmis))], [sysmis]],
1585   [[ctime.days(date.yrday($sysmis,1))], [sysmis]],
1586   [[ctime.days(date.yrday($sysmis,$sysmis))], [sysmis]],
1587   [[date.yrday(1999,'a')], [error],
1588    [error: DEBUG EVALUATE: Type mismatch invoking DATE.YRDAY(number, number) as date.yrday(number, string).]],
1589   [[date.yrday('a',5)], [error],
1590    [error: DEBUG EVALUATE: Type mismatch invoking DATE.YRDAY(number, number) as date.yrday(string, number).]],
1591   [[date.yrday('a','b')], [error],
1592    [error: DEBUG EVALUATE: Type mismatch invoking DATE.YRDAY(number, number) as date.yrday(string, string).]])
1593
1594 CHECK_EXPR_EVAL([xdate],
1595   [[xdate.date(date.mdy(6,10,1648) + time.hms(0,0,0)) / 86400], [23981.00]],
1596   [[xdate.date(date.mdy(6,30,1680) + time.hms(4,50,38)) / 86400], [35689.00]],
1597   [[xdate.date(date.mdy(7,24,1716) + time.hms(12,31,35)) / 86400], [48861.00]],
1598   [[xdate.date(date.mdy(6,19,1768) + time.hms(12,47,53)) / 86400], [67819.00]],
1599   [[xdate.date(date.mdy(8,2,1819) + time.hms(1,26,0)) / 86400], [86489.00]],
1600   [[xdate.date(date.mdy(3,27,1839) + time.hms(20,58,11)) / 86400], [93666.00]],
1601   [[xdate.date(date.mdy(4,19,1903) + time.hms(7,36,5)) / 86400], [117064.00]],
1602   [[xdate.date(date.mdy(8,25,1929) + time.hms(15,43,49)) / 86400], [126689.00]],
1603   [[xdate.date(date.mdy(9,29,1941) + time.hms(4,25,9)) / 86400], [131107.00]],
1604   [[xdate.date(date.mdy(4,19,1943) + time.hms(6,49,27)) / 86400], [131674.00]],
1605   [[xdate.date(date.mdy(10,7,1943) + time.hms(2,57,52)) / 86400], [131845.00]],
1606   [[xdate.date(date.mdy(3,17,1992) + time.hms(16,45,44)) / 86400], [149539.00]],
1607   [[xdate.date(date.mdy(2,25,1996) + time.hms(21,30,57)) / 86400], [150979.00]],
1608   [[xdate.date(date.mdy(9,29,1941) + time.hms(4,25,9)) / 86400], [131107.00]],
1609   [[xdate.date(date.mdy(4,19,43) + time.hms(6,49,27)) / 86400], [131674.00]],
1610   [[xdate.date(date.mdy(10,7,43) + time.hms(2,57,52)) / 86400], [131845.00]],
1611   [[xdate.date(date.mdy(3,17,92) + time.hms(16,45,44)) / 86400], [149539.00]],
1612   [[xdate.date(date.mdy(2,25,96) + time.hms(21,30,57)) / 86400], [150979.00]],
1613   [[xdate.date(date.mdy(11,10,2038) + time.hms(22,30,4)) / 86400], [166578.00]],
1614   [[xdate.date(date.mdy(7,18,2094) + time.hms(1,56,51)) / 86400], [186917.00]],
1615   [[xdate.date(123.4)], [0.00]],
1616   [[xdate.date('')], [error],
1617    [error: DEBUG EVALUATE: Type mismatch invoking XDATE.DATE(number) as xdate.date(string).]],
1618
1619   [[xdate.hour(date.mdy(6,10,1648) + time.hms(0,0,0))], [0.00]],
1620   [[xdate.hour(date.mdy(6,30,1680) + time.hms(4,50,38))], [4.00]],
1621   [[xdate.hour(date.mdy(7,24,1716) + time.hms(12,31,35))], [12.00]],
1622   [[xdate.hour(date.mdy(6,19,1768) + time.hms(12,47,53))], [12.00]],
1623   [[xdate.hour(date.mdy(8,2,1819) + time.hms(1,26,0))], [1.00]],
1624   [[xdate.hour(date.mdy(3,27,1839) + time.hms(20,58,11))], [20.00]],
1625   [[xdate.hour(date.mdy(4,19,1903) + time.hms(7,36,5))], [7.00]],
1626   [[xdate.hour(date.mdy(8,25,1929) + time.hms(15,43,49))], [15.00]],
1627   [[xdate.hour(date.mdy(9,29,1941) + time.hms(4,25,9))], [4.00]],
1628   [[xdate.hour(date.mdy(4,19,1943) + time.hms(6,49,27))], [6.00]],
1629   [[xdate.hour(date.mdy(10,7,1943) + time.hms(2,57,52))], [2.00]],
1630   [[xdate.hour(date.mdy(3,17,1992) + time.hms(16,45,44))], [16.00]],
1631   [[xdate.hour(date.mdy(2,25,1996) + time.hms(21,30,57))], [21.00]],
1632   [[xdate.hour(date.mdy(9,29,1941) + time.hms(4,25,9))], [4.00]],
1633   [[xdate.hour(date.mdy(4,19,43) + time.hms(6,49,27))], [6.00]],
1634   [[xdate.hour(date.mdy(10,7,43) + time.hms(2,57,52))], [2.00]],
1635   [[xdate.hour(date.mdy(3,17,92) + time.hms(16,45,44))], [16.00]],
1636   [[xdate.hour(date.mdy(2,25,96) + time.hms(21,30,57))], [21.00]],
1637   [[xdate.hour(date.mdy(11,10,2038) + time.hms(22,30,4))], [22.00]],
1638   [[xdate.hour(date.mdy(7,18,2094) + time.hms(1,56,51))], [1.00]],
1639   [[xdate.hour(-1)], [-1.00]],
1640   [[xdate.hour(1)], [0.00]],
1641   [[xdate.hour($sysmis)], [sysmis]],
1642   [[xdate.hour('')], [error],
1643    [error: DEBUG EVALUATE: Type mismatch invoking XDATE.HOUR(number) as xdate.hour(string).]],
1644
1645   [[xdate.jday(date.mdy(6,10,1648) + time.hms(0,0,0))], [162.00]],
1646   [[xdate.jday(date.mdy(6,30,1680) + time.hms(4,50,38))], [182.00]],
1647   [[xdate.jday(date.mdy(7,24,1716) + time.hms(12,31,35))], [206.00]],
1648   [[xdate.jday(date.mdy(6,19,1768) + time.hms(12,47,53))], [171.00]],
1649   [[xdate.jday(date.mdy(8,2,1819) + time.hms(1,26,0))], [214.00]],
1650   [[xdate.jday(date.mdy(3,27,1839) + time.hms(20,58,11))], [86.00]],
1651   [[xdate.jday(date.mdy(4,19,1903) + time.hms(7,36,5))], [109.00]],
1652   [[xdate.jday(date.mdy(8,25,1929) + time.hms(15,43,49))], [237.00]],
1653   [[xdate.jday(date.mdy(9,29,1941) + time.hms(4,25,9))], [272.00]],
1654   [[xdate.jday(date.mdy(4,19,1943) + time.hms(6,49,27))], [109.00]],
1655   [[xdate.jday(date.mdy(10,7,1943) + time.hms(2,57,52))], [280.00]],
1656   [[xdate.jday(date.mdy(3,17,1992) + time.hms(16,45,44))], [77.00]],
1657   [[xdate.jday(date.mdy(2,25,1996) + time.hms(21,30,57))], [56.00]],
1658   [[xdate.jday(date.mdy(9,29,1941) + time.hms(4,25,9))], [272.00]],
1659   [[xdate.jday(date.mdy(4,19,43) + time.hms(6,49,27))], [109.00]],
1660   [[xdate.jday(date.mdy(10,7,43) + time.hms(2,57,52))], [280.00]],
1661   [[xdate.jday(date.mdy(3,17,92) + time.hms(16,45,44))], [77.00]],
1662   [[xdate.jday(date.mdy(2,25,96) + time.hms(21,30,57))], [56.00]],
1663   [[xdate.jday(date.mdy(11,10,2038) + time.hms(22,30,4))], [314.00]],
1664   [[xdate.jday(date.mdy(7,18,2094) + time.hms(1,56,51))], [199.00]],
1665   [[xdate.jday(0)], [sysmis]],
1666   [[xdate.jday(1)], [sysmis]],
1667   [[xdate.jday(86400)], [288.00]],
1668
1669   [[xdate.mday(date.mdy(6,10,1648) + time.hms(0,0,0))], [10.00]],
1670   [[xdate.mday(date.mdy(6,30,1680) + time.hms(4,50,38))], [30.00]],
1671   [[xdate.mday(date.mdy(7,24,1716) + time.hms(12,31,35))], [24.00]],
1672   [[xdate.mday(date.mdy(6,19,1768) + time.hms(12,47,53))], [19.00]],
1673   [[xdate.mday(date.mdy(8,2,1819) + time.hms(1,26,0))], [2.00]],
1674   [[xdate.mday(date.mdy(3,27,1839) + time.hms(20,58,11))], [27.00]],
1675   [[xdate.mday(date.mdy(4,19,1903) + time.hms(7,36,5))], [19.00]],
1676   [[xdate.mday(date.mdy(8,25,1929) + time.hms(15,43,49))], [25.00]],
1677   [[xdate.mday(date.mdy(9,29,1941) + time.hms(4,25,9))], [29.00]],
1678   [[xdate.mday(date.mdy(4,19,1943) + time.hms(6,49,27))], [19.00]],
1679   [[xdate.mday(date.mdy(10,7,1943) + time.hms(2,57,52))], [7.00]],
1680   [[xdate.mday(date.mdy(3,17,1992) + time.hms(16,45,44))], [17.00]],
1681   [[xdate.mday(date.mdy(2,25,1996) + time.hms(21,30,57))], [25.00]],
1682   [[xdate.mday(date.mdy(9,29,1941) + time.hms(4,25,9))], [29.00]],
1683   [[xdate.mday(date.mdy(4,19,43) + time.hms(6,49,27))], [19.00]],
1684   [[xdate.mday(date.mdy(10,7,43) + time.hms(2,57,52))], [7.00]],
1685   [[xdate.mday(date.mdy(3,17,92) + time.hms(16,45,44))], [17.00]],
1686   [[xdate.mday(date.mdy(2,25,96) + time.hms(21,30,57))], [25.00]],
1687   [[xdate.mday(date.mdy(11,10,2038) + time.hms(22,30,4))], [10.00]],
1688   [[xdate.mday(date.mdy(7,18,2094) + time.hms(1,56,51))], [18.00]],
1689
1690   [[xdate.minute(date.mdy(6,10,1648) + time.hms(0,0,0))], [0.00]],
1691   [[xdate.minute(date.mdy(6,30,1680) + time.hms(4,50,38))], [50.00]],
1692   [[xdate.minute(date.mdy(7,24,1716) + time.hms(12,31,35))], [31.00]],
1693   [[xdate.minute(date.mdy(6,19,1768) + time.hms(12,47,53))], [47.00]],
1694   [[xdate.minute(date.mdy(8,2,1819) + time.hms(1,26,0))], [26.00]],
1695   [[xdate.minute(date.mdy(3,27,1839) + time.hms(20,58,11))], [58.00]],
1696   [[xdate.minute(date.mdy(4,19,1903) + time.hms(7,36,5))], [36.00]],
1697   [[xdate.minute(date.mdy(8,25,1929) + time.hms(15,43,49))], [43.00]],
1698   [[xdate.minute(date.mdy(9,29,1941) + time.hms(4,25,9))], [25.00]],
1699   [[xdate.minute(date.mdy(4,19,1943) + time.hms(6,49,27))], [49.00]],
1700   [[xdate.minute(date.mdy(10,7,1943) + time.hms(2,57,52))], [57.00]],
1701   [[xdate.minute(date.mdy(3,17,1992) + time.hms(16,45,44))], [45.00]],
1702   [[xdate.minute(date.mdy(2,25,1996) + time.hms(21,30,57))], [30.00]],
1703   [[xdate.minute(date.mdy(9,29,1941) + time.hms(4,25,9))], [25.00]],
1704   [[xdate.minute(date.mdy(4,19,43) + time.hms(6,49,27))], [49.00]],
1705   [[xdate.minute(date.mdy(10,7,43) + time.hms(2,57,52))], [57.00]],
1706   [[xdate.minute(date.mdy(3,17,92) + time.hms(16,45,44))], [45.00]],
1707   [[xdate.minute(date.mdy(2,25,96) + time.hms(21,30,57))], [30.00]],
1708   [[xdate.minute(date.mdy(11,10,2038) + time.hms(22,30,4))], [30.00]],
1709   [[xdate.minute(date.mdy(7,18,2094) + time.hms(1,56,51))], [56.00]],
1710
1711   [[xdate.month(date.mdy(6,10,1648) + time.hms(0,0,0))], [6.00]],
1712   [[xdate.month(date.mdy(6,30,1680) + time.hms(4,50,38))], [6.00]],
1713   [[xdate.month(date.mdy(7,24,1716) + time.hms(12,31,35))], [7.00]],
1714   [[xdate.month(date.mdy(6,19,1768) + time.hms(12,47,53))], [6.00]],
1715   [[xdate.month(date.mdy(8,2,1819) + time.hms(1,26,0))], [8.00]],
1716   [[xdate.month(date.mdy(3,27,1839) + time.hms(20,58,11))], [3.00]],
1717   [[xdate.month(date.mdy(4,19,1903) + time.hms(7,36,5))], [4.00]],
1718   [[xdate.month(date.mdy(8,25,1929) + time.hms(15,43,49))], [8.00]],
1719   [[xdate.month(date.mdy(9,29,1941) + time.hms(4,25,9))], [9.00]],
1720   [[xdate.month(date.mdy(4,19,1943) + time.hms(6,49,27))], [4.00]],
1721   [[xdate.month(date.mdy(10,7,1943) + time.hms(2,57,52))], [10.00]],
1722   [[xdate.month(date.mdy(3,17,1992) + time.hms(16,45,44))], [3.00]],
1723   [[xdate.month(date.mdy(2,25,1996) + time.hms(21,30,57))], [2.00]],
1724   [[xdate.month(date.mdy(9,29,1941) + time.hms(4,25,9))], [9.00]],
1725   [[xdate.month(date.mdy(4,19,43) + time.hms(6,49,27))], [4.00]],
1726   [[xdate.month(date.mdy(10,7,43) + time.hms(2,57,52))], [10.00]],
1727   [[xdate.month(date.mdy(3,17,92) + time.hms(16,45,44))], [3.00]],
1728   [[xdate.month(date.mdy(2,25,96) + time.hms(21,30,57))], [2.00]],
1729   [[xdate.month(date.mdy(11,10,2038) + time.hms(22,30,4))], [11.00]],
1730   [[xdate.month(date.mdy(7,18,2094) + time.hms(1,56,51))], [7.00]],
1731
1732   [[xdate.quarter(date.mdy(6,10,1648) + time.hms(0,0,0))], [2.00]],
1733   [[xdate.quarter(date.mdy(6,30,1680) + time.hms(4,50,38))], [2.00]],
1734   [[xdate.quarter(date.mdy(7,24,1716) + time.hms(12,31,35))], [3.00]],
1735   [[xdate.quarter(date.mdy(6,19,1768) + time.hms(12,47,53))], [2.00]],
1736   [[xdate.quarter(date.mdy(8,2,1819) + time.hms(1,26,0))], [3.00]],
1737   [[xdate.quarter(date.mdy(3,27,1839) + time.hms(20,58,11))], [1.00]],
1738   [[xdate.quarter(date.mdy(4,19,1903) + time.hms(7,36,5))], [2.00]],
1739   [[xdate.quarter(date.mdy(8,25,1929) + time.hms(15,43,49))], [3.00]],
1740   [[xdate.quarter(date.mdy(9,29,1941) + time.hms(4,25,9))], [3.00]],
1741   [[xdate.quarter(date.mdy(4,19,1943) + time.hms(6,49,27))], [2.00]],
1742   [[xdate.quarter(date.mdy(10,7,1943) + time.hms(2,57,52))], [4.00]],
1743   [[xdate.quarter(date.mdy(3,17,1992) + time.hms(16,45,44))], [1.00]],
1744   [[xdate.quarter(date.mdy(2,25,1996) + time.hms(21,30,57))], [1.00]],
1745   [[xdate.quarter(date.mdy(9,29,1941) + time.hms(4,25,9))], [3.00]],
1746   [[xdate.quarter(date.mdy(4,19,43) + time.hms(6,49,27))], [2.00]],
1747   [[xdate.quarter(date.mdy(10,7,43) + time.hms(2,57,52))], [4.00]],
1748   [[xdate.quarter(date.mdy(3,17,92) + time.hms(16,45,44))], [1.00]],
1749   [[xdate.quarter(date.mdy(2,25,96) + time.hms(21,30,57))], [1.00]],
1750   [[xdate.quarter(date.mdy(11,10,2038) + time.hms(22,30,4))], [4.00]],
1751   [[xdate.quarter(date.mdy(7,18,2094) + time.hms(1,56,51))], [3.00]],
1752
1753   [[xdate.second(date.mdy(6,10,1648) + time.hms(0,0,0))], [0.00]],
1754   [[xdate.second(date.mdy(6,30,1680) + time.hms(4,50,38))], [38.00]],
1755   [[xdate.second(date.mdy(7,24,1716) + time.hms(12,31,35))], [35.00]],
1756   [[xdate.second(date.mdy(6,19,1768) + time.hms(12,47,53))], [53.00]],
1757   [[xdate.second(date.mdy(8,2,1819) + time.hms(1,26,0))], [0.00]],
1758   [[xdate.second(date.mdy(3,27,1839) + time.hms(20,58,11))], [11.00]],
1759   [[xdate.second(date.mdy(4,19,1903) + time.hms(7,36,5))], [5.00]],
1760   [[xdate.second(date.mdy(8,25,1929) + time.hms(15,43,49))], [49.00]],
1761   [[xdate.second(date.mdy(9,29,1941) + time.hms(4,25,9))], [9.00]],
1762   [[xdate.second(date.mdy(4,19,1943) + time.hms(6,49,27))], [27.00]],
1763   [[xdate.second(date.mdy(10,7,1943) + time.hms(2,57,52))], [52.00]],
1764   [[xdate.second(date.mdy(3,17,1992) + time.hms(16,45,44))], [44.00]],
1765   [[xdate.second(date.mdy(2,25,1996) + time.hms(21,30,57))], [57.00]],
1766   [[xdate.second(date.mdy(9,29,1941) + time.hms(4,25,9))], [9.00]],
1767   [[xdate.second(date.mdy(4,19,43) + time.hms(6,49,27))], [27.00]],
1768   [[xdate.second(date.mdy(10,7,43) + time.hms(2,57,52))], [52.00]],
1769   [[xdate.second(date.mdy(3,17,92) + time.hms(16,45,44))], [44.00]],
1770   [[xdate.second(date.mdy(2,25,96) + time.hms(21,30,57))], [57.00]],
1771   [[xdate.second(date.mdy(11,10,2038) + time.hms(22,30,4))], [4.00]],
1772   [[xdate.second(date.mdy(7,18,2094) + time.hms(1,56,51))], [51.00]],
1773
1774   [[xdate.tday(date.mdy(6,10,1648) + time.hms(0,0,0))], [23981.00]],
1775   [[xdate.tday(date.mdy(6,30,1680) + time.hms(4,50,38))], [35689.00]],
1776   [[xdate.tday(date.mdy(7,24,1716) + time.hms(12,31,35))], [48861.00]],
1777   [[xdate.tday(date.mdy(6,19,1768) + time.hms(12,47,53))], [67819.00]],
1778   [[xdate.tday(date.mdy(8,2,1819) + time.hms(1,26,0))], [86489.00]],
1779   [[xdate.tday(date.mdy(3,27,1839) + time.hms(20,58,11))], [93666.00]],
1780   [[xdate.tday(date.mdy(4,19,1903) + time.hms(7,36,5))], [117064.00]],
1781   [[xdate.tday(date.mdy(8,25,1929) + time.hms(15,43,49))], [126689.00]],
1782   [[xdate.tday(date.mdy(9,29,1941) + time.hms(4,25,9))], [131107.00]],
1783   [[xdate.tday(date.mdy(4,19,1943) + time.hms(6,49,27))], [131674.00]],
1784   [[xdate.tday(date.mdy(10,7,1943) + time.hms(2,57,52))], [131845.00]],
1785   [[xdate.tday(date.mdy(3,17,1992) + time.hms(16,45,44))], [149539.00]],
1786   [[xdate.tday(date.mdy(2,25,1996) + time.hms(21,30,57))], [150979.00]],
1787   [[xdate.tday(date.mdy(9,29,1941) + time.hms(4,25,9))], [131107.00]],
1788   [[xdate.tday(date.mdy(4,19,43) + time.hms(6,49,27))], [131674.00]],
1789   [[xdate.tday(date.mdy(10,7,43) + time.hms(2,57,52))], [131845.00]],
1790   [[xdate.tday(date.mdy(3,17,92) + time.hms(16,45,44))], [149539.00]],
1791   [[xdate.tday(date.mdy(2,25,96) + time.hms(21,30,57))], [150979.00]],
1792   [[xdate.tday(date.mdy(11,10,2038) + time.hms(22,30,4))], [166578.00]],
1793   [[xdate.tday(date.mdy(7,18,2094) + time.hms(1,56,51))], [186917.00]],
1794
1795   [[xdate.time(date.mdy(6,10,1648) + time.hms(0,0,0))], [0.00]],
1796   [[xdate.time(date.mdy(6,30,1680) + time.hms(4,50,38))], [17438.00]],
1797   [[xdate.time(date.mdy(7,24,1716) + time.hms(12,31,35))], [45095.00]],
1798   [[xdate.time(date.mdy(6,19,1768) + time.hms(12,47,53))], [46073.00]],
1799   [[xdate.time(date.mdy(8,2,1819) + time.hms(1,26,0))], [5160.00]],
1800   [[xdate.time(date.mdy(3,27,1839) + time.hms(20,58,11))], [75491.00]],
1801   [[xdate.time(date.mdy(4,19,1903) + time.hms(7,36,5))], [27365.00]],
1802   [[xdate.time(date.mdy(8,25,1929) + time.hms(15,43,49))], [56629.00]],
1803   [[xdate.time(date.mdy(9,29,1941) + time.hms(4,25,9))], [15909.00]],
1804   [[xdate.time(date.mdy(4,19,1943) + time.hms(6,49,27))], [24567.00]],
1805   [[xdate.time(date.mdy(10,7,1943) + time.hms(2,57,52))], [10672.00]],
1806   [[xdate.time(date.mdy(3,17,1992) + time.hms(16,45,44))], [60344.00]],
1807   [[xdate.time(date.mdy(2,25,1996) + time.hms(21,30,57))], [77457.00]],
1808   [[xdate.time(date.mdy(9,29,1941) + time.hms(4,25,9))], [15909.00]],
1809   [[xdate.time(date.mdy(4,19,43) + time.hms(6,49,27))], [24567.00]],
1810   [[xdate.time(date.mdy(10,7,43) + time.hms(2,57,52))], [10672.00]],
1811   [[xdate.time(date.mdy(3,17,92) + time.hms(16,45,44))], [60344.00]],
1812   [[xdate.time(date.mdy(2,25,96) + time.hms(21,30,57))], [77457.00]],
1813   [[xdate.time(date.mdy(11,10,2038) + time.hms(22,30,4))], [81004.00]],
1814   [[xdate.time(date.mdy(7,18,2094) + time.hms(1,56,51))], [7011.00]],
1815
1816   [[xdate.week(date.mdy(6,10,1648) + time.hms(0,0,0))], [24.00]],
1817   [[xdate.week(date.mdy(6,30,1680) + time.hms(4,50,38))], [26.00]],
1818   [[xdate.week(date.mdy(7,24,1716) + time.hms(12,31,35))], [30.00]],
1819   [[xdate.week(date.mdy(6,19,1768) + time.hms(12,47,53))], [25.00]],
1820   [[xdate.week(date.mdy(8,2,1819) + time.hms(1,26,0))], [31.00]],
1821   [[xdate.week(date.mdy(3,27,1839) + time.hms(20,58,11))], [13.00]],
1822   [[xdate.week(date.mdy(4,19,1903) + time.hms(7,36,5))], [16.00]],
1823   [[xdate.week(date.mdy(8,25,1929) + time.hms(15,43,49))], [34.00]],
1824   [[xdate.week(date.mdy(9,29,1941) + time.hms(4,25,9))], [39.00]],
1825   [[xdate.week(date.mdy(4,19,1943) + time.hms(6,49,27))], [16.00]],
1826   [[xdate.week(date.mdy(10,7,1943) + time.hms(2,57,52))], [40.00]],
1827   [[xdate.week(date.mdy(3,17,1992) + time.hms(16,45,44))], [11.00]],
1828   [[xdate.week(date.mdy(2,25,1996) + time.hms(21,30,57))], [8.00]],
1829   [[xdate.week(date.mdy(9,29,1941) + time.hms(4,25,9))], [39.00]],
1830   [[xdate.week(date.mdy(4,19,43) + time.hms(6,49,27))], [16.00]],
1831   [[xdate.week(date.mdy(10,7,43) + time.hms(2,57,52))], [40.00]],
1832   [[xdate.week(date.mdy(3,17,92) + time.hms(16,45,44))], [11.00]],
1833   [[xdate.week(date.mdy(2,25,96) + time.hms(21,30,57))], [8.00]],
1834   [[xdate.week(date.mdy(11,10,2038) + time.hms(22,30,4))], [45.00]],
1835   [[xdate.week(date.mdy(7,18,2094) + time.hms(1,56,51))], [29.00]],
1836
1837   [[xdate.wkday(date.mdy(6,10,1648))], [4.00]],
1838   [[xdate.wkday(date.mdy(6,30,1680))], [1.00]],
1839   [[xdate.wkday(date.mdy(7,24,1716))], [6.00]],
1840   [[xdate.wkday(date.mdy(6,19,1768))], [1.00]],
1841   [[xdate.wkday(date.mdy(8,2,1819))], [2.00]],
1842   [[xdate.wkday(date.mdy(3,27,1839))], [4.00]],
1843   [[xdate.wkday(date.mdy(4,19,1903))], [1.00]],
1844   [[xdate.wkday(date.mdy(8,25,1929))], [1.00]],
1845   [[xdate.wkday(date.mdy(9,29,1941))], [2.00]],
1846   [[xdate.wkday(date.mdy(4,19,1943))], [2.00]],
1847   [[xdate.wkday(date.mdy(10,7,1943))], [5.00]],
1848   [[xdate.wkday(date.mdy(3,17,1992))], [3.00]],
1849   [[xdate.wkday(date.mdy(2,25,1996))], [1.00]],
1850   [[xdate.wkday(date.mdy(9,29,1941))], [2.00]],
1851   [[xdate.wkday(date.mdy(4,19,43))], [2.00]],
1852   [[xdate.wkday(date.mdy(10,7,43))], [5.00]],
1853   [[xdate.wkday(date.mdy(3,17,92))], [3.00]],
1854   [[xdate.wkday(date.mdy(2,25,96))], [1.00]],
1855   [[xdate.wkday(date.mdy(11,10,2038))], [4.00]],
1856   [[xdate.wkday(date.mdy(7,18,2094))], [1.00]],
1857
1858   [[xdate.year(date.mdy(6,10,1648) + time.hms(0,0,0))], [1648.00]],
1859   [[xdate.year(date.mdy(6,30,1680) + time.hms(4,50,38))], [1680.00]],
1860   [[xdate.year(date.mdy(7,24,1716) + time.hms(12,31,35))], [1716.00]],
1861   [[xdate.year(date.mdy(6,19,1768) + time.hms(12,47,53))], [1768.00]],
1862   [[xdate.year(date.mdy(8,2,1819) + time.hms(1,26,0))], [1819.00]],
1863   [[xdate.year(date.mdy(3,27,1839) + time.hms(20,58,11))], [1839.00]],
1864   [[xdate.year(date.mdy(4,19,1903) + time.hms(7,36,5))], [1903.00]],
1865   [[xdate.year(date.mdy(8,25,1929) + time.hms(15,43,49))], [1929.00]],
1866   [[xdate.year(date.mdy(9,29,1941) + time.hms(4,25,9))], [1941.00]],
1867   [[xdate.year(date.mdy(4,19,1943) + time.hms(6,49,27))], [1943.00]],
1868   [[xdate.year(date.mdy(10,7,1943) + time.hms(2,57,52))], [1943.00]],
1869   [[xdate.year(date.mdy(3,17,1992) + time.hms(16,45,44))], [1992.00]],
1870   [[xdate.year(date.mdy(2,25,1996) + time.hms(21,30,57))], [1996.00]],
1871   [[xdate.year(date.mdy(9,29,1941) + time.hms(4,25,9))], [1941.00]],
1872   [[xdate.year(date.mdy(4,19,43) + time.hms(6,49,27))], [1943.00]],
1873   [[xdate.year(date.mdy(10,7,43) + time.hms(2,57,52))], [1943.00]],
1874   [[xdate.year(date.mdy(3,17,92) + time.hms(16,45,44))], [1992.00]],
1875   [[xdate.year(date.mdy(2,25,96) + time.hms(21,30,57))], [1996.00]],
1876   [[xdate.year(date.mdy(11,10,2038) + time.hms(22,30,4))], [2038.00]],
1877   [[xdate.year(date.mdy(7,18,2094) + time.hms(1,56,51))], [2094.00]])
1878
1879 CHECK_EXPR_EVAL([datediff],
1880   [[datediff(date.mdy(6,10,1648), date.mdy(6,30,1680), 'years')], [-32.00]],
1881   [[datediff(date.mdy(6,30,1680), date.mdy(7,24,1716), 'years')], [-36.00]],
1882   [[datediff(date.mdy(7,24,1716), date.mdy(6,19,1768), 'years')], [-51.00]],
1883   [[datediff(date.mdy(6,19,1768), date.mdy(8,2,1819), 'years')], [-51.00]],
1884   [[datediff(date.mdy(8,2,1819), date.mdy(3,27,1839), 'years')], [-19.00]],
1885   [[datediff(date.mdy(3,27,1839), date.mdy(4,19,1903), 'years')], [-64.00]],
1886   [[datediff(date.mdy(4,19,1903), date.mdy(8,25,1929), 'years')], [-26.00]],
1887   [[datediff(date.mdy(8,25,1929), date.mdy(9,29,1941), 'years')], [-12.00]],
1888   [[datediff(date.mdy(9,29,1941), date.mdy(4,19,1943), 'years')], [-1.00]],
1889   [[datediff(date.mdy(4,19,1943), date.mdy(10,7,1943), 'years')], [0.00]],
1890   [[datediff(date.mdy(10,7,1943), date.mdy(3,17,1992), 'years')], [-48.00]],
1891   [[datediff(date.mdy(3,17,1992), date.mdy(2,25,1996), 'years')], [-3.00]],
1892   [[datediff(date.mdy(9,29,1941), date.mdy(2,25,1996), 'years')], [-54.00]],
1893   [[datediff(date.mdy(9,29,1941), date.mdy(4,19,43), 'years')], [-1.00]],
1894   [[datediff(date.mdy(4,19,43), date.mdy(10,7,43), 'years')], [0.00]],
1895   [[datediff(date.mdy(10,7,43), date.mdy(3,17,92), 'years')], [-48.00]],
1896   [[datediff(date.mdy(3,17,92), date.mdy(2,25,96), 'years')], [-3.00]],
1897   [[datediff(date.mdy(2,25,96), date.mdy(11,10,2038), 'years')], [-42.00]],
1898   [[datediff(date.mdy(11,10,2038), date.mdy(7,18,2094), 'years')], [-55.00]],
1899   [[datediff(date.mdy(2,29,1900), date.mdy(2,29,1904), 'years')], [-3.00]],
1900   [[datediff(date.mdy(2,29,1904), date.mdy(2,29,1908), 'years')], [-4.00]],
1901   [[datediff(date.mdy(2,29,1900), date.mdy(2,28,1903), 'years')], [-2.00]],
1902
1903   [[datediff(date.mdy(6,10,1648), date.mdy(6,30,1680), 'quarters')], [-128.00]],
1904   [[datediff(date.mdy(6,30,1680), date.mdy(7,24,1716), 'quarters')], [-144.00]],
1905   [[datediff(date.mdy(7,24,1716), date.mdy(6,19,1768), 'quarters')], [-207.00]],
1906   [[datediff(date.mdy(6,19,1768), date.mdy(8,2,1819), 'quarters')], [-204.00]],
1907   [[datediff(date.mdy(8,2,1819), date.mdy(3,27,1839), 'quarters')], [-78.00]],
1908   [[datediff(date.mdy(3,27,1839), date.mdy(4,19,1903), 'quarters')], [-256.00]],
1909   [[datediff(date.mdy(4,19,1903), date.mdy(8,25,1929), 'quarters')], [-105.00]],
1910   [[datediff(date.mdy(8,25,1929), date.mdy(9,29,1941), 'quarters')], [-48.00]],
1911   [[datediff(date.mdy(9,29,1941), date.mdy(4,19,1943), 'quarters')], [-6.00]],
1912   [[datediff(date.mdy(4,19,1943), date.mdy(10,7,1943), 'quarters')], [-1.00]],
1913   [[datediff(date.mdy(10,7,1943), date.mdy(3,17,1992), 'quarters')], [-193.00]],
1914   [[datediff(date.mdy(3,17,1992), date.mdy(2,25,1996), 'quarters')], [-15.00]],
1915   [[datediff(date.mdy(9,29,1941), date.mdy(2,25,1996), 'quarters')], [-217.00]],
1916   [[datediff(date.mdy(9,29,1941), date.mdy(4,19,43), 'quarters')], [-6.00]],
1917   [[datediff(date.mdy(4,19,43), date.mdy(10,7,43), 'quarters')], [-1.00]],
1918   [[datediff(date.mdy(10,7,43), date.mdy(3,17,92), 'quarters')], [-193.00]],
1919   [[datediff(date.mdy(3,17,92), date.mdy(2,25,96), 'quarters')], [-15.00]],
1920   [[datediff(date.mdy(2,25,96), date.mdy(11,10,2038), 'quarters')], [-170.00]],
1921   [[datediff(date.mdy(11,10,2038), date.mdy(7,18,2094), 'quarters')], [-222.00]],
1922   [[datediff(date.mdy(2,29,1900), date.mdy(2,29,1904), 'quarters')], [-15.00]],
1923   [[datediff(date.mdy(2,29,1904), date.mdy(2,29,1908), 'quarters')], [-16.00]],
1924   [[datediff(date.mdy(2,29,1900), date.mdy(2,28,1903), 'quarters')], [-11.00]],
1925
1926   [[datediff(date.mdy(6,10,1648), date.mdy(6,30,1680), 'months')], [-384.00]],
1927   [[datediff(date.mdy(6,30,1680), date.mdy(7,24,1716), 'months')], [-432.00]],
1928   [[datediff(date.mdy(7,24,1716), date.mdy(6,19,1768), 'months')], [-622.00]],
1929   [[datediff(date.mdy(6,19,1768), date.mdy(8,2,1819), 'months')], [-613.00]],
1930   [[datediff(date.mdy(8,2,1819), date.mdy(3,27,1839), 'months')], [-235.00]],
1931   [[datediff(date.mdy(3,27,1839), date.mdy(4,19,1903), 'months')], [-768.00]],
1932   [[datediff(date.mdy(4,19,1903), date.mdy(8,25,1929), 'months')], [-316.00]],
1933   [[datediff(date.mdy(8,25,1929), date.mdy(9,29,1941), 'months')], [-145.00]],
1934   [[datediff(date.mdy(9,29,1941), date.mdy(4,19,1943), 'months')], [-18.00]],
1935   [[datediff(date.mdy(4,19,1943), date.mdy(10,7,1943), 'months')], [-5.00]],
1936   [[datediff(date.mdy(10,7,1943), date.mdy(3,17,1992), 'months')], [-581.00]],
1937   [[datediff(date.mdy(3,17,1992), date.mdy(2,25,1996), 'months')], [-47.00]],
1938   [[datediff(date.mdy(9,29,1941), date.mdy(2,25,1996), 'months')], [-652.00]],
1939   [[datediff(date.mdy(9,29,1941), date.mdy(4,19,43), 'months')], [-18.00]],
1940   [[datediff(date.mdy(4,19,43), date.mdy(10,7,43), 'months')], [-5.00]],
1941   [[datediff(date.mdy(10,7,43), date.mdy(3,17,92), 'months')], [-581.00]],
1942   [[datediff(date.mdy(3,17,92), date.mdy(2,25,96), 'months')], [-47.00]],
1943   [[datediff(date.mdy(2,25,96), date.mdy(11,10,2038), 'months')], [-512.00]],
1944   [[datediff(date.mdy(11,10,2038), date.mdy(7,18,2094), 'months')], [-668.00]],
1945   [[datediff(date.mdy(2,29,1900), date.mdy(2,29,1904), 'months')], [-47.00]],
1946   [[datediff(date.mdy(2,29,1904), date.mdy(2,29,1908), 'months')], [-48.00]],
1947   [[datediff(date.mdy(2,29,1900), date.mdy(2,28,1903), 'months')], [-35.00]],
1948
1949   [[datediff(date.mdy(6,10,1648), date.mdy(6,30,1680), 'weeks')], [-1672.00]],
1950   [[datediff(date.mdy(6,30,1680), date.mdy(7,24,1716), 'weeks')], [-1881.00]],
1951   [[datediff(date.mdy(7,24,1716), date.mdy(6,19,1768), 'weeks')], [-2708.00]],
1952   [[datediff(date.mdy(6,19,1768), date.mdy(8,2,1819), 'weeks')], [-2667.00]],
1953   [[datediff(date.mdy(8,2,1819), date.mdy(3,27,1839), 'weeks')], [-1025.00]],
1954   [[datediff(date.mdy(3,27,1839), date.mdy(4,19,1903), 'weeks')], [-3342.00]],
1955   [[datediff(date.mdy(4,19,1903), date.mdy(8,25,1929), 'weeks')], [-1375.00]],
1956   [[datediff(date.mdy(8,25,1929), date.mdy(9,29,1941), 'weeks')], [-631.00]],
1957   [[datediff(date.mdy(9,29,1941), date.mdy(4,19,1943), 'weeks')], [-81.00]],
1958   [[datediff(date.mdy(4,19,1943), date.mdy(10,7,1943), 'weeks')], [-24.00]],
1959   [[datediff(date.mdy(10,7,1943), date.mdy(3,17,1992), 'weeks')], [-2527.00]],
1960   [[datediff(date.mdy(3,17,1992), date.mdy(2,25,1996), 'weeks')], [-205.00]],
1961   [[datediff(date.mdy(9,29,1941), date.mdy(2,25,1996), 'weeks')], [-2838.00]],
1962   [[datediff(date.mdy(9,29,1941), date.mdy(4,19,43), 'weeks')], [-81.00]],
1963   [[datediff(date.mdy(4,19,43), date.mdy(10,7,43), 'weeks')], [-24.00]],
1964   [[datediff(date.mdy(10,7,43), date.mdy(3,17,92), 'weeks')], [-2527.00]],
1965   [[datediff(date.mdy(3,17,92), date.mdy(2,25,96), 'weeks')], [-205.00]],
1966   [[datediff(date.mdy(2,25,96), date.mdy(11,10,2038), 'weeks')], [-2228.00]],
1967   [[datediff(date.mdy(11,10,2038), date.mdy(7,18,2094), 'weeks')], [-2905.00]],
1968   [[datediff(date.mdy(2,29,1900), date.mdy(2,29,1904), 'weeks')], [-208.00]],
1969   [[datediff(date.mdy(2,29,1904), date.mdy(2,29,1908), 'weeks')], [-208.00]],
1970   [[datediff(date.mdy(2,29,1900), date.mdy(2,28,1903), 'weeks')], [-156.00]],
1971
1972   [[datediff(date.mdy(6,10,1648), date.mdy(6,30,1680), 'days')], [-11708.00]],
1973   [[datediff(date.mdy(6,30,1680), date.mdy(7,24,1716), 'days')], [-13172.00]],
1974   [[datediff(date.mdy(7,24,1716), date.mdy(6,19,1768), 'days')], [-18958.00]],
1975   [[datediff(date.mdy(6,19,1768), date.mdy(8,2,1819), 'days')], [-18670.00]],
1976   [[datediff(date.mdy(8,2,1819), date.mdy(3,27,1839), 'days')], [-7177.00]],
1977   [[datediff(date.mdy(3,27,1839), date.mdy(4,19,1903), 'days')], [-23398.00]],
1978   [[datediff(date.mdy(4,19,1903), date.mdy(8,25,1929), 'days')], [-9625.00]],
1979   [[datediff(date.mdy(8,25,1929), date.mdy(9,29,1941), 'days')], [-4418.00]],
1980   [[datediff(date.mdy(9,29,1941), date.mdy(4,19,1943), 'days')], [-567.00]],
1981   [[datediff(date.mdy(4,19,1943), date.mdy(10,7,1943), 'days')], [-171.00]],
1982   [[datediff(date.mdy(10,7,1943), date.mdy(3,17,1992), 'days')], [-17694.00]],
1983   [[datediff(date.mdy(3,17,1992), date.mdy(2,25,1996), 'days')], [-1440.00]],
1984   [[datediff(date.mdy(9,29,1941), date.mdy(2,25,1996), 'days')], [-19872.00]],
1985   [[datediff(date.mdy(9,29,1941), date.mdy(4,19,43), 'days')], [-567.00]],
1986   [[datediff(date.mdy(4,19,43), date.mdy(10,7,43), 'days')], [-171.00]],
1987   [[datediff(date.mdy(10,7,43), date.mdy(3,17,92), 'days')], [-17694.00]],
1988   [[datediff(date.mdy(3,17,92), date.mdy(2,25,96), 'days')], [-1440.00]],
1989   [[datediff(date.mdy(2,25,96), date.mdy(11,10,2038), 'days')], [-15599.00]],
1990   [[datediff(date.mdy(11,10,2038), date.mdy(7,18,2094), 'days')], [-20339.00]],
1991   [[datediff(date.mdy(2,29,1900), date.mdy(2,29,1904), 'days')], [-1460.00]],
1992   [[datediff(date.mdy(2,29,1904), date.mdy(2,29,1908), 'days')], [-1461.00]],
1993   [[datediff(date.mdy(2,29,1900), date.mdy(2,28,1903), 'days')], [-1094.00]],
1994
1995   [[datediff(date.mdy(6,30,1680), date.mdy(6,10,1648), 'years')], [32.00]],
1996   [[datediff(date.mdy(7,24,1716), date.mdy(6,30,1680), 'years')], [36.00]],
1997   [[datediff(date.mdy(6,19,1768), date.mdy(7,24,1716), 'years')], [51.00]],
1998   [[datediff(date.mdy(8,2,1819), date.mdy(6,19,1768), 'years')], [51.00]],
1999   [[datediff(date.mdy(3,27,1839), date.mdy(8,2,1819), 'years')], [19.00]],
2000   [[datediff(date.mdy(4,19,1903), date.mdy(3,27,1839), 'years')], [64.00]],
2001   [[datediff(date.mdy(8,25,1929), date.mdy(4,19,1903), 'years')], [26.00]],
2002   [[datediff(date.mdy(9,29,1941), date.mdy(8,25,1929), 'years')], [12.00]],
2003   [[datediff(date.mdy(4,19,1943), date.mdy(9,29,1941), 'years')], [1.00]],
2004   [[datediff(date.mdy(10,7,1943), date.mdy(4,19,1943), 'years')], [0.00]],
2005   [[datediff(date.mdy(3,17,1992), date.mdy(10,7,1943), 'years')], [48.00]],
2006   [[datediff(date.mdy(2,25,1996), date.mdy(3,17,1992), 'years')], [3.00]],
2007   [[datediff(date.mdy(2,25,1996), date.mdy(9,29,1941), 'years')], [54.00]],
2008   [[datediff(date.mdy(4,19,43), date.mdy(9,29,1941), 'years')], [1.00]],
2009   [[datediff(date.mdy(10,7,43), date.mdy(4,19,43), 'years')], [0.00]],
2010   [[datediff(date.mdy(3,17,92), date.mdy(10,7,43), 'years')], [48.00]],
2011   [[datediff(date.mdy(2,25,96), date.mdy(3,17,92), 'years')], [3.00]],
2012   [[datediff(date.mdy(11,10,2038), date.mdy(2,25,96), 'years')], [42.00]],
2013   [[datediff(date.mdy(7,18,2094), date.mdy(11,10,2038), 'years')], [55.00]],
2014   [[datediff(date.mdy(2,29,1904), date.mdy(2,29,1900), 'years')], [3.00]],
2015   [[datediff(date.mdy(2,29,1908), date.mdy(2,29,1904), 'years')], [4.00]],
2016   [[datediff(date.mdy(2,28,1903), date.mdy(2,29,1900), 'years')], [2.00]],
2017
2018   [[datediff(date.mdy(6,30,1680), date.mdy(6,10,1648), 'months')], [384.00]],
2019   [[datediff(date.mdy(7,24,1716), date.mdy(6,30,1680), 'months')], [432.00]],
2020   [[datediff(date.mdy(6,19,1768), date.mdy(7,24,1716), 'months')], [622.00]],
2021   [[datediff(date.mdy(8,2,1819), date.mdy(6,19,1768), 'months')], [613.00]],
2022   [[datediff(date.mdy(3,27,1839), date.mdy(8,2,1819), 'months')], [235.00]],
2023   [[datediff(date.mdy(4,19,1903), date.mdy(3,27,1839), 'months')], [768.00]],
2024   [[datediff(date.mdy(8,25,1929), date.mdy(4,19,1903), 'months')], [316.00]],
2025   [[datediff(date.mdy(9,29,1941), date.mdy(8,25,1929), 'months')], [145.00]],
2026   [[datediff(date.mdy(4,19,1943), date.mdy(9,29,1941), 'months')], [18.00]],
2027   [[datediff(date.mdy(10,7,1943), date.mdy(4,19,1943), 'months')], [5.00]],
2028   [[datediff(date.mdy(3,17,1992), date.mdy(10,7,1943), 'months')], [581.00]],
2029   [[datediff(date.mdy(2,25,1996), date.mdy(3,17,1992), 'months')], [47.00]],
2030   [[datediff(date.mdy(2,25,1996), date.mdy(9,29,1941), 'months')], [652.00]],
2031   [[datediff(date.mdy(4,19,43), date.mdy(9,29,1941), 'months')], [18.00]],
2032   [[datediff(date.mdy(10,7,43), date.mdy(4,19,43), 'months')], [5.00]],
2033   [[datediff(date.mdy(3,17,92), date.mdy(10,7,43), 'months')], [581.00]],
2034   [[datediff(date.mdy(2,25,96), date.mdy(3,17,92), 'months')], [47.00]],
2035   [[datediff(date.mdy(11,10,2038), date.mdy(2,25,96), 'months')], [512.00]],
2036   [[datediff(date.mdy(7,18,2094), date.mdy(11,10,2038), 'months')], [668.00]],
2037   [[datediff(date.mdy(2,29,1904), date.mdy(2,29,1900), 'months')], [47.00]],
2038   [[datediff(date.mdy(2,29,1908), date.mdy(2,29,1904), 'months')], [48.00]],
2039   [[datediff(date.mdy(2,28,1903), date.mdy(2,29,1900), 'months')], [35.00]],
2040
2041   [[datediff(date.mdy(6,30,1680), date.mdy(6,10,1648), 'quarters')], [128.00]],
2042   [[datediff(date.mdy(7,24,1716), date.mdy(6,30,1680), 'quarters')], [144.00]],
2043   [[datediff(date.mdy(6,19,1768), date.mdy(7,24,1716), 'quarters')], [207.00]],
2044   [[datediff(date.mdy(8,2,1819), date.mdy(6,19,1768), 'quarters')], [204.00]],
2045   [[datediff(date.mdy(3,27,1839), date.mdy(8,2,1819), 'quarters')], [78.00]],
2046   [[datediff(date.mdy(4,19,1903), date.mdy(3,27,1839), 'quarters')], [256.00]],
2047   [[datediff(date.mdy(8,25,1929), date.mdy(4,19,1903), 'quarters')], [105.00]],
2048   [[datediff(date.mdy(9,29,1941), date.mdy(8,25,1929), 'quarters')], [48.00]],
2049   [[datediff(date.mdy(4,19,1943), date.mdy(9,29,1941), 'quarters')], [6.00]],
2050   [[datediff(date.mdy(10,7,1943), date.mdy(4,19,1943), 'quarters')], [1.00]],
2051   [[datediff(date.mdy(3,17,1992), date.mdy(10,7,1943), 'quarters')], [193.00]],
2052   [[datediff(date.mdy(2,25,1996), date.mdy(3,17,1992), 'quarters')], [15.00]],
2053   [[datediff(date.mdy(2,25,1996), date.mdy(9,29,1941), 'quarters')], [217.00]],
2054   [[datediff(date.mdy(4,19,43), date.mdy(9,29,1941), 'quarters')], [6.00]],
2055   [[datediff(date.mdy(10,7,43), date.mdy(4,19,43), 'quarters')], [1.00]],
2056   [[datediff(date.mdy(3,17,92), date.mdy(10,7,43), 'quarters')], [193.00]],
2057   [[datediff(date.mdy(2,25,96), date.mdy(3,17,92), 'quarters')], [15.00]],
2058   [[datediff(date.mdy(11,10,2038), date.mdy(2,25,96), 'quarters')], [170.00]],
2059   [[datediff(date.mdy(7,18,2094), date.mdy(11,10,2038), 'quarters')], [222.00]],
2060   [[datediff(date.mdy(2,29,1904), date.mdy(2,29,1900), 'quarters')], [15.00]],
2061   [[datediff(date.mdy(2,29,1908), date.mdy(2,29,1904), 'quarters')], [16.00]],
2062   [[datediff(date.mdy(2,28,1903), date.mdy(2,29,1900), 'quarters')], [11.00]],
2063
2064 dnl time of day is significant for DATEDIFF
2065   [[datediff(date.mdy(10,15,1910) + 234, date.mdy(10,10,1910) + 123, 'days')],
2066     [5.00]],
2067   [[datediff(date.mdy(10,15,1910) + 123, date.mdy(10,10,1910) + 234, 'days')],
2068     [4.00]],
2069   [[datediff(date.mdy(10,24,1910) + 234, date.mdy(10,10,1910) + 123, 'weeks')],
2070     [2.00]],
2071   [[datediff(date.mdy(10,24,1910) + 123, date.mdy(10,10,1910) + 234, 'weeks')],
2072     [1.00]],
2073   [[datediff(date.mdy(10,10,1910) + 234, date.mdy(5,10,1910) + 123, 'months')],
2074     [5.00]],
2075   [[datediff(date.mdy(10,10,1910) + 123, date.mdy(5,10,1910) + 234, 'months')],
2076     [4.00]],
2077   [[datediff(date.mdy(5,10,1919) + 234, date.mdy(5,10,1910) + 123, 'years')],
2078     [9.00]],
2079   [[datediff(date.mdy(5,10,1919) + 123, date.mdy(5,10,1910) + 234, 'years')],
2080     [8.00]],
2081
2082   [[datediff(date.mdy(10,10,1910) + 123, date.mdy(10,15,1910) + 234, 'days')],
2083     [-5.00]],
2084   [[datediff(date.mdy(10,10,1910) + 234, date.mdy(10,15,1910) + 123, 'days')],
2085     [-4.00]],
2086   [[datediff(date.mdy(10,10,1910) + 123, date.mdy(10,24,1910) + 234, 'weeks')],
2087     [-2.00]],
2088   [[datediff(date.mdy(10,10,1910) + 234, date.mdy(10,24,1910) + 123, 'weeks')],
2089     [-1.00]],
2090   [[datediff(date.mdy(5,10,1910) + 123, date.mdy(10,10,1910) + 234, 'months')],
2091     [-5.00]],
2092   [[datediff(date.mdy(5,10,1910) + 234, date.mdy(10,10,1910) + 123, 'months')],
2093     [-4.00]],
2094   [[datediff(date.mdy(5,10,1910) + 123, date.mdy(5,10,1919) + 234, 'years')],
2095     [-9.00]],
2096   [[datediff(date.mdy(5,10,1910) + 234, date.mdy(5,10,1919) + 123, 'years')],
2097     [-8.00]])
2098
2099 CHECK_EXPR_EVAL([datesum],
2100 dnl DATESUM with non-leap year
2101   [[ctime.days(datesum(date.mdy(1,31,1900), 1, 'months') - date.mdy(1,1,1900))], [58.00]],
2102   [[ctime.days(datesum(date.mdy(1,31,1900), 2, 'months') - date.mdy(1,1,1900))], [89.00]],
2103   [[ctime.days(datesum(date.mdy(1,31,1900), 3, 'months') - date.mdy(1,1,1900))], [119.00]],
2104   [[ctime.days(datesum(date.mdy(1,31,1900), 4, 'months') - date.mdy(1,1,1900))], [150.00]],
2105   [[ctime.days(datesum(date.mdy(1,31,1900), 5.4, 'months') - date.mdy(1,1,1900))], [180.00]],
2106   [[ctime.days(datesum(date.mdy(1,31,1900), 6, 'months') - date.mdy(1,1,1900))], [211.00]],
2107   [[ctime.days(datesum(date.mdy(1,31,1900), 7, 'months') - date.mdy(1,1,1900))], [242.00]],
2108   [[ctime.days(datesum(date.mdy(1,31,1900), 8, 'months') - date.mdy(1,1,1900))], [272.00]],
2109   [[ctime.days(datesum(date.mdy(1,31,1900), 9, 'months') - date.mdy(1,1,1900))], [303.00]],
2110   [[ctime.days(datesum(date.mdy(1,31,1900), 10, 'months') - date.mdy(1,1,1900))], [333.00]],
2111   [[ctime.days(datesum(date.mdy(1,31,1900), 11, 'months') - date.mdy(1,1,1900))], [364.00]],
2112   [[ctime.days(datesum(date.mdy(1,31,1900), 12, 'months') - date.mdy(1,1,1900))], [395.00]],
2113   [[ctime.days(datesum(date.mdy(1,31,1900), 13.9, 'months') - date.mdy(1,1,1900))], [423.00]],
2114   [[ctime.days(datesum(date.mdy(1,31,1900), 1, 'months', 'rollover') - date.mdy(1,1,1900))], [61.00]],
2115   [[ctime.days(datesum(date.mdy(1,31,1900), 2, 'months', 'rollover') - date.mdy(1,1,1900))], [89.00]],
2116   [[ctime.days(datesum(date.mdy(1,31,1900), 3.2, 'months', 'rollover') - date.mdy(1,1,1900))], [120.00]],
2117   [[ctime.days(datesum(date.mdy(1,31,1900), 4, 'months', 'rollover') - date.mdy(1,1,1900))], [150.00]],
2118   [[ctime.days(datesum(date.mdy(1,31,1900), 5, 'months', 'rollover') - date.mdy(1,1,1900))], [181.00]],
2119   [[ctime.days(datesum(date.mdy(1,31,1900), 6, 'months', 'rollover') - date.mdy(1,1,1900))], [211.00]],
2120   [[ctime.days(datesum(date.mdy(1,31,1900), 7, 'months', 'rollover') - date.mdy(1,1,1900))], [242.00]],
2121   [[ctime.days(datesum(date.mdy(1,31,1900), 8, 'months', 'rollover') - date.mdy(1,1,1900))], [273.00]],
2122   [[ctime.days(datesum(date.mdy(1,31,1900), 9, 'months', 'rollover') - date.mdy(1,1,1900))], [303.00]],
2123   [[ctime.days(datesum(date.mdy(1,31,1900), 10, 'months', 'rollover') - date.mdy(1,1,1900))], [334.00]],
2124   [[ctime.days(datesum(date.mdy(1,31,1900), 11, 'months', 'rollover') - date.mdy(1,1,1900))], [364.00]],
2125   [[ctime.days(datesum(date.mdy(1,31,1900), 12, 'months', 'rollover') - date.mdy(1,1,1900))], [395.00]],
2126   [[ctime.days(datesum(date.mdy(1,31,1900), 13, 'months', 'rollover') - date.mdy(1,1,1900))], [426.00]],
2127
2128 dnl DATESUM with leap year
2129   [[ctime.days(datesum(date.mdy(1,31,1904), 1, 'months') - date.mdy(1,1,1904))], [59.00]],
2130   [[ctime.days(datesum(date.mdy(1,31,1904), 2.5, 'months') - date.mdy(1,1,1904))], [90.00]],
2131   [[ctime.days(datesum(date.mdy(1,31,1904), 3, 'months') - date.mdy(1,1,1904))], [120.00]],
2132   [[ctime.days(datesum(date.mdy(1,31,1904), 4.9, 'months') - date.mdy(1,1,1904))], [151.00]],
2133   [[ctime.days(datesum(date.mdy(1,31,1904), 5.1, 'months') - date.mdy(1,1,1904))], [181.00]],
2134   [[ctime.days(datesum(date.mdy(1,31,1904), 6, 'months') - date.mdy(1,1,1904))], [212.00]],
2135   [[ctime.days(datesum(date.mdy(1,31,1904), 7, 'months') - date.mdy(1,1,1904))], [243.00]],
2136   [[ctime.days(datesum(date.mdy(1,31,1904), 8, 'months') - date.mdy(1,1,1904))], [273.00]],
2137   [[ctime.days(datesum(date.mdy(1,31,1904), 9, 'months') - date.mdy(1,1,1904))], [304.00]],
2138   [[ctime.days(datesum(date.mdy(1,31,1904), 10, 'months') - date.mdy(1,1,1904))], [334.00]],
2139   [[ctime.days(datesum(date.mdy(1,31,1904), 11, 'months') - date.mdy(1,1,1904))], [365.00]],
2140   [[ctime.days(datesum(date.mdy(1,31,1904), 12, 'months') - date.mdy(1,1,1904))], [396.00]],
2141   [[ctime.days(datesum(date.mdy(1,31,1904), 13, 'months') - date.mdy(1,1,1904))], [424.00]],
2142   [[ctime.days(datesum(date.mdy(1,31,1904), 1, 'months', 'rollover') - date.mdy(1,1,1904))], [61.00]],
2143   [[ctime.days(datesum(date.mdy(1,31,1904), 2, 'months', 'rollover') - date.mdy(1,1,1904))], [90.00]],
2144   [[ctime.days(datesum(date.mdy(1,31,1904), 3, 'months', 'rollover') - date.mdy(1,1,1904))], [121.00]],
2145   [[ctime.days(datesum(date.mdy(1,31,1904), 4, 'months', 'rollover') - date.mdy(1,1,1904))], [151.00]],
2146   [[ctime.days(datesum(date.mdy(1,31,1904), 5, 'months', 'rollover') - date.mdy(1,1,1904))], [182.00]],
2147   [[ctime.days(datesum(date.mdy(1,31,1904), 6, 'months', 'rollover') - date.mdy(1,1,1904))], [212.00]],
2148   [[ctime.days(datesum(date.mdy(1,31,1904), 7, 'months', 'rollover') - date.mdy(1,1,1904))], [243.00]],
2149   [[ctime.days(datesum(date.mdy(1,31,1904), 8, 'months', 'rollover') - date.mdy(1,1,1904))], [274.00]],
2150   [[ctime.days(datesum(date.mdy(1,31,1904), 9, 'months', 'rollover') - date.mdy(1,1,1904))], [304.00]],
2151   [[ctime.days(datesum(date.mdy(1,31,1904), 10, 'months', 'rollover') - date.mdy(1,1,1904))], [335.00]],
2152   [[ctime.days(datesum(date.mdy(1,31,1904), 11, 'months', 'rollover') - date.mdy(1,1,1904))], [365.00]],
2153   [[ctime.days(datesum(date.mdy(1,31,1904), 12, 'months', 'rollover') - date.mdy(1,1,1904))], [396.00]],
2154   [[ctime.days(datesum(date.mdy(1,31,1904), 13, 'months', 'rollover') - date.mdy(1,1,1904))], [427.00]],
2155
2156   [[ctime.days(datesum(date.mdy(6,10,1648), 1, 'weeks') - date.mdy(6,10,1648))], [7.00]],
2157   [[ctime.days(datesum(date.mdy(6,30,1680), 2.5, 'weeks') - date.mdy(6,30,1680))], [17.50]],
2158   [[ctime.days(datesum(date.mdy(7,24,1716), -3, 'weeks') - date.mdy(7,24,1716))], [-21.00]],
2159   [[ctime.days(datesum(date.mdy(6,19,1768), 4, 'weeks') - date.mdy(6,19,1768))], [28.00]],
2160   [[ctime.days(datesum(date.mdy(8,2,1819), 5, 'weeks') - date.mdy(8,2,1819))], [35.00]],
2161
2162   [[ctime.days(datesum(date.mdy(6,10,1648), 1, 'days') - date.mdy(6,10,1648))], [1.00]],
2163   [[ctime.days(datesum(date.mdy(6,30,1680), 2.5, 'days') - date.mdy(6,30,1680))], [2.50]],
2164   [[ctime.days(datesum(date.mdy(7,24,1716), -3, 'days') - date.mdy(7,24,1716))], [-3.00]],
2165   [[ctime.days(datesum(date.mdy(6,19,1768), 4, 'days') - date.mdy(6,19,1768))], [4.00]],
2166   [[ctime.days(datesum(date.mdy(8,2,1819), 5, 'days') - date.mdy(8,2,1819))], [5.00]],
2167   [[ctime.days(datesum(date.mdy(6,10,1648), 1, 'hours') - date.mdy(6,10,1648))], [0.04]],
2168   [[ctime.days(datesum(date.mdy(6,30,1680), 2.5, 'hours') - date.mdy(6,30,1680))], [0.10]],
2169   [[ctime.days(datesum(date.mdy(6,19,1768), -4, 'hours') - date.mdy(6,19,1768))], [-0.17]],
2170   [[ctime.days(datesum(date.mdy(8,2,1819), 5, 'hours') - date.mdy(8,2,1819))], [0.21]],
2171
2172 dnl DATESUM preserves time-of-day for units of days and longer.
2173   [[ctime.days(datesum(date.mdy(8,2,1819) + time.hms(1,2,3), 5, 'days') - (date.mdy(8,2,1819) + time.hms(1,2,3)))], [5.00]],
2174   [[ctime.days(datesum(date.mdy(8,2,1819) + time.hms(1,2,3), 5, 'weeks') - (date.mdy(8,2,1819) + time.hms(1,2,3)))], [35.00]],
2175   [[ctime.days(datesum(date.mdy(8,2,1819) + time.hms(1,2,3), 5, 'months') - (date.mdy(8,2,1819) + time.hms(1,2,3)))], [153.00]],
2176   [[ctime.days(datesum(date.mdy(8,2,1819) + time.hms(1,2,3), 5, 'years') - (date.mdy(8,2,1819) + time.hms(1,2,3)))], [1827.00]])
2177
2178 CHECK_EXPR_EVAL([miscellaneous],
2179 dnl These test values are from Applied Statistics, Algorithm AS 310.
2180   [[1000 * ncdf.beta(.868,10,20,150)], [937.66]],
2181   [[1000 * ncdf.beta(.9,10,10,120)], [730.68]],
2182   [[1000 * ncdf.beta(.88,15,5,80)], [160.43]],
2183   [[1000 * ncdf.beta(.85,20,10,110)], [186.75]],
2184   [[1000 * ncdf.beta(.66,20,30,65)], [655.94]],
2185   [[1000 * ncdf.beta(.72,20,50,130)], [979.69]],
2186   [[1000 * ncdf.beta(.72,30,20,80)], [116.24]],
2187   [[1000 * ncdf.beta(.8,30,40,130)], [993.04]],
2188
2189 dnl FIXME: LAG
2190 dnl
2191   [[X], [1.00], [], [(X = 1.00)]],
2192   [[SYSMIS(1)], [false]],
2193   [[SYSMIS($SYSMIS)], [true]],
2194   [[SYSMIS(1 + $SYSMIS)], [true]],
2195
2196 dnl FIXME: out-of-range and nearly out-of-range values on dates
2197 dnl
2198 dnl Tests correctness of generic optimizations in optimize_tree().
2199   [[x + 0], [10.00], [], [(X = 10.00)]],
2200   [[x - 0], [-3.00], [], [(X = -3.00)]],
2201   [[0 + x], [5.00], [], [(X = 5.00)]],
2202   [[x * 1], [10.00], [], [(X = 10.00)]],
2203   [[1 * x], [-3.00], [], [(X = -3.00)]],
2204   [[x / 1], [5.00], [], [(X = 5.00)]],
2205   [[0 * x], [0.00], [], [(X = 10.00)]],
2206   [[x * 0], [0.00], [], [(X = -3.00)]],
2207   [[0 / x], [0.00], [], [(X = 5.00)]],
2208   [[mod(0, x)], [0.00], [], [(X = 5.00)]],
2209   [[x ** 1], [5.00], [], [(X = 5.00)]],
2210   [[x ** 2], [25.00], [], [(X = 5.00)]])
2211
2212 CHECK_EXPR_EVAL([negative checks],
2213   [[$nonexistent], [error], [error: DEBUG EVALUATE: Unknown system variable $nonexistent.]],
2214   [[RANGE(1, 2)], [error], [error: DEBUG EVALUATE: RANGE(number, number, number[, number, number]...) must have an odd number of arguments.]],
2215   [[CONCAT.1('a', 'b')], [error], [error: DEBUG EVALUATE: CONCAT(string[, string]...) function cannot accept suffix .1 to specify the minimum number of valid arguments.]],
2216   [[foobar(x)], [error], [error: DEBUG EVALUATE: No function or vector named foobar.]],
2217   [[CONCAT.1('a' b)], [error], [error: DEBUG EVALUATE: Syntax error at `b': expecting `,' or `)'.]],
2218   [[NCDF.CHISQ(1, 2, 3)], [error], [error: DEBUG EVALUATE: NCDF.CHISQ(number, number, number) is not available in this version of PSPP.]])
2219
2220 AT_SETUP([LAG function])
2221 AT_DATA([lag.sps], [dnl
2222 data list /W 1.
2223 begin data.
2224 1
2225 2
2226 3
2227 4
2228 5
2229 end data.
2230
2231 compute X=lag(w,1).
2232 compute Y=lag(x).
2233 compute Z=lag(w,2).
2234 list.
2235 ])
2236 AT_CHECK([pspp -o pspp.csv lag.sps])
2237 AT_CHECK([cat pspp.csv], [0], [dnl
2238 Table: Reading 1 record from INLINE.
2239 Variable,Record,Columns,Format
2240 W,1,1-1,F1.0
2241
2242 Table: Data List
2243 W,X,Y,Z
2244 1,.  ,.  ,.  @&t@
2245 2,1.00,.  ,.  @&t@
2246 3,2.00,1.00,1.00
2247 4,3.00,2.00,2.00
2248 5,4.00,3.00,3.00
2249 ])
2250 AT_CLEANUP
2251
2252 AT_SETUP([LAG crash bug])
2253 AT_DATA([lag.sps], [dnl
2254 DATA LIST LIST /x.
2255 BEGIN DATA
2256 1
2257 2
2258 END DATA.
2259
2260 DO IF (x <> LAG(x) ).
2261         ECHO 'hello'.
2262 END IF.
2263
2264 EXECUTE.
2265 ])
2266 AT_CHECK([pspp -o pspp.csv lag.sps])
2267 AT_CHECK([cat pspp.csv], [0], [dnl
2268 Table: Reading free-form data from INLINE.
2269 Variable,Format
2270 x,F8.0
2271
2272 hello
2273 ])
2274 AT_CLEANUP
2275
2276 dnl Tests for a bug which caused UNIFORM(x) to always return zero.
2277 AT_SETUP([UNIFORM function])
2278 AT_DATA([uniform.sps], [dnl
2279 set seed=10.
2280 input program.
2281 + loop #i = 1 to 20.
2282 +    do repeat response=R1.
2283 +       compute response = uniform(10).
2284 +    end repeat.
2285 +    end case.
2286 + end loop.
2287 + end file.
2288 end input program.
2289
2290 list.
2291 ])
2292 AT_CHECK([pspp -o pspp.csv uniform.sps])
2293 AT_CHECK([cat pspp.csv], [0], [dnl
2294 Table: Data List
2295 R1
2296 7.71
2297 2.99
2298 .21
2299 4.95
2300 6.34
2301 4.43
2302 7.49
2303 8.32
2304 4.99
2305 5.83
2306 2.25
2307 .25
2308 1.98
2309 7.09
2310 7.61
2311 2.66
2312 1.69
2313 2.64
2314 .88
2315 1.50
2316 ])
2317 AT_CLEANUP
2318
2319 AT_SETUP([VALUELABEL function])
2320 AT_DATA([valuelabel.sps], [dnl
2321 DATA LIST notable /n 1 s 2(a).
2322 VALUE LABELS /n 0 'Very dissatisfied'
2323                 1 'Dissatisfied'
2324                 1.5 'Slightly Peeved'
2325                 2 'Neutral'
2326                 3 'Satisfied'
2327                 4 'Very satisfied'.
2328 VALUE LABELS /s 'a' 'Wouldn''t buy again'
2329                 'b' 'Unhappy'
2330                 'c' 'Bored'
2331                 'd' 'Satiated'
2332                 'e' 'Elated'.
2333 STRING nlabel slabel(a10).
2334 COMPUTE nlabel = VALUELABEL(n).
2335 COMPUTE slabel = VALUELABEL(s).
2336 LIST.
2337 BEGIN DATA.
2338
2339 0a
2340 1b
2341 2c
2342 3d
2343 4e
2344 5f
2345 6g
2346 END DATA.
2347 ])
2348 AT_CHECK([pspp -o pspp.csv valuelabel.sps])
2349 AT_CHECK([cat pspp.csv], [0], [dnl
2350 Table: Data List
2351 n,s,nlabel,slabel
2352 .,,,
2353 0,a,Very dissa,Wouldn't b
2354 1,b,Dissatisfi,Unhappy
2355 2,c,Neutral,Bored
2356 3,d,Satisfied,Satiated
2357 4,e,Very satis,Elated
2358 5,f,,
2359 6,g,,
2360 ])
2361 AT_CLEANUP
2362
2363 AT_SETUP([variables in expressions])
2364 AT_DATA([variables.sps], [dnl
2365 DATA LIST NOTABLE/N1 TO N5 1-5.
2366 MISSING VALUES N1 TO N5 (3 THRU 5, 1).
2367 BEGIN DATA.
2368 12345
2369 6789
2370 END DATA.
2371
2372 COMPUTE P1=N1.
2373 COMPUTE P2=N2.
2374 COMPUTE P3=N3.
2375 COMPUTE P4=N4.
2376 COMPUTE P5=N5.
2377
2378 COMPUTE MC=NMISS(N1 TO N5).
2379 COMPUTE VC=NVALID(N1 TO N5).
2380
2381 COMPUTE S1=SYSMIS(N1).
2382 COMPUTE S2=SYSMIS(N2).
2383 COMPUTE S3=SYSMIS(N3).
2384 COMPUTE S4=SYSMIS(N4).
2385 COMPUTE S5=SYSMIS(N5).
2386
2387 COMPUTE M1=MISSING(N1).
2388 COMPUTE M2=MISSING(N2).
2389 COMPUTE M3=MISSING(N3).
2390 COMPUTE M4=MISSING(N4).
2391 COMPUTE M5=MISSING(N5).
2392
2393 COMPUTE V1=VALUE(N1).
2394 COMPUTE V2=VALUE(N2).
2395 COMPUTE V3=VALUE(N3).
2396 COMPUTE V4=VALUE(N4).
2397 COMPUTE V5=VALUE(N5).
2398
2399 FORMATS ALL (F1).
2400
2401 LIST.
2402 ])
2403 AT_CHECK([pspp -o pspp.csv variables.sps])
2404 AT_CHECK([cat pspp.csv], [0], [dnl
2405 Table: Data List
2406 N1,N2,N3,N4,N5,P1,P2,P3,P4,P5,MC,VC,S1,S2,S3,S4,S5,M1,M2,M3,M4,M5,V1,V2,V3,V4,V5
2407 1,2,3,4,5,.,2,.,.,.,4,1,0,0,0,0,0,1,0,1,1,1,1,2,3,4,5
2408 6,7,8,9,.,6,7,8,9,.,1,4,0,0,0,0,1,0,0,0,0,1,6,7,8,9,.
2409 ])
2410 AT_CLEANUP
2411
2412 AT_SETUP([vectors in expressions])
2413 AT_DATA([vectors.sps], [dnl
2414 DATA LIST NOTABLE /N1 TO N5 1-5.
2415 MISSING VALUES N1 TO N5 (3 THRU 5, 1).
2416 BEGIN DATA.
2417 12345
2418 6789
2419 END DATA.
2420
2421 VECTOR N=N1 TO N5.
2422 VECTOR X(5).
2423 LOOP I=1 TO 5.
2424 COMPUTE X(I)=N(I) + 1.
2425 END LOOP.
2426
2427 FORMATS ALL (F2).
2428
2429 LIST.
2430 ])
2431 AT_CHECK([pspp -o pspp.csv vectors.sps])
2432 AT_CHECK([cat pspp.csv], [0], [dnl
2433 Table: Data List
2434 N1,N2,N3,N4,N5,X1,X2,X3,X4,X5,I
2435 1,2,3,4,5,.,3,.,.,.,5
2436 6,7,8,9,.,7,8,9,10,.,5
2437 ])
2438 AT_CLEANUP