def test_cross_check(): for path in sorted(glob.glob('examples/*.json')): print(path) solver = NonogramSolver(path) solver.solve() solver_res = solver.NONO < 2 with open(path) as f: solver_inp = json.load(f) assert(solver_inp == nonogramgenerator.array_to_nonogram(solver_res)) print('....checked')
def test_solver(): for path in sorted(glob.glob('examples/*.json')): print(path) solver = NonogramSolver(path) solver.set_verbose(True) solver.solve() test_res = solver.__str__().replace('\n', '') res_path = path.replace('.json', '.res') with open(res_path, 'r') as f: res = ''.join(f.readlines()).replace('\n', '') assert(test_res == res) print('....checked')