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