def compare_files(correct_file, temp_file): """ Compare a reference file and a file generated by the code tests. :param correct_file: the reference file :param temp_file: the generated file :return: 0 if files identical, 1 otherwise. """ return test_functions.compare_files(correct_file, temp_file, fails, not_tested)
def compare_files(correct_file, temp_file): """ Do a string comparison of the contents of two files. :param correct_file: reference file :param temp_file: file generated during tests :return: 0 on success, or file not present; 1 on failure. """ return test_functions.compare_files(correct_file, temp_file, fails, not_tested)
def compare_items(name, type): """ Compare two files, reference and temporary versions. :param name: name of the directory housing the file. :param type: one of ['apdx-validation', 'macros', 'body'] :return: 0 if success or file missing, 1 on failure """ assert type in ['apdx-validation', 'macros', 'body'] correct_file = os.path.normpath('./test-tex/{0}/{1}.tex'.format(name, type)) temp_file = os.path.normpath('./temp/{0}/{1}.tex'.format(name, type)) return test_functions.compare_files(correct_file, temp_file, fails, not_tested)
def compare_code(name, binding, ext): """ Compare a reference file with a temporary test version of the file. :param name: name of reference file :param binding: which binding, e.g. 'java' :param ext: the file extension :returns: 0 on success or missing file, 1 on failure. """ correct_file = os.path.normpath('./test-binding/{0}/{1}.{2}'.format( binding, name, ext)) temp_file = os.path.normpath('./temp/{0}/{1}.{2}'.format( binding, name, ext)) return test_functions.compare_files(correct_file, temp_file, fails, not_tested)
def compare_files(correct_file, temp_file): return test_functions.compare_files(correct_file, temp_file, fails, not_tested)