|
| 1 | +import OMPython |
| 2 | +import tempfile, shutil, os |
| 3 | +import pytest |
| 4 | + |
| 5 | + |
| 6 | +""" |
| 7 | +do not change the prefix class name, the class name should have prefix "Test" |
| 8 | +according to the documenation of pytest |
| 9 | +""" |
| 10 | +class Test_FMIRegression: |
| 11 | + |
| 12 | + def checkModel(self, modelName): |
| 13 | + mod = OMPython.ModelicaSystem(modelName=modelName) |
| 14 | + fileNamePrefix = modelName.split(".")[-1] |
| 15 | + fmu = mod.convertMo2Fmu(fileNamePrefix=fileNamePrefix) |
| 16 | + assert True == os.path.exists(fmu) |
| 17 | + shutil.rmtree(mod.getWorkDirectory(), ignore_errors=True) |
| 18 | + mod.__del__() |
| 19 | + |
| 20 | + |
| 21 | + def test_Modelica_Blocks_Examples_Filter(self): |
| 22 | + self.checkModel("Modelica.Blocks.Examples.Filter") |
| 23 | + |
| 24 | + def test_Modelica_Blocks_Examples_RealNetwork1(self): |
| 25 | + self.checkModel("Modelica.Blocks.Examples.RealNetwork1") |
| 26 | + |
| 27 | + def test_Modelica_Electrical_Analog_Examples_CauerLowPassAnalog(self): |
| 28 | + self.checkModel("Modelica.Electrical.Analog.Examples.CauerLowPassAnalog") |
| 29 | + |
| 30 | + def test_Modelica_Electrical_Digital_Examples_FlipFlop(self): |
| 31 | + self.checkModel("Modelica.Electrical.Digital.Examples.FlipFlop") |
| 32 | + |
| 33 | + def test_Modelica_Mechanics_Rotational_Examples_FirstGrounded(self): |
| 34 | + self.checkModel("Modelica.Mechanics.Rotational.Examples.FirstGrounded") |
| 35 | + |
| 36 | + def test_Modelica_Mechanics_Rotational_Examples_CoupledClutches(self): |
| 37 | + self.checkModel("Modelica.Mechanics.Rotational.Examples.CoupledClutches") |
| 38 | + |
| 39 | + def test_Modelica_Mechanics_MultiBody_Examples_Elementary_DoublePendulum(self): |
| 40 | + self.checkModel("Modelica.Mechanics.MultiBody.Examples.Elementary.DoublePendulum") |
| 41 | + |
| 42 | + def test_Modelica_Mechanics_MultiBody_Examples_Elementary_FreeBody(self): |
| 43 | + self.checkModel("Modelica.Mechanics.MultiBody.Examples.Elementary.FreeBody") |
| 44 | + |
| 45 | + def test_Modelica_Fluid_Examples_PumpingSystem(self): |
| 46 | + self.checkModel("Modelica.Fluid.Examples.PumpingSystem") |
| 47 | + |
| 48 | + def test_Modelica_Fluid_Examples_TraceSubstances_RoomCO2WithControls(self): |
| 49 | + self.checkModel("Modelica.Fluid.Examples.TraceSubstances.RoomCO2WithControls") |
| 50 | + |
| 51 | + def test_Modelica_Clocked_Examples_SimpleControlledDrive_ClockedWithDiscreteTextbookController(self): |
| 52 | + self.checkModel("Modelica.Clocked.Examples.SimpleControlledDrive.ClockedWithDiscreteTextbookController") |
| 53 | + |
0 commit comments