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 Dec 4, 2016
1 parent 6b50eb6 commit ee38431
Show file tree
Hide file tree
Showing 9 changed files with 169 additions and 29 deletions.
2 changes: 1 addition & 1 deletion flattening/modelica/scodeinst/ComponentAsTypeError.mo
Expand Up @@ -13,7 +13,7 @@ end ComponentAsTypeError;

// Result:
// Error processing file: ComponentAsTypeError.mo
// [flattening/modelica/scodeinst/ComponentAsTypeError.mo:11:3-11:6:writable] Error: Class x not found in scope <unknown>.
// [flattening/modelica/scodeinst/ComponentAsTypeError.mo:11:3-11:6:writable] Error: Expected x to be a class, but found component instead.
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
Expand Down
14 changes: 8 additions & 6 deletions flattening/modelica/scodeinst/Makefile
Expand Up @@ -9,11 +9,13 @@ bindings5.mo \
bindings7.mo \
builtinmod2.mo \
BuiltinTime.mo \
ClassAsComponentError.mo \
ComponentAsTypeError.mo \
cond4.mo \
conn1.mo \
conn2.mo \
const3.mo \
const13.mo \
DuplicateMod1.mo \
DuplicateMod2.mo \
DuplicateMod3.mo \
Expand All @@ -26,6 +28,12 @@ ImportNamed1.mo \
ImportNamed2.mo \
ImportNested1.mo \
ImportQualified1.mo \
inst4.mo \
inst5.mo \
lookup1.mo \
lookup2.mo \
lookup3.mo \
lookup4.mo \
loop2.mo \
mod10.mo \
mod11.mo \
Expand Down Expand Up @@ -54,7 +62,6 @@ usertype6.mo \
FAILINGTESTFILES=\
bindings4.mo \
builtinmod.mo \
ClassAsComponentError.mo \
compfunc.mo \
conn3.mo \
conn4.mo \
Expand All @@ -66,9 +73,7 @@ const4.mo \
const5.mo \
const7.mo \
const8.mo \
const9.mo \
const10.mo \
const13.mo \
const14.mo \
const15.mo \
const16.mo \
Expand Down Expand Up @@ -97,7 +102,6 @@ eq6.mo \
eq7.mo \
eq8.mo \
eq9.mo \
eq10.mo \
expconn4.mo \
expconn7.mo \
ExtendSections.mo \
Expand All @@ -119,7 +123,6 @@ ImportQualifiedInvalid2.mo \
ImportShadowing1.mo \
ImportUnqualified1.mo \
inst3.mo \
inst5.mo \
inst6.mo \
inst8.mo \
InvalidComplexConnectorType1.mo \
Expand Down Expand Up @@ -205,7 +208,6 @@ function1.mo \
FunctionRecordArg1.mo \
ImportUnqualified2.mo \
inst7.mo \
inst4.mo \
loop1.mo \
MultiInheritanceRedeclare1.mo \
noretcall1.mo \
Expand Down
2 changes: 1 addition & 1 deletion flattening/modelica/scodeinst/const13.mo
Expand Up @@ -22,7 +22,7 @@ end C;

// Result:
// Error processing file: const13.mo
// [flattening/modelica/scodeinst/const13.mo:20:3-20:17:writable] Error: Lookup of element B is not allowed via component a when looking for a.B.y (only function calls may be looked up via a component).
// [flattening/modelica/scodeinst/const13.mo:20:3-20:17:writable] Error: Found class y during lookup of composite component name 'a.B.y', expected component.
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
Expand Down
26 changes: 5 additions & 21 deletions flattening/modelica/scodeinst/inst4.mo
Expand Up @@ -3,7 +3,6 @@
// status: incorrect
// cflags: -d=newInst
//
// FAILREASON: Invalid mix of extensions not checked.
//


Expand All @@ -21,26 +20,11 @@ model A
end A;

// Result:
// Error processing file: inst4.mo
// [flattening/modelica/scodeinst/inst4.mo:14:3-14:15:writable] Error: A class extending from builtin type Real may not have other elements.
//
// EXPANDED FORM:
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// class A
// Real r;
// end A;
//
//
// Found 1 components and 0 parameters.
// class A
// final parameter String r.unit = "";
// final parameter String r.quantity = "";
// final parameter String r.displayUnit = "";
// final parameter Real r.min = 0.0;
// final parameter Real r.max = 0.0;
// final parameter Real r.start = 0.0;
// final parameter Boolean r.fixed = false;
// final parameter Real r.nominal;
// final parameter enumeration(never, avoid, default, prefer, always) r.stateSelect = StateSelect.default;
// final parameter enumeration(given, sought, refine) r.uncertain = Uncertainty.given;
// Real r.x;
// end A;
// Execution failed!
// endResult
26 changes: 26 additions & 0 deletions flattening/modelica/scodeinst/inst5.mo
@@ -0,0 +1,26 @@
// name: inst5.mo
// keywords:
// status: correct
// cflags: -d=newInst
//
// Check that instances are cloned properly, so that modifiers don't "stick" to
// a class.
//

model A
Real x;
end A;

model B
A a1(x = 3);
A a2;
A a3(x = 5);
end B;

// Result:
// class B
// Real a1.x = 3;
// Real a2.x;
// Real a3.x = 5;
// end B;
// endResult
30 changes: 30 additions & 0 deletions flattening/modelica/scodeinst/lookup1.mo
@@ -0,0 +1,30 @@
// name: lookup1.mo
// keywords:
// status: incorrect
// cflags: -d=newInst
//

model A
model B
model C
Real x;
end C;
end B;

B b;
end A;

model M
A a;
a.B b;
end M;

// Result:
// Error processing file: lookup1.mo
// [flattening/modelica/scodeinst/lookup1.mo:19:3-19:8:writable] Error: Class name 'a.B' was found via a component (only component and function call names may be accessed in this way).
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
30 changes: 30 additions & 0 deletions flattening/modelica/scodeinst/lookup2.mo
@@ -0,0 +1,30 @@
// name: lookup2.mo
// keywords:
// status: incorrect
// cflags: -d=newInst
//

model A
model B
model C
Real x;
end C;
end B;

B b;
end A;

model M
A a;
A.b.C c;
end M;

// Result:
// Error processing file: lookup2.mo
// [flattening/modelica/scodeinst/lookup2.mo:19:3-19:10:writable] Error: Class name 'A.b.C' was found via a component (only component and function call names may be accessed in this way).
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
34 changes: 34 additions & 0 deletions flattening/modelica/scodeinst/lookup3.mo
@@ -0,0 +1,34 @@
// name: lookup3.mo
// keywords:
// status: incorrect
// cflags: -d=newInst
//

model A
model B
model C
model D
Real x;
end D;

D d;
end C;
end B;

B b;
end A;

model M
A a;
Real x = a.B.C;
end M;

// Result:
// Error processing file: lookup3.mo
// [flattening/modelica/scodeinst/lookup3.mo:23:3-23:17:writable] Error: Class name 'a.B.C' was found via a component (only component and function call names may be accessed in this way).
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
34 changes: 34 additions & 0 deletions flattening/modelica/scodeinst/lookup4.mo
@@ -0,0 +1,34 @@
// name: lookup4.mo
// keywords:
// status: incorrect
// cflags: -d=newInst
//

model A
model B
model C
model D
Real x;
end D;

D d;
end C;
end B;

B b;
end A;

model M
A a;
Real x = a.b.C.d.x;
end M;

// Result:
// Error processing file: lookup4.mo
// [flattening/modelica/scodeinst/lookup4.mo:23:3-23:21:writable] Error: Found class C during lookup of composite component name 'a.b.C.d.x', expected component.
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult

0 comments on commit ee38431

Please sign in to comment.