1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-25 06:00:18 +02:00

Tests for array-copy!, empty case

* test-suite/tests/ramap.test: test array-copy! with empty destination.
  Fix uses of constant array as destination.
This commit is contained in:
Daniel Llorens 2013-04-18 15:10:29 +02:00 committed by Andy Wingo
parent b914b236c3
commit 7e7e3b7f06

View file

@ -39,6 +39,18 @@
(set! nlst (cons n nlst))))
(equal? nlst '(1)))))
;;;
;;; array-copy!
;;;
(with-test-prefix "array-copy!"
(pass-if "empty arrays"
(let* ((b (make-array 0 2 2))
(c (make-shared-array b (lambda (i j) (list i j)) 0 2)))
(array-copy! #2:0:2() c)
(array-equal? #2:0:2() c))))
;;;
;;; array-map!
;;;
@ -195,28 +207,28 @@
(pass-if "noncompact arrays 1"
(let ((a #2((0 1) (2 3)))
(c #(0 0)))
(c (make-array 0 2)))
(begin
(array-map! c + (array-row a 1) (array-row a 1))
(array-equal? c #(4 6)))))
(pass-if "noncompact arrays 2"
(let ((a #2((0 1) (2 3)))
(c #(0 0)))
(c (make-array 0 2)))
(begin
(array-map! c + (array-col a 1) (array-col a 1))
(array-equal? c #(2 6)))))
(pass-if "noncompact arrays 3"
(let ((a #2((0 1) (2 3)))
(c #(0 0)))
(c (make-array 0 2)))
(begin
(array-map! c + (array-col a 1) (array-row a 1))
(array-equal? c #(3 6)))))
(pass-if "noncompact arrays 4"
(let ((a #2((0 1) (2 3)))
(c #(0 0)))
(c (make-array 0 2)))
(begin
(array-map! c + (array-col a 1) (array-row a 1))
(array-equal? c #(3 6)))))))