CS 1102: Testing in Pretty Big


Using Check-Expect

The check-expect function we have been using in class is not defined by default in the Pretty Big language. To regain use of it, add the following to the front of your source files:
(require test-engine/racket-gui)
And then add the expression (test) at the end of of your file.

Another related issue in moving from the student languages to Pretty Big is that comparison of structure values is a more complex issue. The bottom line is that in order to regain the behavior you are used to in the student languages, you must add a special function call as the third argument of every define-struct as shown in the following example:

(define-struct my-structure (a b) (make-inspector))
If you are interested in what this is about, it relates to the issue of "opaque" versus "transparent" data structures (see Section 5.4 in the Racket Guide in the Help Desk).

Enabling Test Case Coverage Display

In the student languages, every time you hit Run, DrRacket displays in reverse video all the code that was not executed by any of your test cases. This is a useful warning for parts of your code where bugs may be hiding. This behavior is not enabled by default in Pretty Big. To enable it, select

Language > Choose Language > Pretty Big

and then click on the Show Details button (in lower left corner). In the new menu area which now appears, under Dynamic Properties, click on the radio button labeled Syntactic test suite coverage.

When you next click Run, you will see the familiar test coverage information display, but in red, rather than reverse video.