diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2014-07-20 01:34:35 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2014-07-20 01:34:35 -0700 |
commit | be34290180293f38da1bb51b60181591ccf4fe7e (patch) | |
tree | 3ba6d7b149a0301ee0c76b43be86107ac0e631dc | |
parent | 4e5cff3d4a8937952f0005ce897d6dea0dbffc0b (diff) | |
download | mu-be34290180293f38da1bb51b60181591ccf4fe7e.tar.gz |
31 - verified that continue generates correct code
-rw-r--r-- | mu.arc.t | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/mu.arc.t b/mu.arc.t index 1a8e7f6e..a347ac9f 100644 --- a/mu.arc.t +++ b/mu.arc.t @@ -453,3 +453,37 @@ ((integer 5) <- loadi 34) (reply))) (prn "F - convert-braces balances curlies when converting continue")) + +(clear) +(add-fns `((main ,@(convert-braces '(((integer 1) <- loadi 4) + ((integer 2) <- loadi 1) + { begin + ((integer 2) <- add (integer 2) (integer 2)) + { begin + ((boolean 3) <- neq (integer 1) (integer 2)) + } + (continueif (boolean 3)) + ((integer 4) <- loadi 34) + } + (reply)))))) +(run function*!main) +;? (prn memory*) +(if (~iso memory* (obj 1 4 2 4 3 nil 4 34)) + (prn "F - continue correctly loops")) + +(clear) +(add-fns `((main ,@(convert-braces '(((integer 1) <- loadi 4) + ((integer 2) <- loadi 2) + { begin + ((integer 2) <- add (integer 2) (integer 2)) + { begin + ((boolean 3) <- neq (integer 1) (integer 2)) + } + (continueif (boolean 3)) + ((integer 4) <- loadi 34) + } + (reply)))))) +(run function*!main) +;? (prn memory*) +(if (~iso memory* (obj 1 4 2 4 3 nil 4 34)) + (prn "F - continue might never trigger")) |