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_generator_array(): for path in sorted(glob.glob('examples/*.res')): print(path) with open(path) as f: ar = [line.strip() for line in f.readlines()] test_res = nonogramgenerator.array_to_nonogram(ar) res_path = path.replace('.res', '.json') with open(res_path, 'r') as f: res = json.load(f) assert(json.dumps(test_res) == json.dumps(res)) print('....checked')