/* * test_set_start_stop_origin.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::test_set_start_stop_origin - sli script to test if start, stop and origin are set properly Synopsis: (test_set_start_stop_origin) run Description: For all models having start, stop, and origin parameters, this test checks that - default values can be set successfully - nodes are created with correct default values - nodes can be created with correct default values from the command line - parameters can be set via SetStatus FirstVersion: December 2011 Author: Hans E Plesser */ /unittest (8831) require /unittest using M_WARNING setverbosity /deviceparams [/start /stop /origin] def /testvalue 1237. def % unlikely value ResetKernel % build list of all models having at least one of deviceparams /devmodels [] def modeldict { ; /mod Set mod GetDefaults /defs Set false deviceparams { defs exch known or } Fold { /devmodels devmodels mod append def } if } forall % First test: check that any model that has one deviceparam has all { ResetKernel true devmodels { GetDefaults /defs Set true deviceparams { defs exch known and } Fold and } Fold } assert_or_die % Second test: ensure that no default value is equal to test value { ResetKernel true devmodels { GetDefaults /defs Set true deviceparams { defs exch get /testvalue neq and } Fold and } Fold } assert_or_die % Third test: check that default values can be set { ResetKernel true devmodels { /model Set true deviceparams { /p Set model << p testvalue >> SetDefaults model GetDefaults p get testvalue eq dup not { (Failed on: ) model cvs join == } if and } Fold and } Fold } assert_or_die % Fourth test: check that default values are transferred to neurons { ResetKernel true devmodels { /model Set true deviceparams { /p Set model << p testvalue >> SetDefaults model Create p get testvalue eq dup not { (Failed on: ) model cvs join == } if and } Fold and } Fold } assert_or_die % Fifth test: check that values can be set on construction { ResetKernel true devmodels { /model Set true deviceparams { /p Set model << p testvalue >> Create p get testvalue eq dup not { (Failed on: ) model cvs join == } if and } Fold and } Fold } assert_or_die % Sixth test: check that values can be set on node { ResetKernel true devmodels { /model Set true deviceparams { /p Set model Create /n Set n p get testvalue neq n << p testvalue >> SetStatus n p get testvalue eq and dup not { (Failed on: ) model cvs join == } if and } Fold and } Fold } assert_or_die endusing