Skip to content

Commit

Permalink
[NF] Update tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
perost authored and OpenModelica-Hudson committed Apr 20, 2018
1 parent 14f66e7 commit 1787fde
Show file tree
Hide file tree
Showing 8 changed files with 113 additions and 5 deletions.
20 changes: 20 additions & 0 deletions flattening/modelica/scodeinst/EnumInvalidLiteralName1.mo
@@ -0,0 +1,20 @@
// name: EnumInvalidLiteralName1
// keywords:
// status: incorrect
// cflags: -d=newInst
//

model EnumInvalidLiteralName1
type E = enumeration(start, min, max);
E e;
end EnumInvalidLiteralName1;

// Result:
// Error processing file: EnumInvalidLiteralName1.mo
// [flattening/modelica/scodeinst/EnumInvalidLiteralName1.mo:8:3-8:40:writable] Error: An element with name start is already declared in this scope.
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
43 changes: 43 additions & 0 deletions flattening/modelica/scodeinst/EqualityConstraint1.mo
@@ -0,0 +1,43 @@
// name: EqualityConstraint1
// keywords:
// status: correct
// cflags: -d=newInst
//

type Real3 = Real[3];

type OC
extends Real3;

function equalityConstraint
input OC oc1;
input OC oc2;
output Real residue[0];
end equalityConstraint;
end OC;

model EqualityConstraint1
OC oc1, oc2;
equation
OC.equalityConstraint(oc1, oc2);
end EqualityConstraint1;


// Result:
// function OC.equalityConstraint
// input Real[3] oc1;
// input Real[3] oc2;
// output Real[0] residue;
// end OC.equalityConstraint;
//
// class EqualityConstraint1
// Real oc1[1];
// Real oc1[2];
// Real oc1[3];
// Real oc2[1];
// Real oc2[2];
// Real oc2[3];
// equation
// OC.equalityConstraint(oc1, oc2);
// end EqualityConstraint1;
// endResult
4 changes: 4 additions & 0 deletions flattening/modelica/scodeinst/Makefile
Expand Up @@ -222,6 +222,7 @@ enum4.mo \
enum5.mo \
enum7.mo \
enum8.mo \
EnumInvalidLiteralName1.mo \
EnumRangeBinding1.mo \
eq1.mo \
eq2.mo \
Expand All @@ -232,6 +233,7 @@ eq6.mo \
eq7.mo \
eq8.mo \
eq10.mo \
EqualityConstraint1.mo \
EquationInvalidType1.mo \
Extends1.mo \
Extends2.mo \
Expand Down Expand Up @@ -612,6 +614,8 @@ TypeDim2.mo \
TypeDim3.mo \
TypeDim4.mo \
TypeDimNonType1.mo \
TypeExtends1.mo \
TypeMissingBaseType1.mo \
TypenameInvalid1.mo \
TypenameInvalid2.mo \
TypenameInvalid3.mo \
Expand Down
19 changes: 19 additions & 0 deletions flattening/modelica/scodeinst/TypeExtends1.mo
@@ -0,0 +1,19 @@
// name: TypeExtends1
// keywords:
// status: correct
// cflags: -d=newInst
//

type MyReal
extends Real(min = 1.0);
end MyReal;

model TypeExtends1
MyReal x(start = 1.0);
end TypeExtends1;

// Result:
// class TypeExtends1
// Real x(min = 1.0, start = 1.0);
// end TypeExtends1;
// endResult
22 changes: 22 additions & 0 deletions flattening/modelica/scodeinst/TypeMissingBaseType1.mo
@@ -0,0 +1,22 @@
// name: TypeMissingBaseType1
// keywords:
// status: incorrect
// cflags: -d=newInst
//

type T
end T;

model TypeMissingBaseType1
T t;
end TypeMissingBaseType1;

// Result:
// Error processing file: TypeMissingBaseType1.mo
// [flattening/modelica/scodeinst/TypeMissingBaseType1.mo:7:1-8:6:writable] Error: Type ‘T‘ does not extend a basic type.
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
6 changes: 3 additions & 3 deletions flattening/modelica/scodeinst/type2.mo
Expand Up @@ -6,11 +6,11 @@


type MyReal
extends Real;
extends Real(max = 1.0);
end MyReal;

type MyReal2
extends MyReal;
extends MyReal(min = 1.0);
end MyReal2;

model M
Expand All @@ -19,6 +19,6 @@ end M;

// Result:
// class M
// Real m(start = 1.0);
// Real m(min = 1.0, max = 1.0, start = 1.0);
// end M;
// endResult
2 changes: 1 addition & 1 deletion flattening/modelica/scodeinst/usertype5.mo
Expand Up @@ -4,7 +4,7 @@
// cflags: -d=newInst
//

model MyReal
type MyReal
extends Real;
end MyReal;

Expand Down
2 changes: 1 addition & 1 deletion flattening/modelica/scodeinst/usertype6.mo
Expand Up @@ -4,7 +4,7 @@
// cflags: -d=newInst
//

model MyReal
type MyReal
extends Real;
Real y;
end MyReal;
Expand Down

0 comments on commit 1787fde

Please sign in to comment.