diff options
Diffstat (limited to 'csc/cps-test.csc')
| -rw-r--r-- | csc/cps-test.csc | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/csc/cps-test.csc b/csc/cps-test.csc index 9881a2d..4259586 100644 --- a/csc/cps-test.csc +++ b/csc/cps-test.csc @@ -10,6 +10,7 @@ lexical-ref? library-ref? make-call + make-call-builtin make-constant make-define-syntax make-if @@ -141,6 +142,38 @@ transform-ir2)) +(test call-builtin-alloc + (assert-equal + (make-primitive 'alloc (list (make-constant 10)) (list (test-ref 'generated-symbol)) + (make-apply (test-ref 'tail) (list (test-ref 'generated-symbol)))) + (ir1->ir2 (make-call-builtin 'alloc (list (make-constant 10))) tail) + transform-ir2)) + + +(test call-builtin-peek + (assert-equal + (make-primitive 'alloc (list (make-constant 1)) (list (test-ref 'generated-symbol)) + (make-primitive 'peek (list (test-ref 'generated-symbol) (make-constant 0)) (list (test-ref 'generated-symbol)) + (make-apply (test-ref 'tail) (list (test-ref 'generated-symbol))))) + (ir1->ir2 + (make-call-builtin 'peek (list (make-call-builtin 'alloc (list (make-constant 1))) (make-constant 0))) + tail) + transform-ir2)) + + +(test call-builtin-poke + (assert-equal + (make-primitive 'alloc (list (make-constant 1)) (list (test-ref 'generated-symbol)) + (make-primitive 'poke (list (make-constant 10) (test-ref 'generated-symbol) (make-constant 0)) '() + (make-apply (test-ref 'tail) (list (make-constant #f))))) + (ir1->ir2 + (make-call-builtin 'poke (list (make-constant 10) + (make-call-builtin 'alloc (list (make-constant 1))) + (make-constant 0))) + tail) + transform-ir2)) + + (test sequence (assert-equal (make-primitive 'poke (list (make-constant 5) (test-ref 'a) (make-constant 0)) '() |
