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 Oct 2, 2017
1 parent 2a672b2 commit c057936
Show file tree
Hide file tree
Showing 11 changed files with 197 additions and 1 deletion.
22 changes: 22 additions & 0 deletions flattening/modelica/scodeinst/End1.mo
@@ -0,0 +1,22 @@
// name: End1
// keywords:
// status: correct
// cflags: -d=newInst
//
//

model End1
Real x[3];
equation
x[end] = 1;
end End1;

// Result:
// class End1
// Real x[1];
// Real x[2];
// Real x[3];
// equation
// x[3] = 1;
// end End1;
// endResult
22 changes: 22 additions & 0 deletions flattening/modelica/scodeinst/EndInvalid1.mo
@@ -0,0 +1,22 @@
// name: EndInvalid1
// keywords:
// status: incorrect
// cflags: -d=newInst
//
//

model EndInvalid1
Real x;
equation
x = end;
end EndInvalid1;

// Result:
// Error processing file: EndInvalid1.mo
// [flattening/modelica/scodeinst/EndInvalid1.mo:11:3-11:10:writable] Error: 'end' can not be used outside array subscripts.
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
22 changes: 22 additions & 0 deletions flattening/modelica/scodeinst/EndInvalid2.mo
@@ -0,0 +1,22 @@
// name: EndInvalid2
// keywords:
// status: incorrect
// cflags: -d=newInst
//
//

model EndInvalid2
Real x;
equation
x[end] = 1;
end EndInvalid2;

// Result:
// Error processing file: EndInvalid2.mo
// [flattening/modelica/scodeinst/EndInvalid2.mo:11:3-11:13:writable] Error: Wrong number of subscripts in x[end] (1 subscripts for 0 dimensions).
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
9 changes: 9 additions & 0 deletions flattening/modelica/scodeinst/Makefile
Expand Up @@ -91,6 +91,9 @@ DuplicateMod2.mo \
DuplicateMod3.mo \
DuplicateMod4.mo \
DuplicateMod5.mo \
End1.mo \
EndInvalid1.mo \
EndInvalid2.mo \
enum1.mo \
enum2.mo \
enum3.mo \
Expand Down Expand Up @@ -263,9 +266,15 @@ SizeInvalidIndex4.mo \
SizeInvalidType1.mo \
SizeInvalidType2.mo \
Subscript1.mo \
SubscriptTooMany1.mo \
SubscriptWrongType1.mo \
SubscriptWrongType2.mo \
type2.mo \
TypeDim1.mo \
TypeDim2.mo \
TypenameInvalid1.mo \
TypenameInvalid2.mo \
TypenameInvalid3.mo \
usertype1.mo \
usertype2.mo \
usertype3.mo \
Expand Down
2 changes: 1 addition & 1 deletion flattening/modelica/scodeinst/Subscript1.mo
@@ -1,4 +1,4 @@
// name: Subscript1.mo
// name: Subscript1
// status: correct
// cflags: -d=newInst
//
Expand Down
19 changes: 19 additions & 0 deletions flattening/modelica/scodeinst/SubscriptTooMany1.mo
@@ -0,0 +1,19 @@
// name: SubscriptTooMany1
// status: incorrect
// cflags: -d=newInst
//

model SubscriptTooMany1
Real x[3] = {1, 2, 3};
Real y = x[2, 2];
end SubscriptTooMany1;

// Result:
// Error processing file: SubscriptTooMany1.mo
// [flattening/modelica/scodeinst/SubscriptTooMany1.mo:8:3-8:19:writable] Error: Wrong number of subscripts in x[2, 2] (2 subscripts for 1 dimensions).
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
19 changes: 19 additions & 0 deletions flattening/modelica/scodeinst/SubscriptWrongType1.mo
@@ -0,0 +1,19 @@
// name: SubscriptWrongType1
// status: incorrect
// cflags: -d=newInst
//

model SubscriptWrongType1
Real x[3] = {1, 2, 3};
Real y = x["1"];
end SubscriptWrongType1;

// Result:
// Error processing file: SubscriptWrongType1.mo
// [flattening/modelica/scodeinst/SubscriptWrongType1.mo:8:3-8:18:writable] Error: Expression '"1"' has type String, expected type Integer.
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
20 changes: 20 additions & 0 deletions flattening/modelica/scodeinst/SubscriptWrongType2.mo
@@ -0,0 +1,20 @@
// name: SubscriptWrongType2
// status: incorrect
// cflags: -d=newInst
//

model SubscriptWrongType2
type E = enumeration(one, two, three);
Real x[E];
Real y = x[1];
end SubscriptWrongType2;

// Result:
// Error processing file: SubscriptWrongType2.mo
// [flattening/modelica/scodeinst/SubscriptWrongType2.mo:9:3-9:16:writable] Error: Expression '1' has type Integer, expected type enumeration(one, two, three).
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
21 changes: 21 additions & 0 deletions flattening/modelica/scodeinst/TypenameInvalid1.mo
@@ -0,0 +1,21 @@
// name: TypenameInvalid1
// keywords:
// status: incorrect
// cflags: -d=newInst
//

model TypenameInvalid1
Boolean b[Boolean];
equation
b = Boolean;
end TypenameInvalid1;

// Result:
// Error processing file: TypenameInvalid1.mo
// [flattening/modelica/scodeinst/TypenameInvalid1.mo:10:3-10:14:writable] Error: Type name 'Boolean' is not allowed in this context.
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
22 changes: 22 additions & 0 deletions flattening/modelica/scodeinst/TypenameInvalid2.mo
@@ -0,0 +1,22 @@
// name: TypenameInvalid2
// keywords:
// status: incorrect
// cflags: -d=newInst
//

model TypenameInvalid2
type E = enumeration(one, two, three);
Real x;
equation
x = E;
end TypenameInvalid2;

// Result:
// Error processing file: TypenameInvalid2.mo
// [flattening/modelica/scodeinst/TypenameInvalid2.mo:11:3-11:8:writable] Error: Type name 'E' is not allowed in this context.
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
20 changes: 20 additions & 0 deletions flattening/modelica/scodeinst/TypenameInvalid3.mo
@@ -0,0 +1,20 @@
// name: TypenameInvalid3
// keywords:
// status: incorrect
// cflags: -d=newInst
//

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

// Result:
// Error processing file: TypenameInvalid3.mo
// [flattening/modelica/scodeinst/TypenameInvalid3.mo:9:3-9:16:writable] Error: Type name 'E' is not allowed in this context.
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult

0 comments on commit c057936

Please sign in to comment.