/[m4]/m4/tests/builtins.at
ViewVC logotype

Diff of /m4/tests/builtins.at

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6 by gary, Thu Oct 11 21:09:16 2001 UTC revision 1.7 by akim, Sat Oct 13 08:55:55 2001 UTC
# Line 455  AT_CLEANUP Line 455  AT_CLEANUP
455    
456    
457    
 ## ---------------- ##  
 ## pushdef/popdef.  ##  
 ## ---------------- ##  
   
 AT_SETUP([pushdef/popdef])  
   
 AT_DATA([[pushpop.m4]],  
 [[divert(-1)  
 pushdef(`hej', `def 1.')  
 dumpdef(`hej')  
 pushdef(`hej', `def 2.')  
 dumpdef(`hej')  
 pushdef(`hej', `def 3.')  
 dumpdef(`hej')  
 pushdef(`hej', `def 4.')  
 dumpdef(`hej')  
   
 popdef(`hej')  
 dumpdef(`hej')  
 popdef(`hej')  
 dumpdef(`hej')  
 popdef(`hej')  
 dumpdef(`hej')  
 popdef(`hej')  
 dumpdef(`hej')  
   
 dumpdef(`mac2')  
 popdef(`mac2')  
 ]])  
   
 AT_CHECK_M4([pushpop.m4], 0, [],  
 [[hej:  `def 1.'  
 hej:    `def 2.'  
 hej:    `def 3.'  
 hej:    `def 4.'  
 hej:    `def 3.'  
 hej:    `def 2.'  
 hej:    `def 1.'  
 m4: pushpop.m4: 18: Warning: dumpdef: undefined name: hej  
 m4: pushpop.m4: 20: Warning: dumpdef: undefined name: mac2  
 m4: pushpop.m4: 21: Warning: popdef: undefined name: mac2  
 ]])  
   
 AT_CLEANUP  
   
   
   
458  ## ------ ##  ## ------ ##
459  ## regexp ##  ## regexp ##
460  ## ------ ##  ## ------ ##
# Line 604  foo line three. Line 557  foo line three.
557    
558  AT_CLEANUP  AT_CLEANUP
559    
   
   
 ## ----- ##  
 ## trace ##  
 ## ----- ##  
   
 AT_SETUP([trace])  
   
 AT_DATA([[trace.m4]],  
 [[divert(-1)  
   
 # move(from, to)  
 define(`move', `Move one disk from `$1' to `$2'.  
 ')  
   
 # _hanoi (cnt, from, to, aux)  
 define(`_hanoi', `ifelse(eval(`$1'<=1), 1, `move($2, $3)',  
 `_hanoi(decr($1), $2, $4, $3)move($2, $3)_hanoi(decr($1), $4, $3, $2)')')  
   
 # hanoi (cnt)  
 define(`hanoi', `_hanoi(`$1', source, destination, auxilliary)')  
 divert`'dnl  
   
 # Debugmode t  
 debugmode(`t')  
 hanoi(2)  
   
 # Debugmode taeq  
 debugmode(`taeq')  
 hanoi(2)  
   
 # Debugmode OFF  
 debugmode  
 hanoi(2)  
   
 # Debugmode ae  
 debugmode(`ae')  
 traceon(`move', `_hanoi')  
 hanoi(2)  
 ]])  
   
 AT_DATA([[expout]],  
 [[  
 # Debugmode t  
   
 Move one disk from source to auxilliary.  
 Move one disk from source to destination.  
 Move one disk from auxilliary to destination.  
   
   
 # Debugmode taeq  
   
 Move one disk from source to auxilliary.  
 Move one disk from source to destination.  
 Move one disk from auxilliary to destination.  
   
   
 # Debugmode OFF  
   
 Move one disk from source to auxilliary.  
 Move one disk from source to destination.  
 Move one disk from auxilliary to destination.  
   
   
 # Debugmode ae  
   
   
 Move one disk from source to auxilliary.  
 Move one disk from source to destination.  
 Move one disk from auxilliary to destination.  
   
 ]])  
   
 AT_DATA([[experr]],  
 [[m4trace: -1- hanoi  
 m4trace: -1- _hanoi  
 m4trace: -2- eval  
 m4trace: -1- ifelse  
 m4trace: -2- decr  
 m4trace: -1- _hanoi  
 m4trace: -2- eval  
 m4trace: -1- ifelse  
 m4trace: -1- move  
 m4trace: -1- move  
 m4trace: -2- decr  
 m4trace: -1- _hanoi  
 m4trace: -2- eval  
 m4trace: -1- ifelse  
 m4trace: -1- move  
   
 m4trace: -1- hanoi(`2') -> `_hanoi(`2', source, destination, auxilliary)'  
 m4trace: -1- _hanoi(`2', `source', `destination', `auxilliary') -> `ifelse(eval(`2'<=1), 1, `move(source, destination)',  
 `_hanoi(decr(2), source, auxilliary, destination)move(source, destination)_hanoi(decr(2), auxilliary, destination, source)')'  
 m4trace: -2- eval(`2<=1') -> `0'  
 m4trace: -1- ifelse(`0', `1', `move(source, destination)', `_hanoi(decr(2), source, auxilliary, destination)move(source, destination)_hanoi(decr(2), auxilliary, destination, source)') -> `_hanoi(decr(2), source, auxilliary, destination)move(source, destination)_hanoi(decr(2), auxilliary, destination, source)'  
 m4trace: -2- decr(`2') -> `1'  
 m4trace: -1- _hanoi(`1', `source', `auxilliary', `destination') -> `ifelse(eval(`1'<=1), 1, `move(source, auxilliary)',  
 `_hanoi(decr(1), source, destination, auxilliary)move(source, auxilliary)_hanoi(decr(1), destination, auxilliary, source)')'  
 m4trace: -2- eval(`1<=1') -> `1'  
 m4trace: -1- ifelse(`1', `1', `move(source, auxilliary)', `_hanoi(decr(1), source, destination, auxilliary)move(source, auxilliary)_hanoi(decr(1), destination, auxilliary, source)') -> `move(source, auxilliary)'  
 m4trace: -1- move(`source', `auxilliary') -> `Move one disk from `source' to `auxilliary'.  
 '  
 m4trace: -1- move(`source', `destination') -> `Move one disk from `source' to `destination'.  
 '  
 m4trace: -2- decr(`2') -> `1'  
 m4trace: -1- _hanoi(`1', `auxilliary', `destination', `source') -> `ifelse(eval(`1'<=1), 1, `move(auxilliary, destination)',  
 `_hanoi(decr(1), auxilliary, source, destination)move(auxilliary, destination)_hanoi(decr(1), source, destination, auxilliary)')'  
 m4trace: -2- eval(`1<=1') -> `1'  
 m4trace: -1- ifelse(`1', `1', `move(auxilliary, destination)', `_hanoi(decr(1), auxilliary, source, destination)move(auxilliary, destination)_hanoi(decr(1), source, destination, auxilliary)') -> `move(auxilliary, destination)'  
 m4trace: -1- move(`auxilliary', `destination') -> `Move one disk from `auxilliary' to `destination'.  
 '  
 m4trace: -1- debugmode  
 m4trace: -1- _hanoi(2, source, destination, auxilliary) -> ifelse(eval(`2'<=1), 1, `move(source, destination)',  
 `_hanoi(decr(2), source, auxilliary, destination)move(source, destination)_hanoi(decr(2), auxilliary, destination, source)')  
 m4trace: -1- _hanoi(1, source, auxilliary, destination) -> ifelse(eval(`1'<=1), 1, `move(source, auxilliary)',  
 `_hanoi(decr(1), source, destination, auxilliary)move(source, auxilliary)_hanoi(decr(1), destination, auxilliary, source)')  
 m4trace: -1- move(source, auxilliary) -> Move one disk from `source' to `auxilliary'.  
   
 m4trace: -1- move(source, destination) -> Move one disk from `source' to `destination'.  
   
 m4trace: -1- _hanoi(1, auxilliary, destination, source) -> ifelse(eval(`1'<=1), 1, `move(auxilliary, destination)',  
 `_hanoi(decr(1), auxilliary, source, destination)move(auxilliary, destination)_hanoi(decr(1), source, destination, auxilliary)')  
 m4trace: -1- move(auxilliary, destination) -> Move one disk from `auxilliary' to `destination'.  
   
 ]])  
   
 AT_CHECK_M4([trace.m4], 0, expout, experr)  
   
 AT_CLEANUP  
   
   
   
 ## ------ ##  
 ## trace2 ##  
 ## ------ ##  
   
 AT_SETUP([trace2])  
   
 AT_DATA([[trace2.m4]],  
 [[traceon(`define')  
 debugmode(`aeq')  
   
 # copy the `define' builtin definition to another symbol  
 define(`my_define', defn(`define'))  
   
 # delete the original  
 undefine(`define')  
   
 # Does it work?  
 my_define(`foo', `bar')  
   
 # Use the new definition to redefine the original symbol  
 my_define(`define', defn(`my_define'))  
   
 # Torture the flag propogation  
 undefine(`my_define')  
 define(`my_define', defn(`define'))  
   
 # There are now 2 symbols pointing to the same builtin function  
 my_define(`foo', `bar')  
 define(`foo', `bar')  
 ]])  
   
 AT_DATA([[expout]],  
 [[  
   
   
 # copy the `define' builtin definition to another symbol  
   
   
 # delete the original  
   
   
 # Does it work?  
   
   
 # Use the new definition to redefine the original symbol  
   
   
 # Torture the flag propogation  
   
   
   
 # There are now 2 symbols pointing to the same builtin function  
   
   
 ]])  
   
 AT_DATA([[experr]],  
 [[m4trace: -1- define(`my_define', <define>)  
 m4trace: -1- define(`my_define', <define>)  
 m4trace: -1- define(`foo', `bar')  
 ]])  
   
 AT_CHECK_M4([trace2.m4], 0, expout, experr)  
   
 AT_CLEANUP  
   
   
   
 ## ------ ##  
 ## trace3 ##  
 ## ------ ##  
   
 AT_SETUP([trace3])  
   
 AT_DATA([[trace3.m4]],  
 [[# copy the `define' builtin definition to another symbol  
 define(`my_define', defn(`define'))  
   
 # delete the original  
 undefine(`define')  
   
 # Does it work?  
 my_define(`foo', `bar')  
   
 # Use the new definition to redefine the original symbol  
 my_define(`define', defn(`my_define'))  
   
 # Torture the flag propogation  
 undefine(`my_define')  
 define(`my_define', defn(`define'))  
   
 # There are now 2 symbols pointing to the same builtin function  
 my_define(`foo', `bar')  
 define(`foo', `bar')  
 ]])  
   
 AT_DATA([[expout]],  
 [[# copy the `define' builtin definition to another symbol  
   
   
 # delete the original  
   
   
 # Does it work?  
   
   
 # Use the new definition to redefine the original symbol  
   
   
 # Torture the flag propogation  
   
   
   
 # There are now 2 symbols pointing to the same builtin function  
   
   
 ]])  
   
 AT_DATA([[experr]],  
 [[m4trace: -1- define(`my_define', <define>)  
 m4trace: -1- define(`my_define', <define>)  
 m4trace: -1- define(`foo', `bar')  
 ]])  
   
 AT_CHECK_M4([-t define -daeq trace3.m4], 0, expout, experr)  
   
 AT_CLEANUP  
   
560    
561    
562  ## -------- ##  ## -------- ##

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26