From 7ecc3553587ca0fe3b09256a8df747cdc5a82c21 Mon Sep 17 00:00:00 2001 From: "David F. Skoll" Date: Fri, 29 Aug 2008 21:03:01 -0400 Subject: [PATCH] Add test for OMITFUNC. --- tests/test.cmp | 194 ++++++++++++++++++++++++++++++++++++++++++++++--- tests/test.rem | 10 ++- 2 files changed, 190 insertions(+), 14 deletions(-) diff --git a/tests/test.cmp b/tests/test.cmp index 90dc94a6..f2a2619d 100644 --- a/tests/test.cmp +++ b/tests/test.cmp @@ -431,7 +431,7 @@ REM 1 Mar --1 MSG 1 mar --1 ../tests/test.rem(133): Trig = Thursday, 28 February, 1991 REM 28 Feb BEFORE MSG 28 Feb BEFORE ../tests/test.rem(134): Trig = Thursday, 28 February, 1991 -REM 28 Feb SKIP MSG 28 Feb SKIP +REM 28 Feb SKIP MSG 28 Feb SKIP ../tests/test.rem(135): Trig = Thursday, 28 February, 1991 REM 28 Feb AFTER MSG 28 Feb AFTER ../tests/test.rem(136): Trig = Thursday, 28 February, 1991 @@ -451,7 +451,7 @@ REM 28 Feb AFTER MSG 28 Feb AFTER (28Feb91 omitted) REM 13 March 1991 *1 UNTIL 19 March 1991 MSG 13-19 Mar 91 ../tests/test.rem(146): Trig = Wednesday, 13 March, 1991 - + # Test BACK CLEAR-OMIT-CONTEXT REM 18 Feb 1991 +1 MSG 18 Feb 1991 +1 @@ -488,6 +488,176 @@ REM Fri after MSG 16 Feb 1991 16 Feb 1991 CLEAR-OMIT-CONTEXT + +# Test omitfunc +fset _ofunc(x) (day(x) < 7 || day(x) % 2) +REM 1 March OMITFUNC _ofunc AFTER MSG OmitFunc Test +Entering UserFN _ofunc(1991-01-15) +x => 1991-01-15 +day(1991-01-15) => 15 +15 < 7 => 0 +x => 1991-01-15 +day(1991-01-15) => 15 +15 % 2 => 1 +0 || 1 => 1 +Leaving UserFN _ofunc() => 1 +Entering UserFN _ofunc(1991-01-14) +x => 1991-01-14 +day(1991-01-14) => 14 +14 < 7 => 0 +x => 1991-01-14 +day(1991-01-14) => 14 +14 % 2 => 0 +0 || 0 => 0 +Leaving UserFN _ofunc() => 0 +Entering UserFN _ofunc(1991-02-01) +x => 1991-02-01 +day(1991-02-01) => 1 +1 < 7 => 1 +x => 1991-02-01 +day(1991-02-01) => 1 +1 % 2 => 1 +1 || 1 => 1 +Leaving UserFN _ofunc() => 1 +Entering UserFN _ofunc(1991-02-02) +x => 1991-02-02 +day(1991-02-02) => 2 +2 < 7 => 1 +x => 1991-02-02 +day(1991-02-02) => 2 +2 % 2 => 0 +1 || 0 => 1 +Leaving UserFN _ofunc() => 1 +Entering UserFN _ofunc(1991-02-03) +x => 1991-02-03 +day(1991-02-03) => 3 +3 < 7 => 1 +x => 1991-02-03 +day(1991-02-03) => 3 +3 % 2 => 1 +1 || 1 => 1 +Leaving UserFN _ofunc() => 1 +Entering UserFN _ofunc(1991-02-04) +x => 1991-02-04 +day(1991-02-04) => 4 +4 < 7 => 1 +x => 1991-02-04 +day(1991-02-04) => 4 +4 % 2 => 0 +1 || 0 => 1 +Leaving UserFN _ofunc() => 1 +Entering UserFN _ofunc(1991-02-05) +x => 1991-02-05 +day(1991-02-05) => 5 +5 < 7 => 1 +x => 1991-02-05 +day(1991-02-05) => 5 +5 % 2 => 1 +1 || 1 => 1 +Leaving UserFN _ofunc() => 1 +Entering UserFN _ofunc(1991-02-06) +x => 1991-02-06 +day(1991-02-06) => 6 +6 < 7 => 1 +x => 1991-02-06 +day(1991-02-06) => 6 +6 % 2 => 0 +1 || 0 => 1 +Leaving UserFN _ofunc() => 1 +Entering UserFN _ofunc(1991-02-07) +x => 1991-02-07 +day(1991-02-07) => 7 +7 < 7 => 0 +x => 1991-02-07 +day(1991-02-07) => 7 +7 % 2 => 1 +0 || 1 => 1 +Leaving UserFN _ofunc() => 1 +Entering UserFN _ofunc(1991-02-08) +x => 1991-02-08 +day(1991-02-08) => 8 +8 < 7 => 0 +x => 1991-02-08 +day(1991-02-08) => 8 +8 % 2 => 0 +0 || 0 => 0 +Leaving UserFN _ofunc() => 0 +../tests/test.rem(169): Trig = Friday, 8 March, 1991 +REM 8 March OMITFUNC _ofunc -1 MSG OmitFunc Test 2 +Entering UserFN _ofunc(1991-02-07) +x => 1991-02-07 +day(1991-02-07) => 7 +7 < 7 => 0 +x => 1991-02-07 +day(1991-02-07) => 7 +7 % 2 => 1 +0 || 1 => 1 +Leaving UserFN _ofunc() => 1 +Entering UserFN _ofunc(1991-02-06) +x => 1991-02-06 +day(1991-02-06) => 6 +6 < 7 => 1 +x => 1991-02-06 +day(1991-02-06) => 6 +6 % 2 => 0 +1 || 0 => 1 +Leaving UserFN _ofunc() => 1 +Entering UserFN _ofunc(1991-02-05) +x => 1991-02-05 +day(1991-02-05) => 5 +5 < 7 => 1 +x => 1991-02-05 +day(1991-02-05) => 5 +5 % 2 => 1 +1 || 1 => 1 +Leaving UserFN _ofunc() => 1 +Entering UserFN _ofunc(1991-02-04) +x => 1991-02-04 +day(1991-02-04) => 4 +4 < 7 => 1 +x => 1991-02-04 +day(1991-02-04) => 4 +4 % 2 => 0 +1 || 0 => 1 +Leaving UserFN _ofunc() => 1 +Entering UserFN _ofunc(1991-02-03) +x => 1991-02-03 +day(1991-02-03) => 3 +3 < 7 => 1 +x => 1991-02-03 +day(1991-02-03) => 3 +3 % 2 => 1 +1 || 1 => 1 +Leaving UserFN _ofunc() => 1 +Entering UserFN _ofunc(1991-02-02) +x => 1991-02-02 +day(1991-02-02) => 2 +2 < 7 => 1 +x => 1991-02-02 +day(1991-02-02) => 2 +2 % 2 => 0 +1 || 0 => 1 +Leaving UserFN _ofunc() => 1 +Entering UserFN _ofunc(1991-02-01) +x => 1991-02-01 +day(1991-02-01) => 1 +1 < 7 => 1 +x => 1991-02-01 +day(1991-02-01) => 1 +1 % 2 => 1 +1 || 1 => 1 +Leaving UserFN _ofunc() => 1 +Entering UserFN _ofunc(1991-01-28) +x => 1991-01-28 +day(1991-01-28) => 28 +28 < 7 => 0 +x => 1991-01-28 +day(1991-01-28) => 28 +28 % 2 => 0 +0 || 0 => 0 +Leaving UserFN _ofunc() => 0 +../tests/test.rem(170): Trig = Thursday, 28 February, 1991 + set a000 abs(1) abs(1) => 1 set a001 abs(-1) @@ -510,7 +680,7 @@ set a008 coerce("string", 11:44) coerce("string", 11:44) => "11:44" set a009 coerce("int", "badnews") coerce("int", "badnews") => Can't coerce -../tests/test.rem(175): Can't coerce +../tests/test.rem(181): Can't coerce set a010 coerce("int", "12") coerce("int", "12") => 12 set a011 coerce("int", 11:44) @@ -522,7 +692,7 @@ set a013 date(1992, 2, 2) date(1992, 2, 2) => 1992-02-02 set a014 date(1993, 2, 29) date(1993, 2, 29) => Bad date specification -../tests/test.rem(180): Bad date specification +../tests/test.rem(186): Bad date specification set a015 day(today()) today() => 1991-02-16 day(1991-02-16) => 16 @@ -617,15 +787,15 @@ strlen("sadjflkhsldkfhsdlfjhk") => 21 set a050 substr(a049, 2) a049 => 21 substr(21, 2) => Type mismatch -../tests/test.rem(218): Type mismatch +../tests/test.rem(224): Type mismatch set a051 substr(a050, 2, 6) -a050 => ../tests/test.rem(219): Undefined variable: a050 +a050 => ../tests/test.rem(225): Undefined variable: a050 set a052 time(1+2, 3+4) 1 + 2 => 3 3 + 4 => 7 time(3, 7) => 03:07 rem 10 jan 1992 AT 11:22 CAL -../tests/test.rem(221): Trig = Friday, 10 January, 1992 +../tests/test.rem(227): Trig = Friday, 10 January, 1992 set a053 trigdate() trigdate() => 1992-01-10 set a054 trigtime() @@ -717,31 +887,31 @@ y => 11:33 x => "foo" y => 11:33 "foo" * 11:33 => Type mismatch -../tests/test.rem(244): `*': Type mismatch +../tests/test.rem(250): `*': Type mismatch Leaving UserFN h() => Type mismatch set a074 dosubst("%a %b %c %d %e %f %g %h", '1992/5/5') dosubst("%a %b %c %d %e %f %g %h", 1992-05-05) => "on Tuesday, 5 May, 1992 in 444 days' tim"... msg [a074]% -../tests/test.rem(246): Trig = Saturday, 16 February, 1991 +../tests/test.rem(252): Trig = Saturday, 16 February, 1991 a074 => "on Tuesday, 5 May, 1992 in 444 days' tim"... on Tuesday, 5 May, 1992 in 444 days' time on Tuesday 5 on 05-05-1992 on 05-05-1992 on Tuesday, 5 May on 05-05 set a075 dosubst("%i %j %k %l %m %n %o %p", '1992/5/5') dosubst("%i %j %k %l %m %n %o %p", 1992-05-05) => "on 05-05 on Tuesday, May 5th, 1992 on Tu"... msg [a075]% -../tests/test.rem(248): Trig = Saturday, 16 February, 1991 +../tests/test.rem(254): Trig = Saturday, 16 February, 1991 a075 => "on 05-05 on Tuesday, May 5th, 1992 on Tu"... on 05-05 on Tuesday, May 5th, 1992 on Tuesday, May 5th on 1992-05-05 May 5 s set a076 dosubst("%q %r %s %t %u %v %w %x", '1992/5/5') dosubst("%q %r %s %t %u %v %w %x", 1992-05-05) => "s' 05 th 05 on Tuesday, 5th May, 1992 on"... msg [a076]% -../tests/test.rem(250): Trig = Saturday, 16 February, 1991 +../tests/test.rem(256): Trig = Saturday, 16 February, 1991 a076 => "s' 05 th 05 on Tuesday, 5th May, 1992 on"... s' 05 th 05 on Tuesday, 5th May, 1992 on Tuesday, 5th May Tuesday 444 set a077 dosubst("%y %z", '1992/5/5') dosubst("%y %z", 1992-05-05) => "1992 92 " msg [a077]% -../tests/test.rem(252): Trig = Saturday, 16 February, 1991 +../tests/test.rem(258): Trig = Saturday, 16 February, 1991 a077 => "1992 92 " 1992 92 diff --git a/tests/test.rem b/tests/test.rem index 357a9c81..30658e6d 100644 --- a/tests/test.rem +++ b/tests/test.rem @@ -132,7 +132,7 @@ CLEAR-OMIT-CONTEXT REM 1 Mar -1 MSG 1 mar -1 REM 1 Mar --1 MSG 1 mar --1 REM 28 Feb BEFORE MSG 28 Feb BEFORE -REM 28 Feb SKIP MSG 28 Feb SKIP +REM 28 Feb SKIP MSG 28 Feb SKIP REM 28 Feb AFTER MSG 28 Feb AFTER POP-OMIT-CONTEXT @@ -144,7 +144,7 @@ REM 28 Feb AFTER MSG 28 Feb AFTER (28Feb91 omitted) REM 13 March 1991 *1 UNTIL 19 March 1991 MSG 13-19 Mar 91 - + # Test BACK CLEAR-OMIT-CONTEXT REM 18 Feb 1991 +1 MSG 18 Feb 1991 +1 @@ -163,6 +163,12 @@ REM Fri SCANFROM [trigger(today()-7)] SATISFY 1 OMIT [trigger(trigdate())] REM Fri after MSG 16 Feb 1991 CLEAR-OMIT-CONTEXT + +# Test omitfunc +fset _ofunc(x) (day(x) < 7 || day(x) % 2) +REM 1 March OMITFUNC _ofunc AFTER MSG OmitFunc Test +REM 8 March OMITFUNC _ofunc -1 MSG OmitFunc Test 2 + set a000 abs(1) set a001 abs(-1) set a002 asc("foo")