mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-29 14:30:34 +02:00
tests: Add `array-for-each' tests for one-dimensional traversals.
* test-suite/tests/ramap.test ("array-for-each")["1 source"]: New test prefix.
This commit is contained in:
parent
0d7f3a6d95
commit
3220b08049
1 changed files with 30 additions and 0 deletions
|
@ -227,6 +227,36 @@
|
|||
|
||||
(with-test-prefix "array-for-each"
|
||||
|
||||
(with-test-prefix "1 source"
|
||||
(pass-if-equal "noncompact array"
|
||||
'(3 2 1 0)
|
||||
(let* ((a #2((0 1) (2 3)))
|
||||
(l '())
|
||||
(p (lambda (x) (set! l (cons x l)))))
|
||||
(array-for-each p a)
|
||||
l))
|
||||
|
||||
(pass-if-equal "vector"
|
||||
'(3 2 1 0)
|
||||
(let* ((a #(0 1 2 3))
|
||||
(l '())
|
||||
(p (lambda (x) (set! l (cons x l)))))
|
||||
(array-for-each p a)
|
||||
l))
|
||||
|
||||
(pass-if-equal "shared array"
|
||||
'(3 2 1 0)
|
||||
(let* ((a #2((0 1) (2 3)))
|
||||
(a' (make-shared-array a
|
||||
(lambda (x)
|
||||
(list (quotient x 4)
|
||||
(modulo x 4)))
|
||||
4))
|
||||
(l '())
|
||||
(p (lambda (x) (set! l (cons x l)))))
|
||||
(array-for-each p a')
|
||||
l)))
|
||||
|
||||
(with-test-prefix "3 sources"
|
||||
(pass-if-equal "noncompact arrays 1"
|
||||
'((3 3 3) (2 2 2))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue