/*
 *  ticket-336-serial.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-serial - Check that vp-specific RNGs only provided for nodes with proxies

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

Description:
  This test ensures that GetVpRNG returns an error if called on a subnet or
  device without proxies. See mpitests/ticket-336.sli for a test checking
  correct vp-rng function.

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

/unittest (8831) require
/unittest using

/*
 * do_test
 *
 * Expects a GID as argument.
 * Returns a dictionary containing
 * - GID
 * - model of node
 * - VP of node
 * - if node is local: integer random number from VP-specific RNG
 * - local number of threads
 *
 * Determines number of local threads, model of GID, vp of GID
 * and tries to obtain the VP-specific RNG for the GID and draws
 * a random number from it.
 *
 * The test should fail on any node that has proxies, since they have no
 * well-defined VP and thus no well-defined VP-specific RNG (see r8824).
 *
 * When called on a node with proxies, one MPI process should report
 * a "full" node and a random number, all others a proxy node and no
 * random number.
 */

[ 0 /subnet /voltmeter ]
{ 
  {
    ResetKernel
    LiteralQ { Create } if
    GetVpRNG
  } fail_or_die
} forall
 

endusing % unittest