Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NF] Added function evaluation tests with arrays.
Belonging to [master]: - OpenModelica/OMCompiler#2421 - OpenModelica/OpenModelica-testsuite#942
- Loading branch information
1 parent
c0e3759
commit ce77458
Showing
4 changed files
with
80 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,25 @@ | ||
// name: CevalFuncArray1 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
// | ||
|
||
function f | ||
input Real x[3]; | ||
output Real y[3]; | ||
algorithm | ||
y := x; | ||
end f; | ||
|
||
model CevalFuncArray1 | ||
constant Real x[:] = f({1, 2, 3}); | ||
end CevalFuncArray1; | ||
|
||
// Result: | ||
// class CevalFuncArray1 | ||
// constant Real x[1] = 1.0; | ||
// constant Real x[2] = 2.0; | ||
// constant Real x[3] = 3.0; | ||
// end CevalFuncArray1; | ||
// 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,27 @@ | ||
// name: CevalFuncArray2 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
// | ||
|
||
function f | ||
input Real x[3]; | ||
output Real y[3]; | ||
algorithm | ||
y[1] := x[1]; | ||
y[2] := x[2]; | ||
y[3] := x[3]; | ||
end f; | ||
|
||
model CevalFuncArray2 | ||
constant Real x[:] = f({1, 2, 3}); | ||
end CevalFuncArray2; | ||
|
||
// Result: | ||
// class CevalFuncArray2 | ||
// constant Real x[1] = 1.0; | ||
// constant Real x[2] = 2.0; | ||
// constant Real x[3] = 3.0; | ||
// end CevalFuncArray2; | ||
// 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,25 @@ | ||
// name: CevalFuncArray3 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
// | ||
|
||
function f | ||
input Real x[3]; | ||
output Real y[3]; | ||
algorithm | ||
y := {x[1], x[2], x[3]}; | ||
end f; | ||
|
||
model CevalFuncArray3 | ||
constant Real x[:] = f({1, 2, 3}); | ||
end CevalFuncArray3; | ||
|
||
// Result: | ||
// class CevalFuncArray3 | ||
// constant Real x[1] = 1.0; | ||
// constant Real x[2] = 2.0; | ||
// constant Real x[3] = 3.0; | ||
// end CevalFuncArray3; | ||
// 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