XIL Test Suite User's Guide
검색에만이 책은
PDF로 이 문서 다운로드

Equivalence Testing Example

C

This appendix explains how to write a test program that uses the equivalence testing functions and provides an example.
The equivalence testing functions test certain XIL features (such as ROIs and child images) without requiring any visual verification. These functions use the TS_FUNCFORMAT structure to receive descriptions of XIL functions. This structure is a union of structures that each correspond to an argument list for an XIL function. Take the following steps to write a test program that uses the equivalence testing functions:
  1. Declare the TS_FUNCFORMAT union variable as follows:

    TS_FUNCFORMAT      format;

  1. Declare the specific format pointer.

    The format pointer is TS_FN_FORMAT, where FN is the name of the XIL function in all upper case. For example,

    TS_XIL_CHOOSE_COLORMAP_FORMAT *choose_cmap_fmt;

  1. Cast the TS_FUNCFORMAT union pointer to a pointer for the structure needed for the XIL function.

    For example,

choose_cmap_fmt = (TS_XIL_CHOOSE_COLORMAP_FORMAT*)&format;

  1. Initialize the code element of the format.

    The code element must be set to TS_FN_FORMAT_CODE, where FN is the name of the XIL function in all upper case. For example,

    choose_cmap_fmt->code = TS_XIL_CHOOSE_COLORMAP_FORMAT_CODE;

  1. Initialize the function element of the format, which must be set to the XIL function being tested.

    For example,

    choose_cmap_fmt->function = xil_choose_colormap;

  1. Specify values for the arguments of the XIL function.

    You must specify a value for each of the XIL function's arguments. You do not identify the arguments by name; instead, you use arg1, arg2, and so on. For example,

choose_cmap_fmt->arg1 = src1;
choose_cmap_fmt->arg2 = 255;

ts_automatic_tests Example

Code Example C-1 is the code for testing the child image behavior of the XIL function, xil_choose_colormap(). The ts_automatic_tests() function is used.
Code Example C-1 ts_automatic_tests() Example

  /*  
  * Declare TS_FUNCFORMAT union variable and specific format  
       pointer.  
  */  
       TS_FUNCFORMAT    format;  
       TS_XIL_CHOOSE_COLORMAP_FORMAT*choose_cmap_fmt;  
  /*  
  * Initialize variables.  
  */  
       choose_cmap_fmt = (TS_XIL_CHOOSE_COLORMAP_FORMAT*)&format;  
       choose_cmap_fmt->code = TS_XIL_CHOOSE_COLORMAP_FORMAT_CODE;  
       choose_cmap_fmt->function = xil_choose_colormap;  
       choose_cmap_fmt->arg1 = src1;  
       choose_cmap_fmt->arg2 = 255;  

Code Example C-1 ts_automatic_tests() Example (Continued)

       errors = ts_automatic_tests ("choose_colormap", &format, 1,  
           0.0, NULL);  
           .  
           .