[plt-scheme] Newbie help using (check-expect): problem nesting (generate-report)

From: mattdz at UDel.Edu (mattdz at UDel.Edu)
Date: Thu Apr 23 01:11:00 EDT 2009

For a school project I'm developing quite a few tests to make sure that all parts of my code are 
functional and working, etc etc etc.

This is being done in DrScheme using the module language.

Instead of just listing a whole lot of (check-expect) expressions all serially one after another, 
and then evaluating them all when I run the code, I was hoping to be able to do something like 

#lang scheme
(require htdp/testing)

(define (valid-coords? x y) 
 ...some logic etc in here...)

;tests for 'valid-coords?'
(define (test-valid-coords?)
  (check-expect (valid-coords? -1 1) #f)
  (check-expect (valid-coords? 11 10) #f)
  (check-expect (valid-coords? 10 10) #t)
  (check-expect (valid-coords? 10 11) #f)
  (check-expect (valid-coords? 10 -1) #f)
  (check-expect (valid-coords? -1 -1) #f)
  (check-expect (valid-coords? 0 0) #t)
  (check-expect (valid-coords? 1 1) #t)

  ....and more below


I was hoping that I could then selectively call my testing blocks, by just calling (test-valid-
coords?), for example. However, when I try to run the above code, I receive the following error:

check-expect: found a test that is not at the top level in: (check-expect (valid-coords? -1 1) #f)

My question is, is there any "easy" way to do something like what I've described above, or will 
I need to use some other method of testing, or even write my own unit-testing procedures?

Posted on the users mailing list.