Skip to content

Commit

Permalink
[NF] Add record constructor tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
perost authored and OpenModelica-Hudson committed Dec 12, 2018
1 parent db3e5da commit 50c7598
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 0 deletions.
2 changes: 2 additions & 0 deletions flattening/modelica/scodeinst/Makefile
Expand Up @@ -658,6 +658,8 @@ RecordBinding1.mo \
RecordBinding2.mo \
RecordBinding3.mo \
RecordBinding4.mo \
RecordConstructor1.mo \
RecordConstructor2.mo \
RecordExtends1.mo \
RecordExtends2.mo \
RecursiveExtends1.mo \
Expand Down
28 changes: 28 additions & 0 deletions flattening/modelica/scodeinst/RecordConstructor1.mo
@@ -0,0 +1,28 @@
// name: RecordConstructor1
// keywords:
// status: correct
// cflags: -d=newInst
//

record R
Real x;
end R;

model RecordConstructor1
R r;
algorithm
r := R(time);
end RecordConstructor1;

// Result:
// function R "Automatically generated record constructor for R"
// input Real x;
// output R res;
// end R;
//
// class RecordConstructor1
// Real r.x;
// algorithm
// r := R(time);
// end RecordConstructor1;
// endResult
34 changes: 34 additions & 0 deletions flattening/modelica/scodeinst/RecordConstructor2.mo
@@ -0,0 +1,34 @@
// name: RecordConstructor2
// keywords:
// status: correct
// cflags: -d=newInst
//
// Checks that constants in a record becomes protected in the default
// constructor.
//

record R
Real x;
constant Real y = 1.0;
end R;

model RecordConstructor2
R r;
algorithm
r := R(time);
end RecordConstructor2;

// Result:
// function R "Automatically generated record constructor for R"
// input Real x;
// protected Real y = 1.0;
// output R res;
// end R;
//
// class RecordConstructor2
// Real r.x;
// constant Real r.y = 1.0;
// algorithm
// r := R(time);
// end RecordConstructor2;
// endResult

0 comments on commit 50c7598

Please sign in to comment.