Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions buildingspy/CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
BuildingsPy Changelog
---------------------


Version 5.2.1, ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

- In buildingspy/development/regressiontest.py, added test for OpenModelica and
OPTIMICA CI testing that issues an error if a pure function calls an impure function.
(https://github.com/lbl-srg/BuildingsPy/issues/607)

Version 5.2.0, March 14, 2025
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down
2 changes: 1 addition & 1 deletion buildingspy/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.2.0
5.2.1
5 changes: 5 additions & 0 deletions buildingspy/development/error_dictionary_openmodelica.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,8 @@ def __init__(self):
'tool_message': "Non-array modification",
'counter': 0,
'summary_message': "Number of models with missing 'each' : {}\n"}

self._error_dict["pure calling impure function"] = {
'tool_message': "call to impure function",
'counter': 0,
'summary_message': "Number of models in which pure function calls impure function: {}\n"}
6 changes: 6 additions & 0 deletions buildingspy/development/error_dictionary_optimica.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,9 @@ def __init__(self):
'tool_message': "Integer, using Real instead",
'counter': 0,
'summary_message': "Number of models with too large Integers : {}\n"}

# Check for pure function calling impure function
self._error_dict["pure calling impure function"] = {
'tool_message': "Call to impure function",
'counter': 0,
'summary_message': "Number of models in which pure function calls impure function: {}\n"}
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,16 @@ def test_regressiontest_diagnostics(self):
'mo_content': """Real x(start=0);
equation
Modelica.Math.exp(x)=-1;""",
'description': "Model that has no solution."}
'description': "Model that has no solution."},
{'ret_val': 1,
'mo_content': """
function aPureFunction
algorithm
Modelica.Utilities.Streams.print("Hello");
end aPureFunction;
equation
aPureFunction();""",
'description': "Model in which a pure function calls an impure function."}
]
# Run all test cases
for test in tests:
Expand Down
11 changes: 10 additions & 1 deletion buildingspy/tests/test_development_regressiontest_optimica.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,16 @@ def test_regressiontest_diagnostics(self):
'mo_content': """Real x(start=0);
equation
Modelica.Math.exp(x)=-1;""",
'description': "Model that has no solution."}
'description': "Model that has no solution."},
{'ret_val': 1,
'mo_content': """
function aPureFunction
algorithm
Modelica.Utilities.Streams.print("Hello");
end aPureFunction;
equation
aPureFunction();""",
'description': "Model in which a pure function calls an impure function."}
]
# Run all test cases
for test in tests:
Expand Down