Mercurial > core / lisp/lib/io/tests.lisp
changeset 698: |
96958d3eb5b0 |
parent: |
c40d2a41d7ce
|
author: |
Richard Westhaver <ellis@rwest.io> |
date: |
Fri, 04 Oct 2024 22:04:59 -0400 |
permissions: |
-rw-r--r-- |
description: |
fixes |
2 (:use :cl :std :rt :io :uring)) 10 (uring::io-uring-major-version)) 12 (deftest serve-event () 13 "See 'tests/serve-event.pure.lisp'." 18 (deftest decompress ()) 21 (defparameter *data-size* (* 10 1024)) 23 (define-test compressing-stream 24 "Test the compressing stream by round tripping random data through salza2 and 26 (let ((data (make-array *data-size* :element-type '(unsigned-byte 8) 27 :initial-contents (loop :repeat *data-size* 28 :collect (random 256)))) 29 (round-trip-data (make-array *data-size* :element-type '(unsigned-byte 8) 33 (flexi-streams:with-output-to-sequence (wrapped-stream) 35 (out-stream (salza2:make-compressing-stream 'salza2:gzip-compressor wrapped-stream)) 36 (write-sequence data out-stream)))) 37 (flexi-streams:with-input-from-sequence (wrapped-stream compressed-data) 39 (in-stream (chipz:make-decompressing-stream 'chipz:gzip wrapped-stream)) 40 (read-sequence round-trip-data in-stream) 41 (is eql :eof (read-byte in-stream nil :eof)))) 42 (is equalp data round-trip-data))) 44 (define-test compressing-stream-closed-error 45 (flexi-streams:with-output-to-sequence (wrapped-stream) 46 (let ((out-stream (salza2:make-compressing-stream 'salza2:gzip-compressor wrapped-stream))) 47 (write-byte 1 out-stream) 49 (fail (write-byte 2 out-stream) 'salza2:stream-closed-error))))