~theothornhill/cl-bare

aba1ccc7ec70333b73aa63aed96ba46085016214 — Theodor Thornhill 3 years ago 05edb87
Fix optional type tests, and add one more
1 files changed, 13 insertions(+), 3 deletions(-)

M tests/bare-tests.lisp
M tests/bare-tests.lisp => tests/bare-tests.lisp +13 -3
@@ 174,7 174,7 @@
        (in
         (with-output-to-sequence (out)
           (write-optional-type
            (read-binary 'u8 (buf #()))
            (read-optional-type 'u8 (buf #(#x00)))
            out)))
      (multiple-value-bind (object) (read-optional-type 'u8 in)
        (with-slots (value) object


@@ 184,11 184,21 @@
        (in
         (with-output-to-sequence (out)
           (write-optional-type
            (read-binary 'u8 (buf #(#x70)))
            (read-optional-type 'u8 (buf #(#x01 #x70)))
            out)))
      (multiple-value-bind (object) (read-optional-type 'u8 in)
        (with-slots (value) object
          (ok (equalp value 112)))))))
          (ok (equalp value 112))))))
  (testing "reading and writing optional type with more bytes"
    (with-input-from-sequence
        (in
         (with-output-to-sequence (out)
           (write-optional-type
            (read-optional-type 'u32 (buf #(#x01 #xEF #xBE #xAD #xDE)))
            out)))
      (multiple-value-bind (object) (read-optional-type 'u32 in)
        (with-slots (value) object
          (ok (equalp value #xDEADBEEF)))))))

(deftest array-test
  (testing "reading and writing array"