UNB/ CS/ David Bremner/ teaching/ cs4613/ tutorials/ CS4613 Tutorial 10

Lecture 19 introduced racket dialects plai/gc2/collector and plai/gc2/mutator. We also looked at the API required to be provided by a collector. Somewhat suprisingly, that does not include actual garbage collection. In this tutorial we'll get a bit more familiar with the API by writing tests for the null collector discussed in Lecture 19.

1 Error cases

Start by writing tests to exercise each of the error calls in null-gc.rkt.txt Use with-heap and test/exn.


2 Atomic / flat data

Add any tests needed for the flat data part of the API.


3 Cons / Pairs

Add tests to cover the cons related code.


4 Closures

Add tests to cover the remaining closure related code.


5 Reflection, test design

Unlike the tests we looked at in Lecture 19, none of my tests for this tutorial used current-heap to look at the exact state of the heap, but rather just API calls to look at at single elements of the heap. Can you think of arguments in favour of both approaches?