/*
 *  ticket-692-getconnections-args.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-692 - ensure GetConnections checks its args

Synopsis: (ticket-686-positive-parameters) run -> NEST exits if test fails

Description: 
This tests ensures that models with parameters C_m or tau_* throw an exception
when trying to set a value that is not strictly positive.
 
The test also ensures that values can actually be set to different, positive 
values.

Author: Hans Ekkehard Plesser, 2013-04-18
 */

(unittest) run
/unittest using

M_ERROR setverbosity

ResetKernel

% Ensure non-array is rejected as source or target
{
  /all_fine true def

  [ /source /target ]
  { 
    /key Set

    [ 0 0.0 () << >> /foo ]
    {
      /val Set
      
      mark
      { 
	<< >> dup key val put_d GetConnections
      }      
      stopped
      {
	% we got an exception, need to clean up
	% remove error code
	errordict /message undef
	errordict /command undef
	errordict begin /newerror false def end
      }
      {
	% model failed to raise exception
	/all_fine false def	  
      }
      ifelse   % stopped
      
      % clear stack
      counttomark npop pop % need to pop mark separately
      
      clear    
    } forall
  }
  forall
  
  all_fine  

} assert_or_die

endusing