|
1 | | -function test_transferInfoToBids() |
| 1 | +function test_suite = test_transferInfoToBids %#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 |
2 | 8 |
|
3 | | - %% |
| 9 | +function test_transferInfoToBidsBasic() |
| 10 | + % basic behavior |
| 11 | + |
4 | 12 | cfg = struct(); |
5 | 13 | fieldsToSet = struct(); |
6 | 14 | cfg = transferInfoToBids(fieldsToSet, cfg); |
7 | | - |
| 15 | + |
8 | 16 | expectedStruct = struct(); |
9 | | - |
| 17 | + |
10 | 18 | assert(isequal(expectedStruct, fieldsToSet)); |
| 19 | + |
| 20 | +end |
11 | 21 |
|
12 | | - %% |
| 22 | +function test_transferInfoToBidsTaskname() |
| 23 | + % make sure the file name gets trasnferred where it should |
| 24 | + |
13 | 25 | cfg.task.name = 'foo bar'; |
14 | | - |
| 26 | + |
| 27 | + fieldsToSet = struct(); |
15 | 28 | fieldsToSet = transferInfoToBids(fieldsToSet, cfg); |
16 | | - |
| 29 | + |
17 | 30 | expectedStruct.fileName.task = 'fooBar'; |
18 | 31 | expectedStruct.bids.meg.TaskName = 'foo Bar'; |
19 | 32 | expectedStruct.bids.mri.TaskName = 'foo Bar'; |
20 | | - |
| 33 | + |
21 | 34 | assert(isequal(expectedStruct, fieldsToSet)); |
| 35 | + |
| 36 | +end |
22 | 37 |
|
23 | | - %% |
24 | | - clear cfg fieldsToSet expectedStruct; |
25 | | - |
| 38 | +function test_transferInfoToBidsMRI() |
| 39 | + % make sure the file name gets trasnferred where it should |
| 40 | + |
26 | 41 | cfg.mri.repetitionTime = 1.56; |
27 | | - |
| 42 | + |
28 | 43 | fieldsToSet = struct(); |
29 | 44 | fieldsToSet = transferInfoToBids(fieldsToSet, cfg); |
30 | | - |
| 45 | + |
31 | 46 | expectedStruct.bids.mri.RepetitionTime = 1.56; |
32 | | - |
| 47 | + |
33 | 48 | assert(isequal(expectedStruct, fieldsToSet)); |
34 | | - |
| 49 | + |
35 | 50 | end |
| 51 | + |
0 commit comments