Exemple #1
0
 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())
Exemple #2
0
 def error(self, *, source, expected):
     """ Common error check """
     for code in source:
         with self.assertRaises(expected):
             interpreter = Brainfuck(code)
             interpreter.evaluate(context=TestCxt())