static void print_types (const tiz_os_t * ap_os) { #ifdef _DEBUG assert (ap_os); assert (ap_os->p_map); tiz_map_for_each (ap_os->p_map, print_function, (tiz_os_t *) ap_os); #endif }
END_TEST START_TEST (test_map_insert_find_erase_size_empty_at_for_each) { OMX_U32 i; OMX_ERRORTYPE error = OMX_ErrorNone; int *p_item = NULL; tiz_map_t *p_map = NULL;; OMX_U32 index = 0; error = tiz_map_init (&p_map, check_map_cmp_f, check_map_free_f, NULL); fail_if (error != OMX_ErrorNone); fail_if (false == tiz_map_empty (p_map)); for (i = 0; i < 10; i++) { p_item = (int *) tiz_mem_alloc (sizeof (int)); fail_if (p_item == NULL); *p_item = i; error = tiz_map_insert (p_map, p_item, p_item, &index); fail_if (error != OMX_ErrorNone); fail_if (index != i); fail_if (tiz_map_size (p_map) != i+1); } fail_if (10 != tiz_map_size (p_map)); fail_if (true == tiz_map_empty (p_map)); i = 5; fail_if (5 != *(p_item = tiz_map_find (p_map, &i))); fail_if (5 != *(p_item = tiz_map_value_at (p_map, i))); fail_if (OMX_ErrorNone != tiz_map_for_each (p_map, check_map_for_each_f, NULL)); for (i = 0; i < 10; i++) { int d = i; tiz_map_erase (p_map, &d); fail_if (tiz_map_size (p_map) != 9-i); } tiz_map_destroy (p_map); }