/*
 *  ticket-464.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-464 - Ensure that UniversalDataLogger triggers assertion with frozen multimeter.

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

Description:
Ensure that NEST triggers an assertion in UniversalDataLogger::record_data() instead of seg faulting
when a frozen multimeter is connected to a node.

Note:
This test has been modified (2011-02-11) to reflect the fact that NEST now protects
multimeter against being frozen. Thus, the first test triggers an error instead of
and assertion, and crash_or_die has been replaced by fail_or_die.

This test will only be executed if NEST has been compiled without MPI support.
 
Author: Hans Ekkehard Plesser, 2010-10-04
 */

% preparatory work for proper test code in case NEST is complied with MPI support
% For now we just ignore this test, this will later be replaced 
% by a restart of NEST with a serial binary.
statusdict/is_mpi :: {statusdict/exitcodes/success :: quit_i} if

/unittest (8831) require
/unittest using

M_ERROR setverbosity

% crash_or_die needs explicit code, cannot handle function names.

% multimeter frozen, should trigger assertion
{
  ResetKernel
  /multimeter << /record_from [/V_m] >> Create dup << /frozen true >> SetStatus
  /iaf_psc_alpha Create
  Connect
  3.0 Simulate
} fail_or_die % was crash_or_die

% multimeter thawed, should run fine
{
  ResetKernel
  /multimeter << /record_from [/V_m] >> Create dup << /frozen false >> SetStatus
  /iaf_psc_alpha Create
  Connect
  3.0 Simulate
} pass_or_die

endusing