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