Skip to content

Commit a0ffb3e

Browse files
authored
Merge pull request #86 from Remi-Gau/remi-utils_test
add utils test and version file
2 parents 962c947 + fe06d93 commit a0ffb3e

File tree

9 files changed

+46
-23
lines changed

9 files changed

+46
-23
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ before_script:
4444
jobs:
4545
include:
4646
- name: "BIDS validator: create and check dataset"
47-
script: octave $OCTFLAGS --eval "test_makeRawDataset" && bids-validator `pwd`/output/rawdata/ --ignoreNiftiHeaders
47+
script: octave $OCTFLAGS --eval "test_makeRawDataset" && bids-validator `pwd`/output/raw/ --ignoreNiftiHeaders
4848
- name: "miss_hit: checking code quality"
4949
script: mh_metric . --ci
5050
- name: "miss_hit: checking code style"

src/convertSourceToRaw.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function convertSourceToRaw(cfg)
1010
% Only covers func folder at the moment
1111

1212
sourceDir = fullfile(cfg.dir.output, 'source');
13-
rawDir = fullfile(cfg.dir.output, 'rawdata');
13+
rawDir = fullfile(cfg.dir.output, 'raw');
1414

1515
% add dummy README and CHANGE file
1616
copyfile(fullfile( ...

src/createFilename.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
'echo', ...
106106
'phaseEncodingDirection', ...
107107
'reconstruction', ...
108-
'recording', ...
108+
'recording' ...
109109
};
110110

111111
targetFields = { ...
@@ -114,7 +114,7 @@
114114
'echo', ...
115115
'dir', ...
116116
'rec', ...
117-
'recording', ...
117+
'recording' ...
118118
};
119119

120120
for iField = 1:numel(fields2Check)
@@ -146,10 +146,10 @@
146146
pattern = cfg.fileName.pattern;
147147

148148
runSuffix = cfg.fileName.suffix.run;
149-
acqSuffix = cfg.fileName.suffix.acquisition ;
150-
ceSuffix = cfg.fileName.suffix.contrastEnhancement ;
151-
dirSuffix = cfg.fileName.suffix.phaseEncodingDirection ;
152-
recSuffix = cfg.fileName.suffix.reconstruction ;
149+
acqSuffix = cfg.fileName.suffix.acquisition;
150+
ceSuffix = cfg.fileName.suffix.contrastEnhancement;
151+
dirSuffix = cfg.fileName.suffix.phaseEncodingDirection;
152+
recSuffix = cfg.fileName.suffix.reconstruction;
153153
echoSuffix = cfg.fileName.suffix.echo;
154154
recordingSuffix = cfg.fileName.suffix.recording;
155155

src/checkCppBidsDependencies.m renamed to src/subfun/checkCppBidsDependencies.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function checkCppBidsDependencies(cfg)
1212

1313
elseif isempty(GITHUB_WORKSPACE) % local
1414

15-
pth = fullfile(fileparts(mfilename('fullpath')), '..');
15+
pth = fullfile(fileparts(mfilename('fullpath')), '..', '..');
1616
checkSubmodule(fullfile(pth, 'lib', 'JSONio'));
1717
checkSubmodule(fullfile(pth, 'lib', 'bids-matlab'));
1818

src/printCreditsCppBids.m renamed to src/subfun/printCreditsCppBids.m

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
function printCreditsCppBids(cfg)
22

3+
try
4+
version = fileread(fullfile(fileparts(mfilename('fullpath')), ...
5+
'..', '..', 'version.txt'));
6+
catch
7+
version = 'v1.0.0';
8+
end
9+
310
verbose = true;
411
if ~isempty(cfg) && isfield(cfg, 'verbose') && ~isempty(cfg.verbose)
512
verbose = cfg.verbose;
613
end
714

815
if verbose
916

10-
version = '0.0.1';
11-
1217
contributors = { ...
1318
'Rémi Gau', ...
1419
'Marco Barilari', ...

tests/test_getIsQuestionToAsk.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
function test_isPositiveIntegerBasic()
1010

1111
questions.questionsToAsk = { ...
12-
[], 1 ; ...
13-
[], 0 ; ...
14-
[], 1 ; ...
15-
[], 0 ; ...
12+
[], 1; ...
13+
[], 0; ...
14+
[], 1; ...
15+
[], 0; ...
1616
};
1717

1818
responses = { ...
@@ -24,6 +24,6 @@ function test_isPositiveIntegerBasic()
2424

2525
isQuestionToAsk = getIsQuestionToAsk(questions, responses);
2626

27-
assertEqual(isQuestionToAsk, [false;false;true;false]);
27+
assertEqual(isQuestionToAsk, [false; false; true; false]);
2828

2929
end

tests/test_removeDateSuffix.m

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ function test_removeDateSuffixBasic()
2323
stimNameZipped = 'test2_stim_date-202008050730.tsv.gz';
2424

2525
filesToProcess = { ...
26-
boldName ;
27-
boldName2 ;
28-
boldName3 ;
29-
jsonName ;
30-
eventsName ;
31-
stimName ;
32-
stimNameZipped ;
26+
boldName;
27+
boldName2;
28+
boldName3;
29+
jsonName;
30+
eventsName;
31+
stimName;
32+
stimNameZipped;
3333
};
3434

3535
% create new files for new tests

tests/test_utils.m

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
function test_suite = test_utils %#ok<*STOUT>
2+
try % assignment of 'localfunctions' is necessary in Matlab >= 2016
3+
test_functions = localfunctions(); %#ok<*NASGU>
4+
catch % no problem; early Matlab versions can use initTestSuite fine
5+
end
6+
initTestSuite;
7+
end
8+
9+
function test_utilsBasic()
10+
11+
cfg.verbose = true;
12+
13+
printCreditsCppBids(cfg);
14+
15+
checkCppBidsDependencies(cfg);
16+
17+
end

version.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v1.0.0

0 commit comments

Comments
 (0)