From 68986fe0410584c6934c835bb0ee784655f5f8c5 Mon Sep 17 00:00:00 2001 From: Rose Hogenson Date: Tue, 11 Jan 2022 22:01:23 -0800 Subject: Move scheme compiler into a separate directory. --- csc/linker-test.csc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 csc/linker-test.csc (limited to 'csc/linker-test.csc') diff --git a/csc/linker-test.csc b/csc/linker-test.csc new file mode 100644 index 0000000..084e9ae --- /dev/null +++ b/csc/linker-test.csc @@ -0,0 +1,24 @@ +(import (scheme base) + (only (csc encoding) encode) + (only (csc testing) + assert-equal + test) + (csc linker)) + + +(test link-if + (assert-equal + (encode '((const 5) (const 1) (if 2) (const 5) add exit)) + (link '((const 5) (const 1) (if "label1") (const 5) add (label "label1") exit)))) + + +(test link-backwards-if + (assert-equal + (encode '((const 10) (const 5) add (if -3))) + (link '((const 10) (label "label1") (const 5) add (if "label1"))))) + + +(test link-call + (assert-equal + (encode '((call 3) (const 10) exit (const 5) exit)) + (link '((call "label1") (const 10) (label "label0") exit (label "label1") (const 5) exit)))) -- cgit v1.3.1