update test code for TopCoder to be more reusable