Refine contract check

original commit: 0b55cf3df2
This commit is contained in:
Asumu Takikawa 2013-04-04 13:45:39 -04:00
parent ab5c430480
commit 58ad235030

View File

@ -329,5 +329,9 @@
(define (bytes-of-length n)
(flat-named-contract
`(bytes-of-length ,n)
(λ (bs) (= (bytes-length bs) n))))
(λ (bs) (and (bytes? bs) (= (bytes-length bs) n)))))
(module+ test
(check-true ((bytes-of-length 5) (bytes 1 2 3 4 5)))
(check-false ((bytes-of-length 5) "moogle")))