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 clashes with reserved names
- Loading branch information
1 parent
2defa71
commit 7a939dc
Showing
2 changed files
with
49 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,48 @@ | ||
// name: nameClashTest | ||
// keywords: reserved names | ||
// status: correct | ||
// teardown_command: rm -f *NameClash.Test* | ||
|
||
setCommandLineOptions("+simCodeTarget=Cpp"); | ||
|
||
loadModel(Modelica); | ||
loadString(" | ||
package NameClash | ||
function f | ||
input Real simTime; | ||
output Real mydouble = simTime; // fixme: double does not work in functions! | ||
output Integer int = integer(simTime); | ||
output String string = String(simTime); | ||
end f; | ||
model Test | ||
Real simTime = time; | ||
Real double; | ||
Integer int; | ||
String string; | ||
equation | ||
(double, int, string) = f(simTime); | ||
annotation(experiment(StopTime = 0)); | ||
end Test; | ||
end NameClash; | ||
"); | ||
getErrorString(); | ||
|
||
simulate(NameClash.Test); | ||
val(double, 0); | ||
val(int, 0); | ||
getErrorString(); | ||
|
||
// Result: | ||
// true | ||
// true | ||
// true | ||
// "" | ||
// record SimulationResult | ||
// resultFile = "NameClash.Test_res.mat", | ||
// simulationOptions = "startTime = 0.0, stopTime = 0.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'NameClash.Test', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''", | ||
// messages = "" | ||
// end SimulationResult; | ||
// 0.0 | ||
// 0.0 | ||
// "" | ||
// endResult |