summaryrefslogtreecommitdiff
path: root/src/tests/eina/eina_test_iterator.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2018-11-15 17:44:09 -0800
committerCedric BAIL <cedric@osg.samsung.com>2018-11-23 10:13:56 -0800
commitaac7d099a17d69f5989481f8999a43d4173005bd (patch)
treee97dfb91dc382f404b43e8e6e503f13ab53ce6df /src/tests/eina/eina_test_iterator.c
parentbd474a8829119d487e5a3bb42f8a0d7a372948ad (diff)
eina: add tests for eina_multiple_iterator_new.
Reviewed-by: Vitor Sousa da Silva <vitorsousa@expertisesolutions.com.br> Differential Revision: https://phab.enlightenment.org/D7287
Diffstat (limited to '')
-rw-r--r--src/tests/eina/eina_test_iterator.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/tests/eina/eina_test_iterator.c b/src/tests/eina/eina_test_iterator.c
index 14650621ca..e2b0a4befb 100644
--- a/src/tests/eina/eina_test_iterator.c
+++ b/src/tests/eina/eina_test_iterator.c
@@ -616,8 +616,8 @@ EFL_START_TEST(eina_iterator_carray_length)
616{ 616{
617 int array[] = { 1, 4, 9, 16 }; 617 int array[] = { 1, 4, 9, 16 };
618 Eina_Iterator *it; 618 Eina_Iterator *it;
619 int i;
620 int j = 1; 619 int j = 1;
620 int i = 0;
621 621
622 it = EINA_C_ARRAY_ITERATOR_NEW(array); 622 it = EINA_C_ARRAY_ITERATOR_NEW(array);
623 EINA_ITERATOR_FOREACH(it, i) 623 EINA_ITERATOR_FOREACH(it, i)
@@ -625,6 +625,31 @@ EFL_START_TEST(eina_iterator_carray_length)
625 fail_if(i != j * j); 625 fail_if(i != j * j);
626 j++; 626 j++;
627 } 627 }
628 fail_if(j < EINA_C_ARRAY_LENGTH(array));
629 eina_iterator_free(it);
630}
631EFL_END_TEST
632
633EFL_START_TEST(eina_iterator_multi)
634{
635 int array1[] = { 1, 4, 9, 16 };
636 int array2[] = { 25, 36, 49, 64 };
637 int array3[] = { 81, 100, 121, 144 };
638 Eina_Iterator *it;
639 int i;
640 int j = 1;
641
642 it = eina_multi_iterator_new(EINA_C_ARRAY_ITERATOR_NEW(array1),
643 EINA_C_ARRAY_ITERATOR_NEW(array2),
644 EINA_C_ARRAY_ITERATOR_NEW(array3));
645 EINA_ITERATOR_FOREACH(it, i)
646 {
647 fail_if(i != j * j);
648 j++;
649 }
650 fail_if(j < EINA_C_ARRAY_LENGTH(array1)
651 + EINA_C_ARRAY_LENGTH(array2)
652 + EINA_C_ARRAY_LENGTH(array3));
628 eina_iterator_free(it); 653 eina_iterator_free(it);
629} 654}
630EFL_END_TEST 655EFL_END_TEST
@@ -641,4 +666,5 @@ eina_test_iterator(TCase *tc)
641 tcase_add_test(tc, eina_iterator_filter_simple); 666 tcase_add_test(tc, eina_iterator_filter_simple);
642 tcase_add_test(tc, eina_iterator_filter_free); 667 tcase_add_test(tc, eina_iterator_filter_free);
643 tcase_add_test(tc, eina_iterator_carray_length); 668 tcase_add_test(tc, eina_iterator_carray_length);
669 tcase_add_test(tc, eina_iterator_multi);
644} 670}