Skip to content

Commit

Permalink
Added test
Browse files Browse the repository at this point in the history
  • Loading branch information
sepehrmn committed Aug 13, 2016
1 parent 6302b8d commit 0bfd1e9
Showing 1 changed file with 55 additions and 8 deletions.
63 changes: 55 additions & 8 deletions testsuite/unittests/test_spike_detector.sli
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@
Description:


FirstVersion: Jan 2008
First Version: Jan 2008
Author: Diesmann, Eppler

Second Version: Aug 2016
Description: added more tests
Author: Sepehr Mahmoudian
*/

(unittest) run
Expand Down Expand Up @@ -74,9 +78,34 @@ true exch {and} Fold % all equal ?

assert_or_die

% Test the setting of the /precision value absent precise models
% 1 Checking the default value and changing it

ResetKernel
/spike_detector Create /sd Set

% is the default correctly set to 3?
sd GetStatus /precision get dup /p_val Set 3 eq assert_or_die

% is the precision still the same after simulating for some time?
10 Simulate
sd GetStatus /precision get p_val eq assert_or_die

% 2. Setting Precision

ResetKernel
/spike_detector Create /sd Set

% can the precision be correctly set?
sd << /precision 17 >> SetStatus
sd GetStatus /precision get 17 eq assert_or_die

% Is the precision the same after simulating?
10 Simulate
sd GetStatus /precision get 17 eq assert_or_die

% Test the behavior of the /precise_times flag
% 1. if the user does not set it
% 3. if the user does not set it

ResetKernel
/spike_detector Create /sd Set
Expand All @@ -85,31 +114,49 @@ assert_or_die
sd GetStatus /precise_times get dup /pt_flag Set false eq assert_or_die

% is the flag still the same after simulating for some time?
100 Simulate
10 Simulate
sd GetStatus /precise_times get pt_flag eq assert_or_die

% is the flag still the same after the creation of a precise neuron?
/iaf_psc_exp_ps Create ;
sd GetStatus /precise_times get pt_flag eq assert_or_die

% does the flag change to true if simulating with a precise neuron around?
100 Simulate
10 Simulate
sd GetStatus /precise_times get true eq assert_or_die

% 2.a if the user sets the flag to false
% check if precision correctly increased to 15.
sd GetStatus /precision get 15 eq assert_or_die

% 4.a if the user sets the flag to false

ResetKernel
/spike_detector Create /sd Set
sd << /precise_times false >> SetStatus
/iaf_psc_exp_ps Create ;
100 Simulate
10 Simulate
sd GetStatus /precise_times get false eq assert_or_die

% 2.b if the user sets the flag to true
% 4.b if the user sets the flag to true

ResetKernel
/spike_detector Create /sd Set
sd << /precise_times true >> SetStatus
/iaf_psc_exp_ps Create ;
100 Simulate
10 Simulate
sd GetStatus /precise_times get true eq assert_or_die

% 5. Can precision be set correctly when precise models exist?

ResetKernel
/spike_detector Create /sd Set

% If user does not set precise_times, it will be set to true
/iaf_psc_exp_ps Create ;
sd << /precision 17 >> SetStatus
sd GetStatus /precision get 17 eq assert_or_die

% does it remain the same after simulation?
10 Simulate
sd GetStatus /precision get 17 eq assert_or_die

0 comments on commit 0bfd1e9

Please sign in to comment.