New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Throw exception when connecting fails #693
Merged
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
89e46b8
Now throws an error for illegal connections.
hakonsbm 699102f
Fixed a test, added new tests
hakonsbm 86dc491
Reinstated parts of a deleted test.
hakonsbm 10b43d1
Expanded connection tests, added missing IllegalConnection.
hakonsbm afb5531
Removed unneeded saving of element type and shortened the test.
hakonsbm File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 |
---|---|---|
|
@@ -180,49 +180,38 @@ ResetKernel | |
|
||
(Running Connect tests with illegal combinations) = | ||
ResetKernel | ||
/generator /poisson_generator Create def | ||
/multimeter /multimeter Create def | ||
/recordable /iaf_psc_alpha Create def | ||
|
||
/n_connections 0 def | ||
modeldict | ||
{ | ||
generator generator Connect | ||
} fail_or_die | ||
pop % remove model id | ||
/model_a Set | ||
/type_a model_a GetDefaults /element_type get def | ||
/m_a model_a Create def | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks to me as if you do not need
and similarly for |
||
modeldict | ||
{ | ||
pop % remove model id | ||
/model_b Set | ||
/type_b model_b GetDefaults /element_type get def | ||
/m_b model_b Create def | ||
|
||
% try to connect model_a and model_b | ||
{ | ||
m_a m_b Connect | ||
} stopped not | ||
{ % if there is no error, check that a connection has been made | ||
{ | ||
n_connections 1 add | ||
0 GetStatus /num_connections get | ||
eq | ||
} assert_or_die | ||
/n_connections n_connections 1 add def | ||
} | ||
{ | ||
5 npop | ||
} ifelse | ||
} forall | ||
|
||
% removing items on stack | ||
pop pop pop pop | ||
|
||
{ | ||
generator multimeter Connect | ||
} fail_or_die | ||
|
||
% removing items on stack | ||
pop pop pop pop | ||
|
||
{ | ||
% recordable -> multimeter | ||
recordable multimeter Connect | ||
} fail_or_die | ||
|
||
% removing items on stack | ||
pop pop pop pop | ||
|
||
{ | ||
recordable generator Connect | ||
} fail_or_die | ||
|
||
% removing items on stack | ||
pop pop pop pop | ||
|
||
{ | ||
multimeter multimeter Connect | ||
} fail_or_die | ||
|
||
% removing items on stack | ||
pop pop pop pop | ||
|
||
{ | ||
multimeter generator Connect | ||
} fail_or_die | ||
} forall | ||
(All illegal connections throw an error) = | ||
|
||
% removing items on stack | ||
pop pop pop pop |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe it would make sense to get all devices from the modeldict and loop through all possible combinations instead of listing them manually here? this would avoid the need to add new tests here upon adding a new device and make sure that we do not forget a certain combination.