From d2fa5278729bbfd5dc62d944ff033f78a9e7b4e2 Mon Sep 17 00:00:00 2001 From: Danny Yoo Date: Wed, 27 Apr 2011 22:09:40 -0400 Subject: [PATCH] fixing code and adding some more test cases --- compiler.rkt | 2 +- test-compiler.rkt | 50 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/compiler.rkt b/compiler.rkt index 504e506..7dbd6f4 100644 --- a/compiler.rkt +++ b/compiler.rkt @@ -1538,7 +1538,7 @@ ;; Finally, make sure any multiple values are off the stack. (if (> (length ids) 1) (make-instruction-sequence - `(,(make-PopEnvironment (make-Const (length ids)) + `(,(make-PopEnvironment (make-Const (sub1 (length ids))) (make-Const 0)))) empty-instruction-sequence))))) diff --git a/test-compiler.rkt b/test-compiler.rkt index 5ac665a..46bda0c 100644 --- a/test-compiler.rkt +++ b/test-compiler.rkt @@ -1170,6 +1170,56 @@ -1 #:with-bootstrapping? #t) + + + + +(test '(begin (define-values () (values)) + 'ok) + 'ok + #:with-bootstrapping? #t) + +(test '(begin (define-values (x y z) (values 3 4 5)) + x) + 3 + #:with-bootstrapping? #t) + + +(test '(begin (define-values (x y z) (values 3 4 5)) + y) + 4 + #:with-bootstrapping? #t) + +(test '(begin (define-values (x y z) (values 3 4 5)) + z) + 5 + #:with-bootstrapping? #t) + + +(test '(begin (define-values (x) "hello") + x) + "hello" + #:with-bootstrapping? #t) + + +(test '(begin (define-values (x) (values "hello")) + x) + "hello" + #:with-bootstrapping? #t) + + +(test '(begin (define (f x) + (values (* x 2) + (/ x 2))) + (define-values (a b) (f 16)) + (list a b)) + (list 32 8) + #:with-bootstrapping? #t) + + + + + #;(test (read (open-input-file "tests/conform/program0.sch")) (port->string (open-input-file "tests/conform/expected0.txt")))