[racket] Rackunit best practices
We don't test contracts. In general contracts are relatively simple functions, but yes, we have written several papers on bugs in contracts and how this complicates a contract monitoring system.
If you are asking how to test functions that have contracts, I import that module itself into a submodule so that the export contracts are exercised during a test:
#lang racket
(provide
(contract-out
(f (-> integer? integer?))))
(define (f x)
pi)
(module+ test
(require (submod "..") rackunit)
(check-equal? (f 1) 3))
On Aug 29, 2013, at 11:35 PM, Alvin Schatte wrote:
> I learned a lot from this thread. Thank you for the guidance. Along similar lines, what would be a good practice for testing contracts?
> Alvin Schatte
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130830/a25f6370/attachment.html>