Build out MATLAB test framework and core integration coverage
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
classdef CIC_filter_test < matlab.unittest.TestCase
|
||||
% Test class for CIC_filter
|
||||
|
||||
methods (Test)
|
||||
function testExample(testCase)
|
||||
% Example test case for CIC_filter
|
||||
% Add your test code here
|
||||
testCase.verifyTrue(true);
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,137 +1,10 @@
|
||||
classdef Duobinary_test < matlab.unittest.TestCase
|
||||
|
||||
properties
|
||||
%genereal properties of the test
|
||||
ber
|
||||
errors
|
||||
errorIndice
|
||||
numbits
|
||||
numsymbols
|
||||
end
|
||||
|
||||
properties (MethodSetupParameter)
|
||||
% Define method-level parameters for PRBS and bit pattern
|
||||
% i.e.: useprbs = {0,1};
|
||||
useprbs = struct('true', 0); % variations: {0, 1}
|
||||
M = struct('M2', 2, 'M4', 4, 'M6', 6, 'M8', 8); % variations: {2, 4, 6, 8}
|
||||
O = struct('O10', 10,'O11', 11,'O12', 12,'O13', 13, 'O15', 15, 'O17', 17, 'O18', 18, 'O19', 19); % variations: {10, 15, 17}
|
||||
end
|
||||
|
||||
properties (TestParameter)
|
||||
% Define test-level parameters for M and O
|
||||
|
||||
end
|
||||
|
||||
methods (TestMethodSetup, ParameterCombination = 'pairwise')
|
||||
|
||||
function setupTest(testCase, useprbs, M, O)
|
||||
|
||||
randkey = 1;
|
||||
datarate = 448e9;
|
||||
fsym = round(datarate / log2(M)) ;
|
||||
|
||||
%%%%% PRBS Generation in correct shape for Modulation Format %%%%%%
|
||||
N = 2^(O-1); %length of prbs
|
||||
[~,seed] = prbs(O,1); %initialize first seed of prbs
|
||||
bitpattern=[];
|
||||
|
||||
if useprbs
|
||||
%%%%% MOVE-IT PRMS %%%%
|
||||
|
||||
state = struct();
|
||||
|
||||
para = struct();
|
||||
|
||||
if M == 6
|
||||
para.bl = 2^(O-2);
|
||||
para.dimension = 5;
|
||||
else
|
||||
para.bl = 2^(O-1);
|
||||
para.dimension = log2(M); %2.5bits/sym -> 2 bit/sym
|
||||
end
|
||||
|
||||
para.rand = 0;
|
||||
|
||||
para.order = floor(O / log2(M));
|
||||
para.skip =0;
|
||||
para.bruijn = 0;
|
||||
para.reset_prms = 0;
|
||||
para.method = 1;
|
||||
|
||||
data_in = [];
|
||||
global loop;
|
||||
loop = 0;
|
||||
[data_out,state_] = prms(data_in, state, para);
|
||||
loop = 1;
|
||||
[data_out,state_out] = prms(data_in, state_, para);
|
||||
bitpattern = data_out';
|
||||
|
||||
%%%%% END MOVE-IT %%%%%%%
|
||||
else
|
||||
s = RandStream('twister','Seed',randkey);
|
||||
for i = 1:log2(M)
|
||||
bitpattern(:,i) = randi(s,[0 1], N, 1);
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if M == 6
|
||||
bitpattern = reshape(bitpattern',[],1);
|
||||
bitpattern = bitpattern(1:end-mod(length(bitpattern),5));
|
||||
end
|
||||
|
||||
testCase.numbits = length(bitpattern);
|
||||
|
||||
Tx_bits = Informationsignal(bitpattern);
|
||||
|
||||
Symbols_tx = PAMmapper(M,0).map(Tx_bits);
|
||||
Symbols_tx.fs = fsym;
|
||||
|
||||
testCase.numsymbols = length(Symbols_tx);
|
||||
|
||||
Symbols_tx = PAMmapper(M,0).map(Tx_bits);
|
||||
|
||||
Symbols_tx.fs = fsym;
|
||||
|
||||
Symbols = Duobinary().precode(Symbols_tx);
|
||||
|
||||
Symbols = Duobinary().encode(Symbols);
|
||||
|
||||
Symbols = Duobinary().decode(Symbols);
|
||||
|
||||
Rx_bits = PAMmapper(M,0).demap(Symbols);
|
||||
|
||||
[bits,testCase.errors,testCase.ber,testCase.errorIndice] = calc_ber(Tx_bits.signal,Rx_bits.signal,"skip_front",0,"skip_end",0,"returnErrorLocation",1);
|
||||
classdef Duobinary_test < IMDDTestCase
|
||||
% Auto-generated placeholder for Duobinary.
|
||||
% Target: C:/Users/Silas/Documents/MATLAB/imdd_simulation/Classes/04_DSP/Coding/Duobinary.m
|
||||
|
||||
methods (Test, TestTags = {'placeholder', 'todo'})
|
||||
function testNotImplemented(testCase)
|
||||
testCase.assumeFail("Tests for Duobinary are not implemented yet.");
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
methods (Test)
|
||||
% Test with sequential combination of parameters
|
||||
|
||||
function checkBerZero(testCase, useprbs, M, O)
|
||||
% Assert that BER is zero
|
||||
testCase.verifyEqual(testCase.ber, 0, ['Numer of Errors is not zero, found ',num2str(testCase.errors), ' errors at position ', num2str(testCase.errorIndice),' out of ', num2str(2^O)]);
|
||||
|
||||
end
|
||||
|
||||
function checkBerCloseToZero(testCase, useprbs, M, O)
|
||||
|
||||
testCase.verifyLessThan(testCase.errors, 5, ['Found more than 5 errors. Found ',num2str(testCase.errors),' errors.']);
|
||||
|
||||
% if ~isempty(testCase.errorIndice)
|
||||
% testCase.verifyEqual(testCase.errorIndice, 2^O , ['Error is NOT at the End but at: ', num2str(testCase.errorIndice),' of ', num2str(2^O)]);
|
||||
% testCase.verifyEqual(testCase.errorIndice,1, ['Error is NOT at the Beginning but at: ', num2str(testCase.errorIndice),' of ', num2str(2^O)]);
|
||||
% end
|
||||
|
||||
end
|
||||
|
||||
function checkSystemFailure(testCase, useprbs, M, O)
|
||||
testCase.verifyLessThan(testCase.ber, 0.1, ['BER is higher than 10%. Soemthing is completely wrong! (BER is ',num2str(testCase.ber),')']);
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
classdef MRDS_coding_test < matlab.unittest.TestCase
|
||||
% Test class for MRDS_coding
|
||||
classdef MRDS_coding_test < IMDDTestCase
|
||||
% Auto-generated placeholder for MRDS_coding.
|
||||
% Target: C:/Users/Silas/Documents/MATLAB/imdd_simulation/Classes/04_DSP/Coding/MRDS_coding.m
|
||||
|
||||
methods (Test)
|
||||
function testExample(testCase)
|
||||
% Example test case for MRDS_coding
|
||||
% Add your test code here
|
||||
testCase.verifyTrue(true);
|
||||
methods (Test, TestTags = {'placeholder', 'todo'})
|
||||
function testNotImplemented(testCase)
|
||||
testCase.assumeFail("Tests for MRDS_coding are not implemented yet.");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
classdef EQ_copy_test < matlab.unittest.TestCase
|
||||
% Test class for EQ_copy
|
||||
classdef EQ_copy_test < IMDDTestCase
|
||||
% Auto-generated placeholder for EQ_copy.
|
||||
% Target: C:/Users/Silas/Documents/MATLAB/imdd_simulation/Classes/04_DSP/Equalizer/EQ_copy.m
|
||||
|
||||
methods (Test)
|
||||
function testExample(testCase)
|
||||
% Example test case for EQ_copy
|
||||
% Add your test code here
|
||||
testCase.verifyTrue(true);
|
||||
methods (Test, TestTags = {'placeholder', 'todo'})
|
||||
function testNotImplemented(testCase)
|
||||
testCase.assumeFail("Tests for EQ_copy are not implemented yet.");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
classdef EQ_silas_ofc_test < matlab.unittest.TestCase
|
||||
% Test class for EQ_silas_ofc
|
||||
classdef EQ_silas_ofc_test < IMDDTestCase
|
||||
% Auto-generated placeholder for EQ_silas_ofc.
|
||||
% Target: C:/Users/Silas/Documents/MATLAB/imdd_simulation/Classes/04_DSP/Equalizer/EQ_silas_ofc.m
|
||||
|
||||
methods (Test)
|
||||
function testExample(testCase)
|
||||
% Example test case for EQ_silas_ofc
|
||||
% Add your test code here
|
||||
testCase.verifyTrue(true);
|
||||
methods (Test, TestTags = {'placeholder', 'todo'})
|
||||
function testNotImplemented(testCase)
|
||||
testCase.assumeFail("Tests for EQ_silas_ofc are not implemented yet.");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
classdef EQ_silas_plain_test < matlab.unittest.TestCase
|
||||
% Test class for EQ_silas_plain
|
||||
classdef EQ_silas_plain_test < IMDDTestCase
|
||||
% Auto-generated placeholder for EQ_silas_plain.
|
||||
% Target: C:/Users/Silas/Documents/MATLAB/imdd_simulation/Classes/04_DSP/Equalizer/EQ_silas_plain.m
|
||||
|
||||
methods (Test)
|
||||
function testExample(testCase)
|
||||
% Example test case for EQ_silas_plain
|
||||
% Add your test code here
|
||||
testCase.verifyTrue(true);
|
||||
methods (Test, TestTags = {'placeholder', 'todo'})
|
||||
function testNotImplemented(testCase)
|
||||
testCase.assumeFail("Tests for EQ_silas_plain are not implemented yet.");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
classdef EQ_silas_sliding_window_dc_removal_test < matlab.unittest.TestCase
|
||||
% Test class for EQ_silas_sliding_window_dc_removal
|
||||
classdef EQ_silas_sliding_window_dc_removal_test < IMDDTestCase
|
||||
% Auto-generated placeholder for EQ_silas_sliding_window_dc_removal.
|
||||
% Target: C:/Users/Silas/Documents/MATLAB/imdd_simulation/Classes/04_DSP/Equalizer/EQ_silas_sliding_window_dc_removal.m
|
||||
|
||||
methods (Test)
|
||||
function testExample(testCase)
|
||||
% Example test case for EQ_silas_sliding_window_dc_removal
|
||||
% Add your test code here
|
||||
testCase.verifyTrue(true);
|
||||
methods (Test, TestTags = {'placeholder', 'todo'})
|
||||
function testNotImplemented(testCase)
|
||||
testCase.assumeFail("Tests for EQ_silas_sliding_window_dc_removal are not implemented yet.");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
classdef EQ_silas_test < matlab.unittest.TestCase
|
||||
% Test class for EQ_silas
|
||||
classdef EQ_silas_test < IMDDTestCase
|
||||
% Auto-generated placeholder for EQ_silas.
|
||||
% Target: C:/Users/Silas/Documents/MATLAB/imdd_simulation/Classes/04_DSP/Equalizer/EQ_silas.m
|
||||
|
||||
methods (Test)
|
||||
function testExample(testCase)
|
||||
% Example test case for EQ_silas
|
||||
% Add your test code here
|
||||
testCase.verifyTrue(true);
|
||||
methods (Test, TestTags = {'placeholder', 'todo'})
|
||||
function testNotImplemented(testCase)
|
||||
testCase.assumeFail("Tests for EQ_silas are not implemented yet.");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
classdef EQ_test < matlab.unittest.TestCase
|
||||
% Test class for EQ
|
||||
classdef EQ_test < IMDDTestCase
|
||||
% Auto-generated placeholder for EQ.
|
||||
% Target: C:/Users/Silas/Documents/MATLAB/imdd_simulation/Classes/04_DSP/Equalizer/EQ.m
|
||||
|
||||
methods (Test)
|
||||
function testExample(testCase)
|
||||
% Example test case for EQ
|
||||
% Add your test code here
|
||||
testCase.verifyTrue(true);
|
||||
methods (Test, TestTags = {'placeholder', 'todo'})
|
||||
function testNotImplemented(testCase)
|
||||
testCase.assumeFail("Tests for EQ are not implemented yet.");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
classdef FFE_DCremoval_adaptive_mu_test < matlab.unittest.TestCase
|
||||
% Test class for FFE_DCremoval_adaptive_mu
|
||||
classdef FFE_DCremoval_adaptive_mu_test < IMDDTestCase
|
||||
% Auto-generated placeholder for FFE_DCremoval_adaptive_mu.
|
||||
% Target: C:/Users/Silas/Documents/MATLAB/imdd_simulation/Classes/04_DSP/Equalizer/FFE_DCremoval_adaptive_mu.m
|
||||
|
||||
methods (Test)
|
||||
function testExample(testCase)
|
||||
% Example test case for FFE_DCremoval_adaptive_mu
|
||||
% Add your test code here
|
||||
testCase.verifyTrue(true);
|
||||
methods (Test, TestTags = {'placeholder', 'todo'})
|
||||
function testNotImplemented(testCase)
|
||||
testCase.assumeFail("Tests for FFE_DCremoval_adaptive_mu are not implemented yet.");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
classdef FFE_DCremoval_level_test < matlab.unittest.TestCase
|
||||
% Test class for FFE_DCremoval_level
|
||||
classdef FFE_DCremoval_level_test < IMDDTestCase
|
||||
% Auto-generated placeholder for FFE_DCremoval_level.
|
||||
% Target: C:/Users/Silas/Documents/MATLAB/imdd_simulation/Classes/04_DSP/Equalizer/FFE_DCremoval_level.m
|
||||
|
||||
methods (Test)
|
||||
function testExample(testCase)
|
||||
% Example test case for FFE_DCremoval_level
|
||||
% Add your test code here
|
||||
testCase.verifyTrue(true);
|
||||
methods (Test, TestTags = {'placeholder', 'todo'})
|
||||
function testNotImplemented(testCase)
|
||||
testCase.assumeFail("Tests for FFE_DCremoval_level are not implemented yet.");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
classdef FFE_DCremoval_test < matlab.unittest.TestCase
|
||||
% Test class for FFE_DCremoval
|
||||
classdef FFE_DCremoval_test < IMDDTestCase
|
||||
% Auto-generated placeholder for FFE_DCremoval.
|
||||
% Target: C:/Users/Silas/Documents/MATLAB/imdd_simulation/Classes/04_DSP/Equalizer/FFE_DCremoval.m
|
||||
|
||||
methods (Test)
|
||||
function testExample(testCase)
|
||||
% Example test case for FFE_DCremoval
|
||||
% Add your test code here
|
||||
testCase.verifyTrue(true);
|
||||
methods (Test, TestTags = {'placeholder', 'todo'})
|
||||
function testNotImplemented(testCase)
|
||||
testCase.assumeFail("Tests for FFE_DCremoval are not implemented yet.");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
classdef FFE_DFE_test < matlab.unittest.TestCase
|
||||
% Test class for FFE_DFE
|
||||
classdef FFE_DFE_test < IMDDTestCase
|
||||
% Auto-generated placeholder for FFE_DFE.
|
||||
% Target: C:/Users/Silas/Documents/MATLAB/imdd_simulation/Classes/04_DSP/Equalizer/FFE_DFE.m
|
||||
|
||||
methods (Test)
|
||||
function testExample(testCase)
|
||||
% Example test case for FFE_DFE
|
||||
% Add your test code here
|
||||
testCase.verifyTrue(true);
|
||||
methods (Test, TestTags = {'placeholder', 'todo'})
|
||||
function testNotImplemented(testCase)
|
||||
testCase.assumeFail("Tests for FFE_DFE are not implemented yet.");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
classdef FFE_FFDCAVG_test < matlab.unittest.TestCase
|
||||
% Test class for FFE_FFDCAVG
|
||||
classdef FFE_FFDCAVG_test < IMDDTestCase
|
||||
% Auto-generated placeholder for FFE_FFDCAVG.
|
||||
% Target: C:/Users/Silas/Documents/MATLAB/imdd_simulation/Classes/04_DSP/Equalizer/FFE_FFDCAVG.m
|
||||
|
||||
methods (Test)
|
||||
function testExample(testCase)
|
||||
% Example test case for FFE_FFDCAVG
|
||||
% Add your test code here
|
||||
testCase.verifyTrue(true);
|
||||
methods (Test, TestTags = {'placeholder', 'todo'})
|
||||
function testNotImplemented(testCase)
|
||||
testCase.assumeFail("Tests for FFE_FFDCAVG are not implemented yet.");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
classdef FFE_Kalman_Feedback_test < matlab.unittest.TestCase
|
||||
% Test class for FFE_Kalman_Feedback
|
||||
classdef FFE_Kalman_Feedback_test < IMDDTestCase
|
||||
% Auto-generated placeholder for FFE_Kalman_Feedback.
|
||||
% Target: C:/Users/Silas/Documents/MATLAB/imdd_simulation/Classes/04_DSP/Equalizer/FFE_Kalman_Feedback.m
|
||||
|
||||
methods (Test)
|
||||
function testExample(testCase)
|
||||
% Example test case for FFE_Kalman_Feedback
|
||||
% Add your test code here
|
||||
testCase.verifyTrue(true);
|
||||
methods (Test, TestTags = {'placeholder', 'todo'})
|
||||
function testNotImplemented(testCase)
|
||||
testCase.assumeFail("Tests for FFE_Kalman_Feedback are not implemented yet.");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
classdef FFE_Kalman_test < matlab.unittest.TestCase
|
||||
% Test class for FFE_Kalman
|
||||
classdef FFE_Kalman_test < IMDDTestCase
|
||||
% Auto-generated placeholder for FFE_Kalman.
|
||||
% Target: C:/Users/Silas/Documents/MATLAB/imdd_simulation/Classes/04_DSP/Equalizer/FFE_Kalman.m
|
||||
|
||||
methods (Test)
|
||||
function testExample(testCase)
|
||||
% Example test case for FFE_Kalman
|
||||
% Add your test code here
|
||||
testCase.verifyTrue(true);
|
||||
methods (Test, TestTags = {'placeholder', 'todo'})
|
||||
function testNotImplemented(testCase)
|
||||
testCase.assumeFail("Tests for FFE_Kalman are not implemented yet.");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
classdef FFE_MLSE_test < matlab.unittest.TestCase
|
||||
% Test class for FFE_MLSE
|
||||
classdef FFE_MLSE_test < IMDDTestCase
|
||||
% Auto-generated placeholder for FFE_MLSE.
|
||||
% Target: C:/Users/Silas/Documents/MATLAB/imdd_simulation/Classes/04_DSP/Equalizer/FFE_MLSE.m
|
||||
|
||||
methods (Test)
|
||||
function testExample(testCase)
|
||||
% Example test case for FFE_MLSE
|
||||
% Add your test code here
|
||||
testCase.verifyTrue(true);
|
||||
methods (Test, TestTags = {'placeholder', 'todo'})
|
||||
function testNotImplemented(testCase)
|
||||
testCase.assumeFail("Tests for FFE_MLSE are not implemented yet.");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
classdef FFE_adaptive_decision_test < matlab.unittest.TestCase
|
||||
% Test class for FFE_adaptive_decision
|
||||
classdef FFE_adaptive_decision_test < IMDDTestCase
|
||||
% Auto-generated placeholder for FFE_adaptive_decision.
|
||||
% Target: C:/Users/Silas/Documents/MATLAB/imdd_simulation/Classes/04_DSP/Equalizer/FFE_adaptive_decision.m
|
||||
|
||||
methods (Test)
|
||||
function testExample(testCase)
|
||||
% Example test case for FFE_adaptive_decision
|
||||
% Add your test code here
|
||||
testCase.verifyTrue(true);
|
||||
methods (Test, TestTags = {'placeholder', 'todo'})
|
||||
function testNotImplemented(testCase)
|
||||
testCase.assumeFail("Tests for FFE_adaptive_decision are not implemented yet.");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
classdef ML_MLSE_GPU_test < matlab.unittest.TestCase
|
||||
% Test class for ML_MLSE_GPU
|
||||
classdef ML_MLSE_GPU_test < IMDDTestCase
|
||||
% Auto-generated placeholder for ML_MLSE_GPU.
|
||||
% Target: C:/Users/Silas/Documents/MATLAB/imdd_simulation/Classes/04_DSP/Equalizer/ML_MLSE_GPU.m
|
||||
|
||||
methods (Test)
|
||||
function testExample(testCase)
|
||||
% Example test case for ML_MLSE_GPU
|
||||
% Add your test code here
|
||||
testCase.verifyTrue(true);
|
||||
methods (Test, TestTags = {'placeholder', 'todo'})
|
||||
function testNotImplemented(testCase)
|
||||
testCase.assumeFail("Tests for ML_MLSE_GPU are not implemented yet.");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
classdef ML_MLSE_test < matlab.unittest.TestCase
|
||||
% Test class for ML_MLSE
|
||||
classdef ML_MLSE_test < IMDDTestCase
|
||||
% Auto-generated placeholder for ML_MLSE.
|
||||
% Target: C:/Users/Silas/Documents/MATLAB/imdd_simulation/Classes/04_DSP/Equalizer/ML_MLSE.m
|
||||
|
||||
methods (Test)
|
||||
function testExample(testCase)
|
||||
% Example test case for ML_MLSE
|
||||
% Add your test code here
|
||||
testCase.verifyTrue(true);
|
||||
methods (Test, TestTags = {'placeholder', 'todo'})
|
||||
function testNotImplemented(testCase)
|
||||
testCase.assumeFail("Tests for ML_MLSE are not implemented yet.");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
classdef Postfilter_test < matlab.unittest.TestCase
|
||||
% Test class for Postfilter
|
||||
classdef Postfilter_test < IMDDTestCase
|
||||
% Auto-generated placeholder for Postfilter.
|
||||
% Target: C:/Users/Silas/Documents/MATLAB/imdd_simulation/Classes/04_DSP/Equalizer/Postfilter.m
|
||||
|
||||
methods (Test)
|
||||
function testExample(testCase)
|
||||
% Example test case for Postfilter
|
||||
% Add your test code here
|
||||
testCase.verifyTrue(true);
|
||||
methods (Test, TestTags = {'placeholder', 'todo'})
|
||||
function testNotImplemented(testCase)
|
||||
testCase.assumeFail("Tests for Postfilter are not implemented yet.");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
classdef VNLE_test < matlab.unittest.TestCase
|
||||
% Test class for VNLE
|
||||
classdef VNLE_test < IMDDTestCase
|
||||
% Auto-generated placeholder for VNLE.
|
||||
% Target: C:/Users/Silas/Documents/MATLAB/imdd_simulation/Classes/04_DSP/Equalizer/VNLE.m
|
||||
|
||||
methods (Test)
|
||||
function testExample(testCase)
|
||||
% Example test case for VNLE
|
||||
% Add your test code here
|
||||
testCase.verifyTrue(true);
|
||||
methods (Test, TestTags = {'placeholder', 'todo'})
|
||||
function testNotImplemented(testCase)
|
||||
testCase.assumeFail("Tests for VNLE are not implemented yet.");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
classdef MLSE_new_test < matlab.unittest.TestCase
|
||||
% Test class for MLSE_new
|
||||
classdef MLSE_new_test < IMDDTestCase
|
||||
% Auto-generated placeholder for MLSE_new.
|
||||
% Target: C:/Users/Silas/Documents/MATLAB/imdd_simulation/Classes/04_DSP/Sequence Detection/MLSE_new.m
|
||||
|
||||
methods (Test)
|
||||
function testExample(testCase)
|
||||
% Example test case for MLSE_new
|
||||
% Add your test code here
|
||||
testCase.verifyTrue(true);
|
||||
methods (Test, TestTags = {'placeholder', 'todo'})
|
||||
function testNotImplemented(testCase)
|
||||
testCase.assumeFail("Tests for MLSE_new are not implemented yet.");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,11 +1,84 @@
|
||||
classdef MLSE_test < matlab.unittest.TestCase
|
||||
% Test class for MLSE
|
||||
classdef MLSE_test < IMDDTestCase
|
||||
methods (Test, TestTags = {'unit', 'fast', 'dsp', 'mlse'})
|
||||
function constructorStoresConfiguration(testCase)
|
||||
mlse = MLSE( ...
|
||||
"M", 4, ...
|
||||
"DIR", [1 0.35], ...
|
||||
"trellis_states", [-3 -1 1 3], ...
|
||||
"duobinary_output", false, ...
|
||||
"trellis_state_mode", 2, ...
|
||||
"trellis_exclusion", 0, ...
|
||||
"scale_mode", 0, ...
|
||||
"debug", 0);
|
||||
|
||||
methods (Test)
|
||||
function testExample(testCase)
|
||||
% Example test case for MLSE
|
||||
% Add your test code here
|
||||
testCase.verifyTrue(true);
|
||||
testCase.verifyEqual(mlse.M, 4);
|
||||
testCase.verifyEqual(mlse.DIR, [1 0.35]);
|
||||
testCase.verifyEqual(mlse.trellis_states, [-3 -1 1 3]);
|
||||
testCase.verifyFalse(mlse.duobinary_output);
|
||||
testCase.verifyEqual(mlse.trellis_state_mode, 2);
|
||||
testCase.verifyEqual(mlse.trellis_exclusion, 0);
|
||||
testCase.verifyEqual(mlse.scale_mode, 0);
|
||||
testCase.verifyEqual(mlse.debug, 0);
|
||||
end
|
||||
|
||||
function processRecoversKnownPAM4Sequence(testCase)
|
||||
[txBits, txSymbols, rxSymbols, mlse] = makePam4Fixture();
|
||||
|
||||
txSignal = Informationsignal(txSymbols, "fs", 1);
|
||||
rxSignal = Signal(rxSymbols, "fs", 1);
|
||||
|
||||
hdSignal = mlse.process(rxSignal, txSignal);
|
||||
rxBits = PAMmapper(4, 0).demap(hdSignal);
|
||||
|
||||
testCase.verifyClass(hdSignal, "Signal");
|
||||
testCase.verifyEqual(hdSignal.fs, rxSignal.fs);
|
||||
testCase.verifyEqual(rxBits.signal, txBits, ...
|
||||
"MLSE should recover the transmitted PAM-4 bits on the deterministic fixture.");
|
||||
end
|
||||
|
||||
function processReturnsExpectedShapesAndFiniteMetric(testCase)
|
||||
[txBits, txSymbols, rxSymbols, mlse] = makePam4Fixture();
|
||||
|
||||
[viterbiSymbols, llr, gmi] = mlse.process_(rxSymbols, txSymbols);
|
||||
rxBits = PAMmapper(4, 0).demap(viterbiSymbols(:));
|
||||
expectedSymbols = txSymbols(:) ./ rms(txSymbols(:));
|
||||
|
||||
testCase.verifyEqual(numel(viterbiSymbols), numel(rxSymbols));
|
||||
testCase.verifyEqual(size(llr), [numel(rxSymbols), 2]);
|
||||
testCase.verifyTrue(isfinite(gmi));
|
||||
testCase.verifyEqual(viterbiSymbols(:), expectedSymbols, "AbsTol", 1e-12);
|
||||
testCase.verifyEqual(rxBits, txBits, ...
|
||||
"Lower-level MLSE output should decode the same deterministic fixture.");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function [txBits, txSymbols, rxSymbols, mlse] = makePam4Fixture()
|
||||
txBits = [ ...
|
||||
0 0; ...
|
||||
0 1; ...
|
||||
1 1; ...
|
||||
1 0; ...
|
||||
0 1; ...
|
||||
1 0; ...
|
||||
0 0; ...
|
||||
1 1];
|
||||
|
||||
mapper = PAMmapper(4, 0);
|
||||
txSignal = Informationsignal(txBits);
|
||||
txSymbols = mapper.map(txSignal).signal;
|
||||
|
||||
channel = [1 0.35];
|
||||
rxSymbols = filter(channel, 1, txSymbols);
|
||||
rxSymbols = rxSymbols + 0.01 * [0; 1; -1; 2; -2; 1; -1; 0];
|
||||
|
||||
mlse = MLSE( ...
|
||||
"M", 4, ...
|
||||
"DIR", channel, ...
|
||||
"trellis_states", mapper.levels, ...
|
||||
"duobinary_output", false, ...
|
||||
"trellis_state_mode", 2, ...
|
||||
"trellis_exclusion", 0, ...
|
||||
"scale_mode", 0, ...
|
||||
"debug", 0);
|
||||
end
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
classdef MLSE_viterbi_test < matlab.unittest.TestCase
|
||||
% Test class for MLSE_viterbi
|
||||
classdef MLSE_viterbi_test < IMDDTestCase
|
||||
% Auto-generated placeholder for MLSE_viterbi.
|
||||
% Target: C:/Users/Silas/Documents/MATLAB/imdd_simulation/Classes/04_DSP/Sequence Detection/MLSE_viterbi.m
|
||||
|
||||
methods (Test)
|
||||
function testExample(testCase)
|
||||
% Example test case for MLSE_viterbi
|
||||
% Add your test code here
|
||||
testCase.verifyTrue(true);
|
||||
methods (Test, TestTags = {'placeholder', 'todo'})
|
||||
function testNotImplemented(testCase)
|
||||
testCase.assumeFail("Tests for MLSE_viterbi are not implemented yet.");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
10
Tests/04_DSP/T_04_DSP_Timing_Recovery_test.m
Normal file
10
Tests/04_DSP/T_04_DSP_Timing_Recovery_test.m
Normal file
@@ -0,0 +1,10 @@
|
||||
classdef T_04_DSP_Timing_Recovery_test < IMDDTestCase
|
||||
% Auto-generated placeholder for Timing_Recovery.
|
||||
% Target: C:/Users/Silas/Documents/MATLAB/imdd_simulation/Classes/04_DSP/Timing_Recovery.m
|
||||
|
||||
methods (Test, TestTags = {'placeholder', 'todo'})
|
||||
function testNotImplemented(testCase)
|
||||
testCase.assumeFail("Tests for Timing_Recovery are not implemented yet.");
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,11 +1,10 @@
|
||||
classdef Godard_Timing_Recovery_test < matlab.unittest.TestCase
|
||||
% Test class for Godard_Timing_Recovery
|
||||
classdef Godard_Timing_Recovery_test < IMDDTestCase
|
||||
% Auto-generated placeholder for Godard_Timing_Recovery.
|
||||
% Target: C:/Users/Silas/Documents/MATLAB/imdd_simulation/Classes/04_DSP/Timing Recovery/Godard_Timing_Recovery.m
|
||||
|
||||
methods (Test)
|
||||
function testExample(testCase)
|
||||
% Example test case for Godard_Timing_Recovery
|
||||
% Add your test code here
|
||||
testCase.verifyTrue(true);
|
||||
methods (Test, TestTags = {'placeholder', 'todo'})
|
||||
function testNotImplemented(testCase)
|
||||
testCase.assumeFail("Tests for Godard_Timing_Recovery are not implemented yet.");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
classdef MaxVar_Timing_Recovery_test < matlab.unittest.TestCase
|
||||
% Test class for MaxVar_Timing_Recovery
|
||||
classdef MaxVar_Timing_Recovery_test < IMDDTestCase
|
||||
% Auto-generated placeholder for MaxVar_Timing_Recovery.
|
||||
% Target: C:/Users/Silas/Documents/MATLAB/imdd_simulation/Classes/04_DSP/Timing Recovery/MaxVar_Timing_Recovery.m
|
||||
|
||||
methods (Test)
|
||||
function testExample(testCase)
|
||||
% Example test case for MaxVar_Timing_Recovery
|
||||
% Add your test code here
|
||||
testCase.verifyTrue(true);
|
||||
methods (Test, TestTags = {'placeholder', 'todo'})
|
||||
function testNotImplemented(testCase)
|
||||
testCase.assumeFail("Tests for MaxVar_Timing_Recovery are not implemented yet.");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
classdef T_04_DSP_Timing_Recovery_Timing_Recovery_test < IMDDTestCase
|
||||
methods (Test, TestTags = {'unit', 'fast', 'dsp', 'timing-recovery'})
|
||||
function constructorAppliesDefaultConfiguration(testCase)
|
||||
tr = Timing_Recovery();
|
||||
|
||||
testCase.verifyEqual(tr.modulation, 'PAM/PSK/QAM');
|
||||
testCase.verifyEqual(tr.timing_error_detector, 'Gardner');
|
||||
testCase.verifyEqual(tr.sps, 2);
|
||||
testCase.verifyEqual(tr.damping_factor, 1.0);
|
||||
testCase.verifyEqual(tr.normalized_loop_bandwidth, 0.005);
|
||||
testCase.verifyEqual(tr.detector_gain, 1);
|
||||
end
|
||||
|
||||
function constructorStoresConfiguredProperties(testCase)
|
||||
tr = Timing_Recovery( ...
|
||||
"modulation", 'PAM/PSK/QAM', ...
|
||||
"timing_error_detector", 'Gardner', ...
|
||||
"sps", 4, ...
|
||||
"damping_factor", 0.75, ...
|
||||
"normalized_loop_bandwidth", 0.02, ...
|
||||
"detector_gain", 1.5);
|
||||
|
||||
testCase.verifyEqual(tr.modulation, 'PAM/PSK/QAM');
|
||||
testCase.verifyEqual(tr.timing_error_detector, 'Gardner');
|
||||
testCase.verifyEqual(tr.sps, 4);
|
||||
testCase.verifyEqual(tr.damping_factor, 0.75);
|
||||
testCase.verifyEqual(tr.normalized_loop_bandwidth, 0.02);
|
||||
testCase.verifyEqual(tr.detector_gain, 1.5);
|
||||
end
|
||||
|
||||
function processSignalsMissingCommunicationsToolboxClearly(testCase)
|
||||
tr = Timing_Recovery("sps", 2);
|
||||
inputSignal = Informationsignal([1; -1; 1; -1], "fs", 2);
|
||||
|
||||
testCase.verifyError(@() tr.process(inputSignal), 'MATLAB:undefinedVarOrClass');
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,11 +1,10 @@
|
||||
classdef Time_Shifter_test < matlab.unittest.TestCase
|
||||
% Test class for Time_Shifter
|
||||
classdef Time_Shifter_test < IMDDTestCase
|
||||
% Auto-generated placeholder for Time_Shifter.
|
||||
% Target: C:/Users/Silas/Documents/MATLAB/imdd_simulation/Classes/04_DSP/Timing Recovery/Time_Shifter.m
|
||||
|
||||
methods (Test)
|
||||
function testExample(testCase)
|
||||
% Example test case for Time_Shifter
|
||||
% Add your test code here
|
||||
testCase.verifyTrue(true);
|
||||
methods (Test, TestTags = {'placeholder', 'todo'})
|
||||
function testNotImplemented(testCase)
|
||||
testCase.assumeFail("Tests for Time_Shifter are not implemented yet.");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
classdef Timing_Recovery_GPT_test < matlab.unittest.TestCase
|
||||
% Test class for Timing_Recovery_GPT
|
||||
classdef Timing_Recovery_GPT_test < IMDDTestCase
|
||||
% Auto-generated placeholder for Timing_Recovery_GPT.
|
||||
% Target: C:/Users/Silas/Documents/MATLAB/imdd_simulation/Classes/04_DSP/Timing Recovery/Timing_Recovery_GPT.m
|
||||
|
||||
methods (Test)
|
||||
function testExample(testCase)
|
||||
% Example test case for Timing_Recovery_GPT
|
||||
% Add your test code here
|
||||
testCase.verifyTrue(true);
|
||||
methods (Test, TestTags = {'placeholder', 'todo'})
|
||||
function testNotImplemented(testCase)
|
||||
testCase.assumeFail("Tests for Timing_Recovery_GPT are not implemented yet.");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
classdef Timing_Recovery_Move_It_test < matlab.unittest.TestCase
|
||||
% Test class for Timing_Recovery_Move_It
|
||||
classdef Timing_Recovery_Move_It_test < IMDDTestCase
|
||||
% Auto-generated placeholder for Timing_Recovery_Move_It.
|
||||
% Target: C:/Users/Silas/Documents/MATLAB/imdd_simulation/Classes/04_DSP/Timing Recovery/Timing_Recovery_Move_It.m
|
||||
|
||||
methods (Test)
|
||||
function testExample(testCase)
|
||||
% Example test case for Timing_Recovery_Move_It
|
||||
% Add your test code here
|
||||
testCase.verifyTrue(true);
|
||||
methods (Test, TestTags = {'placeholder', 'todo'})
|
||||
function testNotImplemented(testCase)
|
||||
testCase.assumeFail("Tests for Timing_Recovery_Move_It are not implemented yet.");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
classdef Timing_Recovery_test < matlab.unittest.TestCase
|
||||
% Test class for Timing_Recovery
|
||||
|
||||
methods (Test)
|
||||
function testExample(testCase)
|
||||
% Example test case for Timing_Recovery
|
||||
% Add your test code here
|
||||
testCase.verifyTrue(true);
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,11 +0,0 @@
|
||||
classdef Timing_Recovery_test < matlab.unittest.TestCase
|
||||
% Test class for Timing_Recovery
|
||||
|
||||
methods (Test)
|
||||
function testExample(testCase)
|
||||
% Example test case for Timing_Recovery
|
||||
% Add your test code here
|
||||
testCase.verifyTrue(true);
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,11 +1,81 @@
|
||||
classdef TransmissionPerformance_test < matlab.unittest.TestCase
|
||||
% Test class for TransmissionPerformance
|
||||
classdef TransmissionPerformance_test < IMDDTestCase
|
||||
methods (Test, TestTags = {'unit', 'fast', 'dsp', 'transmissionperformance'})
|
||||
function ngmiLookupSelectsExpectedSDHDRows(testCase)
|
||||
tp = TransmissionPerformance();
|
||||
grossRate = 10e9;
|
||||
ngmi = [0.8120, 0.8746, 1.0000];
|
||||
|
||||
methods (Test)
|
||||
function testExample(testCase)
|
||||
% Example test case for TransmissionPerformance
|
||||
% Add your test code here
|
||||
testCase.verifyTrue(true);
|
||||
out = tp.calculateNetRate(grossRate, 'NGMI', ngmi);
|
||||
|
||||
expectedIdx = [1, 10, 30];
|
||||
expectedCodeRate = tp.OVERALLCODERATES_SDHD(expectedIdx);
|
||||
expectedThreshold = tp.NGMITHRESHOLDS_SDHD(expectedIdx);
|
||||
expectedNetRate = grossRate .* expectedCodeRate;
|
||||
expectedPunct = tp.ISPUNCT_LDPI(expectedIdx);
|
||||
|
||||
testCase.verifyEqual(out.SDHD.GrossRate, repmat(grossRate, 1, numel(ngmi)));
|
||||
testCase.verifyEqual(out.SDHD.CodeRate, expectedCodeRate, 'AbsTol', 1e-12);
|
||||
testCase.verifyEqual(out.SDHD.Threshold, expectedThreshold, 'AbsTol', 1e-12);
|
||||
testCase.verifyEqual(out.SDHD.NetRate, expectedNetRate, 'AbsTol', 1e-6);
|
||||
testCase.verifyEqual(out.SDHD.punctLDPI, expectedPunct);
|
||||
end
|
||||
|
||||
function berLookupSelectsExpectedSTAIRRowsForVectorInput(testCase)
|
||||
tp = TransmissionPerformance();
|
||||
grossRate = [100e9, 200e9, 300e9];
|
||||
ber = [1e-4, 1e-2, 2e-2];
|
||||
|
||||
out = tp.calculateNetRate(grossRate, 'BER', ber);
|
||||
|
||||
expectedIdx = [11, 6, 1];
|
||||
expectedCodeRate = tp.CODE_RATES_HD(expectedIdx);
|
||||
expectedThreshold = tp.BERTHRESHOLDS_HD(expectedIdx);
|
||||
expectedNetRate = grossRate .* expectedCodeRate;
|
||||
|
||||
testCase.verifyEqual(out.STAIR.GrossRate, grossRate);
|
||||
testCase.verifyEqual(out.STAIR.CodeRate, expectedCodeRate, 'AbsTol', 1e-12);
|
||||
testCase.verifyEqual(out.STAIR.Threshold, expectedThreshold, 'AbsTol', 1e-12);
|
||||
testCase.verifyEqual(out.STAIR.NetRate, expectedNetRate, 'AbsTol', 1e-6);
|
||||
end
|
||||
|
||||
function berLookupPopulatesSpecialFecModesForLowBer(testCase)
|
||||
tp = TransmissionPerformance();
|
||||
grossRate = 100e9;
|
||||
ber = 1e-4;
|
||||
|
||||
out = tp.calculateNetRate(grossRate, 'BER', ber);
|
||||
|
||||
testCase.verifyEqual(out.KP4.CodeRate, tp.CODE_RATE_KP4, 'AbsTol', 1e-12);
|
||||
testCase.verifyEqual(out.KP4.NetRate, grossRate * tp.CODE_RATE_KP4, 'AbsTol', 1e-6);
|
||||
testCase.verifyEqual(out.KP4_hamming.CodeRate, tp.CODE_RATE_KP4_AND_INNER, 'AbsTol', 1e-12);
|
||||
testCase.verifyEqual(out.KP4_hamming.NetRate, grossRate * tp.CODE_RATE_KP4_AND_INNER, 'AbsTol', 1e-6);
|
||||
testCase.verifyEqual(out.O_FEC.CodeRate, tp.CODE_RATE_O_FEC, 'AbsTol', 1e-12);
|
||||
testCase.verifyEqual(out.O_FEC.NetRate, grossRate * tp.CODE_RATE_O_FEC, 'AbsTol', 1e-6);
|
||||
end
|
||||
|
||||
function outOfRangeBerLeavesAllRatesUndefined(testCase)
|
||||
tp = TransmissionPerformance();
|
||||
grossRate = [50e9, 60e9];
|
||||
ber = [0.1, 0.05];
|
||||
|
||||
out = tp.calculateNetRate(grossRate, 'BER', ber);
|
||||
|
||||
testCase.verifyTrue(all(isnan(out.STAIR.CodeRate)));
|
||||
testCase.verifyTrue(all(isnan(out.KP4.CodeRate)));
|
||||
testCase.verifyTrue(all(isnan(out.KP4_hamming.CodeRate)));
|
||||
testCase.verifyTrue(all(isnan(out.O_FEC.CodeRate)));
|
||||
end
|
||||
|
||||
function missingQualityInputRaisesTheDocumentedError(testCase)
|
||||
tp = TransmissionPerformance();
|
||||
|
||||
try
|
||||
tp.calculateNetRate(10e9);
|
||||
testCase.assertFail('Expected calculateNetRate to error when BER and NGMI are both omitted.');
|
||||
catch ME
|
||||
testCase.verifyThat(ME.message, matlab.unittest.constraints.ContainsSubstring( ...
|
||||
'At least one of ''BER'' or ''NGMI'' must be provided.'));
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user