Skip to content

Commit c4ac6df

Browse files
committed
tests from v4.0.0
1 parent aea9da5 commit c4ac6df

12 files changed

Lines changed: 889 additions & 0 deletions

tests_v400/__init__.py

Whitespace-only changes.

tests_v400/test_ArrayDimension.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import OMPython
2+
3+
4+
def test_ArrayDimension(tmp_path):
5+
omc = OMPython.OMCSessionZMQ()
6+
7+
omc.sendExpression(f'cd("{tmp_path.as_posix()}")')
8+
9+
omc.sendExpression('loadString("model A Integer x[5+1,1+6]; end A;")')
10+
omc.sendExpression("getErrorString()")
11+
12+
result = omc.sendExpression("getComponents(A)")
13+
assert result[0][-1] == (6, 7), "array dimension does not match"
14+
15+
omc.sendExpression('loadString("model A Integer y = 5; Integer x[y+1,1+9]; end A;")')
16+
omc.sendExpression("getErrorString()")
17+
18+
result = omc.sendExpression("getComponents(A)")
19+
assert result[-1][-1] == ('y+1', 10), "array dimension does not match"

tests_v400/test_FMIExport.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import OMPython
2+
import shutil
3+
import os
4+
5+
6+
def test_CauerLowPassAnalog():
7+
mod = OMPython.ModelicaSystem(modelName="Modelica.Electrical.Analog.Examples.CauerLowPassAnalog",
8+
lmodel=["Modelica"])
9+
tmp = mod.getWorkDirectory()
10+
try:
11+
fmu = mod.convertMo2Fmu(fileNamePrefix="CauerLowPassAnalog")
12+
assert os.path.exists(fmu)
13+
finally:
14+
shutil.rmtree(tmp, ignore_errors=True)
15+
16+
17+
def test_DrumBoiler():
18+
mod = OMPython.ModelicaSystem(modelName="Modelica.Fluid.Examples.DrumBoiler.DrumBoiler", lmodel=["Modelica"])
19+
tmp = mod.getWorkDirectory()
20+
try:
21+
fmu = mod.convertMo2Fmu(fileNamePrefix="DrumBoiler")
22+
assert os.path.exists(fmu)
23+
finally:
24+
shutil.rmtree(tmp, ignore_errors=True)

0 commit comments

Comments
 (0)