1/*
2 *  issue-264.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/** @BeginDocumentation
24
25Name: testsuite::issue-264 Ensure error is raised on times incommensurate with resolution
26
27Synopsis: (issue-264) run -> NEST exits if test fails
28
29Description:
30This test ensures that NEST raises an error if the requested simulation
31time is not a multiple of the resolution, or if one attempts to set
32start/stop/origin for devices that are not multiples of the resolution.
33
34Author: Hans E Plesser, 2016-03-08
35 */
36
37(unittest) run
38/unittest using
39
40M_ERROR setverbosity
41
42
43% Note: To ensure that the resolution 1.0 and test value 1.5 can be
44%       represented exactly in tics, we set tics_per_ms below to the
45%       usual default. This handles the unusual case where NEST is
46%       compiled with a different value.
47
48% Check incommensurate simulation time
49{
50  ResetKernel
51  << /resolution 1.0 /tics_per_ms 1000 >> SetKernelStatus
52  1.5 Simulate
53} fail_or_die
54
55% Check start, stop, origin on defaults
56[ /start /stop /origin ]
57{
58  /item Set
59
60  % stimulation device
61  {
62    ResetKernel
63    << /resolution 1.0 /tics_per_ms 1000 >> SetKernelStatus
64    /spike_generator << item 1.5 >> SetDefaults
65  } fail_or_die
66
67  % recording device
68  {
69    ResetKernel
70    << /resolution 1.0 /tics_per_ms 1000 >> SetKernelStatus
71    /spike_recorder << item 1.5 >> SetDefaults
72  } fail_or_die
73} forall
74
75% Check start, stop, origin on device
76[ /start /stop /origin ]
77{
78  /item Set
79
80  % stimulation device
81  {
82    ResetKernel
83    << /resolution 1.0 /tics_per_ms 1000 >> SetKernelStatus
84    /spike_generator Create << item 1.5 >> SetStatus
85  } fail_or_die
86
87  % recording device
88  {
89    ResetKernel
90    << /resolution 1.0 /tics_per_ms 1000 >> SetKernelStatus
91    /spike_recorder Create << item 1.5 >> SetStatus
92  } fail_or_die
93} forall