fix (pack "w" 0)
This commit is contained in:
parent
fcaeda281a
commit
711e650bab
|
@ -152,6 +152,7 @@
|
|||
"function to encode a BER number into a binary byte string"
|
||||
(let ((num_bytes (ceiling (/ (log (1+ number) 2) 7)))
|
||||
(n number))
|
||||
(if (eql 0 n) (incf num_bytes))
|
||||
(coerce (loop for i from (1- num_bytes) downto 0 collect
|
||||
(code-char (+ (if (> i 0)
|
||||
128
|
||||
|
|
|
@ -104,6 +104,7 @@
|
|||
(string= (pack "E" 25) (concatenate 'string (gen-null-string 6) "9@"))
|
||||
(string= (pack "x") (string #\null))
|
||||
(string= (pack "w" 193) (coerce `(,(code-char 129) #\A) 'string))
|
||||
(string= (pack "w" 0) (coerce `(,(code-char 0)) 'string))
|
||||
))
|
||||
|
||||
|
||||
|
@ -154,6 +155,7 @@
|
|||
(= (unpack "G" (concatenate 'string "@9" (gen-null-string 6))) 25)
|
||||
(= (unpack "E" (concatenate 'string (gen-null-string 6) "9@")) 25)
|
||||
(= (unpack "w" (coerce `(,(code-char 129) #\A) 'string)) 193)
|
||||
(= (unpack "w" (coerce `(,(code-char 0)) 'string)) 0)
|
||||
))
|
||||
|
||||
(deftest unpack-combinations ()
|
||||
|
|
Loading…
Reference in New Issue