;;;; box-values-test.scm -*- Scheme -*- ;;;; Kon Lovett, Oct '24 (import test) (test-begin "Box (values)") ;;; (import (box values) (box values literals)) (import (chicken base)) (import (only (chicken port) with-output-to-string)) ;should be there #; ;BUG incl file w/ dest override (include "box.values.types") ;; (test-group "Box" (test-assert (not (box? 3))) (let ((tbox (make-box 1 'a 8.5))) (test-assert (box? tbox)) (test 3 (box-arity tbox)) (test 1 (box-ref tbox)) (test '(1 a 8.5) (let-values (((x y z) (box-ref tbox))) (list x y z))) (test-error (box-value-ref tbox -2)) (test-error (box-value-ref tbox 5)) (test 1 (box-value-ref tbox 0)) (test 'a (box-value-ref tbox 1)) (test 8.5 (box-value-ref tbox 2)) #;(test "#" (with-output-to-string (cut display tbox))) (test "#3&(1 a 8.5)" (with-output-to-string (cut display tbox))) (box-set! tbox #t) (test 1 (box-arity tbox)) (test-assert (box-ref tbox)) (box-value-set! tbox 0 'a) (test 'a (box-ref tbox)) (test 'a (box-value-ref tbox 0)) (test-error (box-value-ref tbox 1)) (test "#0&a" (with-output-to-string (cut display tbox))) ) ) ;;; (test-end "Box (values)") (test-exit)