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 699e373 commit 297f7c6
Show file tree
Hide file tree
Showing 41 changed files with 587 additions and 37 deletions.
2 changes: 1 addition & 1 deletion flattening/modelica/operators/ReinitInvalidType2.mo
Expand Up @@ -15,7 +15,7 @@ end ReinitInvalidType2;

// Result:
// Error processing file: ReinitInvalidType2.mo
// [flattening/modelica/operators/ReinitInvalidType2.mo:12:5-12:19:writable] Error: The first argument to reinit must be a variable, but x is a parameter.
// [flattening/modelica/operators/ReinitInvalidType2.mo:12:5-12:19:writable] Error: The first argument to reinit must be a continuous time variable, but x is parameter.
// Error: Error occurred while flattening model ReinitInvalidType2
//
// # Error encountered! Exiting...
Expand Down
2 changes: 1 addition & 1 deletion flattening/modelica/operators/ReinitInvalidType3.mo
Expand Up @@ -15,7 +15,7 @@ end ReinitInvalidType3;

// Result:
// Error processing file: ReinitInvalidType3.mo
// [flattening/modelica/operators/ReinitInvalidType3.mo:12:5-12:19:writable] Error: The first argument to reinit must be a variable, but x is a constant.
// [flattening/modelica/operators/ReinitInvalidType3.mo:12:5-12:19:writable] Error: The first argument to reinit must be a continuous time variable, but x is constant.
// Error: Error occurred while flattening model ReinitInvalidType3
//
// # Error encountered! Exiting...
Expand Down
17 changes: 17 additions & 0 deletions flattening/modelica/scodeinst/Assert1.mo
@@ -0,0 +1,17 @@
// name: Assert1
// keywords:
// status: correct
// cflags: -d=newInst
//

model Assert1
equation
assert(false, "test");
end Assert1;

// Result:
// class Assert1
// equation
// assert(false, "test");
// end Assert1;
// endResult
21 changes: 21 additions & 0 deletions flattening/modelica/scodeinst/Assert2.mo
@@ -0,0 +1,21 @@
// name: Assert2
// keywords:
// status: correct
// cflags: -d=newInst
//

model Assert2
Boolean b;
String s;
equation
assert(b, s);
end Assert2;

// Result:
// class Assert2
// Boolean b;
// String s;
// equation
// assert(b, s);
// end Assert2;
// endResult
17 changes: 17 additions & 0 deletions flattening/modelica/scodeinst/Assert3.mo
@@ -0,0 +1,17 @@
// name: Assert3
// keywords:
// status: correct
// cflags: -d=newInst
//

model Assert3
equation
assert(false, "message", AssertionLevel.warning);
end Assert3;

// Result:
// class Assert3
// equation
// assert(false, "message", AssertionLevel.warning);
// end Assert3;
// endResult
23 changes: 23 additions & 0 deletions flattening/modelica/scodeinst/AssertInvalid1.mo
@@ -0,0 +1,23 @@
// name: AssertInvalid1
// keywords:
// status: incorrect
// cflags: -d=newInst
//

model AssertInvalid1
equation
assert("true", "message");
end AssertInvalid1;

// Result:
// Error processing file: AssertInvalid1.mo
// [flattening/modelica/scodeinst/AssertInvalid1.mo:9:3-9:28:writable] Error: Type mismatch for positional argument 1 in assert(condition="true"). The argument has type:
// String
// expected type:
// Boolean
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
23 changes: 23 additions & 0 deletions flattening/modelica/scodeinst/AssertInvalid2.mo
@@ -0,0 +1,23 @@
// name: AssertInvalid2
// keywords:
// status: incorrect
// cflags: -d=newInst
//

model AssertInvalid2
equation
assert(false, 1);
end AssertInvalid2;

// Result:
// Error processing file: AssertInvalid2.mo
// [flattening/modelica/scodeinst/AssertInvalid2.mo:9:3-9:19:writable] Error: Type mismatch for positional argument 2 in assert(message=1). The argument has type:
// Integer
// expected type:
// String
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
23 changes: 23 additions & 0 deletions flattening/modelica/scodeinst/AssertInvalid3.mo
@@ -0,0 +1,23 @@
// name: AssertInvalid3
// keywords:
// status: incorrect
// cflags: -d=newInst
//

model AssertInvalid3
equation
assert(false, "message", 1);
end AssertInvalid3;

// Result:
// Error processing file: AssertInvalid3.mo
// [flattening/modelica/scodeinst/AssertInvalid3.mo:9:3-9:30:writable] Error: Type mismatch for positional argument 3 in assert(level=1). The argument has type:
// Integer
// expected type:
// enumeration AssertionLevel(error, warning)
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
13 changes: 13 additions & 0 deletions flattening/modelica/scodeinst/ComponentAttr1.mo
@@ -0,0 +1,13 @@
// name: ComponentAttr1
// keywords: extends visibility
// status: correct
// cflags: -d=newInst
//

model A
Real x;
end A;

model ComponentAttr1
protected A a;
end ComponentAttr1;
22 changes: 22 additions & 0 deletions flattening/modelica/scodeinst/EquationInvalidType1.mo
@@ -0,0 +1,22 @@
// name: EquationInvalidType1
// keywords:
// status: incorrect
// cflags: -d=newInst
//

model EquationInvalidType1
Real x;
String s;
equation
x = s;
end EquationInvalidType1;

// Result:
// Error processing file: EquationInvalidType1.mo
// [flattening/modelica/scodeinst/EquationInvalidType1.mo:11:3-11:8:writable] Error: Type mismatch in equation x = s of type Real = String.
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
10 changes: 5 additions & 5 deletions flattening/modelica/scodeinst/ForEquation1.mo
Expand Up @@ -21,10 +21,10 @@ end ForEquation1;
// Real x[4];
// Real x[5];
// equation
// x[1] = 1;
// x[2] = 2;
// x[3] = 3;
// x[4] = 4;
// x[5] = 5;
// x[1] = /*Real*/(1);
// x[2] = /*Real*/(2);
// x[3] = /*Real*/(3);
// x[4] = /*Real*/(4);
// x[5] = /*Real*/(5);
// end ForEquation1;
// endResult
12 changes: 6 additions & 6 deletions flattening/modelica/scodeinst/ForEquation2.mo
Expand Up @@ -26,11 +26,11 @@ end ForEquation2;
// Real x[3,2];
// Real x[3,3];
// equation
// x[1,1] = 1;
// x[2,2] = 2;
// x[3,3] = 3;
// x[1,1] = 1;
// x[2,2] = 2;
// x[3,3] = 3;
// x[1,1] = /*Real*/(1);
// x[2,2] = /*Real*/(2);
// x[3,3] = /*Real*/(3);
// x[1,1] = /*Real*/(1);
// x[2,2] = /*Real*/(2);
// x[3,3] = /*Real*/(3);
// end ForEquation2;
// endResult
10 changes: 5 additions & 5 deletions flattening/modelica/scodeinst/ForEquation3.mo
Expand Up @@ -21,10 +21,10 @@ end ForEquation3;
// Real x[4];
// Real x[5];
// equation
// x[1] = 1;
// x[2] = 2;
// x[3] = 3;
// x[4] = 4;
// x[5] = 5;
// x[1] = /*Real*/(1);
// x[2] = /*Real*/(2);
// x[3] = /*Real*/(3);
// x[4] = /*Real*/(4);
// x[5] = /*Real*/(5);
// end ForEquation3;
// endResult
8 changes: 4 additions & 4 deletions flattening/modelica/scodeinst/ForEquation4.mo
Expand Up @@ -22,9 +22,9 @@ end ForEquation4;
// Real x[3];
// Real x[4];
// equation
// x[1] = 1;
// x[2] = 2;
// x[3] = 3;
// x[4] = 4;
// x[1] = /*Real*/(1);
// x[2] = /*Real*/(2);
// x[3] = /*Real*/(3);
// x[4] = /*Real*/(4);
// end ForEquation4;
// endResult
8 changes: 4 additions & 4 deletions flattening/modelica/scodeinst/ForEquation5.mo
Expand Up @@ -23,9 +23,9 @@ end ForEquation5;
// Real x[3];
// Real x[4];
// equation
// x[1] = 1;
// x[2] = 2;
// x[3] = 3;
// x[4] = 0;
// x[1] = /*Real*/(1);
// x[2] = /*Real*/(2);
// x[3] = /*Real*/(3);
// x[4] = 0.0;
// end ForEquation5;
// endResult
2 changes: 1 addition & 1 deletion flattening/modelica/scodeinst/ForStatement1.mo
Expand Up @@ -22,7 +22,7 @@ end ForStatement1;
// Real x[5];
// algorithm
// for i in 1:5 loop
// x[i] := i;
// x[i] := /*Real*/(i);
// end for;
// end ForStatement1;
// endResult
2 changes: 1 addition & 1 deletion flattening/modelica/scodeinst/ForStatement2.mo
Expand Up @@ -24,7 +24,7 @@ end ForStatement2;
// constant Integer s = 5;
// algorithm
// for i in 1:s loop
// x[i] := i;
// x[i] := /*Real*/(i);
// end for;
// end ForStatement2;
// endResult
2 changes: 1 addition & 1 deletion flattening/modelica/scodeinst/ForStatementArray.mo
Expand Up @@ -22,7 +22,7 @@ end ForStatementArray;
// Real x[5];
// algorithm
// for i in {1, 2, 3, 4, 5} loop
// x[i] := i;
// x[i] := /*Real*/(i);
// end for;
// end ForStatementArray;
// endResult
2 changes: 1 addition & 1 deletion flattening/modelica/scodeinst/ForStatementPrefix.mo
Expand Up @@ -27,7 +27,7 @@ end ForStatementPrefix;
// Real a.x[5];
// algorithm
// for i in 1:5 loop
// a.x[i] := i;
// a.x[i] := /*Real*/(i);
// end for;
// end ForStatementPrefix;
// endResult
1 change: 1 addition & 0 deletions flattening/modelica/scodeinst/FunctionMultiOutput1.mo
Expand Up @@ -16,6 +16,7 @@ model FunctionMultiOutput1
algorithm
(x, y, z) := f(2.0);
end FunctionMultiOutput1;

// Result:
// function f
// input Real x;
Expand Down
33 changes: 33 additions & 0 deletions flattening/modelica/scodeinst/FunctionMultiOutput2.mo
@@ -0,0 +1,33 @@
// name: FunctionMultiOutput2
// keywords:
// status: correct
// cflags: -d=newInst
//

function f
input Real x;
output Real a = x * 2;
output Real b = x * 3;
output Real c = x * 4;
end f;

model FunctionMultiOutput2
Real x;
algorithm
x := f(x);
end FunctionMultiOutput2;

// Result:
// function f
// input Real x;
// output Real a = x * 2.0;
// output Real b = x * 3.0;
// output Real c = x * 4.0;
// end f;
//
// class FunctionMultiOutput2
// Real x;
// algorithm
// x := f(x)[1];
// end FunctionMultiOutput2;
// endResult
38 changes: 38 additions & 0 deletions flattening/modelica/scodeinst/FunctionMultiOutput3.mo
@@ -0,0 +1,38 @@
// name: FunctionMultiOutput3
// keywords:
// status: correct
//

function f
input Real x;
output Real y;
output Real z;
algorithm
y := x * 2;
z := x * 3;
end f;

model FunctionMultiOutput3
Real x = f(3);
Real y;
equation
y = f(4);
end FunctionMultiOutput3;

// Result:
// function f
// input Real x;
// output Real y;
// output Real z;
// algorithm
// y := 2.0 * x;
// z := 3.0 * x;
// end f;
//
// class FunctionMultiOutput3
// Real x = 6.0;
// Real y;
// equation
// y = 8.0;
// end FunctionMultiOutput3;
// endResult

0 comments on commit 297f7c6

Please sign in to comment.