1 #include "ExampleCategoryQ7.h" 2 #include <stdio.h> 3 #include "Error.h" 4 5 #define SNR_THRESHOLD 20 6 7 #define ABS_ERROR_Q7 ((q7_t)2) 8 #define ABS_ERROR_Q31 ((q31_t)(1<<15)) 9 10 11 test_op_q7()12 void ExampleCategoryQ7::test_op_q7() 13 { 14 const q7_t *inp1=input1.ptr(); 15 const q7_t *inp2=input2.ptr(); 16 q7_t *outp=output.ptr(); 17 18 arm_add_q7(inp1,inp2,outp,input1.nbSamples()); 19 20 ASSERT_EMPTY_TAIL(output); 21 22 ASSERT_SNR(output,ref,(q7_t)SNR_THRESHOLD); 23 24 ASSERT_NEAR_EQ(output,ref,ABS_ERROR_Q7); 25 26 } 27 28 29 setUp(Testing::testID_t id,std::vector<Testing::param_t> & params,Client::PatternMgr * mgr)30 void ExampleCategoryQ7::setUp(Testing::testID_t id,std::vector<Testing::param_t>& params,Client::PatternMgr *mgr) 31 { 32 33 Testing::nbSamples_t nb=MAX_NB_SAMPLES; 34 (void)params; 35 36 switch(id) 37 { 38 case ExampleCategoryQ7::TEST_OP_Q7_1: 39 ref.reload(ExampleCategoryQ7::REF_OUT_Q7_ID,mgr); 40 break; 41 42 43 44 } 45 46 47 input1.reload(ExampleCategoryQ7::INPUT1_Q7_ID,mgr,nb); 48 input2.reload(ExampleCategoryQ7::INPUT2_Q7_ID,mgr,nb); 49 50 output.create(ref.nbSamples(),ExampleCategoryQ7::OUT_Q7_ID,mgr); 51 } 52 tearDown(Testing::testID_t id,Client::PatternMgr * mgr)53 void ExampleCategoryQ7::tearDown(Testing::testID_t id,Client::PatternMgr *mgr) 54 { 55 (void)id; 56 output.dump(mgr); 57 } 58