summaryrefslogtreecommitdiff
path: root/tests/encode-tests.lisp
diff options
context:
space:
mode:
authorPiotr Szarmanski2022-12-30 18:29:24 +0100
committerPiotr Szarmanski2022-12-30 18:29:24 +0100
commit5afc44c1082ae7088511f318aa9bd3d4b25ba3c6 (patch)
treed4a30ac582f98b77a79a164d40f9a7e794e1c6b4 /tests/encode-tests.lisp
parent855e79b7ffa37ac64de51defa18104ed897576b3 (diff)
Implement buffer reuse encoding.
This implements a buffer reuse mechanism in eris-encode. This is also a backwards incompatible change, as the provided OUTPUT-FUNCTION now has an additional argument and has to return an octet-vector buffer of equal size. This is not yet implemented optimally, but should amount to a reduce of memory usage and GC required, especially for larger files.
Diffstat (limited to 'tests/encode-tests.lisp')
-rw-r--r--tests/encode-tests.lisp6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/encode-tests.lisp b/tests/encode-tests.lisp
index 36cc435..abbeb0d 100644
--- a/tests/encode-tests.lisp
+++ b/tests/encode-tests.lisp
@@ -36,6 +36,12 @@
(check-urn (base32-to-bytes-unpadded "JBSWY3DPEB3W64TMMQQQ") 1024
"urn:eris:BIAD77QDJMFAKZYH2DXBUZYAP3MXZ3DJZVFYQ5DFWC6T65WSFCU5S2IT4YZGJ7AC4SYQMP2DM2ANS2ZTCP3DJJIRV733CRAAHOSWIYZM3M"))
+(test empty-stream
+ (check-urn (serapeum:make-octet-vector 0) 1024
+ "urn:eris:BIADFUKDPYKJNLGCVSIIDI3FVKND7MO5AGOCXBK2C4ITT5MAL4LSCZF62B4PDOFQCLLNL7AXXSJFGINUYXVGVTDCQ2V7S7W5S234WFXCJ4")
+ (check-urn (serapeum:make-octet-vector 0) eris:32kib
+ "urn:eris:B4AC3MKL2BYR3E2WPMY2QRA6QZBLY4VNWJEBTSK5KWD66BRIT2EXVQVWY6TWVKJCZLC66RE3T2PKWDU3TBAKZZZIZRBTMP6BSOPE4CRXII"))
+
;; simple gray stream class for this particular construction.
(defclass null-stream (fundamental-binary-input-stream)
((counter :initform 0 :accessor counter)