summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-05-23 21:35:47 +0200
committerLudovic Courtès <ludo@gnu.org>2019-05-27 22:47:24 +0200
commit2a991f3ae4823730395c7970d83159e93d5f5fe2 (patch)
tree87cfb6988e84d2080d655e498ded8740184667d8 /tests
parente13354a7ca5a0d5e28e02c4cfce6fecb1ab770e4 (diff)
downloadguix-2a991f3ae4823730395c7970d83159e93d5f5fe2.tar.gz
lzlib: Add 'make-lzip-input-port/compressed'.
* guix/lzlib.scm (lzwrite!, make-lzip-input-port/compressed): New
procedures.
* tests/lzlib.scm ("make-lzip-input-port/compressed"): New test.
* guix/tests.scm (%seed): Export.
Diffstat (limited to 'tests')
-rw-r--r--tests/lzlib.scm10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/lzlib.scm b/tests/lzlib.scm
index cf53a9417d..543622bb45 100644
--- a/tests/lzlib.scm
+++ b/tests/lzlib.scm
@@ -108,4 +108,14 @@
 (test-assert* "Bytevector of size relative to Lzip internal buffers (1MiB+1)"
   (compress-and-decompress (random-bytevector (1+ (* 1024 1024)))))
 
+(test-assert "make-lzip-input-port/compressed"
+  (let* ((len        (pk 'len (+ 10 (random 4000 %seed))))
+         (data       (random-bytevector len))
+         (compressed (make-lzip-input-port/compressed
+                      (open-bytevector-input-port data)))
+         (result     (call-with-lzip-input-port compressed
+                                                get-bytevector-all)))
+    (pk (bytevector-length result) (bytevector-length data))
+    (bytevector=? result data)))
+
 (test-end)