Build out MATLAB test framework and core integration coverage

This commit is contained in:
Silas Oettinghaus
2026-03-24 17:23:02 +01:00
parent 9446dfb888
commit a592ebefda
154 changed files with 2281 additions and 1305 deletions

View File

@@ -1,11 +1,78 @@
classdef FFE_test < matlab.unittest.TestCase
% Test class for FFE
classdef FFE_test < IMDDTestCase
methods (Test, TestTags = {'unit', 'fast', 'dsp', 'ffe'})
function constructorStoresDefaultsAndInitialState(testCase)
ffe = FFE();
methods (Test)
function testExample(testCase)
% Example test case for FFE
% Add your test code here
testCase.verifyTrue(true);
testCase.verifyEqual(ffe.sps, 2);
testCase.verifyEqual(ffe.order, 15);
testCase.verifyEqual(ffe.len_tr, 4096);
testCase.verifyEqual(ffe.mu_tr, 0);
testCase.verifyEqual(ffe.epochs_tr, 5);
testCase.verifyEqual(ffe.adaption_technique, adaption_method.lms);
testCase.verifyEqual(ffe.dd_mode, 1);
testCase.verifyEqual(ffe.mu_dd, 1e-5);
testCase.verifyEqual(ffe.epochs_dd, 5);
testCase.verifyFalse(ffe.decide);
testCase.verifyEqual(ffe.e, zeros(ffe.order, 1));
testCase.verifyEqual(ffe.error, 0);
end
function noUpdateModeKeepsWeightsAtZeroAndPreservesSamplingRate(testCase)
x = makeSignal([-1; 1; -1; 1], 32e9);
d = makeSignal([-1; 1; -1; 1], 8e9);
ffe = FFE( ...
"sps", 1, ...
"order", 1, ...
"len_tr", length(x), ...
"mu_tr", 0, ...
"epochs_tr", 1, ...
"mu_dd", 0, ...
"epochs_dd", 1, ...
"dd_mode", 0, ...
"decide", false, ...
"adaption_technique", adaption_method.lms);
[y, noi] = ffe.process(x, d);
testCase.verifyEqual(ffe.e, 0);
testCase.verifyEqual(ffe.e_tr, 0);
testCase.verifyEqual(y.signal, zeros(size(x.signal)), "AbsTol", 1e-12);
testCase.verifyEqual(y.fs, d.fs);
testCase.verifyEqual(noi.signal, -d.signal, "AbsTol", 1e-12);
testCase.verifyEqual(length(y.signal), length(x.signal));
end
function trainingModeLearnsFromTinySyntheticChannel(testCase)
x = makeSignal([1; -1; 1; -1], 16e9);
d = makeSignal([1; -1; 1; -1], 4e9);
ffe = FFE( ...
"sps", 1, ...
"order", 1, ...
"len_tr", length(x), ...
"mu_tr", 0.5, ...
"epochs_tr", 1, ...
"mu_dd", 0, ...
"epochs_dd", 1, ...
"dd_mode", 0, ...
"decide", false, ...
"adaption_technique", adaption_method.lms);
[y, noi] = ffe.process(x, d);
testCase.verifyEqual(y.fs, d.fs);
testCase.verifyClass(y, 'Informationsignal');
testCase.verifyClass(noi, 'Informationsignal');
testCase.verifyNotEqual(ffe.e, 0);
testCase.verifyNotEqual(ffe.e_tr, 0);
testCase.verifyNotEqual(y.signal, zeros(size(x.signal)));
testCase.verifyEqual(length(y.signal), length(x.signal));
end
end
end
function sig = makeSignal(values, fs)
base = Signal(values);
sig = Informationsignal(values, "fs", fs, "logbook", base.logbook);
end