/*
 *  ticket-336-mpi.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-336-mpi - Check that vp-specific RNGs generate proper random numbers

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

Description:
  This test ensures that GetVpRNG, when called on a node with proxies, generates
  the same random number is generated independent of the number of MPI
  processes.
  
Remarks: In response to the changes of GetStatus return values (cf #549),
  this test now only checks that the first 10 RNs from its VP-RNG are
  identical independent of the number of MPI processes.

See also:
  regressiontests/ticket-336-serial.sli

Author: Hans Ekkehard Plesser, 2010-09-29, 2012-02-16, 2012-02-27, 2012-05-22
 */

(unittest) run
/unittest using

is_threaded not { exit_test_gracefully } if


[1 2 4]
{
  ResetKernel
  0 << /total_num_virtual_procs 4 >> SetStatus
  /iaf_neuron Create 
  dup /local get
  {
    GetVpRNG /rng Set
    [ 10 ] { pop rng drand } Table
  }
  {
    pop
  }    
  ifelse
} 
distributed_invariant_assert_or_die

endusing % unittest
