(module tests mzscheme (require (planet "test.ss" ("schematics" "schemeunit.plt" 1 1))) (require (planet "text-ui.ss" ("schematics" "schemeunit.plt" 1 1))) (require "../../tail.ss") (define tail-tests (make-test-suite "tail tests" (make-test-case "tail-recursive" (assert-equal? (let f ([n 10]) (let/tc return (if (zero? n) (continuation-mark-set->list (current-continuation-marks) 'test) (return (with-continuation-mark 'test n (f (sub1 n))))))) '(1))) (make-test-case "not tail-recursive" (assert-equal? (let f ([n 10]) (let/tc return (if (zero? n) (continuation-mark-set->list (current-continuation-marks) 'test) (return (with-continuation-mark 'test n (values (f (sub1 n)))))))) '(1 2 3 4 5 6 7 8 9 10))) )) (define all-tests (make-test-suite "all tail.plt tests" tail-tests )) (test/text-ui all-tests) (provide all-tests))