diff options
author | Piotr Szarmanski | 2022-12-30 20:50:05 +0100 |
---|---|---|
committer | Piotr Szarmanski | 2022-12-30 20:50:05 +0100 |
commit | 219e118a80858e05e7b9917f9d0996af70982ae4 (patch) | |
tree | d4a30ac582f98b77a79a164d40f9a7e794e1c6b4 /tests/encode-tests.lisp | |
parent | 618ee634557122b3b3c5012405603b28c0001d13 (diff) | |
parent | 5afc44c1082ae7088511f318aa9bd3d4b25ba3c6 (diff) |
Merge branch 'no-allocate-buffers'
Diffstat (limited to 'tests/encode-tests.lisp')
-rw-r--r-- | tests/encode-tests.lisp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/tests/encode-tests.lisp b/tests/encode-tests.lisp index 214eaad..abbeb0d 100644 --- a/tests/encode-tests.lisp +++ b/tests/encode-tests.lisp @@ -21,13 +21,13 @@ (vector-encode (read-capability-to-urn (eris-encode ,data ,block-size - (lambda (&rest args) (declare (ignore args))) + (lambda (block ref) (declare (ignore ref)) block) :secret ,secret))) (stream-encode (read-capability-to-urn (with-octet-input-stream (stream ,data) (eris-encode stream ,block-size - (lambda (&rest args) (declare (ignore args))) + (lambda (block ref) (declare (ignore ref)) block) :secret ,secret))))) (is (equalp vector-encode urn)) (is (equalp stream-encode urn)))) @@ -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) @@ -60,7 +66,7 @@ ,key) :initialization-vector (make-array 8 :element-type '(unsigned-byte 8) :initial-element 0) :direction :input))) - (let ((read-capability (eris-encode chacha-stream ,block-size (lambda (&rest args) (declare (ignore args)))))) + (let ((read-capability (eris-encode chacha-stream ,block-size (lambda (block ref) (declare (ignore ref)) block)))) (is (equalp (read-capability-to-urn read-capability) ,urn))))) |