/*
 *  ticket-451.sli
 *
 *  This file is part of NEST.
 *
 *  Copyright (C) 2004 The NEST Initiative
 *
 *  NEST is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  NEST is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with NEST.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

/* BeginDocumentation

Name: testsuite::ticket-451 - Guard against infinte loops in Random*Connect

Synopsis: (ticket-451) run -> NEST exits if test fails

Description:
 Random connection routines can hang in infinite loops if the user request
 more connections than possible if restrictions on multapses and autapses
 are taken into account. This test ensures that such conditions are caught.
 
Author: Hans Ekkehard Plesser, 2010-09-20
 */

(unittest) run
/unittest using

M_INFO setverbosity

/iaf_neuron 3 Create ;

{
[1 2 3] [1] << /rule /fixed_indegree /indegree 4 /multapses false /autapses true >> Connect
} fail_or_die

{
[1 2 3] [1] << /rule /fixed_indegree /indegree 3 /multapses false /autapses true >> Connect
} pass_or_die

{
[1 2 3] [1] << /rule /fixed_indegree /indegree 2 /multapses false /autapses true >> Connect
} pass_or_die

{
[1 2 3] [1] << /rule /fixed_indegree /indegree 4 /multapses false /autapses false >> Connect
} fail_or_die

{
[1 2 3] [1] << /rule /fixed_indegree /indegree 2 /multapses false /autapses false >> Connect
} pass_or_die

{
[1 1 1 2] [1] << /rule /fixed_indegree /indegree 1 /multapses true /autapses true >> Connect
} pass_or_die

% ---------------------

{
[1] [1 2 3] << /rule /fixed_outdegree /outdegree 4 /multapses false /autapses true >> Connect
} fail_or_die

{
[1] [1 2 3] << /rule /fixed_outdegree /outdegree 3 /multapses false /autapses true >> Connect
} pass_or_die

{
[1] [1 2 3] << /rule /fixed_outdegree /outdegree 2 /multapses false /autapses true >> Connect
} pass_or_die

{
[1] [1 2 3] << /rule /fixed_outdegree /outdegree 4 /multapses false /autapses false >> Connect
} fail_or_die

{
[1] [1 2 3] << /rule /fixed_outdegree /outdegree 2 /multapses false /autapses false >> Connect
} pass_or_die

{
[1] [1 1 1 2] << /rule /fixed_outdegree /outdegree 1 /multapses true /autapses false >> Connect
} pass_or_die

endusing
