forked from enlightenment/efl
eina: add test for Eina_Iterator over pure C array.
Reviewed-by: Vitor Sousa da Silva <vitorsousa@expertisesolutions.com.br> Differential Revision: https://phab.enlightenment.org/D7285
This commit is contained in:
parent
6b26b3330e
commit
a8f520188a
|
@ -289,6 +289,7 @@ EAPI Eina_Bool eina_iterator_unlock(Eina_Iterator *iterator) EINA_ARG_NONNULL(1)
|
|||
* NUL-terminated C array.
|
||||
*
|
||||
* @param[in] array The NUL-terminated array
|
||||
* @return The iterator that will walk over the array.
|
||||
*
|
||||
* You can create it like this:
|
||||
* int array[] = {1, 2, 3, 4};
|
||||
|
@ -305,6 +306,7 @@ EAPI Eina_Iterator *eina_carray_iterator_new(void** array) EINA_ARG_NONNULL(1) E
|
|||
* C array of specified size.
|
||||
*
|
||||
* @param[in] array The array
|
||||
* @return The iterator that will walk over the array.
|
||||
*
|
||||
* You can create it like this:
|
||||
* int array[] = {1, 2, 3, 4};
|
||||
|
@ -321,6 +323,7 @@ EAPI Eina_Iterator *eina_carray_length_iterator_new(void** array, unsigned int s
|
|||
* NUL-terminated C array.
|
||||
*
|
||||
* @param[in] array The NUL-terminated array
|
||||
* @return The iterator that will walk over the array.
|
||||
*
|
||||
* You can create it like this:
|
||||
* int array[] = {1, 2, 3, 4};
|
||||
|
|
|
@ -612,6 +612,23 @@ EFL_START_TEST(eina_iterator_rbtree_simple)
|
|||
}
|
||||
EFL_END_TEST
|
||||
|
||||
EFL_START_TEST(eina_iterator_carray_length)
|
||||
{
|
||||
int array[] = { 1, 4, 9, 16 };
|
||||
Eina_Iterator *it;
|
||||
int i;
|
||||
int j = 1;
|
||||
|
||||
it = EINA_C_ARRAY_ITERATOR_NEW(array);
|
||||
EINA_ITERATOR_FOREACH(it, i)
|
||||
{
|
||||
fail_if(i != j * j);
|
||||
j++;
|
||||
}
|
||||
eina_iterator_free(it);
|
||||
}
|
||||
EFL_END_TEST
|
||||
|
||||
void
|
||||
eina_test_iterator(TCase *tc)
|
||||
{
|
||||
|
@ -623,4 +640,5 @@ eina_test_iterator(TCase *tc)
|
|||
tcase_add_test(tc, eina_iterator_rbtree_simple);
|
||||
tcase_add_test(tc, eina_iterator_filter_simple);
|
||||
tcase_add_test(tc, eina_iterator_filter_free);
|
||||
tcase_add_test(tc, eina_iterator_carray_length);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue