@@ -0,0 +1,2196 @@
+#!/usr/bin/env python3%0A%0Aimport os%0Aimport itertools%0Aimport unittest%0Aimport subprocess%0A%0A%0AALGORITHMS_DIR = os.path.abspath(os.path.dirname(__file__))%0A%0A%0Aclass BaseTestHandler(unittest.TestCase):%0A%0A    ext = None%0A%0A    def __init__(self, src_file):%0A        super().__init__()%0A        self._src_file = src_file%0A        basename = os.path.splitext(self._src_file)%5B0%5D%0A        self._in_file = basename + '.in'%0A        self._out_file = basename + '.out'%0A        self._tmp_file = basename + '.tmp'%0A%0A    def __str__(self):%0A        return self._src_file%5Blen(ALGORITHMS_DIR) + 1:%5D%0A%0A    def setUp(self):  # compile%0A        pass%0A%0A    def runTest(self):  # run program and call compareOutput%0A        pass%0A%0A    def compareOutput(self):%0A        with open(self._out_file) as out_fd:%0A            with open(self._tmp_file) as tmp_fd:%0A                for out_line, tmp_line in itertools.zip_longest(out_fd, tmp_fd):%0A                    if out_line != tmp_line:%0A                        self.fail(%22output doesn't match%22)%0A%0A    def tearDown(self):  # cleanup%0A        if os.path.isfile(self._tmp_file):%0A            os.remove(self._tmp_file)%0A%0A%0Aclass PythonTestHandler(BaseTestHandler):%0A%0A    ext = '.py'%0A%0A    def __init__(self, src_file):%0A        super().__init__(src_file)%0A%0A    def runTest(self):%0A        with open(self._in_file) as stdin_fd:%0A            with open(self._tmp_file, 'w') as stdout_fd:%0A                subprocess.call(%5B'python', self._src_file%5D,%0A                                stdin=stdin_fd, stdout=stdout_fd)%0A        self.compareOutput()%0A%0A%0Adef main():%0A    handlers = %7B%7D%0A    for handler_cls in BaseTestHandler.__subclasses__():%0A        handlers%5Bhandler_cls.ext%5D = handler_cls%0A    suite = unittest.TestSuite()%0A    for dirpath, dirnames, filenames in os.walk(ALGORITHMS_DIR):%0A        if dirpath != ALGORITHMS_DIR:%0A            for filename in filenames:%0A                ext = os.path.splitext(filename)%5B1%5D%0A                if ext in handlers:%0A                    src_file = os.path.join(dirpath, filename)%0A                    handler = handlers%5Bext%5D(src_file)%0A                    suite.addTest(handler)%0A    runner = unittest.TextTestRunner(verbosity=2)%0A    runner.run(suite)%0A%0A%0Aif __name__ == '__main__':%0A    main()%0A

Add initial version of run_tests.py with Python support