/*
 *  test_spike_poisson_ps_base2_nd.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/>.
 *
 */

/* Testscript 

The difference in spike times is exactly 0.0 between 
all resolutions. 
 test_spike_poisson_ps_precision.sli
already verified that spikes are produced and recorded with
double resolution.
  
It is not easy to understand why this script gives identical
results if the computation time step is not representable as 
a double. However, HEP seems to be able to provide a proof.

If this test fails go back to
 test_spike_poisson_ps_precision.sli
to check whether poisson_generator_ps can emit spike times at
double precision or whether spike times are limited to the 
precision of a tic.

*/


/unittest (6688) require
/unittest using

M_ERROR setverbosity

0 /min_exponent Set

/Transmission
{
dexp /h Set

/T 4.0 def 

ResetKernel

[0] <<  
      /tics_per_ms min_exponent neg dexp
      /resolution h
     >> SetStatus

	/poisson_generator_ps Create /pn Set
	pn << /rate 16384.0 >> SetStatus

/spike_detector Create /sp Set  
sp  << /withgid false  /withtime true  /time_in_steps true /precise_times true >> SetStatus
 



pn sp Connect


T Simulate 

sp [/events [/times /offsets]] get cva dup ==


} def

[0 min_exponent -2] Range
 { Transmission } Map

% dup Rest exch First {sub} exch prepend % Map

%Flatten { 0.0 neq } Select [] eq  % comment these two last lines to see the 
%assert_or_die                     % minimal differences causing the failure