[racket] Rackunit best practices

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Fri Aug 30 08:45:28 EDT 2013

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>

Posted on the users mailing list.