Skip to content

Commit

Permalink
all cpp an template files working correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
skeating committed Jul 24, 2023
1 parent bebe43f commit e5488c2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 19 deletions.
2 changes: 0 additions & 2 deletions deviser/pytest_files/functions.py
Expand Up @@ -82,8 +82,6 @@ def compare_files(infile, outfile, fails, not_tested):
:returns: 0 on success, or file not present; 1 on failure.
"""
ret = 0
if infile.endswith('ErrorTable.cpp'):
return 0
if not os.path.isfile(infile):
# we have not added a file to compare to
not_tested.append(infile)
Expand Down
43 changes: 26 additions & 17 deletions deviser/pytest_files/test_other_library/test_other_library.py
Expand Up @@ -45,37 +45,45 @@ def teardown():
# ('combine-archive', 0, 'CaContent', 'check includes', 'CaListOfContents'),
# ('combine-archive', 1, 'CaOmexManifest', 'document', ''),
('testsbxml', 1, 'TSBComment', 'comment class', 'TSBListOfComments'),
('testsbxml', 0, 'TSBDocument', 'document', ''),
])
('testsbxml', 0, 'TSBDocument', 'document', ''),
])
def test_cpp(name, num, class_name, test_case, list_of):
"""
Based on old test_utils.run_templates() function. Run the 'template' file tests.
Based on old test_utils.run_templates() function. Run the 'template' file tests.#
:param name: name of test group e.g. 'test_sedml', 'combine-archive'.
:param class_name: name of C++ class (and thus .cpp/.h filenames),
e.g. 'SedBase'
e.g. 'SedBase'
:param test_case: brief test description, e.g. 'templates'.
:param list_of: class name (and thus filenames) of any corresponding
"list of" class, e.g. 'SedListOf'
"list of" class, e.g. 'SedListOf'
"""
# gv.reset()
# xml_filename = functions.set_up_test(name, class_name, test_case)
# assert xml_filename is not None and xml_filename != ""
# test_utils.generate_new_cpp_header(xml_filename, num)
# assert 0 == test_utils.compare_code_headers(class_name)
# assert 0 == test_utils.compare_code_impl(class_name)
# if len(list_of) > 0:
# class_name = list_of
# assert 0 == test_utils.compare_code_headers(class_name)
# assert 0 == test_utils.compare_code_impl(class_name)
print('skip')
gv.reset()
xml_filename = functions.set_up_test(name, class_name, test_case)
assert xml_filename is not None and xml_filename != ""
test_utils.generate_new_cpp_header(xml_filename, num)
assert 0 == test_utils.compare_code_headers(class_name)
assert 0 == test_utils.compare_code_impl(class_name)
if len(list_of) > 0:
class_name = list_of
assert 0 == test_utils.compare_code_headers(class_name)
assert 0 == test_utils.compare_code_impl(class_name)


@pytest.mark.parametrize('name, class_name, test_case, list_of', [
# # Tests from old test_utils.testCombine()
# ('test_sedml', 'SedBase', 'templates', 'SedListOf'),
# ('combine-archive', 'CaBase', 'templates', 'CaListOf'),
('testsbxml', 'TSBBase', 'templates', 'TSBListOf'),
('testsbxml', 'TSBError', 'templates', ''),
('testsbxml', 'TSBErrorTable', 'templates', ''),
('testsbxml', 'TSBErrorLog', 'templates', ''),
('testsbxml', 'TSBNamespaces', 'templates', ''),
('testsbxml', 'TSBReader', 'templates', ''),
('testsbxml', 'TSBVisitor', 'templates', ''),
('testsbxml', 'TSBTypeCodes', 'templates', ''),
('testsbxml', 'TSBTypes', 'templates', ''),
('testsbxml', 'TSBWriter', 'templates', ''),
])
def test_templates(name, class_name, test_case, list_of):
"""
Expand All @@ -93,7 +101,8 @@ def test_templates(name, class_name, test_case, list_of):
assert xml_filename is not None and xml_filename != ""
test_utils.generate_templates(xml_filename)
assert 0 == test_utils.compare_code_headers(class_name)
assert 0 == test_utils.compare_code_impl(class_name)
if not class_name.endswith('ErrorTable') and not class_name.endswith('Types'):
assert 0 == test_utils.compare_code_impl(class_name)
assert 0 == test_utils.compare_code_headers(list_of)
assert 0 == test_utils.compare_code_impl(list_of)

Expand Down

0 comments on commit e5488c2

Please sign in to comment.