1 #include "ExampleCategoryQ31.h" 2 #include <stdio.h> 3 #include "Error.h" 4 5 #define SNR_THRESHOLD 100 6 7 /* 8 9 Reference patterns are generated with 10 a double precision computation. 11 12 */ 13 #define ABS_ERROR_Q31 ((q31_t)2) 14 #define ABS_ERROR_Q63 ((q63_t)(1<<16)) 15 16 17 18 test_op_q31()19 void ExampleCategoryQ31::test_op_q31() 20 { 21 const q31_t *inp1=input1.ptr(); 22 const q31_t *inp2=input2.ptr(); 23 q31_t *outp=output.ptr(); 24 25 arm_add_q31(inp1,inp2,outp,input1.nbSamples()); 26 27 ASSERT_EMPTY_TAIL(output); 28 29 ASSERT_SNR(output,ref,(q31_t)SNR_THRESHOLD); 30 31 ASSERT_NEAR_EQ(output,ref,ABS_ERROR_Q31); 32 33 } 34 35 36 setUp(Testing::testID_t id,std::vector<Testing::param_t> & params,Client::PatternMgr * mgr)37 void ExampleCategoryQ31::setUp(Testing::testID_t id,std::vector<Testing::param_t>& params,Client::PatternMgr *mgr) 38 { 39 40 Testing::nbSamples_t nb=MAX_NB_SAMPLES; 41 (void)params; 42 43 switch(id) 44 { 45 case ExampleCategoryQ31::TEST_OP_Q31_1: 46 ref.reload(ExampleCategoryQ31::REF_OUT_Q31_ID,mgr); 47 break; 48 49 50 51 } 52 53 54 input1.reload(ExampleCategoryQ31::INPUT1_Q31_ID,mgr,nb); 55 input2.reload(ExampleCategoryQ31::INPUT2_Q31_ID,mgr,nb); 56 57 output.create(ref.nbSamples(),ExampleCategoryQ31::OUT_Q31_ID,mgr); 58 } 59 tearDown(Testing::testID_t id,Client::PatternMgr * mgr)60 void ExampleCategoryQ31::tearDown(Testing::testID_t id,Client::PatternMgr *mgr) 61 { 62 (void)id; 63 output.dump(mgr); 64 } 65