diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-05-30 20:39:34 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-05-30 20:39:34 -0700 |
commit | 6802740f63fdd37078bf8b7c90772f97460840ad (patch) | |
tree | ed4b2fbab40ee22134d828d42a66e1eef67ba03c /tests/012/buf.tl | |
parent | da08194bb7db19064ad82cc0d7341ff5ed1438e7 (diff) | |
download | txr-6802740f63fdd37078bf8b7c90772f97460840ad.tar.gz txr-6802740f63fdd37078bf8b7c90772f97460840ad.tar.bz2 txr-6802740f63fdd37078bf8b7c90772f97460840ad.zip |
buf: compression tests.
* buf.c (buf_compress): Let's use the level value of -1
if not specified, so Zlib defaults it to 6, or whatever.
* tests/012/buf.tl: New tests.
* txr.1: Note that -1 is a valid level value and that
is the default.
Diffstat (limited to 'tests/012/buf.tl')
-rw-r--r-- | tests/012/buf.tl | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/012/buf.tl b/tests/012/buf.tl index 8f494264..01a510ab 100644 --- a/tests/012/buf.tl +++ b/tests/012/buf.tl @@ -8,3 +8,21 @@ (buf-str "\xDCE6\xDCBC") #b'E6BC' (str-buf #b'E6') "\xDCE6" (buf-str "\xDCE6") #b'E6') + +(when (fboundp 'usr:buf-compress) + (mtest + (< (len (buf-compress (make-buf 1024))) 100) t + (buf-compress (make-buf 1024) -2) :error + (buf-compress (make-buf 1024) 10) :error) + + (each ((i 0..65535)) + (let* ((buf (ffi-put i (ffi uint16))) + (zbuf (buf-compress buf))) + (vtest (buf-decompress zbuf) buf))) + + (let ((buf (random-buf 65536))) + (vtest (buf-decompress (buf-compress buf)) buf)) + + (mtest + (buf-decompress (make-buf 1024)) :error + (buf-decompress (make-buf 1024 255)) :error)) |