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 May 28, 2018
1 parent 4348491 commit fedcaa2
Show file tree
Hide file tree
Showing 15 changed files with 95 additions and 65 deletions.
16 changes: 8 additions & 8 deletions flattening/modelica/scodeinst/ExtendsShort2.mo
Expand Up @@ -25,19 +25,19 @@ model ExtendsShort2
end ExtendsShort2;

// Result:
// function P.f2
// input Real x;
// output Real y = x * 2.0;
// end P.f2;
//
// function f
// function ExtendsShort2.f
// input Real x;
// output Real y;
// algorithm
// y := P.f2(x);
// end f;
// end ExtendsShort2.f;
//
// function P.f2
// input Real x;
// output Real y = x * 2.0;
// end P.f2;
//
// class ExtendsShort2
// Real x = f(2.0);
// Real x = ExtendsShort2.f(2.0);
// end ExtendsShort2;
// endResult
6 changes: 3 additions & 3 deletions flattening/modelica/scodeinst/ExtendsVisibility5.mo
Expand Up @@ -26,11 +26,11 @@ model ExtendsVisibility5
end ExtendsVisibility5;

// Result:
// function c.f
// function ExtendsVisibility5.c.f
// output Real x = 1.0;
// end c.f;
// end ExtendsVisibility5.c.f;
//
// class ExtendsVisibility5
// Real x = c.f();
// Real x = ExtendsVisibility5.c.f();
// end ExtendsVisibility5;
// endResult
8 changes: 4 additions & 4 deletions flattening/modelica/scodeinst/FuncMap1.mo
Expand Up @@ -24,11 +24,11 @@ end C;


// Result:
// function F
// function C.F
// input Integer a;
// input Integer b;
// output Integer c = a;
// end F;
// end C.F;
//
// class C
// Integer b[1];
Expand All @@ -44,7 +44,7 @@ end C;
// b[1] = 1;
// b[2] = 2;
// b[3] = 3;
// c = array(F(b[i], b[i]) for i in 1:3);
// d = array(F(b[i], i) for i in 1:3);
// c = array(C.F(b[i], b[i]) for i in 1:3);
// d = array(C.F(b[i], i) for i in 1:3);
// end C;
// endResult
6 changes: 3 additions & 3 deletions flattening/modelica/scodeinst/FuncOverloadAmbiguousDefault.mo
Expand Up @@ -24,10 +24,10 @@ end FuncOverloadAmbiguousDefault;

// Result:
// Error processing file: FuncOverloadAmbiguousDefault.mo
// [flattening/modelica/scodeinst/FuncOverloadAmbiguousDefault.mo:22:3-22:20:writable] Error: Ambiguous matching functions found for OV(/*Integer*/ 1).
// [flattening/modelica/scodeinst/FuncOverloadAmbiguousDefault.mo:22:3-22:20:writable] Error: Ambiguous matching functions found for FuncOverloadAmbiguousDefault.OV(/*Integer*/ 1).
// Candidates are:
// G(Integer g1, Integer g2 = 1) => Integer
// F(Integer f1) => Integer
// FuncOverloadAmbiguousDefault.G(Integer g1, Integer g2 = 1) => Integer
// FuncOverloadAmbiguousDefault.F(Integer f1) => Integer
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
Expand Down
12 changes: 6 additions & 6 deletions flattening/modelica/scodeinst/FuncOverloadExactPrefer.mo
Expand Up @@ -25,19 +25,19 @@ model FuncOverloadExactPrefer
end FuncOverloadExactPrefer;

// Result:
// function F
// function FuncOverloadExactPrefer.F
// input Integer f1;
// output Integer f2;
// end F;
// end FuncOverloadExactPrefer.F;
//
// function G
// function FuncOverloadExactPrefer.G
// input Real g1;
// input Integer g2 = 1;
// output Integer g3;
// end G;
// end FuncOverloadExactPrefer.G;
//
// class FuncOverloadExactPrefer
// Integer x = F(1);
// Integer y = G(1.0, 1);
// Integer x = FuncOverloadExactPrefer.F(1);
// Integer y = FuncOverloadExactPrefer.G(1.0, 1);
// end FuncOverloadExactPrefer;
// endResult
18 changes: 9 additions & 9 deletions flattening/modelica/scodeinst/FuncOverloadMulti.mo
Expand Up @@ -32,24 +32,24 @@ model FuncOverloadMulti
end FuncOverloadMulti;

// Result:
// function bool_string
// function FuncOverloadMulti.bool_string
// input Boolean g1;
// output String g3 = "Boolean";
// end bool_string;
// end FuncOverloadMulti.bool_string;
//
// function int_string
// function FuncOverloadMulti.int_string
// input Integer f1;
// output String f2 = "Integer";
// end int_string;
// end FuncOverloadMulti.int_string;
//
// function real_string
// function FuncOverloadMulti.real_string
// input Real g1;
// output String g3 = "Real";
// end real_string;
// end FuncOverloadMulti.real_string;
//
// class FuncOverloadMulti
// String x = bool_string(true);
// String y = int_string(1);
// String z = real_string(1.0);
// String x = FuncOverloadMulti.bool_string(true);
// String y = FuncOverloadMulti.int_string(1);
// String z = FuncOverloadMulti.real_string(1.0);
// end FuncOverloadMulti;
// endResult
6 changes: 3 additions & 3 deletions flattening/modelica/scodeinst/FuncOverloadNoMatch.mo
Expand Up @@ -23,10 +23,10 @@ end FuncOverloadNoMatch;

// Result:
// Error processing file: FuncOverloadNoMatch.mo
// [flattening/modelica/scodeinst/FuncOverloadNoMatch.mo:21:3-21:23:writable] Error: No matching function found for OV(/*Boolean*/ true).
// [flattening/modelica/scodeinst/FuncOverloadNoMatch.mo:21:3-21:23:writable] Error: No matching function found for FuncOverloadNoMatch.OV(/*Boolean*/ true).
// Candidates are:
// F(Integer f1) => Integer
// G(Real g1) => Integer
// FuncOverloadNoMatch.F(Integer f1) => Integer
// FuncOverloadNoMatch.G(Real g1) => Integer
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
Expand Down
22 changes: 11 additions & 11 deletions flattening/modelica/scodeinst/FuncOverloadSimple.mo
@@ -1,11 +1,11 @@
// name: FuncSimpleOverload
// name: FuncOverloadSimple
// keywords: overload
// status: correct
// cflags: -d=newInst
//
// Tests simple overloading.
//
model FuncSimpleOverload
model FuncOverloadSimple
function F
input Integer f1;
output Integer f2;
Expand All @@ -21,22 +21,22 @@ model FuncSimpleOverload

Integer x = OV(1);
Integer y = OV(1,2);
end FuncSimpleOverload;
end FuncOverloadSimple;

// Result:
// function F
// function FuncOverloadSimple.F
// input Integer f1;
// output Integer f2;
// end F;
// end FuncOverloadSimple.F;
//
// function G
// function FuncOverloadSimple.G
// input Integer g1;
// input Integer g2;
// output Integer g3;
// end G;
// end FuncOverloadSimple.G;
//
// class FuncSimpleOverload
// Integer x = F(1);
// Integer y = G(1, 2);
// end FuncSimpleOverload;
// class FuncOverloadSimple
// Integer x = FuncOverloadSimple.F(1);
// Integer y = FuncOverloadSimple.G(1, 2);
// end FuncOverloadSimple;
// endResult
8 changes: 4 additions & 4 deletions flattening/modelica/scodeinst/FuncVectorizatio1.mo
Expand Up @@ -22,11 +22,11 @@ end C;


// Result:
// function F
// function C.F
// input Integer a;
// input Integer b;
// output Integer c = a;
// end F;
// end C.F;
//
// class C
// Integer b[1];
Expand All @@ -39,7 +39,7 @@ end C;
// b[1] = 1;
// b[2] = 2;
// b[3] = 3;
// c = array(F(1, b[$i1]) for $i1 in 1:3);
// c = array(F(b[$i1], 1) for $i1 in 1:3);
// c = array(C.F(1, b[$i1]) for $i1 in 1:3);
// c = array(C.F(b[$i1], 1) for $i1 in 1:3);
// end C;
// endResult
6 changes: 3 additions & 3 deletions flattening/modelica/scodeinst/FuncVectorizatio2.mo
Expand Up @@ -22,11 +22,11 @@ end C;


// Result:
// function F
// function C.F
// input Integer[4] a;
// input Integer b;
// output Integer o;
// end F;
// end C.F;
//
// class C
// Integer b[1,1,1];
Expand Down Expand Up @@ -60,6 +60,6 @@ end C;
// Integer g[2,2];
// Integer g[2,3];
// equation
// g = array(F(b[$i1,$i2], 1) for $i2 in 1:3, $i1 in 1:2);
// g = array(C.F(b[$i1,$i2], 1) for $i2 in 1:3, $i1 in 1:2);
// end C;
// endResult
10 changes: 5 additions & 5 deletions flattening/modelica/scodeinst/FuncVectorizatioMap1.mo
Expand Up @@ -25,11 +25,11 @@ end C;


// Result:
// function F
// function C.F
// input Real[4] a;
// input Real c;
// output Real o = c;
// end F;
// end C.F;
//
// class C
// Real b[1,1,1];
Expand Down Expand Up @@ -63,8 +63,8 @@ end C;
// Real g[2,2];
// Real g[2,3];
// equation
// g = array(F(b[$i1,$i2], 1.0) for $i2 in 1:3, $i1 in 1:2);
// g = array(array(F(b[i,$i1,:], 1.0) for $i1 in 1:3) for i in 1:2);
// g = array(F(b[i,j,:], 1.0) for j in 1:3, i in 1:2);
// g = array(C.F(b[$i1,$i2], 1.0) for $i2 in 1:3, $i1 in 1:2);
// g = array(array(C.F(b[i,$i1,:], 1.0) for $i1 in 1:3) for i in 1:2);
// g = array(C.F(b[i,j,:], 1.0) for j in 1:3, i in 1:2);
// end C;
// endResult
6 changes: 3 additions & 3 deletions flattening/modelica/scodeinst/FuncViaComp.mo
Expand Up @@ -20,12 +20,12 @@ model FuncViaComp
end FuncViaComp;

// Result:
// function a.f
// function FuncViaComp.a.f
// input Integer n;
// output Real x = 2;
// end a.f;
// end FuncViaComp.a.f;
//
// class FuncViaComp
// Real x = a.f(1);
// Real x = FuncViaComp.a.f(1);
// end FuncViaComp;
// endResult
1 change: 1 addition & 0 deletions flattening/modelica/scodeinst/Makefile
Expand Up @@ -574,6 +574,7 @@ PackageConstant1.mo \
ParameterBug.mos \
Prefix1.mo \
Prefix2.mo \
Prefix3.mo \
PropagateExtends.mo \
RangeInvalidStep1.mo \
RangeInvalidStep2.mo \
Expand Down
29 changes: 29 additions & 0 deletions flattening/modelica/scodeinst/Prefix3.mo
@@ -0,0 +1,29 @@
// name: Prefix3
// keywords:
// status: correct
// cflags: -d=newInst -i=P.P2.Prefix3
//

package P
package P2
model Prefix3
function f
input Real x;
output Real y;
end f;

Real x = f(time);
end Prefix3;
end P2;
end P;

// Result:
// function P.P2.Prefix3.f
// input Real x;
// output Real y;
// end P.P2.Prefix3.f;
//
// class P.P2.Prefix3
// Real x = P.P2.Prefix3.f(time);
// end P.P2.Prefix3;
// endResult
6 changes: 3 additions & 3 deletions flattening/modelica/scodeinst/RedeclareFunction1.mo
Expand Up @@ -22,14 +22,14 @@ model RedeclareFunction1
end RedeclareFunction1;

// Result:
// function P.f
// function RedeclareFunction1.P.f
// input Real x;
// output Real y;
// algorithm
// x := y;
// end P.f;
// end RedeclareFunction1.P.f;
//
// class RedeclareFunction1
// Real x = P.f(4);
// Real x = RedeclareFunction1.P.f(4);
// end RedeclareFunction1;
// endResult

0 comments on commit fedcaa2

Please sign in to comment.