Skip to content

Commit

Permalink
[NF] Add record binding tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
perost authored and OpenModelica-Hudson committed Mar 23, 2018
1 parent 71a15a1 commit a96f71d
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
2 changes: 2 additions & 0 deletions flattening/modelica/scodeinst/Makefile
Expand Up @@ -507,6 +507,8 @@ RangeInvalidStep3.mo \
RangeTypeError1.mo \
RangeTypeError2.mo \
RangeTypeError3.mo \
RecordBinding1.mo \
RecordBinding2.mo \
RecursiveExtends1.mo \
RecursiveExtends3.mo \
RedeclareClass1.mo \
Expand Down
23 changes: 23 additions & 0 deletions flattening/modelica/scodeinst/RecordBinding1.mo
@@ -0,0 +1,23 @@
// name: RecordBinding1
// keywords:
// status: correct
// cflags: -d=newInst
//

record R
Real x = 1.0;
Real y = 2.0;
Real z = 3.0;
end R;

model RecordBinding1
R r = R(4.0, 5.0);
end RecordBinding1;

// Result:
// class RecordBinding1
// Real r.x = 4.0;
// Real r.y = 5.0;
// Real r.z = 3.0;
// end RecordBinding1;
// endResult
29 changes: 29 additions & 0 deletions flattening/modelica/scodeinst/RecordBinding2.mo
@@ -0,0 +1,29 @@
// name: RecordBinding2
// keywords:
// status: correct
// cflags: -d=newInst
//

record R
Real x = 1.0;
Real y = 2.0;
Real z = 3.0;
end R;

model RecordBinding2
R r[2] = {R(4.0, 5.0), R(6.0, 7.0)};
end RecordBinding2;

// Result:
// class RecordBinding2
// Real r[1].x;
// Real r[1].y;
// Real r[1].z;
// Real r[2].x;
// Real r[2].y;
// Real r[2].z;
// equation
// r[1] = R.'constructor'.'$default'(4.0, 5.0, 3.0);
// r[2] = R.'constructor'.'$default'(6.0, 7.0, 3.0);
// end RecordBinding2;
// endResult

0 comments on commit a96f71d

Please sign in to comment.