def test(tests, tester): total_marks, earned_marks = 0, 0 for test in tests: name, map_file, seed, solution = load_test(test) total_marks += 1 try: # Run the test state = GameState(map_file) random.seed(seed) sim = Simulator(map_file, WAIT_TIME) sim.verbose(VERBOSE) result = tester(sim, state, solution) earned = int(result) print("Testing: {}\t [{}/{}]".format(name, earned, 1)) earned_marks += earned except NotImplementedError as e: print("Testing {}\t [{}]\t [0/1]".format(name, e)) return earned_marks, total_marks
def test(tests, tester): total_marks, earned_marks = 0, 0 for test in tests: name, map_file, goal_func, solution = load_test(test) total_marks += 1 try: # Run the test state = GameState(map_file) result = tester(goal_func, state, solution) earned = int(result) print("Testing: {}\t [{}/{}]".format(name, earned, 1)) earned_marks += earned except NotImplementedError as e: print("Testing {}\t [{}]\t [0/1]".format(name, e)) return earned_marks, total_marks
def test(tests, tester): total_marks, earned_marks = 0, 0 for test in tests: name, maps, seed, solution = load_test(test) total_marks += 1 try: # Run the test random.seed(seed) result = tester(maps, solution) earned = int(result) print("Testing: {}\t [{}/{}]".format(name, earned, 1)) earned_marks += earned except NotImplementedError as e: print("Testing {}\t [{}]\t [0/1]".format(name, e)) return earned_marks, total_marks
def test(tests, tester): total_marks, earned_marks = 0, 0 for test in tests: name, grid, variables, solution, pass_expected = load_test(test) csp = TetrisCSP(grid) total_marks += 1 try: # Run the test csp.initialize_variables(variables) result = tester(csp, solution) if pass_expected else not tester(csp, solution) earned = int(result) print("Testing: {}\t [{}/{}]".format(name, earned, 1)) earned_marks += earned except NotImplementedError as e: print("Testing {}\t [{}]\t [0/1]".format(name, e)) return earned_marks, total_marks