-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Renamed some variables and replaced os.path with pathlib
- Loading branch information
Showing
7 changed files
with
61 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 34 additions & 32 deletions
66
tests/CMakeTests/tests/Utils/get_exported_function_list.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,19 @@ | ||
import re | ||
import json | ||
import pytest | ||
import os | ||
from pathlib import Path | ||
import Utils.get_exported_function_list as get_exported_function_list | ||
|
||
struct_json_file_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../testcases/ExportedFunctionList.json") | ||
exported_functions_json_file_path = Path(__file__).parent.parent / "testcases" / "ExportedFunctionList.json" | ||
|
||
def read_json(filepath): | ||
with open(filepath, 'r') as file: | ||
test_data = json.load(file) | ||
return test_data | ||
|
||
exported_function_list, function_map = get_exported_function_list.getFunctionSignatureList() | ||
# function_map = get_exported_function_list.get_function_map(exported_function_list) | ||
parsed_exported_function_list, parsed_function_map = get_exported_function_list.getFunctionSignatureList() | ||
|
||
@pytest.mark.parametrize('function', read_json(struct_json_file_path)['signatures']) | ||
def test_functions(function): | ||
test_input = function_map.get(function['function_name']) | ||
expected_output = {"function_name": function["function_name"], "return_type": function["return_type"], "parameter_list": function["parameter_list"]} | ||
assert test_input == expected_output | ||
@pytest.mark.parametrize('function_signature', read_json(exported_functions_json_file_path)['signatures']) | ||
def test_function_compatibility(function_signature): | ||
test_input = parsed_function_map.get(function_signature['function_name']) | ||
expected_output = {"function_name": function_signature["function_name"], "return_type": function_signature["return_type"], "parameter_list": function_signature["parameter_list"]} | ||
assert test_input == expected_output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters