/*
 *  ticket-507.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-507 - Ensure that spike_detector throws exception on SetStatus if off-grid times are set

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

Description:
Ensure that spike_detector throws exception on SetStatus if off-grid times are set,
unless precise_times is set.
 
Author: Hans Ekkehard Plesser, 2011-03-18
 */

/unittest (8831) require
/unittest using
M_ERROR setverbosity

% this should be fine
{
  ResetKernel
  0 << /resolution 0.1 >> SetStatus
  /spike_generator Create
  << /spike_times [0.2] /precise_times false >> SetStatus
}
pass_or_die

% this should fail 
{
  ResetKernel
  0 << /resolution 0.1 >> SetStatus
  /spike_generator Create
  << /spike_times [0.1 0.123456789 0.22345567854] /precise_times false >> SetStatus
}
fail_or_die

% this should fail 
{
  ResetKernel
  0 << /resolution 0.1 >> SetStatus
  /spike_generator Create
  << /spike_times [0.123456789] /precise_times false >> SetStatus
}
fail_or_die

% this should pass as precise_times is true 
{
  ResetKernel
  0 << /resolution 0.1 >> SetStatus
  /spike_generator Create
  << /spike_times [0.123456789] /precise_times true >> SetStatus
}
pass_or_die