def process(self, *, source, expected): """ Common process """ location = "./etc/brainfuck/" + source + ".bf" with open(location) as f: code = f.read() interpreter = Brainfuck(code) interpreter.evaluate(context=TestCxt()) self.assertEqual(expected + "\n", self.capture.getvalue())
def error(self, *, source, expected): """ Common error check """ for code in source: with self.assertRaises(expected): interpreter = Brainfuck(code) interpreter.evaluate(context=TestCxt())