-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDSPRunTests.m
More file actions
94 lines (67 loc) · 2.2 KB
/
Copy pathDSPRunTests.m
File metadata and controls
94 lines (67 loc) · 2.2 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
%% Runs all tests for Polyphase Decimator DSP
clear;
clc;
%% ==========================================
%% PROJECT ROOT
%% ==========================================
projectRoot = fileparts(mfilename("fullpath"));
%% ==========================================
%% PROJECT PATHS
%% ==========================================
addpath(genpath(fullfile(projectRoot, "Design")));
%% ==========================================
%% LOCATE TESTS
%% ==========================================
TestRoot = fullfile(projectRoot, "Tests");
if ~isfolder(TestRoot)
error( ...
'PolyphaseDSP:TestsNotFound', ...
'The Polyphase DSP Tests folder could not be located.');
end
%% ==========================================
%% CREATE TEST SUITE
%% ==========================================
TestSuite = testsuite( ...
TestRoot, ...
"IncludeSubfolders", true);
%% ==========================================
%% CONFIGURE TEST RUNNER
%% ==========================================
Runner = matlab.unittest.TestRunner.withDefaultPlugins;
%% ==========================================
%% CI TEST REPORTING
%% ==========================================
if strcmpi(getenv("GITHUB_ACTIONS"), "true")
ReportRoot = fullfile( ...
projectRoot, ...
"test-results");
if ~isfolder(ReportRoot)
mkdir(ReportRoot);
end
%% JUnit XML report
import matlab.unittest.plugins.XMLPlugin
XMLReport = fullfile( ...
ReportRoot, ...
"polyphase-dsp-test-results.xml");
Runner.addPlugin( ...
XMLPlugin.producingJUnitFormat(XMLReport));
%% HTML report
import matlab.unittest.plugins.TestReportPlugin
HTMLReport = fullfile( ...
ReportRoot, ...
"polyphase-dsp-test-report.html");
Runner.addPlugin( ...
TestReportPlugin.producingHTML( ...
HTMLReport, ...
"Title", ...
"Polyphase Decimator Verification Report"));
end
%% ==========================================
%% RUN TESTS
%% ==========================================
results = Runner.run(TestSuite);
disp(results);
%% ==========================================
%% VERIFY TEST RESULTS
%% ==========================================
assertSuccess(results);