/*
 *  test_getrng_neuron.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::test_getrng_neuron - sli script of assignment of rng to neuron

Synopsis: nest_indirect test_getrng_neuron.sli -> compare results for different numbers of jobs 

Description:

The scripts test whether in simulations distributed over different numbers of 
processors the assignment of the global id and the random number generator stay
the same.
See #336 for discussion.

Author:  July 2009, Diesmann
SeeAlso: unittest::distributed_assert_or_die
*/


/unittest (9715) require
/unittest using


[1 2 4]                                            % list of different numbers of distributed jobs
{                                                  % 4 is max because of the number of neurons
 ResetKernel

 0 << /total_num_virtual_procs 4 >> SetStatus

 /iaf_neuron Create /n1 Set
 /iaf_neuron Create /n2 Set
 /iaf_neuron Create /n3 Set
 /iaf_neuron Create /n4 Set

 n3 /local get                                      % only a single job should generate output
 {
  n3 GetVpRNG drand               % should be independent of number of jobs 
 } if                             % involved in the computation

}

distributed_invariant_assert_or_die   
                            % a variant of this function will have an extra argument
                            % which specifies the test carried out to compare the 
                            % simulation results (not implemented 090716 MD)