reorganize test code