Changeset 29958 in project for release/4/r7rs/trunk/tests/run.scm


Ignore:
Timestamp:
10/26/13 04:09:33 (8 years ago)
Author:
evhan
Message:

r7rs: bytevectors (mostly reexported from srfi-4)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/4/r7rs/trunk/tests/run.scm

    r29954 r29958  
    343343    (test #t (string>=? "b" "b" "a"))
    344344    (test #f (string>=? "b" "a" "b"))))
     345
     346(test-group "6.9: bytevectors"
     347
     348  (test-group "bytevector-copy"
     349    (test-error (bytevector-copy ""))
     350    (test-error (bytevector-copy #u8() #u8()))
     351    (test-error (bytevector-copy #u8() 1))
     352    (test-error (bytevector-copy #u8(0) -1))
     353    (test-error (bytevector-copy #u8(0) 0 2))
     354    (test #u8() (bytevector-copy #u8()))
     355    (test #u8(0 1 2) (bytevector-copy #u8(0 1 2)))
     356    (test #u8(1 2) (bytevector-copy #u8(0 1 2) 1))
     357    (test #u8(1) (bytevector-copy #u8(0 1 2) 1 2))
     358    (test #u8() (bytevector-copy #u8(0 1 2) 1 1)))
     359
     360  (test-group "bytevector-copy!"
     361    (test-error (bytevector-copy! ""))
     362    (test-error (bytevector-copy! #u8(0) 0 ""))
     363    (test-error (bytevector-copy! #u8() #u8() 0))
     364    (test-error (bytevector-copy! #u8() 0 #u8(0)))
     365    (test-error (bytevector-copy! #u8(0) 1 #u8(0)))
     366    (test-error (bytevector-copy! #u8(0) 1 #u8(0) 0))
     367    (test-error (bytevector-copy! #u8(0) 0 #u8(0) 0 2))
     368    (test-error (bytevector-copy! #u8(0) 0 #u8(0 1) 1 0))
     369    (test-assert (bytevector-copy! #u8() 0 #u8()))
     370    (let ((t #u8(0 1 2))
     371          (f #u8(3 4 5 6)))
     372      (bytevector-copy! t 0 f 1 1)
     373      (test "(bytevector-copy! t 1 f 1 1)" #u8(0 1 2) t)
     374      (bytevector-copy! t 0 f 0 1)
     375      (test "(bytevector-copy! t 0 f 0 1)" #u8(3 1 2) t)
     376      (bytevector-copy! t 0 f 1 3)
     377      (test "(bytevector-copy! t 0 f 1 3)" #u8(4 5 2) t)
     378      (bytevector-copy! t 1 f 2)
     379      (test "(bytevector-copy! t 1 f 1)" #u8(4 5 6) t)
     380      (bytevector-copy! t 0 f 1)
     381      (test "(bytevector-copy! t 0 f)" #u8(4 5 6) t)))
     382
     383  (test-group "bytevector-append"
     384    (test-error (bytevector-append #u8() 1))
     385    (test #u8() (bytevector-append))
     386    (test #u8(0) (bytevector-append #u8(0)))
     387    (test #u8() (bytevector-append #u8() #u8()))
     388    (test #u8(0 1) (bytevector-append #u8(0) #u8(1)))
     389    (test #u8(0 1 2 3 4 5) (bytevector-append #u8(0 1) #u8(2 3) #u8(4 5)))))
    345390
    346391(define-syntax catch
Note: See TracChangeset for help on using the changeset viewer.