diff --git a/cwDsp.cpp b/cwDsp.cpp index c0e3897..eceb488 100644 --- a/cwDsp.cpp +++ b/cwDsp.cpp @@ -9,6 +9,7 @@ #include "cwMath.h" #include "cwVectOps.h" #include "cwDsp.h" +#include "cwText.h" //---------------------------------------------------------------------------------------------------------------------- @@ -35,7 +36,7 @@ cw::rc_t cw::dsp::fft::test() create(p,xN,flags); - if(p != nullptr ) + if(p == nullptr ) { rc = cwLogError(kOpFailRC,"FFT procedure allocation failed."); 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 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; +} diff --git a/cwDsp.h b/cwDsp.h index ec827ea..706864b 100644 --- a/cwDsp.h +++ b/cwDsp.h @@ -530,7 +530,7 @@ namespace cw for(unsigned i=0; ihV[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; } @@ -625,7 +625,9 @@ namespace cw rc_t test(); - } + } + + rc_t test_dsp( const test::test_args_t& args ); } } diff --git a/cwTest.cpp b/cwTest.cpp index 0fb221c..11b95b6 100644 --- a/cwTest.cpp +++ b/cwTest.cpp @@ -50,6 +50,7 @@ namespace cw { "/filesys", filesys::test }, { "/object", object_test }, { "/vop", vop::test }, + { "/dsp", dsp::test_dsp }, { "/time", time::test }, { "/flow", flow::test }, { "/textBuf", textBuf::test },