diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/backend-tests.lisp | 4 | ||||
-rw-r--r-- | tests/decode-tests.lisp | 3 | ||||
-rw-r--r-- | tests/encode-tests.lisp | 6 | ||||
-rw-r--r-- | tests/rfc.lisp | 3 |
4 files changed, 12 insertions, 4 deletions
diff --git a/tests/backend-tests.lisp b/tests/backend-tests.lisp index 625740f..dc411d5 100644 --- a/tests/backend-tests.lisp +++ b/tests/backend-tests.lisp @@ -21,7 +21,7 @@ `(let ((backend (make-instance 'hash-backend)) (array ,array)) (is (equalp (alexandria:read-stream-content-into-byte-vector - (fetch-read-capability + (fetch-data (store-data array backend :block-size ,block-size :secret ,secret) backend)) array)))) @@ -49,7 +49,7 @@ (let* ((backend (make-instance 'file-backend :directory tmpdir)) (array ,array)) (is (equalp (alexandria:read-stream-content-into-byte-vector - (fetch-read-capability + (fetch-data (store-data array backend :secret ,secret) backend)) array))) (uiop:delete-directory-tree tmpdir :validate t)))) diff --git a/tests/decode-tests.lisp b/tests/decode-tests.lisp index 27ff4e3..5053d11 100644 --- a/tests/decode-tests.lisp +++ b/tests/decode-tests.lisp @@ -22,7 +22,8 @@ (defvar *stream* nil) (defun hashtable-encode (block ref) - (setf (gethash ref *table*) block)) + (setf (gethash ref *table*) (copy-seq block)) + block) (defun hashtable-decode (ref) (copy-seq (gethash ref *table*))) 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) diff --git a/tests/rfc.lisp b/tests/rfc.lisp index 15b993e..dafa086 100644 --- a/tests/rfc.lisp +++ b/tests/rfc.lisp @@ -24,7 +24,8 @@ (defun test-output (block ref) (assert (equalp block - (base32-to-bytes-unpadded (getf *alist* (intern (bytes-to-base32-unpadded ref) :keyword)))))) + (base32-to-bytes-unpadded (getf *alist* (intern (bytes-to-base32-unpadded ref) :keyword))))) + block) (defmacro positive-test (urn content block-alist secret block-size) `(let ((*alist* ,block-alist) |