forked from ludvigak/SE_unified
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_unit_tests.m
48 lines (45 loc) · 1.25 KB
/
run_unit_tests.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
clear
module_folders = {'SE_Rotlet', ...
'SE_Stresslet', ...
'SE_Stokes', ...
'SE_Stokes_direct'
};
% Run all unit tests that we have
results = cell(size(module_folders));
num_tests = numel(module_folders);
% Enter folders and run init + tests
for i=1:num_tests
folder = module_folders{i};
run([folder '/init'])
results{i} = runtests([folder '/tests']);
end
% Print results
all_passed = true;
for i=1:num_tests
folder = module_folders{i};
fprintf('======================================\n');
fprintf('Results from %s:\n\n', folder);
disp(table(results{i}))
failed = find([results{i}.Passed] == false);
if any(failed)
all_passed = false;
end
end
% List failed tests
if all_passed
disp('ALL TESTS PASSED')
else
disp('===================================')
fprintf('= FAILED TESTS:\n=\n')
for i=1:num_tests
folder = module_folders{i};
failed = find([results{i}.Passed] == false);
if any(failed)
for f=failed
fprintf('= %s | %s\n', folder, results{i}(f).Name);
end
end
end
disp('===================================')
error('There were failed tests.')
end