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