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