|
| 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