/*
 *  test_multimeter_support.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_multimeter_support - test if multimeter support works in neurons

Synopsis: (test_multimeter_support.sli) run -> dies if assertion fails

Description:
The script checks all modes providing a "recordables" entry in their status dict.
It creates a multimeter, sets it to record from all recordables and checks whether
the correct amount of data is collected. It does not check the content of the data
collected.
Author: Plesser
FirstVersion: 2010-10-01
*/

/unittest (8831) require
/unittest using

M_ERROR setverbosity

% Execute test for one model
% Argument: model name
% Result: true or false
% Returns true if model does not have recordables
/run_test
{
  /model Set
  model GetDefaults dup
  /recordables known
  {
     /recordables get /recs Set
     /n model Create def
     /mm /multimeter << /record_from recs /withtime false >> Create def
     mm n Connect
     10.0 Simulate
     mm /events get [ recs ] get { cva length 9 eq } Map
     true exch { and } Fold
  }
  {
    pop
    true
  }
  ifelse
} 
def

{
  modeldict keys { run_test } Map
  true exch { and } Fold
}
assert_or_die