3 # Tests the expression optimizer and evaluator.
5 TEMPDIR=/tmp/pspp-tst-$$
7 # ensure that top_builddir are absolute
8 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
9 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
10 top_builddir=`cd $top_builddir; pwd`
12 # ensure that top_srcdir is absolute
13 top_srcdir=`cd $top_srcdir; pwd`
15 STAT_CONFIG_PATH=$top_srcdir/config
16 export STAT_CONFIG_PATH
52 activity="create expressions list"
53 sed -ne 's/#.*//;/^[ ]*$/!p' > $TEMPDIR/expr-list <<'EOF'
61 # Test using numeric/string values as Booleans and vice-versa
66 2 OR $sysmis => sysmis
67 2 AND $sysmis => false
68 'string' AND $sysmis => error
69 0 AND $sysmis => false
71 $true + $false => 1.00
73 # Addition and subtraction.
77 7676 + $sysmis => sysmis
79 ('foo') + ('bar') => error # Arithmetic concatenation requires CONCAT.
80 'foo' + 'bar' => "foobar" # Lexical concatentation succeeds.
81 1 +3 - 2 +4 -5 => 1.00
84 'string' - 1e10 => error
89 # Multiplication and division
95 $sysmis * 15 => sysmis
103 (2**3)**4 => 4096.00 # Irritating, but compatible.
117 $false AND $false => false
118 $false AND $true => false
119 $false AND $sysmis => false
120 $true AND $false => false
121 $true AND $true => true
122 $true AND $sysmis => sysmis
123 $sysmis AND $false => false
124 $sysmis AND $true => sysmis
125 $sysmis AND $sysmis => sysmis
126 $false & $false => false
127 $false & $true => false
128 $false & $sysmis => false
129 $true & $false => false
130 $true & $true => true
131 $true & $sysmis => sysmis
132 $sysmis & $false => false
133 $sysmis & $true => sysmis
134 $sysmis & $sysmis => sysmis
137 $false OR $false => false
138 $false OR $true => true
139 $false OR $sysmis => sysmis
140 $true OR $false => true
141 $true OR $true => true
142 $true OR $sysmis => true
143 $sysmis OR $false => sysmis
144 $sysmis OR $true => true
145 $sysmis OR $sysmis => sysmis
146 $false | $false => false
147 $false | $true => true
148 $false | $sysmis => sysmis
149 $true | $false => true
150 $true | $true => true
151 $true | $sysmis => true
152 $sysmis | $false => sysmis
153 $sysmis | $true => true
154 $sysmis | $sysmis => sysmis
162 not $sysmis => sysmis
170 # Relational operators.
175 1 eq 'foobar' => error
176 5 eq 'foobar' => error
178 'quux' = 5.55 => error
179 'foobar' = 'foobar' => true
180 'quux' = 'bar' => false
181 'bar ' = 'bar' => true
182 'asdf ' = 'asdf ' => true
183 'asdfj ' = 'asdf' => false
184 1 + 2 = 3 => true # Check precedence.
185 1 >= 2 = 2 ge 3 => false # Check precedence.
186 3 ne 2 ~= 1 => false # Mathematically true.
187 3 > 2 > 1 => false # Mathematically true.
194 2 < = 2 => error # Make sure <= token can't be split.
195 1 <= 'foobar' => error
196 5 <= 'foobar' => error
198 'quux' <= 5.55 => error
199 '0123' <= '0123' => true
200 '0123' <= '0124' => true
201 '0124' le '0123' => false
202 '0123 ' <= '0123' => true
203 '0123' le '0123 ' => true
209 1 lt 'foobar' => error
210 5 lt 'foobar' => error
212 'quux' < 5.55 => error
213 '0123' lt '0123' => false
214 '0123' < '0124' => true
215 '0124' lt '0123' => false
216 '0123 ' < '0123' => false
217 '0123' lt '0123 ' => false
224 2 > = 2 => error # Make sure >= token can't be split.
225 1 >= 'foobar' => error
226 5 ge 'foobar' => error
228 'quux' >= 5.55 => error
229 '0123' ge '0123' => true
230 '0123' >= '0124' => false
231 '0124' >= '0123' => true
232 '0123 ' ge '0123' => true
233 '0123' >= '0123 ' => true
239 1 gt 'foobar' => error
240 5 gt 'foobar' => error
242 'quux' > 5.55 => error
243 '0123' gt '0123' => false
244 '0123' > '0124' => false
245 '0124' gt '0123' => true
246 '0123 ' > '0123' => false
247 '0123' gt '0123 ' => false
253 1 ~= 'foobar' => error
254 5 <> 'foobar' => error
256 'quux' ~= 5.55 => error
257 'foobar' <> 'foobar' => false
258 'quux' ne 'bar' => true
259 'bar ' <> 'bar' => false
260 'asdf ' ~= 'asdf ' => false
261 'asdfj ' ne 'asdf' => true
262 1 < > 1 => error # <> token can't be split
263 1 ~ = 1 => error # ~= token can't be split
283 mod(-55.5, 2) => -1.50
284 mod(55.5, -2) => 1.50
285 mod(-55.5, -2) => -1.50
288 mod('a', 'b') => error
291 mod10(-55.5) => -5.50
306 acos(.5) / 3.14159 * 180 => 60.00
307 arcos(.75) / 3.14159 * 180 => 41.41
308 arcos(-.5) / 3.14159 * 180 => 120.00
309 acos(-.75) / 3.14159 * 180 => 138.59
310 acos(-1) / 3.14159 * 180 => 180.00
311 arcos(1) / 3.14159 * 180 => 0.00
312 acos(-1.01) => sysmis
313 arcos(1.01) => sysmis
316 arsin(.5) / 3.14159 * 180 => 30.00
317 asin(.25) / 3.14159 * 180 => 14.48
318 arsin(-.5) / 3.14159 * 180 => -30.00
319 asin(-.25) / 3.14159 * 180 => -14.48
320 arsin(-1.01) => sysmis
324 artan(1) / 3.14159 * 180 => 45.00
325 atan(10) / 3.14159 * 180 => 84.29
326 artan(-1) / 3.14159 * 180 => -45.00
327 atan(-10) / 3.14159 * 180 => -84.29
330 cos(60 / 180 * 3.14159) => 0.50
331 cos(45 / 180 * 3.14159) => 0.71
332 cos(30 / 180 * 3.14159) => 0.87
333 cos(15 / 180 * 3.14159) => 0.97
334 cos(-60 / 180 * 3.14159) => 0.50
335 cos(-45 / 180 * 3.14159) => 0.71
336 cos(-30 / 180 * 3.14159) => 0.87
337 cos(-15 / 180 * 3.14159) => 0.97
338 cos(123 / 180 * 3.14159) => -0.54
339 cos(321 / 180 * 3.14159) => 0.78
342 sin(60 / 180 * 3.14159) => 0.87
343 sin(45 / 180 * 3.14159) => 0.71
344 sin(30 / 180 * 3.14159) => 0.50
345 sin(15 / 180 * 3.14159) => 0.26
346 sin(-60 / 180 * 3.14159) => -0.87
347 sin(-45 / 180 * 3.14159) => -0.71
348 sin(-30 / 180 * 3.14159) => -0.50
349 sin(-15 / 180 * 3.14159) => -0.26
350 sin(123 / 180 * 3.14159) => 0.84
351 sin(321 / 180 * 3.14159) => -0.63
354 tan(60 / 180 * 3.14159) => 1.73
355 tan(45 / 180 * 3.14159) => 1.00
356 tan(30 / 180 * 3.14159) => 0.58
357 tan(15 / 180 * 3.14159) => 0.27
358 tan(-60 / 180 * 3.14159) => -1.73
359 tan(-45 / 180 * 3.14159) => -1.00
360 tan(-30 / 180 * 3.14159) => -0.58
361 tan(-15 / 180 * 3.14159) => -0.27
362 tan(123 / 180 * 3.14159) => -1.54
363 tan(321 / 180 * 3.14159) => -0.81
366 # FIXME: a variable name as the argument to SYSMIS is a special case
367 # that we don't yet test. We also can't test VALUE this way.
369 missing($sysmis) => true
370 missing(asin(1.01)) => true
371 missing(asin(.5)) => false
372 missing(' ') => error
373 nmiss($sysmis) => 1.00
375 nmiss($sysmis, $sysmis, $sysmis) => 3.00
376 nmiss(1, 2, 3, 4) => 0.00
377 nmiss(1, $sysmis, $sysmis, 2, 2, $sysmis, $sysmis, 3, 4) => 4.00
378 nvalid($sysmis) => 0.00
380 nvalid($sysmis, $sysmis, $sysmis) => 0.00
381 nvalid(1, 2, 3, 4) => 4.00
382 nvalid(1, $sysmis, $sysmis, 2, 2, $sysmis, $sysmis, 3, 4) => 5.00
384 sysmis($sysmis) => true
385 sysmis(asin(1.01)) => true
386 sysmis(asin(.5)) => false
389 any($sysmis, 1, $sysmis, 3) => sysmis
390 any(1, 1, 2, 3) => true
391 any(1, $true, 2, 3) => true
392 any(1, $false, 2, 3) => false
393 any(2, 1, 2, 3) => true
394 any(3, 1, 2, 3) => true
395 any(5, 1, 2, 3) => false
396 any(1, 1, 1, 1) => true
397 any($sysmis, 1, 1, 1) => sysmis
398 any(1, $sysmis, $sysmis, $sysmis) => sysmis
399 any($sysmis, $sysmis, $sysmis, $sysmis) => sysmis
401 any('1', 2, 3, 4) => error
402 any(1, '2', 3, 4) => error
403 any(1, 2, '3', 4) => error
404 any(1, 2, 3, '4') => error
406 any('', 'a', '', 'c') => true
407 any('a', 'a', 'b', 'c') => true
408 any('b', 'a', 'b', 'c') => true
409 any('c', 'a', 'b', 'c') => true
410 any('e', 'a', 'b', 'c') => false
411 any('a', 'a', 'a', 'a') => true
412 any('', 'a', 'a', 'a') => false
413 any('a', '', '', '') => false
415 any('a', 'a ', 'b', 'c') => true
416 any('b ', 'a', 'b', 'c') => true
417 any('c ', 'a', 'b', 'c ') => true
418 any(a, 'b', 'c', 'd') => error
419 any('a', b, 'c', 'd') => error
420 any('a', 'b', c, 'd') => error
421 any('a', 'b', 'c', d) => error
423 range(5, 1, 10) => true
424 range(1, 1, 10) => true
425 range(10, 1, 10) => true
426 range(-1, 1, 10) => false
427 range(12, 1, 10) => false
428 range($sysmis, 1, 10) => sysmis
429 range(5, 1, $sysmis) => sysmis
430 range(5, $sysmis, 10) => sysmis
431 range($sysmis, $sysmis, 10) => sysmis
432 range($sysmis, 1, $sysmis) => sysmis
433 range($sysmis, $sysmis, $sysmis) => sysmis
434 range(0, 1, 8, 10, 18) => false
435 range(1, 1, 8, 10, 18) => true
436 range(6, 1, 8, 10, 18) => true
437 range(8, 1, 8, 10, 18) => true
438 range(9, 1, 8, 10, 18) => false
439 range(10, 1, 8, 10, 18) => true
440 range(13, 1, 8, 10, 18) => true
441 range(16, 1, 8, 10, 18) => true
442 range(18, 1, 8, 10, 18) => true
443 range(20, 1, 8, 10, 18) => false
446 range(1, 2, 3, 4) => error
447 range(1, 2, 3, 4, 5, 6) => error
448 range('1', 2, 3) => error
449 range(1, '2', 3) => error
450 range(1, 2, '3') => error
452 range('123', '111', '888') => true
453 range('111', '111', '888') => true
454 range('888', '111', '888') => true
455 range('110', '111', '888') => false
456 range('889', '111', '888') => false
457 range('000', '111', '888') => false
458 range('999', '111', '888') => false
459 range('123 ', '111', '888') => true
460 range('123', '111 ', '888') => true
461 range('123', '111', '888 ') => true
462 range('123', '111 ', '888 ') => true
463 range('00', '01', '08', '10', '18') => false
464 range('01', '01', '08', '10', '18') => true
465 range('06', '01', '08', '10', '18') => true
466 range('08', '01', '08', '10', '18') => true
467 range('09', '01', '08', '10', '18') => false
468 range('10', '01', '08', '10', '18') => true
469 range('15', '01', '08', '10', '18') => true
470 range('18', '01', '08', '10', '18') => true
471 range('19', '01', '08', '10', '18') => false
473 range('1', '2') => error
474 range('1', '2', '3', '4') => error
475 range('1', '2', '3', '4', '5', '6') => error
476 range(1, '2', '3') => error
477 range('1', 2, '3') => error
478 range('1', '2', 3) => error
480 cfvar(1, 2, 3, 4, 5) => 0.53
481 cfvar(1, $sysmis, 2, 3, $sysmis, 4, 5) => 0.53
484 cfvar(1, $sysmis) => sysmis
485 cfvar(1, 2, 3, $sysmis) => 0.50
486 cfvar.4(1, 2, 3, $sysmis) => sysmis
487 cfvar.4(1, 2, 3) => error
489 cfvar('x', 1, 2, 3) => error
491 max(1, 2, 3, 4, 5) => 5.00
492 max(1, $sysmis, 2, 3, $sysmis, 4, 5) => 5.00
496 max(1, $sysmis) => 1.00
497 max(1, 2, 3, $sysmis) => 3.00
498 max.4(1, 2, 3, $sysmis) => sysmis
499 max.4(1, 2, 3) => error
501 max("2", "3", "5", "1", "4") => "5"
505 mean(1, 2, 3, 4, 5) => 3.00
506 mean(1, $sysmis, 2, 3, $sysmis, 4, 5) => 3.00
510 mean(1, $sysmis) => 1.00
511 mean(1, 2, 3, $sysmis) => 2.00
512 mean.4(1, 2, 3, $sysmis) => sysmis
513 mean.4(1, 2, 3) => error
515 min(1, 2, 3, 4, 5) => 1.00
516 min(1, $sysmis, 2, 3, $sysmis, 4, 5) => 1.00
520 min(1, $sysmis) => 1.00
521 min(1, 2, 3, $sysmis) => 1.00
522 min.4(1, 2, 3, $sysmis) => sysmis
523 min.4(1, 2, 3) => error
525 min("2", "3", "5", "1", "4") => "1"
529 sd(1, 2, 3, 4, 5) => 1.58
530 sd(1, $sysmis, 2, 3, $sysmis, 4, 5) => 1.58
533 sd(1, $sysmis) => sysmis
534 sd(1, 2, 3, $sysmis) => 1.00
535 sd.4(1, 2, 3, $sysmis) => sysmis
536 sd.4(1, 2, 3) => error
538 sd('x', 1, 2, 3) => error
540 sum(1, 2, 3, 4, 5) => 15.00
541 sum(1, $sysmis, 2, 3, $sysmis, 4, 5) => 15.00
545 sum(1, $sysmis) => 1.00
546 sum(1, 2, 3, $sysmis) => 6.00
547 sum.4(1, 2, 3, $sysmis) => sysmis
548 sum.4(1, 2, 3) => error
550 variance(1, 2, 3, 4, 5) => 2.50
551 variance(1, $sysmis, 2, 3, $sysmis, 4, 5) => 2.50
552 variance(1, 2) => 0.50
554 variance(1, $sysmis) => sysmis
555 variance(1, 2, 3, $sysmis) => 1.00
556 variance.4(1, 2, 3, $sysmis) => sysmis
557 variance.4(1, 2, 3) => error
558 variance('x') => error
559 variance('x', 1, 2, 3) => error
562 concat('a', 'b') => "ab"
563 concat('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h') => "abcdefgh"
564 concat('abcdefgh', 'ijklmnopq') => "abcdefghijklmnopq"
565 concat('a', 1) => error
566 concat(1, 2) => error
568 index('abcbcde', 'bc') => 2.00
569 index('abcbcde', 'bcd') => 4.00
570 index('abcbcde', 'bcbc') => 2.00
571 index('abcdefgh', 'abc') => 1.00
572 index('abcdefgh', 'bcd') => 2.00
573 index('abcdefgh', 'cde') => 3.00
574 index('abcdefgh', 'def') => 4.00
575 index('abcdefgh', 'efg') => 5.00
576 index('abcdefgh', 'fgh') => 6.00
577 index('abcdefgh', 'fghi') => 0.00
578 index('abcdefgh', 'x') => 0.00
579 index('abcdefgh', 'abch') => 0.00
580 index('banana', 'na') => 3.00
581 index('banana', 'ana') => 2.00
582 index('', 'x') => 0.00
583 index('', '') => sysmis
584 index('abcdefgh', '') => sysmis
585 index('abcdefgh', 'alkjsfdjlskalkjfa') => 0.00
587 index('abcbcde', 'bc', 1) => 2.00
588 index('abcbcde', 'dc', 1) => 3.00
589 index('abcbcde', 'abc', 1) => 1.00
590 index('abcbcde', 'bc', 2) => 2.00
591 index('abcbcde', 'dc', 2) => 0.00
592 index('abcbcde', 'abc', 1) => 1.00
593 index('abcbcde', 'bccb', 2) => 2.00
594 index('abcbcde', 'bcbc', 2) => 2.00
595 index('abcbcde', 'bcbc', $sysmis) => sysmis
597 rindex('abcbcde', 'bc') => 4.00
598 rindex('abcbcde', 'bcd') => 4.00
599 rindex('abcbcde', 'bcbc') => 2.00
600 rindex('abcdefgh', 'abc') => 1.00
601 rindex('abcdefgh', 'bcd') => 2.00
602 rindex('abcdefgh', 'cde') => 3.00
603 rindex('abcdefgh', 'def') => 4.00
604 rindex('abcdefgh', 'efg') => 5.00
605 rindex('abcdefgh', 'fgh') => 6.00
606 rindex('abcdefgh', 'fghi') => 0.00
607 rindex('abcdefgh', 'x') => 0.00
608 rindex('abcdefgh', 'abch') => 0.00
609 rindex('banana', 'na') => 5.00
610 rindex('banana', 'ana') => 4.00
611 rindex('', 'x') => 0.00
612 rindex('', '') => sysmis
613 rindex('abcdefgh', '') => sysmis
614 rindex('abcdefgh', 'alkjsfdjlskalkjfa') => 0.00
616 rindex('abcbcde', 'bc', 1) => 5.00
617 rindex('abcbcde', 'dc', 1) => 6.00
618 rindex('abcbcde', 'abc', 1) => 5.00
619 rindex('abcbcde', 'bc', 2) => 4.00
620 rindex('abcbcde', 'dc', 2) => 0.00
621 rindex('abcbcde', 'abc', 1) => 5.00
622 rindex('abcbcde', 'bccb', 2) => 4.00
623 rindex('abcbcde', 'bcbc', 2) => 4.00
624 rindex('abcbcde', 'bcbc', $sysmis) => sysmis
625 rindex('abcbcde', 'bcbcg', 2) => sysmis
626 rindex('abcbcde', 'bcbcg', $sysmis) => sysmis
627 rindex('abcbcde', 'bcbcg', 'x') => error
628 rindex(1, 'bcdfkjl', 2) => error
629 rindex('aksj', 2, 2) => error
630 rindex(1, 2, 3) => error
631 rindex(1, 2, '3') => error
636 length('adsf ') => 8.00
637 length('abcdefghijkl') => 12.00
639 length($sysmis) => error
641 lower('ABCDEFGHIJKLMNOPQRSTUVWXYZ!@%&*(089') => "abcdefghijklmnopqrstuvwxyz!@%&*(089"
645 lpad('abc', -1) => ""
646 lpad('abc', 0) => "abc"
647 lpad('abc', 2) => "abc"
648 lpad('abc', 3) => "abc"
649 lpad('abc', 10) => " abc"
650 lpad('abc', 256) => ""
651 lpad('abc', $sysmis) => ""
652 lpad('abc', -1, '*') => ""
653 lpad('abc', 0, '*') => "abc"
654 lpad('abc', 2, '*') => "abc"
655 lpad('abc', 3, '*') => "abc"
656 lpad('abc', 10, '*') => "*******abc"
657 lpad('abc', 256, '*') => ""
658 lpad('abc', $sysmis, '*') => ""
659 lpad('abc', $sysmis, '') => ""
660 lpad('abc', $sysmis, 'xy') => ""
662 lpad('abc', 'def') => error
663 lpad(0, 10, ' ') => error
664 lpad('abc', 'def', ' ') => error
665 lpad('x', 5, 0) => error
666 lpad('x', 5, 2) => error
668 number("123", f3.0) => 123.00
669 number(" 123", f3.0) => 12.00
670 number("123", f3.1) => 12.30
671 number(" ", f3.1) => sysmis
672 number("123", a8) => error
673 number("123", cca1.2) => error # CCA is not an input format
675 ltrim(' abc') => "abc"
676 rtrim(' abc ') => " abc"
677 ltrim('abc') => "abc"
678 ltrim(' abc') => " abc"
682 ltrim('***abc', '*') => "abc"
683 ltrim('abc', '*') => "abc"
684 ltrim('*abc', '*') => "abc"
686 ltrim(8, '*') => error
687 ltrim(' x', 8) => error
690 rpad('abc', -1) => ""
691 rpad('abc', 0) => "abc"
692 rpad('abc', 2) => "abc"
693 rpad('abc', 3) => "abc"
694 rpad('abc', 10) => "abc "
695 rpad('abc', 256) => ""
696 rpad('abc', $sysmis) => ""
697 rpad('abc', -1, '*') => ""
698 rpad('abc', 0, '*') => "abc"
699 rpad('abc', 2, '*') => "abc"
700 rpad('abc', 3, '*') => "abc"
701 rpad('abc', 10, '*') => "abc*******"
702 rpad('abc', 256, '*') => ""
703 rpad('abc', $sysmis, '*') => ""
704 rpad('abc', $sysmis, '') => ""
705 rpad('abc', $sysmis, 'xy') => ""
707 rpad('abc', 'def') => error
708 rpad(0, 10, ' ') => error
709 rpad('abc', 'def', ' ') => error
710 rpad('x', 5, 0) => error
711 rpad('x', 5, 2) => error
713 rtrim('abc ') => "abc"
714 rtrim(' abc ') => " abc"
715 rtrim('abc') => "abc"
716 rtrim('abc ') => "abc "
720 rtrim('abc***', '*') => "abc"
721 rtrim('abc', '*') => "abc"
722 rtrim('abc*', '*') => "abc"
724 rtrim(8, '*') => error
725 rtrim(' x', 8) => error
728 string(123.56, f5.1) => "123.6"
729 string($sysmis, f5.1) => " . "
730 string("abc", A5) => error
731 string(123, e1) => error # E has a minimum width of 6 on output.
732 string(123, e6.0) => " 1E+02"
734 substr('abcdefgh', -5) => ""
735 substr('abcdefgh', 0) => ""
736 substr('abcdefgh', 1) => "abcdefgh"
737 substr('abcdefgh', 3) => "cdefgh"
738 substr('abcdefgh', 5) => "efgh"
739 substr('abcdefgh', 6) => "fgh"
740 substr('abcdefgh', 7) => "gh"
741 substr('abcdefgh', 8) => "h"
742 substr('abcdefgh', 9) => ""
743 substr('abcdefgh', 10) => ""
744 substr('abcdefgh', 20) => ""
745 substr('abcdefgh', $sysmis) => ""
746 substr(0, 10) => error
747 substr('abcd', 'abc') => error
748 substr(0, 'abc') => error
750 substr('abcdefgh', 0, 0) => ""
751 substr('abcdefgh', 3, 0) => ""
752 substr('abcdefgh', 5, 0) => ""
753 substr('abcdefgh', 9, 0) => ""
754 substr('abcdefgh', 0, 1) => ""
755 substr('abcdefgh', 0, 5) => ""
756 substr('abcdefgh', 1, 8) => "abcdefgh"
757 substr('abcdefgh', 1, 10) => "abcdefgh"
758 substr('abcdefgh', 1, 20) => "abcdefgh"
759 substr('abcdefgh', 3, 4) => "cdef"
760 substr('abcdefgh', 5, 2) => "ef"
761 substr('abcdefgh', 6, 1) => "f"
762 substr('abcdefgh', 7, 10) => "gh"
763 substr('abcdefgh', 8, 1) => "h"
764 substr('abcdefgh', 8, 2) => "h"
765 substr('abcdefgh', 9, 11) => ""
766 substr('abcdefgh', 10, 52) => ""
767 substr('abcdefgh', 20, 1) => ""
768 substr('abcdefgh', $sysmis, 2) => ""
769 substr('abcdefgh', 9, $sysmis) => ""
770 substr('abcdefgh', $sysmis, $sysmis) => ""
771 substr('abc', 1, 'x') => error
772 substr(0, 10, 1) => error
773 substr(0, 10, 'x') => error
774 substr('abcd', 'abc', 0) => error
775 substr('abcd', 'abc', 'j') => error
776 substr(0, 'abc', 4) => error
777 substr(0, 'abc', 'k') => error
779 upcase('abcdefghijklmnopqrstuvwxyz!@%&*(089') => "ABCDEFGHIJKLMNOPQRSTUVWXYZ!@%&*(089"
783 time.days(1) => 86400.00
784 time.days(-1) => -86400.00
785 time.days(0.5) => 43200.00
786 time.days('x') => error
787 time.days($sysmis) => sysmis
789 time.hms(4,50,38) => 17438.00
790 time.hms(12,31,35) => 45095.00
791 time.hms(12,47,53) => 46073.00
792 time.hms(1,26,0) => 5160.00
793 time.hms(20,58,11) => 75491.00
794 time.hms(7,36,5) => 27365.00
795 time.hms(15,43,49) => 56629.00
796 time.hms(4,25,9) => 15909.00
797 time.hms(6,49,27) => 24567.00
798 time.hms(2,57,52) => 10672.00
799 time.hms(16,45,44) => 60344.00
800 time.hms(21,30,57) => 77457.00
801 time.hms(22,30,4) => 81004.00
802 time.hms(1,56,51) => 7011.00
803 time.hms(5, 6, 7) => 18367.00
804 time.hms(5, 6, 0) => 18360.00
805 time.hms(5, 0, 7) => 18007.00
806 time.hms(0, 6, 7) => 367.00
807 time.hms(-5, 6, -7) => sysmis
808 time.hms(-5, 5, -7) => sysmis
809 time.hms($sysmis, 6, 7) => sysmis
810 time.hms(5, $sysmis, 7) => sysmis
811 time.hms(5, $sysmis, 7) => sysmis
812 time.hms($sysmis, $sysmis, 7) => sysmis
813 time.hms(5, $sysmis, $sysmis) => sysmis
814 time.hms($sysmis, $sysmis, 7) => sysmis
815 time.hms($sysmis, $sysmis, $sysmis) => sysmis
817 ctime.days(106272) => 1.23
818 ctime.hours(106272) => 29.52
819 ctime.minutes(106272) => 1771.20
820 ctime.seconds(106272) => 106272.00
821 ctime.days(-106272) => -1.23
822 ctime.hours(-106272) => -29.52
823 ctime.minutes(-106272) => -1771.20
824 ctime.seconds(-106272) => -106272.00
825 ctime.days($sysmis) => sysmis
826 ctime.hours($sysmis) => sysmis
827 ctime.minutes($sysmis) => sysmis
828 ctime.seconds($sysmis) => sysmis
829 ctime.days('a') => error
830 ctime.hours('b') => error
831 ctime.minutes('c') => error
832 ctime.seconds('d') => error
834 ctime.days(date.dmy(15,10,1582)) => 1.00
835 ctime.days(date.dmy(6,9,1719)) => 50000.00
836 ctime.days(date.dmy(24,1,1583)) => 102.00
837 ctime.days(date.dmy(14,12,1585)) => 1157.00
838 ctime.days(date.dmy(26,11,1621)) => 14288.00
839 ctime.days(date.dmy(25,12,1821)) => 87365.00
840 ctime.days(date.dmy(3,12,1882)) => 109623.00
841 ctime.days(date.dmy(6,4,2002)) => 153211.00
842 ctime.days(date.dmy(19,12,1999)) => 152372.00
843 ctime.days(date.dmy(1,10,1978)) => 144623.00
844 ctime.days(date.dmy(0,10,1978)) => 144622.00
845 ctime.days(date.dmy(32,10,1978)) => sysmis
846 ctime.days(date.dmy(31,0,1978)) => 144349.00
847 ctime.days(date.dmy(31,13,1978)) => 144745.00
848 ctime.days(date.dmy($sysmis,10,1978)) => sysmis
849 ctime.days(date.dmy(31,$sysmis,1978)) => sysmis
850 ctime.days(date.dmy(31,10,$sysmis)) => sysmis
851 ctime.days(date.dmy($sysmis,$sysmis,1978)) => sysmis
852 ctime.days(date.dmy(31,$sysmis,$sysmis)) => sysmis
853 ctime.days(date.dmy($sysmis,10,$sysmis)) => sysmis
854 ctime.days(date.dmy($sysmis,$sysmis,$sysmis)) => sysmis
855 date.dmy('a',1,2) => error
856 date.dmy(1,'a',2) => error
857 date.dmy(1,2,'a') => error
858 # FIXME: check out-of-range and nearly out-of-range values
860 yrmoda(1582,10,15) => 1.00
861 yrmoda(1719,9,6) => 50000.00
862 yrmoda(1583,1,24) => 102.00
863 yrmoda(1585,12,14) => 1157.00
864 yrmoda(1621,11,26) => 14288.00
865 yrmoda(1821,12,25) => 87365.00
866 yrmoda(1882,12,3) => 109623.00
867 yrmoda(2002,4,6) => 153211.00
868 yrmoda(1999,12,19) => 152372.00
869 yrmoda(1978,10,1) => 144623.00
870 yrmoda(1978,10,0) => 144622.00
871 yrmoda(1978,10,32) => sysmis
872 yrmoda(1978,0,31) => 144349.00
873 yrmoda(1978,13,31) => 144745.00
874 yrmoda(1978,10,$sysmis) => sysmis
875 yrmoda(1978,$sysmis,31) => sysmis
876 yrmoda($sysmis,10,31) => sysmis
877 yrmoda(1978,$sysmis,$sysmis) => sysmis
878 yrmoda($sysmis,$sysmis,31) => sysmis
879 yrmoda($sysmis,10,$sysmis) => sysmis
880 yrmoda($sysmis,$sysmis,$sysmis) => sysmis
881 yrmoda('a',1,2) => error
882 yrmoda(1,'a',2) => error
883 yrmoda(1,2,'a') => error
884 # FIXME: check out-of-range and nearly out-of-range values
886 ctime.days(date.mdy(6,10,1648)) + 577735 => 601716.00
887 ctime.days(date.mdy(6,30,1680)) + 577735 => 613424.00
888 ctime.days(date.mdy(7,24,1716)) + 577735 => 626596.00
889 ctime.days(date.mdy(6,19,1768)) + 577735 => 645554.00
890 ctime.days(date.mdy(8,2,1819)) + 577735 => 664224.00
891 ctime.days(date.mdy(3,27,1839)) + 577735 => 671401.00
892 ctime.days(date.mdy(4,19,1903)) + 577735 => 694799.00
893 ctime.days(date.mdy(8,25,1929)) + 577735 => 704424.00
894 ctime.days(date.mdy(9,29,1941)) + 577735 => 708842.00
895 ctime.days(date.mdy(4,19,1943)) + 577735 => 709409.00
896 ctime.days(date.mdy(10,7,1943)) + 577735 => 709580.00
897 ctime.days(date.mdy(3,17,1992)) + 577735 => 727274.00
898 ctime.days(date.mdy(2,25,1996)) + 577735 => 728714.00
899 ctime.days(date.mdy(11,10,2038)) + 577735 => 744313.00
900 ctime.days(date.mdy(7,18,2094)) + 577735 => 764652.00
901 # FIXME: check out-of-range and nearly out-of-range values
903 ctime.days(date.mdy(10,15,1582)) => 1.00
904 ctime.days(date.mdy(9,6,1719)) => 50000.00
905 ctime.days(date.mdy(1,24,1583)) => 102.00
906 ctime.days(date.mdy(12,14,1585)) => 1157.00
907 ctime.days(date.mdy(11,26,1621)) => 14288.00
908 ctime.days(date.mdy(12,25,1821)) => 87365.00
909 ctime.days(date.mdy(12,3,1882)) => 109623.00
910 ctime.days(date.mdy(4,6,2002)) => 153211.00
911 ctime.days(date.mdy(12,19,1999)) => 152372.00
912 ctime.days(date.mdy(10,1,1978)) => 144623.00
913 ctime.days(date.mdy(10,0,1978)) => 144622.00
914 ctime.days(date.mdy(10,32,1978)) => sysmis
915 ctime.days(date.mdy(0,31,1978)) => 144349.00
916 ctime.days(date.mdy(13,31,1978)) => 144745.00
917 ctime.days(date.mdy(10,$sysmis,1978)) => sysmis
918 ctime.days(date.mdy($sysmis,31,1978)) => sysmis
919 ctime.days(date.mdy(10,31,$sysmis)) => sysmis
920 ctime.days(date.mdy($sysmis,$sysmis,1978)) => sysmis
921 ctime.days(date.mdy($sysmis,31,$sysmis)) => sysmis
922 ctime.days(date.mdy(10,$sysmis,$sysmis)) => sysmis
923 ctime.days(date.mdy($sysmis,$sysmis,$sysmis)) => sysmis
924 date.mdy('a',1,2) => error
925 date.mdy(1,'a',2) => error
926 date.mdy(1,2,'a') => error
927 ctime.days(date.mdy(0,0,0)) => 152353.00
928 ctime.days(date.mdy(0,0,999)) => sysmis
929 date.mdy(1,1,1582) => sysmis
930 date.mdy(10,14,1582) => sysmis
931 date.mdy(10,15,1582) => 86400.00
933 ctime.days(date.moyr(1,2000)) => 152385.00
934 ctime.days(date.moyr(2,2000)) => 152416.00
935 ctime.days(date.moyr(3,2000)) => 152445.00
936 ctime.days(date.moyr(4,2000)) => 152476.00
937 ctime.days(date.moyr(5,2000)) => 152506.00
938 ctime.days(date.moyr(13,2000)) => 152751.00
939 ctime.days(date.moyr(14,2000)) => sysmis
940 ctime.days(date.moyr($sysmis,2000)) => sysmis
941 ctime.days(date.moyr(1,$sysmis)) => sysmis
942 ctime.days(date.moyr($sysmis,$sysmis)) => sysmis
943 date.moyr('a',2000) => error
944 date.moyr(5,'a') => error
945 date.moyr('a','b') => error
947 ctime.days(date.qyr(1,2000)) => 152385.00
948 ctime.days(date.qyr(2,2000)) => 152476.00
949 ctime.days(date.qyr(5,2000)) => 152751.00
950 ctime.days(date.qyr(6,2000)) => sysmis
951 ctime.days(date.qyr($sysmis,2000)) => sysmis
952 ctime.days(date.qyr(1,$sysmis)) => sysmis
953 ctime.days(date.qyr($sysmis,$sysmis)) => sysmis
954 date.qyr('a',2000) => error
955 date.qyr(5,'a') => error
956 date.qyr('a','b') => error
958 ctime.days(date.wkyr(1,2000)) => 152385.00
959 ctime.days(date.wkyr(15,1999)) => 152118.00
960 ctime.days(date.wkyr(36,1999)) => 152265.00
961 ctime.days(date.wkyr(54,1999)) => sysmis
962 ctime.days(date.wkyr($sysmis,1999)) => sysmis
963 ctime.days(date.wkyr(1,$sysmis)) => sysmis
964 ctime.days(date.wkyr($sysmis,$sysmis)) => sysmis
965 date.wkyr('a',1999) => error
966 date.wkyr(5,'a') => error
967 date.wkyr('a','b') => error
969 ctime.days(date.yrday(2000,1)) => 152385.00
970 ctime.days(date.yrday(2000,100)) => 152484.00
971 ctime.days(date.yrday(2000,253)) => 152637.00
972 ctime.days(date.yrday(2000,500)) => sysmis
973 ctime.days(date.yrday(2000,-100)) => sysmis
974 ctime.days(date.yrday(1999,$sysmis)) => sysmis
975 ctime.days(date.yrday($sysmis,1)) => sysmis
976 ctime.days(date.yrday($sysmis,$sysmis)) => sysmis
977 date.yrday(1999,'a') => error
978 date.yrday('a',5) => error
979 date.yrday('a','b') => error
981 xdate.date(date.mdy(6,10,1648) + time.hms(0,0,0)) / 86400 => 23981.00
982 xdate.date(date.mdy(6,30,1680) + time.hms(4,50,38)) / 86400 => 35689.00
983 xdate.date(date.mdy(7,24,1716) + time.hms(12,31,35)) / 86400 => 48861.00
984 xdate.date(date.mdy(6,19,1768) + time.hms(12,47,53)) / 86400 => 67819.00
985 xdate.date(date.mdy(8,2,1819) + time.hms(1,26,0)) / 86400 => 86489.00
986 xdate.date(date.mdy(3,27,1839) + time.hms(20,58,11)) / 86400 => 93666.00
987 xdate.date(date.mdy(4,19,1903) + time.hms(7,36,5)) / 86400 => 117064.00
988 xdate.date(date.mdy(8,25,1929) + time.hms(15,43,49)) / 86400 => 126689.00
989 xdate.date(date.mdy(9,29,1941) + time.hms(4,25,9)) / 86400 => 131107.00
990 xdate.date(date.mdy(4,19,1943) + time.hms(6,49,27)) / 86400 => 131674.00
991 xdate.date(date.mdy(10,7,1943) + time.hms(2,57,52)) / 86400 => 131845.00
992 xdate.date(date.mdy(3,17,1992) + time.hms(16,45,44)) / 86400 => 149539.00
993 xdate.date(date.mdy(2,25,1996) + time.hms(21,30,57)) / 86400 => 150979.00
994 xdate.date(date.mdy(9,29,41) + time.hms(4,25,9)) / 86400 => 131107.00
995 xdate.date(date.mdy(4,19,43) + time.hms(6,49,27)) / 86400 => 131674.00
996 xdate.date(date.mdy(10,7,43) + time.hms(2,57,52)) / 86400 => 131845.00
997 xdate.date(date.mdy(3,17,92) + time.hms(16,45,44)) / 86400 => 149539.00
998 xdate.date(date.mdy(2,25,96) + time.hms(21,30,57)) / 86400 => 150979.00
999 xdate.date(date.mdy(11,10,2038) + time.hms(22,30,4)) / 86400 => 166578.00
1000 xdate.date(date.mdy(7,18,2094) + time.hms(1,56,51)) / 86400 => 186917.00
1001 xdate.date(123.4) => 0.00
1002 xdate.date('') => error
1004 xdate.hour(date.mdy(6,10,1648) + time.hms(0,0,0)) => 0.00
1005 xdate.hour(date.mdy(6,30,1680) + time.hms(4,50,38)) => 4.00
1006 xdate.hour(date.mdy(7,24,1716) + time.hms(12,31,35)) => 12.00
1007 xdate.hour(date.mdy(6,19,1768) + time.hms(12,47,53)) => 12.00
1008 xdate.hour(date.mdy(8,2,1819) + time.hms(1,26,0)) => 1.00
1009 xdate.hour(date.mdy(3,27,1839) + time.hms(20,58,11)) => 20.00
1010 xdate.hour(date.mdy(4,19,1903) + time.hms(7,36,5)) => 7.00
1011 xdate.hour(date.mdy(8,25,1929) + time.hms(15,43,49)) => 15.00
1012 xdate.hour(date.mdy(9,29,1941) + time.hms(4,25,9)) => 4.00
1013 xdate.hour(date.mdy(4,19,1943) + time.hms(6,49,27)) => 6.00
1014 xdate.hour(date.mdy(10,7,1943) + time.hms(2,57,52)) => 2.00
1015 xdate.hour(date.mdy(3,17,1992) + time.hms(16,45,44)) => 16.00
1016 xdate.hour(date.mdy(2,25,1996) + time.hms(21,30,57)) => 21.00
1017 xdate.hour(date.mdy(9,29,41) + time.hms(4,25,9)) => 4.00
1018 xdate.hour(date.mdy(4,19,43) + time.hms(6,49,27)) => 6.00
1019 xdate.hour(date.mdy(10,7,43) + time.hms(2,57,52)) => 2.00
1020 xdate.hour(date.mdy(3,17,92) + time.hms(16,45,44)) => 16.00
1021 xdate.hour(date.mdy(2,25,96) + time.hms(21,30,57)) => 21.00
1022 xdate.hour(date.mdy(11,10,2038) + time.hms(22,30,4)) => 22.00
1023 xdate.hour(date.mdy(7,18,2094) + time.hms(1,56,51)) => 1.00
1024 xdate.hour(-1) => -1.00
1025 xdate.hour(1) => 0.00
1026 xdate.hour($sysmis) => sysmis
1027 xdate.hour('') => error
1029 xdate.jday(date.mdy(6,10,1648) + time.hms(0,0,0)) => 162.00
1030 xdate.jday(date.mdy(6,30,1680) + time.hms(4,50,38)) => 182.00
1031 xdate.jday(date.mdy(7,24,1716) + time.hms(12,31,35)) => 206.00
1032 xdate.jday(date.mdy(6,19,1768) + time.hms(12,47,53)) => 171.00
1033 xdate.jday(date.mdy(8,2,1819) + time.hms(1,26,0)) => 214.00
1034 xdate.jday(date.mdy(3,27,1839) + time.hms(20,58,11)) => 86.00
1035 xdate.jday(date.mdy(4,19,1903) + time.hms(7,36,5)) => 109.00
1036 xdate.jday(date.mdy(8,25,1929) + time.hms(15,43,49)) => 237.00
1037 xdate.jday(date.mdy(9,29,1941) + time.hms(4,25,9)) => 272.00
1038 xdate.jday(date.mdy(4,19,1943) + time.hms(6,49,27)) => 109.00
1039 xdate.jday(date.mdy(10,7,1943) + time.hms(2,57,52)) => 280.00
1040 xdate.jday(date.mdy(3,17,1992) + time.hms(16,45,44)) => 77.00
1041 xdate.jday(date.mdy(2,25,1996) + time.hms(21,30,57)) => 56.00
1042 xdate.jday(date.mdy(9,29,41) + time.hms(4,25,9)) => 272.00
1043 xdate.jday(date.mdy(4,19,43) + time.hms(6,49,27)) => 109.00
1044 xdate.jday(date.mdy(10,7,43) + time.hms(2,57,52)) => 280.00
1045 xdate.jday(date.mdy(3,17,92) + time.hms(16,45,44)) => 77.00
1046 xdate.jday(date.mdy(2,25,96) + time.hms(21,30,57)) => 56.00
1047 xdate.jday(date.mdy(11,10,2038) + time.hms(22,30,4)) => 314.00
1048 xdate.jday(date.mdy(7,18,2094) + time.hms(1,56,51)) => 199.00
1049 xdate.jday(0) => sysmis
1050 xdate.jday(1) => sysmis
1051 xdate.jday(86400) => 288.00
1053 xdate.mday(date.mdy(6,10,1648) + time.hms(0,0,0)) => 10.00
1054 xdate.mday(date.mdy(6,30,1680) + time.hms(4,50,38)) => 30.00
1055 xdate.mday(date.mdy(7,24,1716) + time.hms(12,31,35)) => 24.00
1056 xdate.mday(date.mdy(6,19,1768) + time.hms(12,47,53)) => 19.00
1057 xdate.mday(date.mdy(8,2,1819) + time.hms(1,26,0)) => 2.00
1058 xdate.mday(date.mdy(3,27,1839) + time.hms(20,58,11)) => 27.00
1059 xdate.mday(date.mdy(4,19,1903) + time.hms(7,36,5)) => 19.00
1060 xdate.mday(date.mdy(8,25,1929) + time.hms(15,43,49)) => 25.00
1061 xdate.mday(date.mdy(9,29,1941) + time.hms(4,25,9)) => 29.00
1062 xdate.mday(date.mdy(4,19,1943) + time.hms(6,49,27)) => 19.00
1063 xdate.mday(date.mdy(10,7,1943) + time.hms(2,57,52)) => 7.00
1064 xdate.mday(date.mdy(3,17,1992) + time.hms(16,45,44)) => 17.00
1065 xdate.mday(date.mdy(2,25,1996) + time.hms(21,30,57)) => 25.00
1066 xdate.mday(date.mdy(9,29,41) + time.hms(4,25,9)) => 29.00
1067 xdate.mday(date.mdy(4,19,43) + time.hms(6,49,27)) => 19.00
1068 xdate.mday(date.mdy(10,7,43) + time.hms(2,57,52)) => 7.00
1069 xdate.mday(date.mdy(3,17,92) + time.hms(16,45,44)) => 17.00
1070 xdate.mday(date.mdy(2,25,96) + time.hms(21,30,57)) => 25.00
1071 xdate.mday(date.mdy(11,10,2038) + time.hms(22,30,4)) => 10.00
1072 xdate.mday(date.mdy(7,18,2094) + time.hms(1,56,51)) => 18.00
1074 xdate.minute(date.mdy(6,10,1648) + time.hms(0,0,0)) => 0.00
1075 xdate.minute(date.mdy(6,30,1680) + time.hms(4,50,38)) => 50.00
1076 xdate.minute(date.mdy(7,24,1716) + time.hms(12,31,35)) => 31.00
1077 xdate.minute(date.mdy(6,19,1768) + time.hms(12,47,53)) => 47.00
1078 xdate.minute(date.mdy(8,2,1819) + time.hms(1,26,0)) => 26.00
1079 xdate.minute(date.mdy(3,27,1839) + time.hms(20,58,11)) => 58.00
1080 xdate.minute(date.mdy(4,19,1903) + time.hms(7,36,5)) => 36.00
1081 xdate.minute(date.mdy(8,25,1929) + time.hms(15,43,49)) => 43.00
1082 xdate.minute(date.mdy(9,29,1941) + time.hms(4,25,9)) => 25.00
1083 xdate.minute(date.mdy(4,19,1943) + time.hms(6,49,27)) => 49.00
1084 xdate.minute(date.mdy(10,7,1943) + time.hms(2,57,52)) => 57.00
1085 xdate.minute(date.mdy(3,17,1992) + time.hms(16,45,44)) => 45.00
1086 xdate.minute(date.mdy(2,25,1996) + time.hms(21,30,57)) => 30.00
1087 xdate.minute(date.mdy(9,29,41) + time.hms(4,25,9)) => 25.00
1088 xdate.minute(date.mdy(4,19,43) + time.hms(6,49,27)) => 49.00
1089 xdate.minute(date.mdy(10,7,43) + time.hms(2,57,52)) => 57.00
1090 xdate.minute(date.mdy(3,17,92) + time.hms(16,45,44)) => 45.00
1091 xdate.minute(date.mdy(2,25,96) + time.hms(21,30,57)) => 30.00
1092 xdate.minute(date.mdy(11,10,2038) + time.hms(22,30,4)) => 30.00
1093 xdate.minute(date.mdy(7,18,2094) + time.hms(1,56,51)) => 56.00
1095 xdate.month(date.mdy(6,10,1648) + time.hms(0,0,0)) => 6.00
1096 xdate.month(date.mdy(6,30,1680) + time.hms(4,50,38)) => 6.00
1097 xdate.month(date.mdy(7,24,1716) + time.hms(12,31,35)) => 7.00
1098 xdate.month(date.mdy(6,19,1768) + time.hms(12,47,53)) => 6.00
1099 xdate.month(date.mdy(8,2,1819) + time.hms(1,26,0)) => 8.00
1100 xdate.month(date.mdy(3,27,1839) + time.hms(20,58,11)) => 3.00
1101 xdate.month(date.mdy(4,19,1903) + time.hms(7,36,5)) => 4.00
1102 xdate.month(date.mdy(8,25,1929) + time.hms(15,43,49)) => 8.00
1103 xdate.month(date.mdy(9,29,1941) + time.hms(4,25,9)) => 9.00
1104 xdate.month(date.mdy(4,19,1943) + time.hms(6,49,27)) => 4.00
1105 xdate.month(date.mdy(10,7,1943) + time.hms(2,57,52)) => 10.00
1106 xdate.month(date.mdy(3,17,1992) + time.hms(16,45,44)) => 3.00
1107 xdate.month(date.mdy(2,25,1996) + time.hms(21,30,57)) => 2.00
1108 xdate.month(date.mdy(9,29,41) + time.hms(4,25,9)) => 9.00
1109 xdate.month(date.mdy(4,19,43) + time.hms(6,49,27)) => 4.00
1110 xdate.month(date.mdy(10,7,43) + time.hms(2,57,52)) => 10.00
1111 xdate.month(date.mdy(3,17,92) + time.hms(16,45,44)) => 3.00
1112 xdate.month(date.mdy(2,25,96) + time.hms(21,30,57)) => 2.00
1113 xdate.month(date.mdy(11,10,2038) + time.hms(22,30,4)) => 11.00
1114 xdate.month(date.mdy(7,18,2094) + time.hms(1,56,51)) => 7.00
1116 xdate.quarter(date.mdy(6,10,1648) + time.hms(0,0,0)) => 2.00
1117 xdate.quarter(date.mdy(6,30,1680) + time.hms(4,50,38)) => 2.00
1118 xdate.quarter(date.mdy(7,24,1716) + time.hms(12,31,35)) => 3.00
1119 xdate.quarter(date.mdy(6,19,1768) + time.hms(12,47,53)) => 2.00
1120 xdate.quarter(date.mdy(8,2,1819) + time.hms(1,26,0)) => 3.00
1121 xdate.quarter(date.mdy(3,27,1839) + time.hms(20,58,11)) => 1.00
1122 xdate.quarter(date.mdy(4,19,1903) + time.hms(7,36,5)) => 2.00
1123 xdate.quarter(date.mdy(8,25,1929) + time.hms(15,43,49)) => 3.00
1124 xdate.quarter(date.mdy(9,29,1941) + time.hms(4,25,9)) => 3.00
1125 xdate.quarter(date.mdy(4,19,1943) + time.hms(6,49,27)) => 2.00
1126 xdate.quarter(date.mdy(10,7,1943) + time.hms(2,57,52)) => 4.00
1127 xdate.quarter(date.mdy(3,17,1992) + time.hms(16,45,44)) => 1.00
1128 xdate.quarter(date.mdy(2,25,1996) + time.hms(21,30,57)) => 1.00
1129 xdate.quarter(date.mdy(9,29,41) + time.hms(4,25,9)) => 3.00
1130 xdate.quarter(date.mdy(4,19,43) + time.hms(6,49,27)) => 2.00
1131 xdate.quarter(date.mdy(10,7,43) + time.hms(2,57,52)) => 4.00
1132 xdate.quarter(date.mdy(3,17,92) + time.hms(16,45,44)) => 1.00
1133 xdate.quarter(date.mdy(2,25,96) + time.hms(21,30,57)) => 1.00
1134 xdate.quarter(date.mdy(11,10,2038) + time.hms(22,30,4)) => 4.00
1135 xdate.quarter(date.mdy(7,18,2094) + time.hms(1,56,51)) => 3.00
1137 xdate.second(date.mdy(6,10,1648) + time.hms(0,0,0)) => 0.00
1138 xdate.second(date.mdy(6,30,1680) + time.hms(4,50,38)) => 38.00
1139 xdate.second(date.mdy(7,24,1716) + time.hms(12,31,35)) => 35.00
1140 xdate.second(date.mdy(6,19,1768) + time.hms(12,47,53)) => 53.00
1141 xdate.second(date.mdy(8,2,1819) + time.hms(1,26,0)) => 0.00
1142 xdate.second(date.mdy(3,27,1839) + time.hms(20,58,11)) => 11.00
1143 xdate.second(date.mdy(4,19,1903) + time.hms(7,36,5)) => 5.00
1144 xdate.second(date.mdy(8,25,1929) + time.hms(15,43,49)) => 49.00
1145 xdate.second(date.mdy(9,29,1941) + time.hms(4,25,9)) => 9.00
1146 xdate.second(date.mdy(4,19,1943) + time.hms(6,49,27)) => 27.00
1147 xdate.second(date.mdy(10,7,1943) + time.hms(2,57,52)) => 52.00
1148 xdate.second(date.mdy(3,17,1992) + time.hms(16,45,44)) => 44.00
1149 xdate.second(date.mdy(2,25,1996) + time.hms(21,30,57)) => 57.00
1150 xdate.second(date.mdy(9,29,41) + time.hms(4,25,9)) => 9.00
1151 xdate.second(date.mdy(4,19,43) + time.hms(6,49,27)) => 27.00
1152 xdate.second(date.mdy(10,7,43) + time.hms(2,57,52)) => 52.00
1153 xdate.second(date.mdy(3,17,92) + time.hms(16,45,44)) => 44.00
1154 xdate.second(date.mdy(2,25,96) + time.hms(21,30,57)) => 57.00
1155 xdate.second(date.mdy(11,10,2038) + time.hms(22,30,4)) => 4.00
1156 xdate.second(date.mdy(7,18,2094) + time.hms(1,56,51)) => 51.00
1158 xdate.tday(date.mdy(6,10,1648) + time.hms(0,0,0)) => 23981.00
1159 xdate.tday(date.mdy(6,30,1680) + time.hms(4,50,38)) => 35689.00
1160 xdate.tday(date.mdy(7,24,1716) + time.hms(12,31,35)) => 48861.00
1161 xdate.tday(date.mdy(6,19,1768) + time.hms(12,47,53)) => 67819.00
1162 xdate.tday(date.mdy(8,2,1819) + time.hms(1,26,0)) => 86489.00
1163 xdate.tday(date.mdy(3,27,1839) + time.hms(20,58,11)) => 93666.00
1164 xdate.tday(date.mdy(4,19,1903) + time.hms(7,36,5)) => 117064.00
1165 xdate.tday(date.mdy(8,25,1929) + time.hms(15,43,49)) => 126689.00
1166 xdate.tday(date.mdy(9,29,1941) + time.hms(4,25,9)) => 131107.00
1167 xdate.tday(date.mdy(4,19,1943) + time.hms(6,49,27)) => 131674.00
1168 xdate.tday(date.mdy(10,7,1943) + time.hms(2,57,52)) => 131845.00
1169 xdate.tday(date.mdy(3,17,1992) + time.hms(16,45,44)) => 149539.00
1170 xdate.tday(date.mdy(2,25,1996) + time.hms(21,30,57)) => 150979.00
1171 xdate.tday(date.mdy(9,29,41) + time.hms(4,25,9)) => 131107.00
1172 xdate.tday(date.mdy(4,19,43) + time.hms(6,49,27)) => 131674.00
1173 xdate.tday(date.mdy(10,7,43) + time.hms(2,57,52)) => 131845.00
1174 xdate.tday(date.mdy(3,17,92) + time.hms(16,45,44)) => 149539.00
1175 xdate.tday(date.mdy(2,25,96) + time.hms(21,30,57)) => 150979.00
1176 xdate.tday(date.mdy(11,10,2038) + time.hms(22,30,4)) => 166578.00
1177 xdate.tday(date.mdy(7,18,2094) + time.hms(1,56,51)) => 186917.00
1179 xdate.time(date.mdy(6,10,1648) + time.hms(0,0,0)) => 0.00
1180 xdate.time(date.mdy(6,30,1680) + time.hms(4,50,38)) => 17438.00
1181 xdate.time(date.mdy(7,24,1716) + time.hms(12,31,35)) => 45095.00
1182 xdate.time(date.mdy(6,19,1768) + time.hms(12,47,53)) => 46073.00
1183 xdate.time(date.mdy(8,2,1819) + time.hms(1,26,0)) => 5160.00
1184 xdate.time(date.mdy(3,27,1839) + time.hms(20,58,11)) => 75491.00
1185 xdate.time(date.mdy(4,19,1903) + time.hms(7,36,5)) => 27365.00
1186 xdate.time(date.mdy(8,25,1929) + time.hms(15,43,49)) => 56629.00
1187 xdate.time(date.mdy(9,29,1941) + time.hms(4,25,9)) => 15909.00
1188 xdate.time(date.mdy(4,19,1943) + time.hms(6,49,27)) => 24567.00
1189 xdate.time(date.mdy(10,7,1943) + time.hms(2,57,52)) => 10672.00
1190 xdate.time(date.mdy(3,17,1992) + time.hms(16,45,44)) => 60344.00
1191 xdate.time(date.mdy(2,25,1996) + time.hms(21,30,57)) => 77457.00
1192 xdate.time(date.mdy(9,29,41) + time.hms(4,25,9)) => 15909.00
1193 xdate.time(date.mdy(4,19,43) + time.hms(6,49,27)) => 24567.00
1194 xdate.time(date.mdy(10,7,43) + time.hms(2,57,52)) => 10672.00
1195 xdate.time(date.mdy(3,17,92) + time.hms(16,45,44)) => 60344.00
1196 xdate.time(date.mdy(2,25,96) + time.hms(21,30,57)) => 77457.00
1197 xdate.time(date.mdy(11,10,2038) + time.hms(22,30,4)) => 81004.00
1198 xdate.time(date.mdy(7,18,2094) + time.hms(1,56,51)) => 7011.00
1200 xdate.week(date.mdy(6,10,1648) + time.hms(0,0,0)) => 24.00
1201 xdate.week(date.mdy(6,30,1680) + time.hms(4,50,38)) => 26.00
1202 xdate.week(date.mdy(7,24,1716) + time.hms(12,31,35)) => 30.00
1203 xdate.week(date.mdy(6,19,1768) + time.hms(12,47,53)) => 25.00
1204 xdate.week(date.mdy(8,2,1819) + time.hms(1,26,0)) => 31.00
1205 xdate.week(date.mdy(3,27,1839) + time.hms(20,58,11)) => 13.00
1206 xdate.week(date.mdy(4,19,1903) + time.hms(7,36,5)) => 16.00
1207 xdate.week(date.mdy(8,25,1929) + time.hms(15,43,49)) => 34.00
1208 xdate.week(date.mdy(9,29,1941) + time.hms(4,25,9)) => 39.00
1209 xdate.week(date.mdy(4,19,1943) + time.hms(6,49,27)) => 16.00
1210 xdate.week(date.mdy(10,7,1943) + time.hms(2,57,52)) => 40.00
1211 xdate.week(date.mdy(3,17,1992) + time.hms(16,45,44)) => 11.00
1212 xdate.week(date.mdy(2,25,1996) + time.hms(21,30,57)) => 8.00
1213 xdate.week(date.mdy(9,29,41) + time.hms(4,25,9)) => 39.00
1214 xdate.week(date.mdy(4,19,43) + time.hms(6,49,27)) => 16.00
1215 xdate.week(date.mdy(10,7,43) + time.hms(2,57,52)) => 40.00
1216 xdate.week(date.mdy(3,17,92) + time.hms(16,45,44)) => 11.00
1217 xdate.week(date.mdy(2,25,96) + time.hms(21,30,57)) => 8.00
1218 xdate.week(date.mdy(11,10,2038) + time.hms(22,30,4)) => 45.00
1219 xdate.week(date.mdy(7,18,2094) + time.hms(1,56,51)) => 29.00
1221 xdate.wkday(date.mdy(6,10,1648)) => 4.00
1222 xdate.wkday(date.mdy(6,30,1680)) => 1.00
1223 xdate.wkday(date.mdy(7,24,1716)) => 6.00
1224 xdate.wkday(date.mdy(6,19,1768)) => 1.00
1225 xdate.wkday(date.mdy(8,2,1819)) => 2.00
1226 xdate.wkday(date.mdy(3,27,1839)) => 4.00
1227 xdate.wkday(date.mdy(4,19,1903)) => 1.00
1228 xdate.wkday(date.mdy(8,25,1929)) => 1.00
1229 xdate.wkday(date.mdy(9,29,1941)) => 2.00
1230 xdate.wkday(date.mdy(4,19,1943)) => 2.00
1231 xdate.wkday(date.mdy(10,7,1943)) => 5.00
1232 xdate.wkday(date.mdy(3,17,1992)) => 3.00
1233 xdate.wkday(date.mdy(2,25,1996)) => 1.00
1234 xdate.wkday(date.mdy(9,29,41)) => 2.00
1235 xdate.wkday(date.mdy(4,19,43)) => 2.00
1236 xdate.wkday(date.mdy(10,7,43)) => 5.00
1237 xdate.wkday(date.mdy(3,17,92)) => 3.00
1238 xdate.wkday(date.mdy(2,25,96)) => 1.00
1239 xdate.wkday(date.mdy(11,10,2038)) => 4.00
1240 xdate.wkday(date.mdy(7,18,2094)) => 1.00
1242 xdate.year(date.mdy(6,10,1648) + time.hms(0,0,0)) => 1648.00
1243 xdate.year(date.mdy(6,30,1680) + time.hms(4,50,38)) => 1680.00
1244 xdate.year(date.mdy(7,24,1716) + time.hms(12,31,35)) => 1716.00
1245 xdate.year(date.mdy(6,19,1768) + time.hms(12,47,53)) => 1768.00
1246 xdate.year(date.mdy(8,2,1819) + time.hms(1,26,0)) => 1819.00
1247 xdate.year(date.mdy(3,27,1839) + time.hms(20,58,11)) => 1839.00
1248 xdate.year(date.mdy(4,19,1903) + time.hms(7,36,5)) => 1903.00
1249 xdate.year(date.mdy(8,25,1929) + time.hms(15,43,49)) => 1929.00
1250 xdate.year(date.mdy(9,29,1941) + time.hms(4,25,9)) => 1941.00
1251 xdate.year(date.mdy(4,19,1943) + time.hms(6,49,27)) => 1943.00
1252 xdate.year(date.mdy(10,7,1943) + time.hms(2,57,52)) => 1943.00
1253 xdate.year(date.mdy(3,17,1992) + time.hms(16,45,44)) => 1992.00
1254 xdate.year(date.mdy(2,25,1996) + time.hms(21,30,57)) => 1996.00
1255 xdate.year(date.mdy(9,29,41) + time.hms(4,25,9)) => 1941.00
1256 xdate.year(date.mdy(4,19,43) + time.hms(6,49,27)) => 1943.00
1257 xdate.year(date.mdy(10,7,43) + time.hms(2,57,52)) => 1943.00
1258 xdate.year(date.mdy(3,17,92) + time.hms(16,45,44)) => 1992.00
1259 xdate.year(date.mdy(2,25,96) + time.hms(21,30,57)) => 1996.00
1260 xdate.year(date.mdy(11,10,2038) + time.hms(22,30,4)) => 2038.00
1261 xdate.year(date.mdy(7,18,2094) + time.hms(1,56,51)) => 2094.00
1263 # These test values are from Applied Statistics, Algorithm AS 310.
1264 1000 * ncdf.beta(.868,10,20,150) => 937.66
1265 1000 * ncdf.beta(.9,10,10,120) => 730.68
1266 1000 * ncdf.beta(.88,15,5,80) => 160.43
1267 1000 * ncdf.beta(.85,20,10,110) => 186.75
1268 1000 * ncdf.beta(.66,20,30,65) => 655.94
1269 1000 * ncdf.beta(.72,20,50,130) => 979.69
1270 1000 * ncdf.beta(.72,30,20,80) => 116.24
1271 1000 * ncdf.beta(.8,30,40,130) => 993.04
1275 (X = 1.00); X => 1.00
1277 SYSMIS($SYSMIS) => true
1278 SYSMIS(1 + $SYSMIS) => true
1280 # FIXME: out-of-range and nearly out-of-range values on dates
1282 # Tests correctness of generic optimizations in optimize_tree().
1283 (X = 10.00); x + 0 => 10.00
1284 (X = -3.00); x - 0 => -3.00
1285 (X = 5.00); 0 + x => 5.00
1286 (X = 10.00); x * 1 => 10.00
1287 (X = -3.00); 1 * x => -3.00
1288 (X = 5.00); x / 1 => 5.00
1289 (X = 10.00); 0 * x => 0.00
1290 (X = -3.00); x * 0 => 0.00
1291 (X = 5.00); 0 / x => 0.00
1292 (X = 5.00); mod(0, x) => 0.00
1293 (X = 5.00); x ** 1 => 5.00
1294 (X = 5.00); x ** 2 => 25.00
1296 if [ $? -ne 0 ] ; then no_result ; fi
1298 activity="create optimizing input"
1299 echo 'set mxwarn 1000.
1300 set mxerr 1000.' > $TEMPDIR/expr-opt.stat
1301 sed < $TEMPDIR/expr-list >> $TEMPDIR/expr-opt.stat \
1302 -e 's#^\(\(.*\); \)*\(.*\) => .*$#DEBUG EVALUATE\2/\3.#'
1303 if [ $? -ne 0 ] ; then no_result ; fi
1305 activity="run optimizing program"
1306 $SUPERVISOR $top_builddir/src/pspp --testing-mode -o raw-ascii \
1307 $TEMPDIR/expr-opt.stat >$TEMPDIR/expr-opt.err 2> $TEMPDIR/expr-opt.out
1309 activity="compare optimizing output"
1310 perl -pi -e 's/^\s*$//g' $TEMPDIR/expr-list $TEMPDIR/expr-opt.out
1311 diff -b $TEMPDIR/expr-list $TEMPDIR/expr-opt.out
1312 if [ $? -ne 0 ] ; then fail ; fi
1314 activity="create non-optimizing input"
1315 echo 'set mxwarn 1000.
1316 set mxerr 1000.' > $TEMPDIR/expr-noopt.stat
1317 sed < $TEMPDIR/expr-list >> $TEMPDIR/expr-noopt.stat \
1318 -e 's#^\(\(.*\); \)*\(.*\) => .*$#DEBUG EVALUATE NOOPTIMIZE\2/\3.#'
1319 if [ $? -ne 0 ] ; then no_result ; fi
1321 activity="run non-optimizing program"
1322 $SUPERVISOR $top_builddir/src/pspp --testing-mode -o raw-ascii \
1323 $TEMPDIR/expr-noopt.stat >$TEMPDIR/expr-noopt.err 2> $TEMPDIR/expr-noopt.out
1325 activity="compare non-optimizing output"
1326 perl -pi -e 's/^\s*$//g' $TEMPDIR/expr-list $TEMPDIR/expr-noopt.out
1327 diff -b $TEMPDIR/expr-list $TEMPDIR/expr-noopt.out
1328 if [ $? -ne 0 ] ; then fail ; fi
1330 activity="create optimizing postfix input"
1331 echo 'set mxwarn 1000.
1332 set mxerr 1000.' > $TEMPDIR/expr-opt-pos.stat
1333 sed < $TEMPDIR/expr-list >> $TEMPDIR/expr-opt-pos.stat \
1334 -e 's#^\(\(.*\); \)*\(.*\) => .*$#DEBUG EVALUATE POSTFIX\2/\3.#'
1335 if [ $? -ne 0 ] ; then no_result ; fi
1337 activity="run optimizing postfix program"
1338 $SUPERVISOR $top_builddir/src/pspp --testing-mode -o raw-ascii \
1339 $TEMPDIR/expr-opt-pos.stat >$TEMPDIR/expr-opt-pos.err 2> $TEMPDIR/expr-opt-pos.out
1340 if [ $? -eq 0 ] ; then no_result ; fi
1342 activity="create non-optimizing postfix input"
1343 echo 'set mxwarn 1000.
1344 set mxerr 1000.' > $TEMPDIR/expr-noopt-pos.stat
1345 sed < $TEMPDIR/expr-list >> $TEMPDIR/expr-noopt-pos.stat \
1346 -e 's#^\(\(.*\); \)*\(.*\) => .*$#DEBUG EVALUATE NOOPTIMIZE POSTFIX\2/\3.#'
1347 if [ $? -ne 0 ] ; then no_result ; fi
1349 activity="run non-optimizing postfix program"
1350 $SUPERVISOR $top_builddir/src/pspp --testing-mode -o raw-ascii \
1351 $TEMPDIR/expr-noopt-pos.stat >$TEMPDIR/expr-noopt-pos.err 2> $TEMPDIR/expr-noopt-pos.out
1352 if [ $? -eq 0 ] ; then no_result ; fi