summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Llorens <daniel.llorens@bluewin.ch>2013-04-10 13:45:05 +0200
committerAndy Wingo <wingo@pobox.com>2014-02-06 21:40:38 +0100
commit1080ce25bca18ef3a999995ab15664c2a10fd974 (patch)
tree555445bc310b4a3a18a1e9c80a5171063c9db8b3
parent2bee653acbc4d0978fc5de3d8027865e19fc6ce9 (diff)
downloadguile-1080ce25bca18ef3a999995ab15664c2a10fd974.tar.gz
Tests for shared-array-root
* test-suite/tests/arrays.test: check shared-array-root against make-shared-array, array-contents.
-rw-r--r--test-suite/tests/arrays.test29
1 files changed, 29 insertions, 0 deletions
diff --git a/test-suite/tests/arrays.test b/test-suite/tests/arrays.test
index 9d8637122..135392797 100644
--- a/test-suite/tests/arrays.test
+++ b/test-suite/tests/arrays.test
@@ -574,6 +574,35 @@
(eqv? 8 (array-ref s2 2))))))
;;;
+;;; shared-array-root
+;;;
+
+(with-test-prefix "shared-array-root"
+
+ (define amap1 (lambda (i) (list (* 2 i))))
+ (define amap2 (lambda (i j) (list (+ 1 (* 2 i)) (+ 1 (* 2 j)))))
+
+ (pass-if "plain vector"
+ (let* ((a (make-vector 4 0))
+ (b (make-shared-array a amap1 2)))
+ (eq? (shared-array-root a) (shared-array-root b) (array-contents a))))
+
+ (pass-if "plain array rank 2"
+ (let* ((a (make-array 0 4 4))
+ (b (make-shared-array a amap2 2 2)))
+ (eq? (shared-array-root a) (shared-array-root b) (array-contents a))))
+
+ (pass-if "uniform array rank 2"
+ (let* ((a (make-typed-array 'c64 0 4 4))
+ (b (make-shared-array a amap2 2 2)))
+ (eq? (shared-array-root a) (shared-array-root b) (array-contents a))))
+
+ (pass-if "bit array rank 2"
+ (let* ((a (make-typed-array 'b #f 4 4))
+ (b (make-shared-array a amap2 2 2)))
+ (eq? (shared-array-root a) (shared-array-root b) (array-contents a)))))
+
+;;;
;;; uniform-vector
;;;