From: Chris Hanson Date: Sat, 7 Jan 2017 09:10:36 +0000 (-0800) Subject: Test shift right/left using bytevector-copy!. X-Git-Tag: mit-scheme-pucked-9.2.12~227^2~187 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=56a0b3f2afe822e8e0f54c966fe1b68fe3383ec0;p=mit-scheme.git Test shift right/left using bytevector-copy!. --- diff --git a/tests/runtime/test-bytevector.scm b/tests/runtime/test-bytevector.scm index 065354221..0fe5de2bc 100644 --- a/tests/runtime/test-bytevector.scm +++ b/tests/runtime/test-bytevector.scm @@ -142,7 +142,17 @@ USA. (bytevector-copy! (make-bytevector n) 0 v n (+ n 1)))) (assert-range-error (lambda () - (bytevector-copy! (make-bytevector n) 0 v -1 n)))))))) + (bytevector-copy! (make-bytevector n) 0 v -1 n)))))) + ;; shift left + (let* ((bytes (reverse (iota 16))) + (v (apply bytevector bytes))) + (bytevector-copy! v 3 v 5 9) + (assert-equal v (bytevector 15 14 13 10 9 8 7 8 7 6 5 4 3 2 1 0))) + ;; shift right + (let* ((bytes (reverse (iota 16))) + (v (apply bytevector bytes))) + (bytevector-copy! v 5 v 3 7) + (assert-equal v (bytevector 15 14 13 12 11 12 11 10 9 6 5 4 3 2 1 0))))) (define (test-bytevector-properties v bytes) (assert-true (bytevector? v))