summaryrefslogtreecommitdiff
path: root/web/funnelAC/tests/an03.fw
diff options
context:
space:
mode:
Diffstat (limited to 'web/funnelAC/tests/an03.fw')
-rw-r--r--web/funnelAC/tests/an03.fw48
1 files changed, 48 insertions, 0 deletions
diff --git a/web/funnelAC/tests/an03.fw b/web/funnelAC/tests/an03.fw
new file mode 100644
index 0000000000..db1a06c7a1
--- /dev/null
+++ b/web/funnelAC/tests/an03.fw
@@ -0,0 +1,48 @@
+AN03: Test semantics checking of macros.
+
+First define some macros to call.
+@$@<Zero@>@Z@M@{@}
+@$@<One@>@(@1@)@Z@M@{@}
+@$@<Two@>@(@2@)@Z@M@{@}
+
+1. Test call to undefined macro.
+@$@<Sloth1@>@Z==@{@<Walrus@>@}
+
+2. Test calls with wrong number of parameters.
+@$@<Sloth2@>@Z==@{
+@<Zero@>
+@<Zero@>@(@)
+@<Zero@>@(@,@)
+@<One@>
+@<One@>@(@)
+@<One@>@(Walrus@,@)
+@<Two@>@(Sloth@)
+@}
+
+3. Test call to file macro.
+@O@<deleteme.txt@>@{@}
+@$@<Teapot@>@Z@{@<deleteme.txt@>@}
+
+4. Test macro never used and has <special>Z.
+@$@<Elephant@>@Z@{@}
+
+5. Test macro often used and has <special>M.
+@$@<Giraffe@>@M@{@}
+@$@<Use Giraffe@>@Z@{@<Giraffe@>@<Giraffe@>@}
+
+6. Test macro never used and no <special>Z
+@$@<Zebra@>@{@}
+
+7. Test multiply used and no <special>M.
+@$@<Monkey@>@{@}
+@$@<Use Monkey@>@Z@{@<Monkey@>@<Monkey@>@}
+
+8. Test directly recursive macro.
+@$@<Who do ya call?@>@{@<Who do ya call?@>@}
+
+9. Test indirectly recursive macro.
+@$@<X@>@M@{@<Y@>@}
+@$@<Y@>@{@<X@>@}
+
+10. Test callers of recursive macros.
+@$@<Z@>@Z@{@<X@>@}