From 56a0b3f2afe822e8e0f54c966fe1b68fe3383ec0 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Sat, 7 Jan 2017 01:10:36 -0800 Subject: [PATCH] Test shift right/left using bytevector-copy!. --- tests/runtime/test-bytevector.scm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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)) -- 2.25.1