Debian Codegraph @

tests/an03.fw

raw
1 AN03: Test semantics checking of macros.
2
3 First define some macros to call.
4 @$@<Zero@>@Z@M@{@}
5 @$@<One@>@(@1@)@Z@M@{@}
6 @$@<Two@>@(@2@)@Z@M@{@}
7
8 1. Test call to undefined macro.
9 @$@<Sloth1@>@Z==@{@<Walrus@>@}
10
11 2. Test calls with wrong number of parameters.
12 @$@<Sloth2@>@Z==@{
13 @<Zero@>
14 @<Zero@>@(@)
15 @<Zero@>@(@,@)
16 @<One@>
17 @<One@>@(@)
18 @<One@>@(Walrus@,@)
19 @<Two@>@(Sloth@)
20 @}
21
22 3. Test call to file macro.
23 @O@<deleteme.txt@>@{@}
24 @$@<Teapot@>@Z@{@<deleteme.txt@>@}
25
26 4. Test macro never used and has <special>Z.
27 @$@<Elephant@>@Z@{@}
28
29 5. Test macro often used and has <special>M.
30 @$@<Giraffe@>@M@{@}
31 @$@<Use Giraffe@>@Z@{@<Giraffe@>@<Giraffe@>@}
32
33 6. Test macro never used and no <special>Z
34 @$@<Zebra@>@{@}
35
36 7. Test multiply used and no <special>M.
37 @$@<Monkey@>@{@}
38 @$@<Use Monkey@>@Z@{@<Monkey@>@<Monkey@>@}
39
40 8. Test directly recursive macro.
41 @$@<Who do ya call?@>@{@<Who do ya call?@>@}
42
43 9. Test indirectly recursive macro.
44 @$@<X@>@M@{@<Y@>@}
45 @$@<Y@>@{@<X@>@}
46
47 10. Test callers of recursive macros.
48 @$@<Z@>@Z@{@<X@>@}