1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-01 12:20:26 +02:00

Replaced uniform-array-set1! with just array-set!. Do not check

improper index lists, which can't arise with uarray-set!.  Use
"#s16()" instead of "#h()".
This commit is contained in:
Marius Vollmer 2004-11-12 19:00:22 +00:00
parent 5c4b4321a2
commit bd6713d5ea

View file

@ -202,8 +202,8 @@
(with-test-prefix "array-equal?" (with-test-prefix "array-equal?"
(pass-if "#h(...)" (pass-if "#s16(...)"
(array-equal? #h(1 2 3) #h(1 2 3)))) (array-equal? #s16(1 2 3) #s16(1 2 3))))
;;; ;;;
;;; array-fill! ;;; array-fill!
@ -409,50 +409,42 @@
(= n (array-ref a 0)))))))) (= n (array-ref a 0))))))))
;;; ;;;
;;; uniform-array-set1! ;;; array-set!
;;; ;;;
(with-test-prefix "uniform-array-set1!" (with-test-prefix "array-set!"
(with-test-prefix "one dim" (with-test-prefix "one dim"
(let ((a (make-uniform-array '() '(3 5)))) (let ((a (make-uniform-array '() '(3 5))))
(pass-if "start" (pass-if "start"
(uniform-array-set1! a 'y '(3)) (array-set! a 'y 3)
#t) #t)
(pass-if "end" (pass-if "end"
(uniform-array-set1! a 'y '(5)) (array-set! a 'y 5)
#t) #t)
(pass-if-exception "start-1" exception:out-of-range (pass-if-exception "start-1" exception:out-of-range
(uniform-array-set1! a 'y '(2))) (array-set! a 'y 2))
(pass-if-exception "end+1" exception:out-of-range (pass-if-exception "end+1" exception:out-of-range
(uniform-array-set1! a 'y '(6))) (array-set! a 'y 6))
(pass-if-exception "two indexes" exception:out-of-range (pass-if-exception "two indexes" exception:out-of-range
(uniform-array-set1! a 'y '(6 7))) (array-set! a 'y 6 7))))
(pass-if-exception "two improper indexes" exception:out-of-range
(uniform-array-set1! a 'y '(6 . 7)))
(pass-if-exception "three improper indexes" exception:out-of-range
(uniform-array-set1! a 'y '(6 7 . 8)))))
(with-test-prefix "two dim" (with-test-prefix "two dim"
(let ((a (make-uniform-array '() '(3 5) '(7 9)))) (let ((a (make-uniform-array '() '(3 5) '(7 9))))
(pass-if "start" (pass-if "start"
(uniform-array-set1! a 'y '(3 7)) (array-set! a 'y 3 7)
#t) #t)
(pass-if "end" (pass-if "end"
(uniform-array-set1! a 'y '(5 9)) (array-set! a 'y 5 9)
#t) #t)
(pass-if-exception "start i-1" exception:out-of-range (pass-if-exception "start i-1" exception:out-of-range
(uniform-array-set1! a 'y '(2 7))) (array-set! a 'y 2 7))
(pass-if-exception "end i+1" exception:out-of-range (pass-if-exception "end i+1" exception:out-of-range
(uniform-array-set1! a 'y '(6 9))) (array-set! a 'y 6 9))
(pass-if-exception "one index" exception:wrong-num-args (pass-if-exception "one index" exception:wrong-num-args
(uniform-array-set1! a 'y '(4))) (array-set! a 'y 4))
(pass-if-exception "three indexes" exception:wrong-num-args (pass-if-exception "three indexes" exception:wrong-num-args
(uniform-array-set1! a 'y '(4 8 0))) (array-set! a 'y 4 8 0)))))
(pass-if-exception "two improper indexes" exception:wrong-num-args
(uniform-array-set1! a 'y '(4 . 8)))
(pass-if-exception "three improper indexes" exception:wrong-num-args
(uniform-array-set1! a 'y '(4 8 . 0))))))
;;; ;;;
;;; uniform-vector-ref ;;; uniform-vector-ref