/*
 *  issue-281.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::issue-281 - Check that ConnectLayers works MPI-parallel for fixed fan-out

Synopsis: (issue-281) run -> NEST exits if test fails

Description:
 This test connects a layer with itself with fixed fan-out. 
 The test should pass with any number of MPI processes.

Author: Hans Ekkehard Plesser, 2016-03-18
 */

(unittest) run
/unittest using

[1 2 4]
{
  << 
    /rows 3 
    /columns 3
    /elements /iaf_neuron
  >>
  CreateLayer
  dup

  << 
     /connection_type /divergent
     /number_of_connections 8
     /allow_multapses false
     /allow_autapses false

     % weights are randomized to check that global RNGs stay in sync
     /weights << /uniform << /min 1. /max 2. >> >>
  >>
  ConnectLayers
  
  % Simulate call required to provoke global-rng-sync-check.
  10 Simulate
}
distributed_pass_or_die

