Start to add unit tests.

Testing this will not be trivial, as it depends on processes being
either terminated through exit or signaled on memory errors in certain
ways. I hope I can extended this first test to a general method of
testing the expected termination conditions.