Skip to content

Commit

Permalink
Updated nfinst test cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
perost authored and OpenModelica-Hudson committed Sep 20, 2017
1 parent d85ad38 commit 13c08d4
Show file tree
Hide file tree
Showing 33 changed files with 563 additions and 348 deletions.
25 changes: 25 additions & 0 deletions flattening/modelica/scodeinst/EnumRangeBinding1.mo
@@ -0,0 +1,25 @@
// name: EnumRangeBinding1
// keywords:
// status: correct
// cflags: -d=newInst
//

model EnumRangeBinding1
type E = enumeration(one, two, three, four);
E e1[E] = E.one:E.four;
E e2[2] = E.two:E.three;
end EnumRangeBinding1;

// Result:
// class EnumRangeBinding1
// enumeration(one, two, three, four) e1[E.one];
// enumeration(one, two, three, four) e1[E.two];
// enumeration(one, two, three, four) e1[E.three];
// enumeration(one, two, three, four) e1[E.four];
// enumeration(one, two, three, four) e2[1];
// enumeration(one, two, three, four) e2[2];
// equation
// e1 = {E.one, E.two, E.three, E.four};
// e2 = {E.two, E.three};
// end EnumRangeBinding1;
// endResult
236 changes: 236 additions & 0 deletions flattening/modelica/scodeinst/EquationQualified1.mo
@@ -0,0 +1,236 @@
// name: EquationQualified1
// keywords:
// status: correct
// cflags: -d=newInst
//
//

model A
Real x[3, 2, 1];
end A;

model B
A a[1, 3];
end B;

model EquationQualified1
B b[2, 5];
equation
b[1].a[1].x[2] = b[2].a[1].x[2];
end EquationQualified1;

// Result:
// class EquationQualified1
// Real b[1,1].a[1,1].x[1,1,1];
// Real b[1,1].a[1,1].x[1,2,1];
// Real b[1,1].a[1,1].x[2,1,1];
// Real b[1,1].a[1,1].x[2,2,1];
// Real b[1,1].a[1,1].x[3,1,1];
// Real b[1,1].a[1,1].x[3,2,1];
// Real b[1,1].a[1,2].x[1,1,1];
// Real b[1,1].a[1,2].x[1,2,1];
// Real b[1,1].a[1,2].x[2,1,1];
// Real b[1,1].a[1,2].x[2,2,1];
// Real b[1,1].a[1,2].x[3,1,1];
// Real b[1,1].a[1,2].x[3,2,1];
// Real b[1,1].a[1,3].x[1,1,1];
// Real b[1,1].a[1,3].x[1,2,1];
// Real b[1,1].a[1,3].x[2,1,1];
// Real b[1,1].a[1,3].x[2,2,1];
// Real b[1,1].a[1,3].x[3,1,1];
// Real b[1,1].a[1,3].x[3,2,1];
// Real b[1,2].a[1,1].x[1,1,1];
// Real b[1,2].a[1,1].x[1,2,1];
// Real b[1,2].a[1,1].x[2,1,1];
// Real b[1,2].a[1,1].x[2,2,1];
// Real b[1,2].a[1,1].x[3,1,1];
// Real b[1,2].a[1,1].x[3,2,1];
// Real b[1,2].a[1,2].x[1,1,1];
// Real b[1,2].a[1,2].x[1,2,1];
// Real b[1,2].a[1,2].x[2,1,1];
// Real b[1,2].a[1,2].x[2,2,1];
// Real b[1,2].a[1,2].x[3,1,1];
// Real b[1,2].a[1,2].x[3,2,1];
// Real b[1,2].a[1,3].x[1,1,1];
// Real b[1,2].a[1,3].x[1,2,1];
// Real b[1,2].a[1,3].x[2,1,1];
// Real b[1,2].a[1,3].x[2,2,1];
// Real b[1,2].a[1,3].x[3,1,1];
// Real b[1,2].a[1,3].x[3,2,1];
// Real b[1,3].a[1,1].x[1,1,1];
// Real b[1,3].a[1,1].x[1,2,1];
// Real b[1,3].a[1,1].x[2,1,1];
// Real b[1,3].a[1,1].x[2,2,1];
// Real b[1,3].a[1,1].x[3,1,1];
// Real b[1,3].a[1,1].x[3,2,1];
// Real b[1,3].a[1,2].x[1,1,1];
// Real b[1,3].a[1,2].x[1,2,1];
// Real b[1,3].a[1,2].x[2,1,1];
// Real b[1,3].a[1,2].x[2,2,1];
// Real b[1,3].a[1,2].x[3,1,1];
// Real b[1,3].a[1,2].x[3,2,1];
// Real b[1,3].a[1,3].x[1,1,1];
// Real b[1,3].a[1,3].x[1,2,1];
// Real b[1,3].a[1,3].x[2,1,1];
// Real b[1,3].a[1,3].x[2,2,1];
// Real b[1,3].a[1,3].x[3,1,1];
// Real b[1,3].a[1,3].x[3,2,1];
// Real b[1,4].a[1,1].x[1,1,1];
// Real b[1,4].a[1,1].x[1,2,1];
// Real b[1,4].a[1,1].x[2,1,1];
// Real b[1,4].a[1,1].x[2,2,1];
// Real b[1,4].a[1,1].x[3,1,1];
// Real b[1,4].a[1,1].x[3,2,1];
// Real b[1,4].a[1,2].x[1,1,1];
// Real b[1,4].a[1,2].x[1,2,1];
// Real b[1,4].a[1,2].x[2,1,1];
// Real b[1,4].a[1,2].x[2,2,1];
// Real b[1,4].a[1,2].x[3,1,1];
// Real b[1,4].a[1,2].x[3,2,1];
// Real b[1,4].a[1,3].x[1,1,1];
// Real b[1,4].a[1,3].x[1,2,1];
// Real b[1,4].a[1,3].x[2,1,1];
// Real b[1,4].a[1,3].x[2,2,1];
// Real b[1,4].a[1,3].x[3,1,1];
// Real b[1,4].a[1,3].x[3,2,1];
// Real b[1,5].a[1,1].x[1,1,1];
// Real b[1,5].a[1,1].x[1,2,1];
// Real b[1,5].a[1,1].x[2,1,1];
// Real b[1,5].a[1,1].x[2,2,1];
// Real b[1,5].a[1,1].x[3,1,1];
// Real b[1,5].a[1,1].x[3,2,1];
// Real b[1,5].a[1,2].x[1,1,1];
// Real b[1,5].a[1,2].x[1,2,1];
// Real b[1,5].a[1,2].x[2,1,1];
// Real b[1,5].a[1,2].x[2,2,1];
// Real b[1,5].a[1,2].x[3,1,1];
// Real b[1,5].a[1,2].x[3,2,1];
// Real b[1,5].a[1,3].x[1,1,1];
// Real b[1,5].a[1,3].x[1,2,1];
// Real b[1,5].a[1,3].x[2,1,1];
// Real b[1,5].a[1,3].x[2,2,1];
// Real b[1,5].a[1,3].x[3,1,1];
// Real b[1,5].a[1,3].x[3,2,1];
// Real b[2,1].a[1,1].x[1,1,1];
// Real b[2,1].a[1,1].x[1,2,1];
// Real b[2,1].a[1,1].x[2,1,1];
// Real b[2,1].a[1,1].x[2,2,1];
// Real b[2,1].a[1,1].x[3,1,1];
// Real b[2,1].a[1,1].x[3,2,1];
// Real b[2,1].a[1,2].x[1,1,1];
// Real b[2,1].a[1,2].x[1,2,1];
// Real b[2,1].a[1,2].x[2,1,1];
// Real b[2,1].a[1,2].x[2,2,1];
// Real b[2,1].a[1,2].x[3,1,1];
// Real b[2,1].a[1,2].x[3,2,1];
// Real b[2,1].a[1,3].x[1,1,1];
// Real b[2,1].a[1,3].x[1,2,1];
// Real b[2,1].a[1,3].x[2,1,1];
// Real b[2,1].a[1,3].x[2,2,1];
// Real b[2,1].a[1,3].x[3,1,1];
// Real b[2,1].a[1,3].x[3,2,1];
// Real b[2,2].a[1,1].x[1,1,1];
// Real b[2,2].a[1,1].x[1,2,1];
// Real b[2,2].a[1,1].x[2,1,1];
// Real b[2,2].a[1,1].x[2,2,1];
// Real b[2,2].a[1,1].x[3,1,1];
// Real b[2,2].a[1,1].x[3,2,1];
// Real b[2,2].a[1,2].x[1,1,1];
// Real b[2,2].a[1,2].x[1,2,1];
// Real b[2,2].a[1,2].x[2,1,1];
// Real b[2,2].a[1,2].x[2,2,1];
// Real b[2,2].a[1,2].x[3,1,1];
// Real b[2,2].a[1,2].x[3,2,1];
// Real b[2,2].a[1,3].x[1,1,1];
// Real b[2,2].a[1,3].x[1,2,1];
// Real b[2,2].a[1,3].x[2,1,1];
// Real b[2,2].a[1,3].x[2,2,1];
// Real b[2,2].a[1,3].x[3,1,1];
// Real b[2,2].a[1,3].x[3,2,1];
// Real b[2,3].a[1,1].x[1,1,1];
// Real b[2,3].a[1,1].x[1,2,1];
// Real b[2,3].a[1,1].x[2,1,1];
// Real b[2,3].a[1,1].x[2,2,1];
// Real b[2,3].a[1,1].x[3,1,1];
// Real b[2,3].a[1,1].x[3,2,1];
// Real b[2,3].a[1,2].x[1,1,1];
// Real b[2,3].a[1,2].x[1,2,1];
// Real b[2,3].a[1,2].x[2,1,1];
// Real b[2,3].a[1,2].x[2,2,1];
// Real b[2,3].a[1,2].x[3,1,1];
// Real b[2,3].a[1,2].x[3,2,1];
// Real b[2,3].a[1,3].x[1,1,1];
// Real b[2,3].a[1,3].x[1,2,1];
// Real b[2,3].a[1,3].x[2,1,1];
// Real b[2,3].a[1,3].x[2,2,1];
// Real b[2,3].a[1,3].x[3,1,1];
// Real b[2,3].a[1,3].x[3,2,1];
// Real b[2,4].a[1,1].x[1,1,1];
// Real b[2,4].a[1,1].x[1,2,1];
// Real b[2,4].a[1,1].x[2,1,1];
// Real b[2,4].a[1,1].x[2,2,1];
// Real b[2,4].a[1,1].x[3,1,1];
// Real b[2,4].a[1,1].x[3,2,1];
// Real b[2,4].a[1,2].x[1,1,1];
// Real b[2,4].a[1,2].x[1,2,1];
// Real b[2,4].a[1,2].x[2,1,1];
// Real b[2,4].a[1,2].x[2,2,1];
// Real b[2,4].a[1,2].x[3,1,1];
// Real b[2,4].a[1,2].x[3,2,1];
// Real b[2,4].a[1,3].x[1,1,1];
// Real b[2,4].a[1,3].x[1,2,1];
// Real b[2,4].a[1,3].x[2,1,1];
// Real b[2,4].a[1,3].x[2,2,1];
// Real b[2,4].a[1,3].x[3,1,1];
// Real b[2,4].a[1,3].x[3,2,1];
// Real b[2,5].a[1,1].x[1,1,1];
// Real b[2,5].a[1,1].x[1,2,1];
// Real b[2,5].a[1,1].x[2,1,1];
// Real b[2,5].a[1,1].x[2,2,1];
// Real b[2,5].a[1,1].x[3,1,1];
// Real b[2,5].a[1,1].x[3,2,1];
// Real b[2,5].a[1,2].x[1,1,1];
// Real b[2,5].a[1,2].x[1,2,1];
// Real b[2,5].a[1,2].x[2,1,1];
// Real b[2,5].a[1,2].x[2,2,1];
// Real b[2,5].a[1,2].x[3,1,1];
// Real b[2,5].a[1,2].x[3,2,1];
// Real b[2,5].a[1,3].x[1,1,1];
// Real b[2,5].a[1,3].x[1,2,1];
// Real b[2,5].a[1,3].x[2,1,1];
// Real b[2,5].a[1,3].x[2,2,1];
// Real b[2,5].a[1,3].x[3,1,1];
// Real b[2,5].a[1,3].x[3,2,1];
// equation
// b[1,1].a[1,1].x[2,1,1] = b[2,1].a[1,1].x[2,1,1];
// b[1,1].a[1,1].x[2,2,1] = b[2,1].a[1,1].x[2,2,1];
// b[1,1].a[1,2].x[2,1,1] = b[2,1].a[1,2].x[2,1,1];
// b[1,1].a[1,2].x[2,2,1] = b[2,1].a[1,2].x[2,2,1];
// b[1,1].a[1,3].x[2,1,1] = b[2,1].a[1,3].x[2,1,1];
// b[1,1].a[1,3].x[2,2,1] = b[2,1].a[1,3].x[2,2,1];
// b[1,2].a[1,1].x[2,1,1] = b[2,2].a[1,1].x[2,1,1];
// b[1,2].a[1,1].x[2,2,1] = b[2,2].a[1,1].x[2,2,1];
// b[1,2].a[1,2].x[2,1,1] = b[2,2].a[1,2].x[2,1,1];
// b[1,2].a[1,2].x[2,2,1] = b[2,2].a[1,2].x[2,2,1];
// b[1,2].a[1,3].x[2,1,1] = b[2,2].a[1,3].x[2,1,1];
// b[1,2].a[1,3].x[2,2,1] = b[2,2].a[1,3].x[2,2,1];
// b[1,3].a[1,1].x[2,1,1] = b[2,3].a[1,1].x[2,1,1];
// b[1,3].a[1,1].x[2,2,1] = b[2,3].a[1,1].x[2,2,1];
// b[1,3].a[1,2].x[2,1,1] = b[2,3].a[1,2].x[2,1,1];
// b[1,3].a[1,2].x[2,2,1] = b[2,3].a[1,2].x[2,2,1];
// b[1,3].a[1,3].x[2,1,1] = b[2,3].a[1,3].x[2,1,1];
// b[1,3].a[1,3].x[2,2,1] = b[2,3].a[1,3].x[2,2,1];
// b[1,4].a[1,1].x[2,1,1] = b[2,4].a[1,1].x[2,1,1];
// b[1,4].a[1,1].x[2,2,1] = b[2,4].a[1,1].x[2,2,1];
// b[1,4].a[1,2].x[2,1,1] = b[2,4].a[1,2].x[2,1,1];
// b[1,4].a[1,2].x[2,2,1] = b[2,4].a[1,2].x[2,2,1];
// b[1,4].a[1,3].x[2,1,1] = b[2,4].a[1,3].x[2,1,1];
// b[1,4].a[1,3].x[2,2,1] = b[2,4].a[1,3].x[2,2,1];
// b[1,5].a[1,1].x[2,1,1] = b[2,5].a[1,1].x[2,1,1];
// b[1,5].a[1,1].x[2,2,1] = b[2,5].a[1,1].x[2,2,1];
// b[1,5].a[1,2].x[2,1,1] = b[2,5].a[1,2].x[2,1,1];
// b[1,5].a[1,2].x[2,2,1] = b[2,5].a[1,2].x[2,2,1];
// b[1,5].a[1,3].x[2,1,1] = b[2,5].a[1,3].x[2,1,1];
// b[1,5].a[1,3].x[2,2,1] = b[2,5].a[1,3].x[2,2,1];
// end EquationQualified1;
// endResult
14 changes: 7 additions & 7 deletions flattening/modelica/scodeinst/FuncBuiltinCross.mo
Expand Up @@ -11,11 +11,11 @@ model FuncBuiltinCross
end FuncBuiltinCross;

// Result:
// Error processing file: FuncBuiltinCross.mo
// Error: Internal error Instantiation of FuncBuiltinCross failed with no error message.
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// class FuncBuiltinCross
// Real x[1];
// Real x[2];
// Real x[3];
// equation
// x = cross({1.0, 2.0, 3.0}, {4.0, 5.0, 6.0});
// end FuncBuiltinCross;
// endResult
2 changes: 1 addition & 1 deletion flattening/modelica/scodeinst/FuncBuiltinReduction.mo
Expand Up @@ -36,7 +36,7 @@ model FuncBuiltinReduction
E e1 = min(e for e in E.one:E.three);
E e2 = max(e for e in E);
E e3 = min(e for e in E.three:E.one);
E e3 = max(e for e in E.three:E.one);
E e4 = max(e for e in E.three:E.one);
end FuncBuiltinReduction;

// Result:
Expand Down
26 changes: 17 additions & 9 deletions flattening/modelica/scodeinst/FuncBuiltinSize.mo
Expand Up @@ -16,13 +16,21 @@ model FuncBuiltinSize
end FuncBuiltinSize;

// Result:
// Error processing file: FuncBuiltinSize.mo
// [flattening/modelica/scodeinst/FuncBuiltinSize.mo:11:3-11:26:writable] Error: No matching function found for size(x, 1) in component <REMOVE ME>
// candidates are :
// size()
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// class FuncBuiltinSize
// Real x[1,1,1];
// Real x[1,1,2];
// Real x[1,1,3];
// Real x[1,2,1];
// Real x[1,2,2];
// Real x[1,2,3];
// Integer i1 = 1;
// Integer i2 = 2;
// Integer i3 = 3;
// Integer i4 = 3;
// Integer i5[1];
// Integer i5[2];
// Integer i5[3];
// equation
// i5 = size(x);
// end FuncBuiltinSize;
// endResult
20 changes: 13 additions & 7 deletions flattening/modelica/scodeinst/FuncBuiltinSkew.mo
Expand Up @@ -11,11 +11,17 @@ model FuncBuiltinSkew
end FuncBuiltinSkew;

// Result:
// Error processing file: FuncBuiltinSkew.mo
// Error: Internal error Instantiation of FuncBuiltinSkew failed with no error message.
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// class FuncBuiltinSkew
// Real x[1,1];
// Real x[1,2];
// Real x[1,3];
// Real x[2,1];
// Real x[2,2];
// Real x[2,3];
// Real x[3,1];
// Real x[3,2];
// Real x[3,3];
// equation
// x = skew({1.0, 2.0, 3.0});
// end FuncBuiltinSkew;
// endResult
18 changes: 10 additions & 8 deletions flattening/modelica/scodeinst/FuncBuiltinSpatialDistribution.mo
Expand Up @@ -19,12 +19,14 @@ equation
end FuncBuiltinSpatialDistribution;

// Result:
// [/home/per/workspace/OpenModelica/OMCompiler/Compiler/NFFrontEnd/NFInst.mo:1210:9-1210:69:writable]Modelica Assert: NFInst.instExp got unknown expression!
// Error processing file: FuncBuiltinSpatialDistribution.mo
// Error: Internal error Instantiation of FuncBuiltinSpatialDistribution failed with no error message.
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// class FuncBuiltinSpatialDistribution
// Real in0;
// Real in1;
// Real out0;
// Real out1;
// Real x;
// Boolean positiveVelocity;
// equation
// (out0, out1) = spatialDistribution(in0, in1, x, positiveVelocity, {0.0, 1.0}, {0.0, 0.0});
// end FuncBuiltinSpatialDistribution;
// endResult

0 comments on commit 13c08d4

Please sign in to comment.