Skip to content

Commit 7dd33ff

Browse files
perostOpenModelica-Hudson
authored andcommitted
[NF] Update tests.
Belonging to [master]: - OpenModelica/OMCompiler#2984 - OpenModelica/OpenModelica-testsuite#1142
1 parent 8a7ebb7 commit 7dd33ff

File tree

4 files changed

+48
-6
lines changed

4 files changed

+48
-6
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// name: FuncViaComp2
2+
// keywords:
3+
// status: correct
4+
// cflags: -d=newInst
5+
//
6+
//
7+
8+
function f
9+
input Real x;
10+
output Real y = x;
11+
end f;
12+
13+
model M
14+
Real mx;
15+
function mf = f(x = mx);
16+
Real my = mf();
17+
end M;
18+
19+
model FuncViaComp2
20+
M m;
21+
M m2;
22+
end FuncViaComp2;
23+
24+
// Result:
25+
// function FuncViaComp2.m.mf
26+
// input Real x = m.mx;
27+
// output Real y = x;
28+
// end FuncViaComp2.m.mf;
29+
//
30+
// function FuncViaComp2.m2.mf
31+
// input Real x = m2.mx;
32+
// output Real y = x;
33+
// end FuncViaComp2.m2.mf;
34+
//
35+
// class FuncViaComp2
36+
// Real m.mx;
37+
// Real m.my = FuncViaComp2.m.mf(m.mx);
38+
// Real m2.mx;
39+
// Real m2.my = FuncViaComp2.m2.mf(m2.mx);
40+
// end FuncViaComp2;
41+
// endResult

flattening/modelica/scodeinst/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@ FuncUnknownDim1.mo \
485485
FuncUnknownDim2.mo \
486486
FuncVariability.mo \
487487
FuncViaComp.mo \
488+
FuncViaComp2.mo \
488489
FuncVectorization1.mo \
489490
FuncVectorization2.mo \
490491
FuncVectorization3.mo \
@@ -722,6 +723,8 @@ redeclare13.mo \
722723
redeclare2.mo \
723724
redeclare3.mo \
724725
redeclare4.mo \
726+
redeclare5.mo \
727+
redeclare6.mo \
725728
redeclare7.mo \
726729
redeclare9.mo \
727730
ReductionInvalidTypeSum.mo \
@@ -883,8 +886,6 @@ loop4.mo \
883886
PartialInst.mo \
884887
PropagateRedeclareMod1.mo \
885888
RecursiveExtends2.mo \
886-
redeclare5.mo \
887-
redeclare6.mo \
888889
redeclare8.mo \
889890
type4.mo \
890891
type5.mo \

flattening/modelica/scodeinst/TestSampleNoClock.mos

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ instantiateModel(Modelica.Blocks.Examples.BooleanNetwork1); getErrorString();
1212
// Result:
1313
// true
1414
// ""
15-
// "function Modelica.Blocks.Sources.BooleanTable.getFirstIndex \"Get first index of table and check table\"
15+
// "function Modelica.Blocks.Examples.BooleanNetwork1.booleanTable.getFirstIndex \"Get first index of table and check table\"
1616
// input Real[:] table \"Vector of time instants\";
1717
// input Real simulationStartTime(quantity = \"Time\", unit = \"s\") \"Simulation start time\";
1818
// input Boolean startValue \"Value of y for time < table[1]\";
@@ -52,7 +52,7 @@ instantiateModel(Modelica.Blocks.Examples.BooleanNetwork1); getErrorString();
5252
// end if;
5353
// index := j;
5454
// end if;
55-
// end Modelica.Blocks.Sources.BooleanTable.getFirstIndex;
55+
// end Modelica.Blocks.Examples.BooleanNetwork1.booleanTable.getFirstIndex;
5656
//
5757
// function Modelica.Math.BooleanVectors.allTrue \"Returns true, if all elements of the Boolean input vector are true ('and')\"
5858
// input Boolean[:] b \"Boolean vector\";
@@ -246,7 +246,7 @@ instantiateModel(Modelica.Blocks.Examples.BooleanNetwork1); getErrorString();
246246
// pre(triggeredAdd.y) = triggeredAdd.y_start;
247247
// pre(rSFlipFlop.pre.u) = rSFlipFlop.pre.pre_u_start;
248248
// initial algorithm
249-
// (booleanTable.index, booleanTable.nextTime, booleanTable.y) := Modelica.Blocks.Sources.BooleanTable.getFirstIndex(booleanTable.table, time, booleanTable.startValue);
249+
// (booleanTable.index, booleanTable.nextTime, booleanTable.y) := Modelica.Blocks.Examples.BooleanNetwork1.booleanTable.getFirstIndex(booleanTable.table, time, booleanTable.startValue);
250250
// equation
251251
// showValue.activePort = showValue.showActive;
252252
// showValue2.activePort = showValue2.showActive;

flattening/modelica/scodeinst/func2.mo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ end B;
2020

2121
// Result:
2222
// Error processing file: func2.mo
23-
// [flattening/modelica/scodeinst/func2.mo:12:3-12:15:writable] Error: Type mismatch in binding x = A.f(), expected subtype of Real, got type ().
23+
// [flattening/modelica/scodeinst/func2.mo:12:3-12:15:writable] Error: Type mismatch in binding x = B.a.f(), expected subtype of Real, got type ().
2424
//
2525
// # Error encountered! Exiting...
2626
// # Please check the error message and the flags.

0 commit comments

Comments
 (0)