cleanup and generalize unit tests