Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added some nfinst test cases for size.
- Loading branch information
1 parent
e5d7afe
commit bf355bb
Showing
6 changed files
with
120 additions
and
0 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
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: Size1 | ||
// keywords: size | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
// Tests the builtin size operator. | ||
// | ||
|
||
model Size1 | ||
Real x[3]; | ||
Integer y = size(x, 1); | ||
end Size1; | ||
|
||
// Result: | ||
// class Size1 | ||
// Real x[1]; | ||
// Real x[2]; | ||
// Real x[3]; | ||
// Integer y = size(x, 1); | ||
// end Size1; | ||
// 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// name: SizeInvalidArgs1 | ||
// keywords: size | ||
// status: incorrect | ||
// cflags: -d=newInst | ||
// | ||
// Tests the builtin size operator. | ||
// | ||
|
||
model SizeInvalidArgs1 | ||
Real x[3]; | ||
Integer y = size(x, 1, 2); | ||
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 in component | ||
// candidates are : | ||
// size(array) => Integer[:] | ||
// size(array, Integer) => Integer | ||
// | ||
// # 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// name: SizeInvalidArgs2 | ||
// keywords: size | ||
// status: incorrect | ||
// cflags: -d=newInst | ||
// | ||
// Tests the builtin size operator. | ||
// | ||
|
||
model SizeInvalidArgs2 | ||
Real x[3]; | ||
Integer y = size(x, dim = 1); | ||
end SizeInvalidArgs2; | ||
|
||
// Result: | ||
// Error processing file: SizeInvalidArgs2.mo | ||
// [flattening/modelica/scodeinst/SizeInvalidArgs2.mo:11:3-11:31:writable] Error: Function size has no parameter named dim. | ||
// | ||
// # 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// name: SizeInvalidType1 | ||
// keywords: size | ||
// status: incorrect | ||
// cflags: -d=newInst | ||
// | ||
// Tests the builtin size operator. | ||
// | ||
|
||
model SizeInvalidType1 | ||
Real x[3]; | ||
Integer y = size(x, "1"); | ||
end SizeInvalidType1; | ||
|
||
// Result: | ||
// Error processing file: SizeInvalidType1.mo | ||
// [flattening/modelica/scodeinst/SizeInvalidType1.mo:11:3-11:27:writable] Error: Type mismatch for positional argument 2 in size (dim="1"). The argument has type: | ||
// String | ||
// expected type: | ||
// Integer | ||
// | ||
// # 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// name: SizeInvalidType2 | ||
// keywords: size | ||
// status: incorrect | ||
// cflags: -d=newInst | ||
// | ||
// Tests the builtin size operator. | ||
// | ||
|
||
model SizeInvalidType2 | ||
Real x[3]; | ||
Integer y = size("array", 1); | ||
end SizeInvalidType2; | ||
|
||
// Result: | ||
// Error processing file: SizeInvalidType2.mo | ||
// [flattening/modelica/scodeinst/SizeInvalidType2.mo:11:3-11:31:writable] Error: The first argument of size must be an array expression. | ||
// | ||
// # Error encountered! Exiting... | ||
// # Please check the error message and the flags. | ||
// | ||
// Execution failed! | ||
// endResult |