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 7, 2017
1 parent 1a22a75 commit e4efaec
Show file tree
Hide file tree
Showing 33 changed files with 367 additions and 157 deletions.
20 changes: 20 additions & 0 deletions flattening/modelica/scodeinst/DimCyclic1.mo
@@ -0,0 +1,20 @@
// name: DimCyclic1
// keywords:
// status: incorrect
// cflags: -d=newInst
//

model DimCyclic1
Real x[size(x, 2), size(x, 1)] = {{1, 2, 3}, {4, 5, 6}};
end DimCyclic1;


// Result:
// Error processing file: DimCyclic1.mo
// [flattening/modelica/scodeinst/DimCyclic1.mo:8:3-8:58:writable] Error: Dimension 1 of x, 'size(x, 2)', could not be evaluated due to a cyclic dependency.
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
21 changes: 21 additions & 0 deletions flattening/modelica/scodeinst/DimCyclic2.mo
@@ -0,0 +1,21 @@
// name: DimCyclic2
// keywords:
// status: incorrect
// cflags: -d=newInst
//

model DimCyclic2
Real x[size(y, 1)];
Real y[size(x, 1)];
end DimCyclic2;


// Result:
// Error processing file: DimCyclic2.mo
// [flattening/modelica/scodeinst/DimCyclic2.mo:8:3-8:21:writable] Error: Dimension 1 of x, 'size(y, 1)', could not be evaluated due to a cyclic dependency.
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
20 changes: 20 additions & 0 deletions flattening/modelica/scodeinst/DimCyclic3.mo
@@ -0,0 +1,20 @@
// name: DimCyclic3
// keywords:
// status: incorrect
// cflags: -d=newInst
//
//

model DimCyclic3
Real x[size(x,1)] = {1, 2, 3};
end DimCyclic3;

// Result:
// Error processing file: DimCyclic3.mo
// [flattening/modelica/scodeinst/DimCyclic3.mo:9:3-9:32:writable] Error: Dimension 1 of x, 'size(x, 1)', could not be evaluated due to a cyclic dependency.
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
21 changes: 21 additions & 0 deletions flattening/modelica/scodeinst/DimCyclic4.mo
@@ -0,0 +1,21 @@
// name: DimCyclic4
// keywords:
// status: incorrect
// cflags: -d=newInst
//
//

model DimCyclic4
parameter Integer i = size(x, 2);
Real x[i, i + 2] = {{1, 2, 3}, {4, 5, 6}};
end DimCyclic4;

// Result:
// Error processing file: DimCyclic4.mo
// [flattening/modelica/scodeinst/DimCyclic4.mo:9:3-9:35:writable] Error: Dimension 2 of x, '(i + 2)', could not be evaluated due to a cyclic dependency.
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
21 changes: 21 additions & 0 deletions flattening/modelica/scodeinst/DimSize1.mo
@@ -0,0 +1,21 @@
// name: DimSize1
// keywords:
// status: correct
// cflags: -d=newInst
//

model DimSize1
Real x[3];
Real y[size(x, 1)];
end DimSize1;

// Result:
// class DimSize1
// Real x[1];
// Real x[2];
// Real x[3];
// Real y[1];
// Real y[2];
// Real y[3];
// end DimSize1;
// endResult
23 changes: 23 additions & 0 deletions flattening/modelica/scodeinst/DimSize2.mo
@@ -0,0 +1,23 @@
// name: DimSize2
// keywords:
// status: correct
// cflags: -d=newInst
//

model DimSize2
Real x[size(x, 2), 3];
end DimSize2;

// Result:
// class DimSize2
// 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];
// end DimSize2;
// endResult
23 changes: 23 additions & 0 deletions flattening/modelica/scodeinst/DimSize3.mo
@@ -0,0 +1,23 @@
// name: DimSize3
// keywords:
// status: correct
// cflags: -d=newInst
//

model DimSize3
Real x[size(x, 2), 3];
end DimSize3;

// Result:
// class DimSize3
// 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];
// end DimSize3;
// endResult
2 changes: 1 addition & 1 deletion flattening/modelica/scodeinst/FuncBuiltinRem.mo
Expand Up @@ -14,7 +14,7 @@ end FuncBuiltinRem;

// Result:
// class FuncBuiltinRem
// Real r1 = OpenModelica.Internal.intRem(5, 2);
// Real r1 = /*Real*/(OpenModelica.Internal.intRem(5, 2));
// Real r2 = OpenModelica.Internal.realRem(5.0, 2.0);
// Real r3 = OpenModelica.Internal.realRem(8.0, 3.0);
// end FuncBuiltinRem;
Expand Down
40 changes: 24 additions & 16 deletions flattening/modelica/scodeinst/Makefile
Expand Up @@ -33,6 +33,8 @@ conn2.mo \
conn4.mo \
const1.mo \
const2.mo \
const7.mo \
const8.mo \
const10.mo \
const11.mo \
const13.mo \
Expand All @@ -41,10 +43,22 @@ const15.mo \
const16.mo \
const17.mo \
const3.mo \
DimCyclic1.mo \
DimCyclic2.mo \
DimCyclic3.mo \
DimCyclic4.mo \
DimSize1.mo \
DimSize2.mo \
DimSize3.mo \
dim1.mo \
dim10.mo \
dim12.mo \
dim13.mo \
dim17.mo \
dim18.mo \
dim19.mo \
dim3.mo \
dim7.mo \
dim8.mo \
DuplicateElements1.mo \
DuplicateElements2.mo \
Expand Down Expand Up @@ -148,12 +162,15 @@ inst2.mo \
inst3.mo \
inst4.mo \
inst5.mo \
inst7.mo \
inst8.mo \
lookup1.mo \
lookup2.mo \
lookup3.mo \
lookup4.mo \
loop1.mo \
loop2.mo \
loop3.mo \
mod1.mo \
mod10.mo \
mod11.mo \
Expand All @@ -175,8 +192,6 @@ RangeInvalidStep1.mo \
RangeInvalidStep2.mo \
RangeInvalidStep3.mo \
RangeTypeError1.mo \
RangeTypeError1.mo \
RangeTypeError2.mo \
RangeTypeError2.mo \
RangeTypeError3.mo \
RecursiveExtends1.mo \
Expand All @@ -192,12 +207,19 @@ redeclare6.mo \
redeclare7.mo \
redeclare9.mo \
Size1.mo \
Size2.mo \
SizeInvalidArgs1.mo \
SizeInvalidArgs2.mo \
SizeInvalidIndex1.mo \
SizeInvalidIndex2.mo \
SizeInvalidIndex3.mo \
SizeInvalidIndex4.mo \
SizeInvalidType1.mo \
SizeInvalidType2.mo \
Subscript1.mo \
type2.mo \
TypeDim1.mo \
TypeDim2.mo \
usertype1.mo \
usertype2.mo \
usertype3.mo \
Expand Down Expand Up @@ -239,23 +261,13 @@ const12.mo \
const4.mo \
const5.mo \
const6.mo \
const7.mo \
const8.mo \
ConstantConnector1.mo \
ConstantConnector2.mo \
ConstantConnector3.mo \
dim10.mo \
dim12.mo \
dim14.mo \
dim15.mo \
dim16.mo \
dim17.mo \
dim19.mo \
dim2.mo \
dim4.mo \
dim5.mo \
dim6.mo \
dim7.mo \
enum6.mo \
eq2.mo \
eq3.mo \
Expand Down Expand Up @@ -316,7 +328,6 @@ ImportConflict1.mo \
ImportShadowing1.mo \
inst1.mo \
inst6.mo \
inst7.mo \
InvalidComplexConnectorType1.mo \
InvalidComplexConnectorType2.mo \
InvalidComplexConnectorType3.mo \
Expand All @@ -335,8 +346,6 @@ InvalidConnectorType6.mo \
InvalidExpandableConnector1.mo \
InvalidVariability1.mo \
InvalidVariability2.mo \
loop1.mo \
loop3.mo \
loop4.mo \
MissingRedeclare1.mo \
mod13.mo \
Expand All @@ -355,7 +364,6 @@ redeclare5.mo \
redeclare8.mo \
RedeclaredFunction1.mo \
type1.mo \
type3.mo \
type4.mo \
type5.mo \

Expand Down
2 changes: 1 addition & 1 deletion flattening/modelica/scodeinst/Range1.mo
Expand Up @@ -7,7 +7,7 @@

model Range1
type E = enumeration(one, two, three);
Real x[E] = E.one:E.three;
E x[E] = E.one:E.three;
end Range1;

// Result:
Expand Down
2 changes: 1 addition & 1 deletion flattening/modelica/scodeinst/RangeInvalidStep3.mo
Expand Up @@ -14,7 +14,7 @@ end RangeInvalidStep3;

// Result:
// Error processing file: RangeInvalidStep3.mo
// [flattening/modelica/scodeinst/RangeInvalidStep3.mo:12:3-12:31:writable] Error: Range of type enumeration() may not specify a step size.
// [flattening/modelica/scodeinst/RangeInvalidStep3.mo:12:3-12:31:writable] Error: Range of type enumeration(one, two, three) may not specify a step size.
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
Expand Down
2 changes: 1 addition & 1 deletion flattening/modelica/scodeinst/RangeTypeError2.mo
Expand Up @@ -15,7 +15,7 @@ end RangeTypeError2;
// [flattening/modelica/scodeinst/RangeTypeError2.mo:10:3-10:24:writable] Error: Type mismatch in range: '1' of type
// Integer
// is not type compatible with 'E.one' of type
// enumeration()
// enumeration(one, two, three)
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
Expand Down
2 changes: 1 addition & 1 deletion flattening/modelica/scodeinst/Size1.mo
Expand Up @@ -16,6 +16,6 @@ end Size1;
// Real x[1];
// Real x[2];
// Real x[3];
// Integer y = size(x, 1);
// Integer y = 3;
// end Size1;
// endResult
17 changes: 17 additions & 0 deletions flattening/modelica/scodeinst/Size2.mo
@@ -0,0 +1,17 @@
// name: Size2
// keywords: size
// status: correct
// cflags: -d=newInst
//
// Tests the builtin size operator.
//

model Size2
Integer x = size({1, 2, 3}, 1);
end Size2;

// Result:
// class Size2
// Integer x = 3;
// end Size2;
// endResult
22 changes: 22 additions & 0 deletions flattening/modelica/scodeinst/SizeInvalidIndex1.mo
@@ -0,0 +1,22 @@
// name: SizeInvalidIndex1
// keywords: size
// status: incorrect
// cflags: -d=newInst
//
// Tests the builtin size operator.
//

model SizeInvalidIndex1
Real x[2, 3];
Integer y = size(x, 3);
end SizeInvalidIndex1;

// Result:
// Error processing file: SizeInvalidIndex1.mo
// [flattening/modelica/scodeinst/SizeInvalidIndex1.mo:11:3-11:25:writable] Error: Invalid index 3 in call to size of x, valid index interval is [1,2].
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
22 changes: 22 additions & 0 deletions flattening/modelica/scodeinst/SizeInvalidIndex2.mo
@@ -0,0 +1,22 @@
// name: SizeInvalidIndex2
// keywords: size
// status: incorrect
// cflags: -d=newInst
//
// Tests the builtin size operator.
//

model SizeInvalidIndex2
Real x[2, 3];
Integer y = size(x, -1);
end SizeInvalidIndex2;

// Result:
// Error processing file: SizeInvalidIndex2.mo
// [flattening/modelica/scodeinst/SizeInvalidIndex2.mo:11:3-11:26:writable] Error: Invalid index -1 in call to size of x, valid index interval is [1,2].
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult

0 comments on commit e4efaec

Please sign in to comment.