refactoring: DRY check_tests script