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-01-27 21:45:17 +0100
commite0c58a504224b48c44161387aabd036a3ce4a1dd (patch)
treea6c5c158297d8933036f28722ad850c01ed50b1f
parent951ce0f413269f14ed7f763c40b2c343fe73eb8c (diff)
downloadguile-e0c58a504224b48c44161387aabd036a3ce4a1dd.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
;;;