def run(self): if "board" in self.annotations.keys(): if not self.annotations["board"].value is None: board = os.path.join(module_dir(self), self.annotations["board"].value) else: board = os.path.join(module_dir(self), self.filename[:-4] + ".gbb") else: board = os.path.join(parent_dir(__file__), "boards/empty.gbb") results = run_gobstones(self.filename, board) if results[0] == "OK": passed = True if self.annotation_present("assert"): passed = passed and self.check_assert(results[1]) if passed: return "PASSED" else: return "FAILED" else: return results[0] def check_assert(self, results): pass
def run(self): if "board" in self.annotations.keys(): if not self.annotations["board"].value is None: board = os.path.join(module_dir(self), self.annotations["board"].value) else: board = os.path.join(module_dir(self), self.filename[:-4] + ".gbb") else: board = os.path.join(parent_dir(__file__), "boards/empty.gbb") results = run_gobstones(self.filename, board) if results[0] == "OK": if self.annotation_present("assert"): passed, failed = self.check_assert(results[1]) else: res = dict(results[1]) passed, failed = int(res["passed"]), int(res["failed"]) return (passed, failed, 0, passed + failed) else: return (0, 0, 1, 1) def check_assert(self, results): pass
def cleanup(): clean_dir = os.path.join(parent_dir(__file__), "examples") delete_files_in_dir(clean_dir, ["README"])
def get_gobstones_tests(self): PATH = os.path.join(parent_dir(__file__), self.name) return [ GobstonesFileTest(os.path.join(PATH, f)) for f in os.listdir(PATH) if ".gbs" in f and self.is_test_file(PATH, f)]
def get_gobstones_tests(self): PATH = os.path.join(parent_dir(__file__), self.name) return [ GobstonesFileTest(os.path.join(PATH, f)) for f in os.listdir(PATH) if ".gbs" in f and self.is_test_file(PATH, f) ]