GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> QMEM / V0-2-1 > qmem_unit_test / rhel6-32
#include <QMEM/QMEM.h>
Classes | |
struct | _test_Test_Descriptor |
Description of a test state. More... | |
struct | _Context |
QMEM context information. More... | |
Defines | |
#define | DIM(a) (sizeof (a) / sizeof ((a)[0])) |
Dimension of an array. | |
Typedefs | |
typedef struct _test_Test_Descriptor | test_Test_Descriptor |
Typedef for _test_Test_Descriptor. | |
typedef struct _Context | Context |
Typedef for _Context. | |
Functions | |
void | test_Push_State (test_Test_Descriptor *td_p, const char *desc, const int index) |
Enter a new test state. | |
void | test_Pop_State (test_Test_Descriptor *td_p) |
Return for a test state. | |
void | test_Show (const test_Test_Descriptor *td_p, const int level, const char *item_1, const char *item_2) |
Display text with indentation. | |
int | test_Generic_Error (const test_Test_Descriptor *td_p, const char *fmt, const char *str_param, const unsigned int int_param) |
Display a generic error message. | |
int | test_Context_Compare (const test_Test_Descriptor *td_p, const Context *expect_p, const Context *actual_p, const char *desc) |
Verify parsing context information. | |
int | test_Memory_Compare (const test_Test_Descriptor *td_p, const void *expect_p, const void *actual_p, const void *mask_p, const unsigned int num_bytes) |
Verify the contents of a buffer in memory. | |
int | test_NULL_Compare (const test_Test_Descriptor *td_p, const void *actual, const char *desc) |
Check a 32-bit value to make sure it is not NULL. | |
int | test_Status_Compare (const test_Test_Descriptor *td_p, const QMEM_Status expect, const QMEM_Status actual, const char *func) |
Check a QMEM_Status value. | |
int | test_Value32_Compare (const test_Test_Descriptor *td_p, const unsigned int expect, const unsigned int actual, const char *desc) |
Check a 32-bit value. | |
void | test_Show_Item (const test_Test_Descriptor *td_p, const char *name, const char *fmt, const char *str_param, const unsigned int int_param) |
Display an item of data. | |
void | qmem_test_context (test_Test_Descriptor *td_p, const unsigned int bit_mask) |
Unit test for the QMEM context information functions. | |
void | qmem_test_ctb (test_Test_Descriptor *td_p, const unsigned int bit_mask) |
Unit test for the QMEM_parse_contribution() function. | |
void | qmem_test_datagram (test_Test_Descriptor *td_p, const unsigned int bit_mask) |
Unit test for the QMEM_parse_datagram() function. | |
void | qmem_test_start (test_Test_Descriptor *td_p, const unsigned int bit_mask) |
Unit test for the QMEM_start_parsing() function. |
** CVS $Id: qmem_unit_test.h,v 1.2 2011/03/30 23:56:36 russell Exp $ **
void qmem_test_context | ( | test_Test_Descriptor * | td_p, | |
const unsigned int | bit_mask | |||
) |
Unit test for the QMEM context information functions.
td_p | Pointer to test descriptor. | |
bit_mask | Bitmask ID for this subtest. |
References _Context::bytes_available, _Context::bytes_dumped, _Context::cmd_fcode, _WRAP_Info::context_p, _Context::data_buf, _WRAP_Info::data_buf_bytes, _WRAP_Info::data_buf_p, _test_Test_Descriptor::exec, _WRAP_Info::exp_ctx, _WRAP_Info::exp_status, _test_Test_Descriptor::fail, _Context::lat_unit, _Context::num_datagrams, QMEM_LAT_UNIT_UNKNOWN, QMEM_STATUS_BAD_CTX, QMEM_STATUS_INCOMPLETE, QMEM_STATUS_OK, _Context::start_addr, _Context::status, test_Pop_State(), test_Push_State(), _Context::tran_id, WRAP_alloc_context(), WRAP_free_context(), WRAP_get_context(), WRAP_init_context(), and WRAP_init_info().
Referenced by qmem_unit_test().
void qmem_test_ctb | ( | test_Test_Descriptor * | td_p, | |
const unsigned int | bit_mask | |||
) |
Unit test for the QMEM_parse_contribution() function.
td_p | Pointer to test descriptor. | |
bit_mask | Bitmask ID for this subtest. |
References _WRAP_Info::act_data_p, _Context::bytes_available, _Context::bytes_dumped, _Context::cmd_fcode, _WRAP_Info::context_p, _WRAP_Info::ctb_p, _Context::data_buf, _WRAP_Info::data_buf_bytes, _WRAP_Info::data_buf_p, _WRAP_Info::dgm_bytes, _WRAP_Info::dgm_p, _WRAP_Info::dgm_swapped, _test_Test_Descriptor::exec, _WRAP_Info::exp_ctx, _WRAP_Info::exp_data_bytes, _WRAP_Info::exp_data_p, _WRAP_Info::exp_status, _test_Test_Descriptor::fail, _Context::lat_unit, _Context::num_datagrams, QMEM_LAT_UNIT_SIU, QMEM_LAT_UNIT_UNKNOWN, QMEM_STATUS_BAD_CTB_LEN, QMEM_STATUS_BAD_CTX, QMEM_STATUS_BAD_DIR, QMEM_STATUS_BAD_HDR, QMEM_STATUS_BAD_TYPE, QMEM_STATUS_BAD_VER, QMEM_STATUS_INCOMPLETE, QMEM_STATUS_NULL_PTR, QMEM_STATUS_OK, QMEM_STATUS_SHORT, QMEM_STATUS_TRUNCATED, small_dgm, _Context::start_addr, _Context::status, test_Pop_State(), test_Push_State(), _Context::tran_id, WRAP_alloc_context(), WRAP_free_context(), WRAP_init_context(), WRAP_init_info(), WRAP_parse_contribution(), and WRAP_start_parsing().
Referenced by qmem_unit_test().
void qmem_test_datagram | ( | test_Test_Descriptor * | td_p, | |
const unsigned int | bit_mask | |||
) |
Unit test for the QMEM_parse_datagram() function.
td_p | Pointer to test descriptor. | |
bit_mask | Bitmask ID for this subtest. |
References _WRAP_Info::act_data_p, byte_swap(), _Context::bytes_available, _Context::bytes_dumped, _Context::cmd_fcode, _WRAP_Info::context_p, _Context::data_buf, _WRAP_Info::data_buf_bytes, _WRAP_Info::data_buf_p, _WRAP_Info::dgm_bytes, _WRAP_Info::dgm_p, _WRAP_Info::dgm_swapped, _test_Test_Descriptor::exec, _WRAP_Info::exp_ctx, _WRAP_Info::exp_data_bytes, _WRAP_Info::exp_data_p, _WRAP_Info::exp_status, _test_Test_Descriptor::fail, _Context::lat_unit, _Context::num_datagrams, QMEM_LAT_UNIT_SIU, QMEM_LAT_UNIT_UNKNOWN, QMEM_STATUS_BAD_CTX, QMEM_STATUS_BAD_DIR, QMEM_STATUS_BAD_VER, QMEM_STATUS_INCOMPLETE, QMEM_STATUS_NULL_PTR, QMEM_STATUS_OK, small_dgm, _Context::start_addr, _Context::status, test_Pop_State(), test_Push_State(), _Context::tran_id, WRAP_alloc_context(), WRAP_free_context(), WRAP_init_context(), WRAP_init_info(), and WRAP_parse_datagram().
Referenced by qmem_unit_test().
void qmem_test_start | ( | test_Test_Descriptor * | td_p, | |
const unsigned int | bit_mask | |||
) |
Unit test for the QMEM_start_parsing() function.
td_p | Pointer to test descriptor. | |
bit_mask | Bitmask ID for this subtest. |
References _WRAP_Info::act_data_p, _Context::bytes_available, _Context::bytes_dumped, _Context::cmd_fcode, _WRAP_Info::context_p, _Context::data_buf, _WRAP_Info::data_buf_bytes, _WRAP_Info::data_buf_p, _WRAP_Info::dgm_bytes, _WRAP_Info::dgm_p, _WRAP_Info::dgm_swapped, _test_Test_Descriptor::exec, _WRAP_Info::exp_ctx, _WRAP_Info::exp_data_bytes, _WRAP_Info::exp_data_p, _WRAP_Info::exp_status, _test_Test_Descriptor::fail, _Context::lat_unit, _Context::num_datagrams, QMEM_LAT_UNIT_UNKNOWN, QMEM_STATUS_BAD_CTX, QMEM_STATUS_BAD_DIR, QMEM_STATUS_BAD_HDR, QMEM_STATUS_BAD_TYPE, QMEM_STATUS_BAD_VER, QMEM_STATUS_INCOMPLETE, QMEM_STATUS_NULL_PTR, QMEM_STATUS_OK, QMEM_STATUS_SHORT, QMEM_STATUS_TRUNCATED, small_dgm, _Context::start_addr, _Context::status, test_Pop_State(), test_Push_State(), _Context::tran_id, WRAP_alloc_context(), WRAP_free_context(), WRAP_init_context(), WRAP_init_info(), and WRAP_start_parsing().
Referenced by qmem_unit_test().
int test_Context_Compare | ( | const test_Test_Descriptor * | td_p, | |
const Context * | exp_p, | |||
const Context * | act_p, | |||
const char * | desc | |||
) |
Verify parsing context information.
td_p | Pointer to test descriptor. | |
exp_p | Pointer to expected information. | |
act_p | Pointer to actual information. | |
desc | Description of the information. |
0 | Information is correct. | |
-1 | Information is not correct. |
References _test_Test_Descriptor::depth, show_at_level(), show_desc_stack(), and test_Show_Context().
Referenced by WRAP_get_context().
int test_Generic_Error | ( | const test_Test_Descriptor * | td_p, | |
const char * | fmt, | |||
const char * | str_param, | |||
const unsigned int | int_param | |||
) |
Display a generic error message.
td_p | Pointer to test descriptor. | |
fmt | Format string to display. | |
str_param | First parameter (string) for fmt string. | |
int_param | Second parameter (uint) for fmt string. |
References _test_Test_Descriptor::depth, show_at_level(), and show_desc_stack().
Referenced by qmem_unit_test(), and WRAP_alloc_context().
int test_Memory_Compare | ( | const test_Test_Descriptor * | td_p, | |
const void * | expect_p, | |||
const void * | actual_p, | |||
const void * | mask_p, | |||
const unsigned int | num_bytes | |||
) |
Verify the contents of a buffer in memory.
This function verifies the contents of a memory buffer and reports an error if the values are not as expected. An optional mask can be used to indicate which bits should be verified.
td_p | Pointer to test descriptor. | |
expect_p | Pointer to a memory buffer with the expected values. | |
actual_p | Pointer to the memory buffer to verify. | |
mask_p | Pointer to a memory buffer of mask values. | |
num_bytes | Number of bytes to verify within the buffer. |
0 | Buffer values are correct. | |
-1 | One or more values within the buffer are incorrect. |
References _test_Test_Descriptor::depth, show_at_level(), and show_desc_stack().
Referenced by WRAP_get_context().
int test_NULL_Compare | ( | const test_Test_Descriptor * | td_p, | |
const void * | actual, | |||
const char * | desc | |||
) |
Check a 32-bit value to make sure it is not NULL.
td_p | Pointer to test descriptor. | |
actual | Actual value. | |
desc | Description of the value. |
0 | Actual value != NULL. | |
-1 | Actual value == NULL. |
References _test_Test_Descriptor::depth, show_at_level(), and show_desc_stack().
Referenced by WRAP_alloc_context().
void test_Pop_State | ( | test_Test_Descriptor * | td_p | ) |
Return for a test state.
Pop a test state description from a test's state stack.
td_p | Pointer to test descriptor. |
References _test_Test_Descriptor::depth, _test_Test_Descriptor::desc, and show_banner().
Referenced by qmem_test_context(), qmem_test_ctb(), qmem_test_datagram(), qmem_test_start(), qmem_unit_test(), WRAP_alloc_context(), WRAP_get_context(), WRAP_init_context(), WRAP_parse_contribution(), WRAP_parse_datagram(), and WRAP_start_parsing().
void test_Push_State | ( | test_Test_Descriptor * | td_p, | |
const char * | desc, | |||
const int | index | |||
) |
Enter a new test state.
Push a new test state description onto a test's state stack. This state stack provides a trace of the execution of the test.
td_p | Pointer to test descriptor. | |
desc | Description of the new state. | |
index | Generic index value. |
References _test_Test_Descriptor::depth, _test_Test_Descriptor::desc, DIM, _test_Test_Descriptor::index, show_at_level(), and show_banner().
Referenced by qmem_test_context(), qmem_test_ctb(), qmem_test_datagram(), qmem_test_start(), qmem_unit_test(), WRAP_alloc_context(), WRAP_get_context(), WRAP_init_context(), WRAP_parse_contribution(), WRAP_parse_datagram(), and WRAP_start_parsing().
void test_Show | ( | const test_Test_Descriptor * | td_p, | |
const int | level, | |||
const char * | item_1, | |||
const char * | item_2 | |||
) |
Display text with indentation.
Display text with indentation appropriate for the specified level.
td_p | Pointer to test descriptor. | |
level | Indentation level. | |
item_1 | First text string to display. | |
item_2 | Second text string to display. |
References show_at_level().
void test_Show_Item | ( | const test_Test_Descriptor * | td_p, | |
const char * | name, | |||
const char * | fmt, | |||
const char * | str_param, | |||
const unsigned int | int_param | |||
) |
Display an item of data.
This function displays an item of data in a predefined format.
td_p | Pointer to test descriptor. | |
name | Name of the item. | |
fmt | Format string to display the item's value. | |
str_param | First parameter (string) for fmt string. | |
int_param | Second parameter (uint) for fmt string. |
References _test_Test_Descriptor::depth, and show_at_level().
int test_Status_Compare | ( | const test_Test_Descriptor * | td_p, | |
const QMEM_Status | expect, | |||
const QMEM_Status | actual, | |||
const char * | func | |||
) |
Check a QMEM_Status value.
Compare actual and expected QMEM_Status values and display a message if they differ.
td_p | Pointer to test descriptor. | |
expect | Expected value. | |
actual | Actual value. | |
func | Name of the function that returned the status. |
0 | Actual value == Expected value | |
-1 | Actual value != Expected value. |
References _test_Test_Descriptor::depth, show_at_level(), show_desc_stack(), and show_status_name().
Referenced by WRAP_init_context(), WRAP_parse_contribution(), WRAP_parse_datagram(), and WRAP_start_parsing().
int test_Value32_Compare | ( | const test_Test_Descriptor * | td_p, | |
const unsigned int | expect, | |||
const unsigned int | actual, | |||
const char * | desc | |||
) |
Check a 32-bit value.
Compare actual and expected 32-bit values and display a message if they differ.
td_p | Pointer to test descriptor. | |
expect | Expected value. | |
actual | Actual value. | |
desc | Description of the value. |
0 | Actual value == Expected value | |
-1 | Actual value != Expected value. |
References _test_Test_Descriptor::depth, show_at_level(), and show_desc_stack().