[racket] rackunit messages

From: Danny Yoo (dyoo at hashcollision.org)
Date: Tue Nov 27 01:13:21 EST 2012

On Mon, Nov 26, 2012 at 9:45 PM, Harry Spier <vasishtha.spier at gmail.com>wrote:

> I'm using rackunit for the first time.  In the code below (simulating
> a 2-dimensional byte array by a structure with a byte-string) passes
> the tests but I get these messages.
> Can someone tell me what the messages in the interactions window are all
> about.
>
>

A test suite is a value, and you're seeing that value since it's a toplevel
expression.  That is, nothing's being run.  You'll probably want to amend
to something like this:

;;;;;;;;;;;;;;;;;;;;;;;

(module+ main
  (require rackunit rackunit/text-ui)
  ;;make-byte-array tests
  (define 2-3-0-barry (make-byte-array 2 3 ))
  (define 2-3-λ-barry (make-byte-array 2 3 #o377))

  (define my-test-suite
    (test-suite
     "Testing make-byte-array"
     (check equal? (byte-array-string 2-3-0-barry) #"\0\0\0\0\0\0")
     (check equal? (byte-array-string 2-3-λ-barry)
#"\377\377\377\377\377\377")
     (check equal? (byte-array-row-count 2-3-0-barry) 2)
     (check equal? (byte-array-column-count 2-3-0-barry) 3)))

  (run-tests my-test-suite))

;;;;;;;;;;;;;;;;;;;;;;;


For more information, take a look near the end of
http://docs.racket-lang.org/rackunit/quick-start.html, where the example
organizes the checks into a "suite".


Best of wishes!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20121126/6adfbf4b/attachment.html>

Posted on the users mailing list.