/*
 *  ticket-737-DScallback.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-737 - ensure generators depending on port info detect "bad wiring"

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

Description: 
This tests ensures that generators relying on port information to provide target-specific
output via the DS-callback mechanism verify that all callback connections have a contiguous
port range starting from 0.

Remarks: 
This test does not work properly until #681 is fixed, because exceptions thrown in parallel
sections are not handled properly.

Author: Hans Ekkehard Plesser, 2013-05-06
 */

(unittest) run
/unittest using

M_ERROR setverbosity

/all_fine true def

[ /noise_generator 
  /ppd_sup_generator 
  /gamma_sup_generator
  /sinusoidal_gamma_generator ]  
{
  /gentype Set

  ResetKernel 
 
  /static_synapse /A CopyModel
  /static_synapse /B CopyModel
  /gen1 gentype Create def
  /gen2 gentype Create def
  /nrns [ 6 ] { ; /iaf_neuron Create } Table def
  [gen1] nrns  3 Take << /rule /all_to_all >> << /model /A >> Connect
  [gen2] nrns -3 Take << /rule /all_to_all >> << /model /B >> Connect

  gentype ==
  { 1 Simulate } fail_or_die
} forall

endusing
