Skip to content
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 5 commits into from
Apr 7, 2017
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions nestkernel/connection_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,8 @@ nest::ConnectionManager::connect( index sgid,
// we do not allow to connect a device to a global receiver at the moment
if ( not source->has_proxies() )
{
return;
throw IllegalConnection( "The models " + target->get_name() + " and "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we throw a similar error in line546?

+ source->get_name() + " cannot be connected." );
}
connect_( *source, *target, sgid, tid, syn, d, w );
}
Expand Down Expand Up @@ -474,7 +475,8 @@ nest::ConnectionManager::connect( index sgid,
// we do not allow to connect a device to a global receiver at the moment
if ( not source->has_proxies() )
{
return;
throw IllegalConnection( "The models " + target->get_name() + " and "
+ source->get_name() + " cannot be connected." );
}
connect_( *source, *target, sgid, tid, syn, params, d, w );
}
Expand Down
6 changes: 0 additions & 6 deletions testsuite/regressiontests/issue-211.sli
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@ n2 d4 << /weight 1. >> Connect
[g5 g5] [n1] Connect
g5 n3 << /weight 1. >> Connect

% device-device; but g5g5 should be ignored
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you remove this whole block? I think the connection g5 -> g4 is still valid, and actually created, so I would suggest just removing the first line ([g5 g5] [d4 g5] /one_to_one Connect) and keeping the others. This would imply that you need to remove one [5 4 0] from the target_conn list.

[g5 g5] [d4 g5] /one_to_one Connect
[g5 g5] [d4] Connect
g5 d4 << /weight 1. >> Connect

% neuron-globally receiving device (volume transmitter)
n1 v6 Connect
n2 v6 Connect
Expand All @@ -83,7 +78,6 @@ n2 v6 Connect
/target_conn <[1 3 1] [2 3 1] [2 1 1] [3 1 1] [2 1 1] % neuron-neuron
[1 4 1] [1 3 1] [2 4 0] [3 4 1] [2 4 0] % neuron-device
[5 2 0] [5 3 1] [5 1 1] [5 1 1] [5 3 1] % device-neuron
[5 4 0] [5 4 0] [5 4 0] [5 4 0] % device-device
[1 6 0] [1 6 1] [2 6 0] [2 6 1]> def % neuron-globally receiving device

conn {
Expand Down
49 changes: 49 additions & 0 deletions testsuite/unittests/test_connect.sli
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,52 @@ ResetKernel
Last /target get 6 eq assert_or_die

} forall

Copy link
Contributor

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.

(Running Connect tests with illegal combinations) =
ResetKernel
/generator /poisson_generator Create def
/multimeter /multimeter Create def
/recordable /iaf_psc_alpha Create def

{
generator generator Connect
} fail_or_die

% 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

% removing items on stack
pop pop pop pop