Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fetch connection list API * fixed indentation issue * removed duplicate flatten fn code * added testcases for connection list --------- Co-authored-by: rahulp13 <rahulp13@users.noreply.github.com> Co-authored-by: Per Östlund <per.ostlund@liu.se>
- Loading branch information
1 parent
001d260
commit a738ef5
Showing
8 changed files
with
188 additions
and
7 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
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
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
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,69 @@ | ||
// name: ConnectionList | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
// Tests the getConnectionList API function. | ||
// | ||
|
||
loadString(" | ||
model M | ||
connector A | ||
end A; | ||
connector B | ||
end B; | ||
|
||
parameter Integer n = 3; | ||
A a[n], c; | ||
B b[n], d; | ||
equation | ||
connect(a,b); | ||
connect(c,d); | ||
end M; | ||
"); getErrorString(); | ||
|
||
getConnectionList(M); getErrorString(); | ||
|
||
deleteClass(M); getErrorString(); | ||
|
||
|
||
|
||
// Testing complex loop structure | ||
|
||
loadString(" | ||
model M | ||
connector A | ||
end A; | ||
connector B | ||
end B; | ||
|
||
parameter Integer n = 5; | ||
A a[n]; | ||
B b[n]; | ||
equation | ||
for i in n-2:(n-2)*2-3 loop | ||
for j in 1:n loop | ||
if j <> i then | ||
connect(a[j],b[j]); | ||
end if; | ||
end for; | ||
|
||
connect(a[i],b[i]); | ||
end for; | ||
end M; | ||
"); getErrorString(); | ||
|
||
getConnectionList(M); getErrorString(); | ||
|
||
|
||
// Result: | ||
// true | ||
// "" | ||
// {{"c","d"},{"a[3]","b[3]"},{"a[2]","b[2]"},{"a[1]","b[1]"}} | ||
// "" | ||
// true | ||
// "" | ||
// true | ||
// "" | ||
// {{"a[3]","b[3]"},{"a[5]","b[5]"},{"a[4]","b[4]"},{"a[2]","b[2]"},{"a[1]","b[1]"}} | ||
// "" | ||
// 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