/* * test_recorder_close_flush.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_recorde_close_flush - test {close,flush}_after_simulate flags for recording devices Description: Two voltmeters record from an iaf_neuron driven by an intrisic current. One voltmeter has close_after_simulate set, the other flush_after_simulate. After simulating for 100ms, the two files must have identical content. After simulating for another 100ms, the flushed file must contain data for 200ms, the "closed" file for the second 200ms only. Author: Plesser FirstVersion: August 2008 */ /unittest (7488) require /unittest using % expect on stack: % (close) or (flush) % number of runs (1 or 2) % returns: filename /run_sim { ResetKernel 0 << /overwrite_files true >> SetStatus /nruns Set /protocol Set /mm /multimeter << /record_from [/V_m] /record_to [/file] /interval 1.0 /withtime true /scientific false /precision 3 >> Create def protocol (close) eq { mm << /close_after_simulate true /label protocol >> SetStatus } { mm << /flush_after_simulate true /label protocol >> SetStatus } ifelse /iaf_neuron Create /n Set n << /I_e 100.0 >> SetStatus mm n Connect nruns { 100 Simulate } repeat mm /filenames get First % only take first in multithreaded runs } def % run once: must give identical results { (close) 1 run_sim (flush) 1 run_sim CompareFiles } assert_or_die % run twice: must give different results: flush shorter { (close) 2 run_sim (flush) 2 run_sim CompareFiles not } assert_or_die endusing