From 35f45ed6d0d4d8d73975cb1935faf32f82cb48b8 Mon Sep 17 00:00:00 2001 From: Daniel Llorens Date: Wed, 24 Apr 2013 17:13:56 +0200 Subject: [PATCH] Check more cases of array-contents * libguile/arrays.c: (scm_array_contents): fix comment. * test-suite/tests/arrays.test: add cases that depend on correct setting of CONTIGUOUS_FLAG. --- libguile/arrays.c | 4 ++-- test-suite/tests/arrays.test | 11 ++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/libguile/arrays.c b/libguile/arrays.c index 413a6f4c1..a378585c8 100644 --- a/libguile/arrays.c +++ b/libguile/arrays.c @@ -548,8 +548,8 @@ SCM_DEFINE (scm_transpose_array, "transpose-array", 1, 0, 1, /* attempts to unroll an array into a one-dimensional array. returns the unrolled array or #f if it can't be done. */ - /* if strict is not SCM_UNDEFINED, return #f if returned array - wouldn't have contiguous elements. */ +/* if strict is true, return #f if returned array + wouldn't have contiguous elements. */ SCM_DEFINE (scm_array_contents, "array-contents", 1, 1, 0, (SCM ra, SCM strict), "If @var{ra} may be @dfn{unrolled} into a one dimensional shared\n" diff --git a/test-suite/tests/arrays.test b/test-suite/tests/arrays.test index 54d936520..4ef836084 100644 --- a/test-suite/tests/arrays.test +++ b/test-suite/tests/arrays.test @@ -342,7 +342,16 @@ (let* ((a (make-array 0 4)) (b (make-shared-array a (lambda (i j k) (list k)) 0 1 4))) (if #f #f))) - ) + + (pass-if "broadcast 2-rank I" + (let* ((a #2((1 2 3) (4 5 6))) + (b (make-shared-array a (lambda (i j) (list 0 j)) 2 3))) + (not (array-contents b)))) + + (pass-if "broadcast 2-rank I" + (let* ((a #2((1 2 3) (4 5 6))) + (b (make-shared-array a (lambda (i j) (list i 0)) 2 3))) + (not (array-contents b))))) ;;; ;;; shared-array-root