Skip to content

Commit 6ba2d10

Browse files
Merge pull request #6 from marcobarilari/marco_springCleaning
remove code that is in common with `CPP_SPM` and add missing test for check optionns
2 parents 9848445 + b2d36a4 commit 6ba2d10

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

tests/test_checkOptionsSource.m

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
function test_suite = test_checkOptionsSource %#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_checkOptionsSourceBasic()
10+
11+
optSource.nbDummies = 0;
12+
optSource = checkOptionsSource(optSource);
13+
14+
expectedOptionsSource = defaultOptionsSource();
15+
expectedOptionsSource.nbDummies = 0;
16+
17+
assertEqual(optSource, expectedOptionsSource);
18+
19+
end
20+
21+
function test_checkOptionsSourceDoNotOverwrite()
22+
23+
optSource.dataType = 666;
24+
optSource.someExtraField = 'test';
25+
optSource.nbDummies = 42;
26+
27+
optSource = checkOptionsSource(optSource);
28+
29+
assertEqual(optSource.dataType, 666);
30+
assertEqual(optSource.someExtraField, 'test');
31+
assertEqual(optSource.nbDummies, 42);
32+
33+
end
34+
35+
function expectedOptionsSource = defaultOptionsSource()
36+
37+
expectedOptionsSource.sourceDir = '';
38+
39+
expectedOptionsSource.dataDir = '';
40+
41+
expectedOptionsSource.sequenceToIgnore = {};
42+
43+
expectedOptionsSource.dataType = 0;
44+
45+
expectedOptionsSource.zip = 0;
46+
47+
expectedOptionsSource.nbDummies = 0;
48+
49+
expectedOptionsSource.sequenceRmDummies = {};
50+
51+
end

0 commit comments

Comments
 (0)