Skip to content

Commit

Permalink
[NF] Added function evaluation tests with arrays.
Browse files Browse the repository at this point in the history
  • Loading branch information
perost authored and OpenModelica-Hudson committed May 9, 2018
1 parent c0e3759 commit ce77458
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 0 deletions.
25 changes: 25 additions & 0 deletions flattening/modelica/scodeinst/CevalFuncArray1.mo
@@ -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
27 changes: 27 additions & 0 deletions flattening/modelica/scodeinst/CevalFuncArray2.mo
@@ -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
25 changes: 25 additions & 0 deletions flattening/modelica/scodeinst/CevalFuncArray3.mo
@@ -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
3 changes: 3 additions & 0 deletions flattening/modelica/scodeinst/Makefile
Expand Up @@ -68,6 +68,8 @@ CevalExp1.mo \
CevalFill1.mo \
CevalFloor1.mo \
CevalFunc1.mo \
CevalFuncArray1.mo \
CevalFuncArray3.mo \
CevalFuncAssert1.mo \
CevalFuncAssert2.mo \
CevalFuncFor1.mo \
Expand Down Expand Up @@ -679,6 +681,7 @@ Wild1.mo \
# test that currently fail. Move up when fixed.
# Run make testfailing
FAILINGTESTFILES=\
CevalFuncArray2.mo \
ModClass6.mo \
IfExpression6.mo \
TupleOperation3.mo \
Expand Down

0 comments on commit ce77458

Please sign in to comment.