forked from OpenModelica/OpenModelica
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for OpenModelica/OMSimulator#1011
- Loading branch information
Showing
2 changed files
with
59 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// keywords: fmu export import | ||
// status: correct | ||
// teardown_command: rm -rf Enumeration3.lua Enum1.fmu Int1.fmu Enum1.log Int1.log Enumeration3_systemCall.log temp-Enumeration3/ | ||
// cflags: -d=-newInst | ||
|
||
loadString(" | ||
model Enum1 | ||
type E = enumeration(one, two, three); | ||
input E u; | ||
end Enum1; | ||
"); getErrorString(); | ||
|
||
loadString(" | ||
model Int1 | ||
output Integer y = 2; | ||
end Int1; | ||
"); getErrorString(); | ||
|
||
buildModelFMU(Enum1, version="2.0", fmuType="me", platforms={"static"}); getErrorString(); | ||
buildModelFMU(Int1, version="2.0", fmuType="me", platforms={"static"}); getErrorString(); | ||
|
||
writeFile("Enumeration3.lua", " | ||
oms_setCommandLineOption(\"--suppressPath=true\") | ||
oms_setTempDirectory(\"./temp-Enumeration3/\") | ||
|
||
oms_newModel(\"test\") | ||
oms_addSystem(\"test.root\", oms_system_sc) | ||
oms_addSubModel(\"test.root.A\", \"Int1.fmu\") | ||
oms_addSubModel(\"test.root.B\", \"Enum1.fmu\") | ||
oms_addConnection(\"test.root.B.u\", \"test.root.A.y\") | ||
oms_setResultFile(\"test\", \"\") | ||
|
||
oms_instantiate(\"test\") | ||
oms_initialize(\"test\") | ||
oms_simulate(\"test\") | ||
oms_terminate(\"test\") | ||
oms_delete(\"test\") | ||
"); getErrorString(); | ||
|
||
system(getInstallationDirectoryPath() + "/bin/OMSimulator Enumeration3.lua", "Enumeration3_systemCall.log"); | ||
readFile("Enumeration3_systemCall.log"); | ||
|
||
// Result: | ||
// true | ||
// "" | ||
// true | ||
// "" | ||
// "Enum1.fmu" | ||
// "" | ||
// "Int1.fmu" | ||
// "" | ||
// true | ||
// "" | ||
// 0 | ||
// "info: model doesn't contain any continuous state | ||
// info: No result file will be created | ||
// " | ||
// endResult |