Subversion Repositories ScreenTimer

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. #ifndef _SUPPORT_TEMPLATES_H_
  2. #define _SUPPORT_TEMPLATES_H_
  3.  
  4. /*--------------------------------------------------------------------------------*/
  5. /* Includes */
  6. /*--------------------------------------------------------------------------------*/
  7.  
  8. #include "test_templates.h"
  9.  
  10. /*--------------------------------------------------------------------------------*/
  11. /* Group Specific Templates */
  12. /*--------------------------------------------------------------------------------*/
  13.  
  14. /**
  15.  *  Compare the outputs from the function under test and the reference function.
  16.  */
  17. #define SUPPORT_COMPARE_INTERFACE(block_size,   \
  18.                                   output_type)  \
  19.     do                                          \
  20.     {                                           \
  21.         TEST_ASSERT_BUFFERS_EQUAL(              \
  22.             support_output_ref.data_ptr,        \
  23.             support_output_fut.data_ptr,        \
  24.             block_size * sizeof(output_type));  \
  25.     } while (0)                                  \
  26.  
  27. /*--------------------------------------------------------------------------------*/
  28. /* Input Interfaces */
  29. /*--------------------------------------------------------------------------------*/
  30. /*
  31.  *  General:
  32.  *  Input interfaces provide inputs to functions inside test templates.  They
  33.  *  ONLY provide the inputs.  The output variables should be hard coded.
  34.  *
  35.  *  The input interfaces must have the following format:
  36.  *
  37.  *  ARM_xxx_INPUT_INTERFACE() or
  38.  *  REF_xxx_INPUT_INTERFACE()
  39.  *
  40.  *  The xxx must be lowercase, and is intended to be the indentifying substring
  41.  *  in the function's name.  Acceptable values are 'sub' or 'add' from the
  42.  *  functions arm_add_q31.
  43.  */
  44.  
  45. #define ARM_copy_INPUT_INTERFACE(input, block_size)         \
  46.     PAREN(input, support_output_fut.data_ptr, block_size)
  47.  
  48. #define REF_copy_INPUT_INTERFACE(input, block_size)         \
  49.     PAREN(input, support_output_ref.data_ptr, block_size)
  50.  
  51. #define ARM_fill_INPUT_INTERFACE(elt, block_size)       \
  52.     PAREN(elt, support_output_fut.data_ptr, block_size)
  53.  
  54. #define REF_fill_INPUT_INTERFACE(elt, block_size)       \
  55.     PAREN(elt, support_output_ref.data_ptr, block_size)
  56.  
  57. #define ARM_x_to_y_INPUT_INTERFACE(input, block_size)       \
  58.     PAREN(input, support_output_fut.data_ptr, block_size)
  59.  
  60. #define REF_x_to_y_INPUT_INTERFACE(input, block_size)       \
  61.     PAREN(input, support_output_ref.data_ptr, block_size)
  62.  
  63. /*--------------------------------------------------------------------------------*/
  64. /* Test Templates */
  65. /*--------------------------------------------------------------------------------*/
  66.  
  67.  
  68. /**
  69.  *  Specialization of #TEST_TEMPLATE_BUF1_BLK() for support tests.
  70.  *
  71.  *  @note This macro relies on the existance of ARM_xxx_INPUT_INTERFACE and
  72.  *  REF_xxx_INPUT_INTERFACEs.
  73.  */
  74. #define SUPPORT_DEFINE_TEST_TEMPLATE_BUF1_BLK(fn_name,              \
  75.                                               suffix,               \
  76.                                               input_type,           \
  77.                                               output_type,          \
  78.                                               comparison_interface) \
  79.     JTEST_DEFINE_TEST(arm_##fn_name##_##suffix##_test,              \
  80.                       arm_##fn_name##_##suffix)                     \
  81.     {                                                               \
  82.         TEST_TEMPLATE_BUF1_BLK(                                     \
  83.             support_f_all,                                          \
  84.             support_block_sizes,                                    \
  85.             input_type,                                             \
  86.             output_type,                                            \
  87.             arm_##fn_name##_##suffix,                               \
  88.             ARM_##fn_name##_INPUT_INTERFACE,                        \
  89.             ref_##fn_name##_##suffix,                               \
  90.             REF_##fn_name##_INPUT_INTERFACE,                        \
  91.             comparison_interface);                                  \
  92.     }
  93.  
  94. /**
  95.  *  Specialization of #TEST_TEMPLATE_ELT1_BLK() for support tests.
  96.  *
  97.  *  @note This macro relies on the existance of ARM_xxx_INPUT_INTERFACE and
  98.  *  REF_xxx_INPUT_INTERFACEs.
  99.  */
  100. #define SUPPORT_DEFINE_TEST_TEMPLATE_ELT1_BLK(fn_name,              \
  101.                                               suffix,               \
  102.                                               elt_type,             \
  103.                                               output_type,          \
  104.                                               comparison_interface) \
  105.     JTEST_DEFINE_TEST(arm_##fn_name##_##suffix##_test,              \
  106.                       arm_##fn_name##_##suffix)                     \
  107.     {                                                               \
  108.         TEST_TEMPLATE_ELT1_BLK(                                     \
  109.             support_elts,                                           \
  110.             support_block_sizes,                                    \
  111.             elt_type,                                               \
  112.             output_type,                                            \
  113.             arm_##fn_name##_##suffix,                               \
  114.             ARM_##fn_name##_INPUT_INTERFACE,                        \
  115.             ref_##fn_name##_##suffix,                               \
  116.             REF_##fn_name##_INPUT_INTERFACE,                        \
  117.             comparison_interface);                                  \
  118.     }
  119.  
  120. #endif /* _SUPPORT_TEMPLATES_H_ */
  121.