Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Belonging to [master]: - OpenModelica/OMCompiler#2151 - OpenModelica/OpenModelica-testsuite#836
- Loading branch information
1 parent
87c4710
commit 61c89af
Showing
9 changed files
with
155 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
flattening/modelica/scodeinst/FuncBuiltinMatrixWrongType1.mo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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
23
flattening/modelica/scodeinst/FuncBuiltinSmoothNonParam.mo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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
25
flattening/modelica/scodeinst/FuncBuiltinSmoothWrongArgs1.mo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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
29
flattening/modelica/scodeinst/FuncBuiltinSmoothWrongType1.mo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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
26
flattening/modelica/scodeinst/FuncBuiltinSmoothWrongType2.mo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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
21
flattening/modelica/scodeinst/FuncBuiltinVectorWrongType1.mo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters