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