cwDsp.h/cpp,cwTest.cpp : Move fft,ifft,convolve into cwTest framework.

This commit is contained in:
kevin 2024-12-02 14:48:13 -05:00
parent 2b42d60b29
commit 7eacb5e005
3 changed files with 35 additions and 3 deletions

View File

@ -9,6 +9,7 @@
#include "cwMath.h" #include "cwMath.h"
#include "cwVectOps.h" #include "cwVectOps.h"
#include "cwDsp.h" #include "cwDsp.h"
#include "cwText.h"
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
@ -35,7 +36,7 @@ cw::rc_t cw::dsp::fft::test()
create<real_t>(p,xN,flags); create<real_t>(p,xN,flags);
if(p != nullptr ) if(p == nullptr )
{ {
rc = cwLogError(kOpFailRC,"FFT procedure allocation failed."); rc = cwLogError(kOpFailRC,"FFT procedure allocation failed.");
goto errLabel; goto errLabel;
@ -157,3 +158,31 @@ cw::rc_t cw::dsp::convolve::test()
// 1. 0.5 0.25 0.1 1.05 0.5 0.25 0.1 1.05 0.5 0.25 0.1 0.05 0.0. 0. ] // 1. 0.5 0.25 0.1 1.05 0.5 0.25 0.1 1.05 0.5 0.25 0.1 0.05 0.0. 0. ]
// 1.0 0.5 0.25 0.1 1.05 0.5 0.25 0.1 1.05 0.5 0.25 0.1 1.05 1.0 0.75 0. // 1.0 0.5 0.25 0.1 1.05 0.5 0.25 0.1 1.05 0.5 0.25 0.1 1.05 1.0 0.75 0.
cw::rc_t cw::dsp::test_dsp( const test::test_args_t& args )
{
rc_t rc = kOkRC;
if( textIsEqual(args.test_label,"fft") )
{
rc = fft::test();
goto errLabel;
}
if( textIsEqual(args.test_label,"ifft") )
{
rc = ifft::test();
goto errLabel;
}
if( textIsEqual(args.test_label,"convolve") )
{
rc = convolve::test();
goto errLabel;
}
rc = cwLogError(kInvalidArgRC,"Unknown dsp test case module:%s test:%s.",args.module_label,args.test_label);
errLabel:
return rc;
}

View File

@ -530,7 +530,7 @@ namespace cw
for(unsigned i=0; i<binN; ++i) for(unsigned i=0; i<binN; ++i)
p->hV[i] = hScale * p->ft->cplxV[i] / ((T)cN); p->hV[i] = hScale * p->ft->cplxV[i] / ((T)cN);
printf("procN:%i cN:%i hN:%i binN:%i outN:%i\n", procSmpN, cN, hN, binN, p->outN ); //printf("procN:%i cN:%i hN:%i binN:%i outN:%i\n", procSmpN, cN, hN, binN, p->outN );
return kOkRC; return kOkRC;
} }
@ -625,7 +625,9 @@ namespace cw
rc_t test(); rc_t test();
} }
rc_t test_dsp( const test::test_args_t& args );
} }
} }

View File

@ -50,6 +50,7 @@ namespace cw
{ "/filesys", filesys::test }, { "/filesys", filesys::test },
{ "/object", object_test }, { "/object", object_test },
{ "/vop", vop::test }, { "/vop", vop::test },
{ "/dsp", dsp::test_dsp },
{ "/time", time::test }, { "/time", time::test },
{ "/flow", flow::test }, { "/flow", flow::test },
{ "/textBuf", textBuf::test }, { "/textBuf", textBuf::test },