1/*
2 *  ticket-310.sli
3 *
4 *  This file is part of NEST.
5 *
6 *  Copyright (C) 2004 The NEST Initiative
7 *
8 *  NEST is free software: you can redistribute it and/or modify
9 *  it under the terms of the GNU General Public License as published by
10 *  the Free Software Foundation, either version 2 of the License, or
11 *  (at your option) any later version.
12 *
13 *  NEST is distributed in the hope that it will be useful,
14 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *  GNU General Public License for more details.
17 *
18 *  You should have received a copy of the GNU General Public License
19 *  along with NEST.  If not, see <http://www.gnu.org/licenses/>.
20 *
21 */
22
23/*
24 * Regression test for Ticket #310.
25 *
26 * Ensure that all neuron models that have V_m and V_th permit
27 * V_m to be set to >= V_th, and that they emit a spike with
28 * time stamp == resolution in that case.
29 *
30 * Hans Ekkehard Plesser, 2009-02-11
31 *
32 */
33
34(unittest) run
35/unittest using
36
37% use power-of-two resolution to avoid roundof problems
38/res -3 dexp def
39
40/* The following models will not be tested:
41   iaf_cxhk_2008  ---  spikes only on explicit positive threshold crossings
42*/
43/skip_list [ /iaf_chxk_2008 /correlospinmatrix_detector ] def
44
45{
46  modeldict keys {
47    dup skip_list exch MemberQ not
48    {
49      /model Set
50
51      ResetKernel
52      << /resolution res >> SetKernelStatus
53      model Create /n Set
54
55      % see if we have V_m and V_th, otherwise return true
56      n GetStatus 0 get dup /V_m known exch /V_th known and
57      {
58        n << /V_m n /V_th get 15.0 add >> SetStatus
59        res Simulate
60        n /t_spike get res leq    % works also for precise models
61        dup not { (FAILED: ) model cvs join == n ShowStatus } if
62      }
63      { true }
64      ifelse
65    }
66    { true }
67    ifelse
68  }
69  Map
70
71  % see if all entries are true
72  true exch { and } Fold
73
74}
75assert_or_die
76
77endusing
78