Skip to content

Commit

Permalink
added core function for new notifcation method, including test script
Browse files Browse the repository at this point in the history
  • Loading branch information
robertoostenveld committed Jun 21, 2017
1 parent bb369ff commit 5889be2
Show file tree
Hide file tree
Showing 2 changed files with 439 additions and 0 deletions.
74 changes: 74 additions & 0 deletions test/test_notification.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
function test_notification

% WALLTIME 00:10:00
% MEM 1gb

% TEST ft_debug ft_info ft_notice ft_warning ft_notification

sublevel(@ft_debug)
sublevel(@ft_info)
sublevel(@ft_notice)
sublevel(@ft_warning)
% sublevel(@ft_error)

function sublevel(notice)

fprintf('========================================\n')
fprintf('the following should not print anything\n')
fprintf('========================================\n')
notice('off', 'FieldTrip:something');
notice('FieldTrip:something', 'notice %d %d %d\n', 1, 2, 3);

fprintf('========================================\n')
fprintf('the following should print the query status\n')
fprintf('========================================\n')
notice('query', 'FieldTrip:something');

fprintf('========================================\n')
fprintf('the following should print "notice 4, 5, 6"\n')
fprintf('========================================\n')
notice('on', 'FieldTrip:something');
notice('FieldTrip:something', 'notice %d, %d, %d\n', 4, 5, 6);

fprintf('========================================\n')
fprintf('the following should print "notice backtrace" with a backtrace\n')
fprintf('========================================\n')
notice('on', 'backtrace');
notice('FieldTrip:something', 'notice backtrace\n');
notice('off', 'backtrace');

fprintf('========================================\n')
fprintf('the following should print "pause 1", "4"\n')
fprintf('========================================\n')
notice('once', 'FieldTrip:once');
notice('timeout', 3);
for i=1:5
pause(1);
notice('FieldTrip:once', 'pause %d\n', i);
end

notice('clear')
notice('on', '1')
notice('on', '2')
notice('off', 'a')
notice('off', 'b')
fprintf('========================================\n')
fprintf('the following should show 1 and 2 as ''on''\n')
fprintf('========================================\n')
notice('off')
notice('query')
fprintf('========================================\n')
fprintf('the following should show a and b as ''off''\n')
fprintf('========================================\n')
notice('on')
notice('query')

notice('clear')
fprintf('========================================\n')
fprintf('the following should show ''a''\n')
fprintf('========================================\n')
notice('a');
notice('last')



Loading

0 comments on commit 5889be2

Please sign in to comment.