Skip to content

Commit

Permalink
Update nfinst tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
perost authored and OpenModelica-Hudson committed Feb 1, 2018
1 parent 87c4710 commit 61c89af
Show file tree
Hide file tree
Showing 9 changed files with 155 additions and 5 deletions.
2 changes: 1 addition & 1 deletion flattening/modelica/scodeinst/FuncBuiltinDiagonal.mo
Expand Up @@ -22,6 +22,6 @@ end FuncBuiltinDiagonal;
// Real x[3,2];
// Real x[3,3];
// equation
// x = diagonal(#({1, 2, 3}));
// x = /*Real[3, 3]*/(diagonal({1, 2, 3}));
// end FuncBuiltinDiagonal;
// endResult
21 changes: 21 additions & 0 deletions flattening/modelica/scodeinst/FuncBuiltinMatrixWrongType1.mo
@@ -0,0 +1,21 @@
// name: FuncBuiltinMatrixWrongType1
// keywords: matrix
// status: incorrect
// cflags: -d=newInst
//
// Tests the builtin matrix operator.
//

model FuncBuiltinMatrixWrongType1
Real x[3,3] = matrix({{{1, 2}, {2, 2}, {3, 2}}, {{1, 2}, {2, 2}, {3, 2}}, {{1, 2}, {2, 2}, {3, 2}}});
end FuncBuiltinMatrixWrongType1;

// Result:
// Error processing file: FuncBuiltinMatrixWrongType1.mo
// [flattening/modelica/scodeinst/FuncBuiltinMatrixWrongType1.mo:10:3-10:103:writable] Error: Invalid dimension 3 of argument to matrix, expected dimension size 1 but got 2.
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
23 changes: 23 additions & 0 deletions flattening/modelica/scodeinst/FuncBuiltinSmoothNonParam.mo
@@ -0,0 +1,23 @@
// name: FuncBuiltinSmoothNonParam
// keywords: smooth
// status: incorrect
// cflags: -d=newInst
//
// Tests the builtin smooth operator.
//

model FuncBuiltinSmoothNonParam
Integer k = 1;
Real x = time;
Real y = smooth(k, x);
end FuncBuiltinSmoothNonParam;

// Result:
// Error processing file: FuncBuiltinSmoothNonParam.mo
// [flattening/modelica/scodeinst/FuncBuiltinSmoothNonParam.mo:12:3-12:24:writable] Error: Argument 1 of smooth must be a parameter expression, but k is continuous.
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
25 changes: 25 additions & 0 deletions flattening/modelica/scodeinst/FuncBuiltinSmoothWrongArgs1.mo
@@ -0,0 +1,25 @@
// name: FuncBuiltinSmoothWrongArgs1
// keywords: smooth
// status: incorrect
// cflags: -d=newInst
//
// Tests the builtin smooth operator.
//

model FuncBuiltinSmoothWrongArgs1
parameter Integer k = 1;
Real x;
Real y = smooth(k, x, x);
end FuncBuiltinSmoothWrongArgs1;

// Result:
// Error processing file: FuncBuiltinSmoothWrongArgs1.mo
// [flattening/modelica/scodeinst/FuncBuiltinSmoothWrongArgs1.mo:12:3-12:27:writable] Error: No matching function found for smooth(k, x, x).
// Candidates are:
// smooth(Integer, Any) => Any
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
29 changes: 29 additions & 0 deletions flattening/modelica/scodeinst/FuncBuiltinSmoothWrongType1.mo
@@ -0,0 +1,29 @@
// name: FuncBuiltinSmoothWrongType1
// keywords: smooth
// status: incorrect
// cflags: -d=newInst
//
// Tests the builtin smooth operator.
//

model FuncBuiltinSmoothWrongType1
parameter Integer k = 1;
String s;
Real y = smooth(k, s);
end FuncBuiltinSmoothWrongType1;

// Result:
// Error processing file: FuncBuiltinSmoothWrongType1.mo
// [flattening/modelica/scodeinst/FuncBuiltinSmoothWrongType1.mo:12:3-12:24:writable] Error: Type mismatch for positional argument 2 in smooth(=s). The argument has type:
// String
// expected type:
// Real
// Real[:, ...]
// Real record
// Real record[:, ...]
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
26 changes: 26 additions & 0 deletions flattening/modelica/scodeinst/FuncBuiltinSmoothWrongType2.mo
@@ -0,0 +1,26 @@
// name: FuncBuiltinSmoothWrongType2
// keywords: smooth
// status: incorrect
// cflags: -d=newInst
//
// Tests the builtin smooth operator.
//

model FuncBuiltinSmoothWrongType2
parameter Real k = 1;
Real x;
Real y = smooth(k, x);
end FuncBuiltinSmoothWrongType2;

// Result:
// Error processing file: FuncBuiltinSmoothWrongType2.mo
// [flattening/modelica/scodeinst/FuncBuiltinSmoothWrongType2.mo:12:3-12:24:writable] Error: Type mismatch for positional argument 1 in smooth(=k). The argument has type:
// Real
// expected type:
// Integer
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
21 changes: 21 additions & 0 deletions flattening/modelica/scodeinst/FuncBuiltinVectorWrongType1.mo
@@ -0,0 +1,21 @@
// name: FuncBuiltinVectorWrongType1
// keywords: vector
// status: incorrect
// cflags: -d=newInst
//
// Tests the builtin vector operator.
//

model FuncBuiltinVectorWrongType1
Real x[3] = vector({{1, 2}, {2, 2}, {3, 2}});
end FuncBuiltinVectorWrongType1;

// Result:
// Error processing file: FuncBuiltinVectorWrongType1.mo
// [flattening/modelica/scodeinst/FuncBuiltinVectorWrongType1.mo:10:3-10:47:writable] Error: Invalid dimension 2 of argument to vector, expected dimension size 1 but got 2.
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
6 changes: 6 additions & 0 deletions flattening/modelica/scodeinst/Makefile
Expand Up @@ -279,6 +279,7 @@ FuncBuiltinInteger.mo \
FuncBuiltinLinspace.mo \
FuncBuiltinMath.mo \
FuncBuiltinMatrix.mo \
FuncBuiltinMatrixWrongType1.mo \
FuncBuiltinMax.mo \
FuncBuiltinMin.mo \
FuncBuiltinMod.mo \
Expand All @@ -295,6 +296,10 @@ FuncBuiltinSign.mo \
FuncBuiltinSize.mo \
FuncBuiltinSkew.mo \
FuncBuiltinSmooth.mo \
FuncBuiltinSmoothNonParam.mo \
FuncBuiltinSmoothWrongArgs1.mo \
FuncBuiltinSmoothWrongType1.mo \
FuncBuiltinSmoothWrongType2.mo \
FuncBuiltinSpatialDistribution.mo \
FuncBuiltinSqrt.mo \
FuncBuiltinSum.mo \
Expand All @@ -303,6 +308,7 @@ FuncBuiltinTerminal1.mo \
FuncBuiltinTerminal2.mo \
FuncBuiltinTranspose.mo \
FuncBuiltinVector.mo \
FuncBuiltinVectorWrongType1.mo \
FuncBuiltinZeros.mo \
FuncClassParam.mo \
FuncDefaultArg1.mo \
Expand Down
7 changes: 3 additions & 4 deletions flattening/modelica/scodeinst/SizeInvalidArgs1.mo
Expand Up @@ -13,11 +13,10 @@ end SizeInvalidArgs1;

// Result:
// Error processing file: SizeInvalidArgs1.mo
// [flattening/modelica/scodeinst/SizeInvalidArgs1.mo:11:3-11:28:writable] Error: No matching function found for size(/*unknown()*/ x, /*Integer*/ 1, /*Integer*/ 2).
// [flattening/modelica/scodeinst/SizeInvalidArgs1.mo:11:3-11:28:writable] Error: No matching function found for size(x, 1, 2).
// Candidates are:
// :
// size(Expression) => Integer[:]
// size(Expression, Integer) => Integer
// size(Any[:, ...]) => Integer[:]
// size(Any[:, ...], Integer) => Integer
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
Expand Down

0 comments on commit 61c89af

Please sign in to comment.