Skip to content

Commit

Permalink
Add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bokesan committed Jan 22, 2025
1 parent 2e36c3d commit 69ff935
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
3 changes: 2 additions & 1 deletion m3f.asd
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@
(defsystem "m3f/tests"
:depends-on ("fiveam" "m3f")
:pathname "test"
:components ((:file "tiff-tests")
:components ((:file "arrays-tests")
(:file "tiff-tests")
(:file "report-tests")))
2 changes: 1 addition & 1 deletion src/arrays.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ the source and destination region must not overlap."
(> (+ src-offs count) (length src))
(> (+ dest-offs count) (length dest)))
;; TODO: signal error more in line what AREF would signal
(error "index out of bounbds"))
(error "index out of bounds"))
(dotimes (i count)
(setf (aref dest (+ dest-offs i))
(aref src (+ src-offs i)))))
14 changes: 14 additions & 0 deletions test/arrays-tests.lisp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
(defpackage :arrays-tests
(:use :cl :fiveam :arrays))

(in-package :arrays-tests)

(def-suite arrays-tests)
(in-suite arrays-tests)

(test all
(let ((a (make-array 9 :element-type '(unsigned-byte 8))))
(dotimes (i (length a))
(setf (aref a i) (+ i 1)))
(copy-bytes a 4 a 1 2)
(is (equalp #(1 5 6 4 5 6 7 8 9) a))))

0 comments on commit 69ff935

Please sign in to comment.