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