diff options
author | Daniel Llorens <lloda@sarc.name> | 2021-10-21 15:05:46 +0200 |
---|---|---|
committer | Daniel Llorens <lloda@sarc.name> | 2021-10-21 15:05:46 +0200 |
commit | 6be51f9bbf47692ee5747b2cac6b372df65de970 (patch) | |
tree | 1c9c4fd6cfc65d64f320d32e91ed10e7ccd0ed57 /test-suite | |
parent | c85724bd0a72a11f8c28c844a200d624ce32958a (diff) | |
download | guile-6be51f9bbf47692ee5747b2cac6b372df65de970.tar.gz |
Provide xxvector-copy and xxvector-copy! for srfi-4 vectors
These use the argument conventions of vector-copy!, string-copy!,
etc. and not that of bytevector-copy! (which is from r6rs).
* module/srfi/srfi-4/gnu.scm: As stated.
* test-suite/tests/srfi-4.test: Tests.
* doc/ref/srfi-modules.texi: Documentation.
* libguile/bytevectors.c (bytevector-copy!): Add overlap note to
docstring.
* libguile/vectors.c (vector-copy!): Reuse text for the overlap note.
Diffstat (limited to 'test-suite')
-rw-r--r-- | test-suite/tests/srfi-4.test | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test-suite/tests/srfi-4.test b/test-suite/tests/srfi-4.test index ffb185129..707abee3d 100644 --- a/test-suite/tests/srfi-4.test +++ b/test-suite/tests/srfi-4.test @@ -540,3 +540,27 @@ (u16vector-set! v 2 0) (u16vector-set! v 3 0) (equal? v #u32(#xFFFFFFFF 0))))) + +(with-test-prefix "typed vector copies (srfi srfi-4 gnu)" + + (pass-if "f64vector-copy" + (equal? #f64(1 2 3 4) (f64vector-copy #f64(9 7 1 2 3 4 0 8) 2 6))) + + (pass-if "c64vector-copy" + (equal? #c64(1 2 3 4 0 8) (c64vector-copy #c64(9 7 1 2 3 4 0 8) 2))) + + (pass-if "s32vector-copy! (both optional args)" + (let ((v (s32vector 9 7 1 2 3 4 0 8))) + (s32vector-copy! v 2 #s32(-1 -2 -3 -4 -5 -6 -7 -8) 3 7) + (equal? #s32(9 7 -4 -5 -6 -7 0 8) v))) + + (pass-if "s16vector-copy! (one optional arg)" + (let ((v (s16vector 9 7 1 2 3 4 0 8))) + (s16vector-copy! v 2 #s16(-1 -2 -3 -4 -5 -6 -7 -8) 3) + (equal? #s16(9 7 -4 -5 -6 -7 -8 8) v))) + + (pass-if "s8vector-copy! (no optional args)" + (let ((v (s8vector 9 7 1 2 3 4 0 8))) + (s8vector-copy! v 2 #s8(-1 -2 -3 -4 -5)) + (equal? #s8(9 7 -1 -2 -3 -4 -5 8) v)))) + |