summaryrefslogtreecommitdiff
path: root/test-suite/tests/arrays.test
diff options
context:
space:
mode:
authorDaniel Llorens <daniel.llorens@bluewin.ch>2013-04-08 13:13:21 +0200
committerAndy Wingo <wingo@pobox.com>2014-01-27 21:45:17 +0100
commit4569bbf7f6b930f49758023f15ab1b9020036db9 (patch)
treee26384ca79e968b7d3b6bdafcf190569b56bc5ed /test-suite/tests/arrays.test
parent07f4a9151eda892e391800b5d53d4c50f93feb4e (diff)
downloadguile-4569bbf7f6b930f49758023f15ab1b9020036db9.tar.gz
Don't use generalized-vector functions in uniform.c
* libguile/uniform.c - (scm_is_uniform_vector): replace scm_is_generalized_vector and scm_generalized_vector_get_handle by scm_is_array and manual rank check. - (scm_c_uniform_vector_length): inline length computation. This removes a redundant rank check. - (scm_c_uniform_vector_ref): inline impl->vref use. This removes a redundant rank check. - (scm_c_uniform_vector_set): inline impl->vset use. This removes a redundant rank check. - (scm_uniform_vector_writable_elements): replace scm_generalized_vector_get_handle by scm_array_get_handle. * test-suite/test/arrays.test - rename uniform-vector-ref block to uniform-vector. - exercise uniform-vector-length and shared arrays remaining uniform.
Diffstat (limited to 'test-suite/tests/arrays.test')
-rw-r--r--test-suite/tests/arrays.test24
1 files changed, 20 insertions, 4 deletions
diff --git a/test-suite/tests/arrays.test b/test-suite/tests/arrays.test
index 0b3d57ca2..9d8637122 100644
--- a/test-suite/tests/arrays.test
+++ b/test-suite/tests/arrays.test
@@ -574,12 +574,12 @@
(eqv? 8 (array-ref s2 2))))))
;;;
-;;; uniform-vector-ref
+;;; uniform-vector
;;;
-(with-test-prefix "uniform-vector-ref"
+(with-test-prefix "uniform-vector"
- (with-test-prefix "byte"
+ (with-test-prefix "uniform-vector-ref byte"
(let ((a (make-s8vector 1)))
@@ -594,7 +594,23 @@
(pass-if "-128"
(begin
(array-set! a -128 0)
- (= -128 (uniform-vector-ref a 0)))))))
+ (= -128 (uniform-vector-ref a 0))))))
+
+ (with-test-prefix "shared with rank 1 remain uniform vectors"
+
+ (let ((a #f64(1 2 3 4)))
+
+ (pass-if "change offset"
+ (let ((b (make-shared-array a (lambda (i) (list (+ i 1))) 3)))
+ (and (uniform-vector? b)
+ (= 3 (uniform-vector-length b))
+ (array-equal? b #f64(2 3 4)))))
+
+ (pass-if "change stride"
+ (let ((c (make-shared-array a (lambda (i) (list (* i 2))) 2)))
+ (and (uniform-vector? c)
+ (= 2 (uniform-vector-length c))
+ (array-equal? c #f64(1 3))))))))
;;;
;;; syntax