ExampleCategoryQ7.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #include "ExampleCategoryQ7.h"
  2. #include "Error.h"
  3. #define SNR_THRESHOLD 20
  4. #define ABS_ERROR_Q7 ((q7_t)2)
  5. #define ABS_ERROR_Q31 ((q31_t)(1<<15))
  6. void ExampleCategoryQ7::test_op_q7()
  7. {
  8. const q7_t *inp1=input1.ptr();
  9. const q7_t *inp2=input2.ptr();
  10. q7_t *refp=ref.ptr();
  11. q7_t *outp=output.ptr();
  12. arm_add_q7(inp1,inp2,outp,input1.nbSamples());
  13. ASSERT_EMPTY_TAIL(output);
  14. ASSERT_SNR(output,ref,(q7_t)SNR_THRESHOLD);
  15. ASSERT_NEAR_EQ(output,ref,ABS_ERROR_Q7);
  16. }
  17. void ExampleCategoryQ7::setUp(Testing::testID_t id,std::vector<Testing::param_t>& params,Client::PatternMgr *mgr)
  18. {
  19. Testing::nbSamples_t nb=MAX_NB_SAMPLES;
  20. switch(id)
  21. {
  22. case ExampleCategoryQ7::TEST_OP_Q7_1:
  23. ref.reload(ExampleCategoryQ7::REF_OUT_Q7_ID,mgr);
  24. break;
  25. }
  26. input1.reload(ExampleCategoryQ7::INPUT1_Q7_ID,mgr,nb);
  27. input2.reload(ExampleCategoryQ7::INPUT2_Q7_ID,mgr,nb);
  28. output.create(ref.nbSamples(),ExampleCategoryQ7::OUT_Q7_ID,mgr);
  29. }
  30. void ExampleCategoryQ7::tearDown(Testing::testID_t id,Client::PatternMgr *mgr)
  31. {
  32. output.dump(mgr);
  33. }