;;;; sparse-vectors-print-test.scm (import test) ;;; (test-begin "Sparse Vectors Print") (import #; ;“record tag issue” (except sparse-vectors sparse-vector-print) sparse-vectors (sparse-vectors print) (sparse-vectors extras)) (import (chicken port) (chicken string) (srfi 1)) ;; ;shared, ordered by index (check result), test sparse-vector alist (define tal '((60 . 60) (43 . 43) (8 . 9) (7 . 8) (6 . 7) (5 . 6) (4 . 4) (3 . 3) (2 . 2) (1 . 1) (0 . 0))) (test-group "Print Styles" (test-assert (sparse-vector-print-style? 'describe)) (test-assert (sparse-vector-print-style? 'contents)) (test-assert (not (sparse-vector-print-style? 'foo))) (test-assert (list? (sparse-vector-print-styles))) (test-assert (every sparse-vector-print-style? (sparse-vector-print-styles))) ) (test-group "Print Style Ops" (let ((sv (alist->sparse-vector tal))) (test 'describe (sparse-vector-print-style)) (test (conc "#") (with-output-to-string (lambda () (display sv)))) (sparse-vector-print-style 'contents) (test 'contents (sparse-vector-print-style)) (test (conc "#") (with-output-to-string (lambda () (display sv)))) ) ) ;;; (test-end "Sparse Vectors Print") (test-exit)