Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NF] More test for records in function evaluation.
Belonging to [master]: - OpenModelica/OMCompiler#2415 - OpenModelica/OpenModelica-testsuite#941
- Loading branch information
1 parent
83fe9fa
commit c0e3759
Showing
4 changed files
with
99 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// name: CevalFuncRecord2 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
// | ||
|
||
record R | ||
Real x; | ||
Real y; | ||
end R; | ||
|
||
function f | ||
input Real x; | ||
input Real y; | ||
output R r; | ||
algorithm | ||
r.x := x; | ||
r.y := y; | ||
end f; | ||
|
||
model CevalFuncRecord2 | ||
parameter R r = f(1.0, 2.0); | ||
end CevalFuncRecord2; | ||
|
||
// Result: | ||
// class CevalFuncRecord2 | ||
// parameter Real r.x = 1.0; | ||
// parameter Real r.y = 2.0; | ||
// end CevalFuncRecord2; | ||
// endResult |
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,33 @@ | ||
// name: CevalFuncRecord2 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
// | ||
|
||
record R | ||
Real x; | ||
Real y; | ||
end R; | ||
|
||
function f | ||
input R inR; | ||
output R outR; | ||
algorithm | ||
outR.x := inR.x; | ||
outR.y := inR.y; | ||
end f; | ||
|
||
model CevalFuncRecord2 | ||
parameter R r1; | ||
parameter R r2 = f(r1); | ||
end CevalFuncRecord2; | ||
|
||
// Result: | ||
// class CevalFuncRecord2 | ||
// parameter Real r1.x; | ||
// parameter Real r1.y; | ||
// parameter Real r2.x = r1.x; | ||
// parameter Real r2.y = r1.y; | ||
// end CevalFuncRecord2; | ||
// endResult |
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,32 @@ | ||
// name: CevalFuncRecord4 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
// | ||
|
||
record R | ||
Real x; | ||
Real y; | ||
end R; | ||
|
||
function f | ||
input R inR; | ||
output R outR; | ||
algorithm | ||
outR := inR; | ||
end f; | ||
|
||
model CevalFuncRecord4 | ||
parameter R r1; | ||
parameter R r2 = f(r1); | ||
end CevalFuncRecord4; | ||
|
||
// Result: | ||
// class CevalFuncRecord4 | ||
// parameter Real r1.x; | ||
// parameter Real r1.y; | ||
// parameter Real r2.x = r1.x; | ||
// parameter Real r2.y = r1.y; | ||
// end CevalFuncRecord4; | ||
// endResult |
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