Skip to content

Commit 644689a

Browse files
committed
simplify unit test for checkCFG
make use of mox unit functions
1 parent a17e12a commit 644689a

File tree

1 file changed

+3
-33
lines changed

1 file changed

+3
-33
lines changed

tests/test_checkCFG.m

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function test_checkCfgDefault()
1818
expectedStructure.testingDevice = 'pc';
1919

2020
%% test
21-
checkSubFields(expectedStructure, cfg);
21+
assertEqual(expectedStructure, cfg);
2222

2323
end
2424

@@ -73,7 +73,7 @@ function test_checkCfgBasic()
7373
expectedStructure = orderfields(expectedStructure);
7474

7575
%% test
76-
checkSubFields(expectedStructure, cfg);
76+
assertEqual(expectedStructure, cfg);
7777

7878
end
7979

@@ -124,34 +124,4 @@ function test_checkCfgBasic()
124124

125125
expectedCfgStructure = orderfields(expectedCfgStructure);
126126

127-
end
128-
129-
function checkSubFields(expectedStructure, cfg)
130-
% check that that the structures match
131-
% if it fails it check from which subfield the error comes from
132-
133-
try
134-
135-
assertEqual(expectedStructure, cfg);
136-
137-
catch ME
138-
139-
if isstruct(expectedStructure)
140-
141-
names = fieldnames(expectedStructure);
142-
143-
for i = 1:numel(names)
144-
145-
disp(names{i});
146-
testSubFields(expectedStructure.(names{i}), cfg.(names{i}));
147-
148-
end
149-
150-
end
151-
152-
disp(expectedStructure);
153-
disp(cfg);
154-
155-
rethrow(ME);
156-
end
157-
end
127+
end

0 commit comments

Comments
 (0)