fix `vector-copy' range checking for starting position
This commit is contained in:
parent
f8039ddb74
commit
60335d9b23
|
@ -41,13 +41,13 @@
|
|||
end))
|
||||
(vector)]
|
||||
[else
|
||||
(unless (and (<= 0 start) (< start len))
|
||||
(unless (and (<= 0 start len))
|
||||
(raise-mismatch-error
|
||||
'vector-copy
|
||||
(format "start index ~e out of range [~e, ~e] for vector: "
|
||||
start 0 len)
|
||||
v))
|
||||
(unless (and (<= start end) (<= end len))
|
||||
(unless (and (<= start end len))
|
||||
(raise-mismatch-error
|
||||
'vector-copy
|
||||
(format "end index ~e out of range [~e, ~e] for vector: "
|
||||
|
|
|
@ -133,6 +133,9 @@
|
|||
(let ()
|
||||
(test #() vector-copy #())
|
||||
(test #(1 2 3) vector-copy #(1 2 3))
|
||||
(test #() vector-copy #(1 2 3) 3)
|
||||
(test #(2 3) vector-copy #(1 2 3) 1)
|
||||
(test #(2) vector-copy #(1 2 3) 1 2)
|
||||
(test #f immutable? (vector-copy #(1 2 3)))
|
||||
(let ([v (vector 1 2 3)])
|
||||
(test #f eq? v (vector-copy v))))
|
||||
|
|
Loading…
Reference in New Issue
Block a user