Test output for z3 [ok]
Testing time: 0s
/home/mario/local/chicken-4.8.0.3/bin/csi -script run.scm < /dev/null ;;; BEGIN "z3" TESTS ;; EVAL: compressing empty buffer (z3:encode-buffer "") ;; ==> "\x03\x00" ;; EVAL: compressing single char buffer (z3:encode-buffer "0") ;; ==> "3\x00\x00" ;; DEFINE: opening file (define fd (file-open "BSD-LICENCE.gz" (+ open/trunc open/wronly))) ;; DEFINE: init (define z3 (z3:encode-file fd level: 8)) ;; EVAL: writing (z3:write-encoded z3 (substring BSD-LICENCE 0 100)) ;; ==> #<unspecified> ;; EVAL: writing (2) (z3:write-encoded z3 (substring BSD-LICENCE 100)) ;; ==> #<unspecified> ;; EVAL: writing (3) (z3:write-encoded z3 #f) ;; ==> #t ;; EVAL: closing (file-close fd) ;; ==> #<unspecified> ;; 1. testing result (system "gunzip -c BSD-LICENCE.gz >tmp && cmp tmp BSD-LICENCE") ;; ==> 0 ;; Passed. ;; DEFINE: opening file (define fd (file-open "BSD-LICENCE.gz" open/read)) ;; DEFINE: init (define z3 (z3:decode-file fd)) ;; 2. reading (string=? (let loop () (let ((x (z3:read-decoded z3))) (if (eof-object? x) "" (string-append x (loop))))) BSD-LICENCE) ;; ==> #t ;; Passed. ;; EVAL: closing file (file-close fd) ;; ==> #<unspecified> ;; DEFINE: compression destination (define dest (open-output-string)) ;; DEFINE: definining compression receiver (define r (lambda (x) (display x dest))) ;; DEFINE: prepare compression (define ze (z3:encode-init)) ;; EVAL: compressing ... (let loop ((c BSD-LICENCE)) (let ((t (z3:encode ze r c))) (when t (print* ".") (loop (substring c t))))) ........................;; ==> #<unspecified> ;; DEFINE: compressed (define compressed (get-output-string dest)) ;; EVAL: compressed size (conc (string-length BSD-LICENCE) " -> " (string-length compressed)) ;; ==> "1498 -> 800" ;; DEFINE: prepare decompression (define z (z3:decode-init)) ;; EVAL: decomp. destination (set! dest (open-output-string)) ;; ==> #<unspecified> ;; EVAL: decompressing... (let loop ((c compressed)) (let ((t (z3:decode z r c))) (when t (print* "(" (string-length c) ")") (loop (substring c t))))) (800);; ==> #<unspecified> ;; 3. comparing results (string=? BSD-LICENCE (get-output-string dest)) ;; ==> #t ;; Passed. ;;; END "z3" TESTS: PASSED ;;; (Total: 3 Passed: 3 Failed: 0)