ExampleCategoryQ7.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #include "ExampleCategoryQ7.h"
  2. #include <stdio.h>
  3. #include "Error.h"
  4. #define SNR_THRESHOLD 20
  5. #define ABS_ERROR_Q7 ((q7_t)2)
  6. #define ABS_ERROR_Q31 ((q31_t)(1<<15))
  7. void ExampleCategoryQ7::test_op_q7()
  8. {
  9. const q7_t *inp1=input1.ptr();
  10. const q7_t *inp2=input2.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. (void)params;
  21. switch(id)
  22. {
  23. case ExampleCategoryQ7::TEST_OP_Q7_1:
  24. ref.reload(ExampleCategoryQ7::REF_OUT_Q7_ID,mgr);
  25. break;
  26. }
  27. input1.reload(ExampleCategoryQ7::INPUT1_Q7_ID,mgr,nb);
  28. input2.reload(ExampleCategoryQ7::INPUT2_Q7_ID,mgr,nb);
  29. output.create(ref.nbSamples(),ExampleCategoryQ7::OUT_Q7_ID,mgr);
  30. }
  31. void ExampleCategoryQ7::tearDown(Testing::testID_t id,Client::PatternMgr *mgr)
  32. {
  33. (void)id;
  34. output.dump(mgr);
  35. }