Hoffice push

This commit is contained in:
Silas
2024-09-06 15:53:32 +02:00
parent 03bfd70470
commit 179a7f9682
50 changed files with 921 additions and 93 deletions

View File

@@ -0,0 +1,11 @@
classdef AWG_test < matlab.unittest.TestCase
% Test class for AWG
methods (Test)
function testExample(testCase)
% Example test case for AWG
% Add your test code here
testCase.verifyTrue(true);
end
end
end

View File

@@ -0,0 +1,11 @@
classdef ChannelFreqResp_test < matlab.unittest.TestCase
% Test class for ChannelFreqResp
methods (Test)
function testExample(testCase)
% Example test case for ChannelFreqResp
% Add your test code here
testCase.verifyTrue(true);
end
end
end

View File

@@ -0,0 +1,11 @@
classdef M8196A_test < matlab.unittest.TestCase
% Test class for M8196A
methods (Test)
function testExample(testCase)
% Example test case for M8196A
% Add your test code here
testCase.verifyTrue(true);
end
end
end

View File

@@ -0,0 +1,11 @@
classdef M8199A_test < matlab.unittest.TestCase
% Test class for M8199A
methods (Test)
function testExample(testCase)
% Example test case for M8199A
% Add your test code here
testCase.verifyTrue(true);
end
end
end

View File

@@ -0,0 +1,11 @@
classdef M8199B_test < matlab.unittest.TestCase
% Test class for M8199B
methods (Test)
function testExample(testCase)
% Example test case for M8199B
% Add your test code here
testCase.verifyTrue(true);
end
end
end

View File

@@ -0,0 +1,67 @@
classdef PAMmapper_test < matlab.unittest.TestCase
properties
Digi_Mod
Tx_bits
Rx_bits
% M = 8; % Modulation order
fsym = 112e9; % Symbol rate
end
properties (TestParameter)
M = {4,6,8};
end
methods (TestMethodSetup)
function setupModulation(testCase)
% Setup PRBS and bit pattern for the test case
O = 10; % Order of PRBS
N = 2^(O-1); % Length of PRBS
useprbs = 1; % Flag to use PRBS
randkey = 1; % Random key for random stream
[~, seed] = prbs(O, 1); % Initialize first seed of PRBS
bitpattern = [];
if useprbs
for i = 1:log2(testCase.M)
[bitpattern(:, i), seed] = prbs(O, N, seed);
end
else
s = RandStream('twister', 'Seed', randkey);
for i = 1:log2(testCase.M)
bitpattern(:, i) = randi(s, [0 1], N, 1);
end
end
if testCase.M == 6
bitpattern = reshape(bitpattern, [], 1);
bitpattern = bitpattern(1:end-mod(length(bitpattern), 5));
end
testCase.Tx_bits = Informationsignal(bitpattern);
testCase.Digi_Mod = PAMmapper(testCase.M, 0);
end
end
methods (Test)
function testBackToBackMapping(testCase)
% Test Bits -> Symbols -> Bits (Back-to-Back Mapping)
% Map bits to symbols
Symbols = testCase.Digi_Mod.map(testCase.Tx_bits);
% Demap symbols back to bits
testCase.Rx_bits = testCase.Digi_Mod.demap(Symbols);
% Validate BER is zero
[~, error_num, ber, ~] = calc_ber(testCase.Tx_bits.signal, testCase.Rx_bits.signal, ...
"skip_front", 0, "skip_end", 0, "returnErrorLocation", 1);
% Assert that BER is zero
testCase.verifyEqual(ber, 0, 'BER should be zero');
testCase.verifyEqual(error_num, 0, 'No errors should occur in the mapping process');
end
end
end

View File

@@ -0,0 +1,11 @@
classdef PAMsource_test < matlab.unittest.TestCase
% Test class for PAMsource
methods (Test)
function testExample(testCase)
% Example test case for PAMsource
% Add your test code here
testCase.verifyTrue(true);
end
end
end

View File

@@ -0,0 +1,11 @@
classdef Pulseformer_test < matlab.unittest.TestCase
% Test class for Pulseformer
methods (Test)
function testExample(testCase)
% Example test case for Pulseformer
% Add your test code here
testCase.verifyTrue(true);
end
end
end

View File

@@ -0,0 +1,11 @@
classdef Signalgenerator_test < matlab.unittest.TestCase
% Test class for Signalgenerator
methods (Test)
function testExample(testCase)
% Example test case for Signalgenerator
% Add your test code here
testCase.verifyTrue(true);
end
end
end