Exemplo n.º 1
0
 def __init__(self, file):
     tests = Parser.parse(file)
     tests = random.iter(tests)
     tests = map(Test, tests)
     self.tests = filter(truth, tests)
Exemplo n.º 2
0
    def ask_tests(self):
        for test in self.tests:
            self.ask_fields(test)

    def ask_fields(self, test):
        for field in test.fields:
            self.ask_field(test, field)

    def ask_field(self, test, field):
        os.cls()
        print('=' * 50)
        print('Hex:\n')
        print(test.hex)
        ans = input('Input %s:\n' % field)
        if Test.filter(ans) == Test.filter(test.fields[field]):
            print('Correct')
        else:
            print('Wrong')
            print('%s: %s' % (field, test.fields[field]))
        input('Press Enter...')


if __name__ == '__main__':
    while True:
        test_files = glob.glob(TESTS_DIR)
        for file_dir in random.iter(test_files):
            with open(file_dir) as file:
                tester = Tester(file)
                tester.ask_tests()