Skip to content

Commit

Permalink
readded previous test_gabfirtight as test_gabwintight because it actu…
Browse files Browse the repository at this point in the history
…ally tests gabwin
  • Loading branch information
allthatsounds committed Oct 13, 2023
1 parent 9b539be commit 3325246
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions testing/test_gabwintight.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
function test_failed = test_gabwintight()
%TEST_GABWINTIGHT Some of the windows returned from firwin are tight
% immediatelly. This function tests for that
test_failed = 0;



disp(' =============== TEST_GABWINTIGHT ================');

disp('--- Used subroutines ---');

which gabwin
which comp_window


shouldBeTight = [...
struct('g','sine','a',10,'M',40,'L',[]),...
struct('g',{{'sine',40}},'a',10,'M',40,'L',[]),...
struct('g',{{'sine',28}},'a',14,'M',40,'L',[]),...
struct('g','sine','a',20,'M',40,'L',[]),...
struct('g',{{'sine',60}},'a',20,'M',60,'L',[]),...
struct('g',{{'sine',54}},'a',18,'M',60,'L',[]),...
struct('g',{{'sine',54,'inf'}},'a',18,'M',60,'L',[]),...
struct('g','sine','a',5,'M',40,'L',[]),...
struct('g','sqrttria','a',5,'M',40,'L',[]),...
];

shouldNotBeTight = [...
struct('g','sine','a',16,'M',40,'L',[]),...
struct('g',{{'sine',41}},'a',10,'M',40,'L',[]),...
struct('g',{{'sine',26}},'a',10,'M',40,'L',[]),...
struct('g','sqrttria','a',40,'M',40,'L',[]),...
];


for ii=1:numel(shouldBeTight)
gw = shouldBeTight(ii);

[~,info] = gabwin(gw.g,gw.a,gw.M,gw.L);
[test_failed,fail]=ltfatdiditfail(~info.istight,test_failed,0);
fprintf(['GABWINISTIGHT g= a=%i M=%i %s\n'],gw.a,gw.M,fail);

end

for ii=1:numel(shouldNotBeTight)
gw = shouldNotBeTight(ii);

[~,info] = gabwin(gw.g,gw.a,gw.M,gw.L);
[test_failed,fail]=ltfatdiditfail(info.istight,test_failed,0);
fprintf(['GABWINISNOTTIGHT g= a=%i M=%i %s\n'],gw.a,gw.M,fail);

end

0 comments on commit 3325246

Please sign in to comment.