Skip to content

Commit

Permalink
[test] create a test for tsvread
Browse files Browse the repository at this point in the history
  • Loading branch information
Remi-Gau authored and apjanke committed Dec 23, 2019
1 parent 7049be0 commit d3ca784
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
Binary file added tests/data/sub-01_task-auditory_events.tsv.gz
Binary file not shown.
35 changes: 35 additions & 0 deletions tests/test_tsvread.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
function test_tsvread(pth)
% Test the tsvread function
%__________________________________________________________________________
%
% BIDS (Brain Imaging Data Structure): https://bids.neuroimaging.io/
% The brain imaging data structure, a format for organizing and
% describing outputs of neuroimaging experiments.
% K. J. Gorgolewski et al, Scientific Data, 2016.
%__________________________________________________________________________
%
% Copyright (C) 2019, Remi Gau
% Copyright (C) 2019--, BIDS-MATLAB developers
%
%
% Small test to ensure that the functionality of the tsvread function

if ~nargin
pth = fullfile(fileparts(mfilename('fullpath')),'data','MoAEpilot');
end

% define the expected output from bids query metadata
events.onset = [42 126 210 294 378 462 546];


%% test tsvread on tsv file
tsv_file = fullfile(pth, 'sub-01', 'func', 'sub-01_task-auditory_events.tsv');
output = bids.util.tsvread(tsv_file);
assert(isequal(output.onset', events.onset));


%% test tsvread on zipped tsv file
output = bids.util.tsvread(fullfile(fileparts(mfilename('fullpath')), 'data', 'sub-01_task-auditory_events.tsv.gz'));
assert(isequal(output.onset', events.onset));


0 comments on commit d3ca784

Please sign in to comment.