Refactoring tests of TestProgram