summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2020-01-22 10:23:53 -0800
committerCedric BAIL <cedric.bail@free.fr>2020-01-31 10:11:32 -0800
commitc7508d3d521b548429c8f00e0018c3565a3c8299 (patch)
treef4c2400044450e5357d08f1174b2ae925726e907
parent373f2ad7974a064daabcc7ba74db8b553ecfc1e0 (diff)
eina: add test for eina_future_all_iterator.
Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D11181
-rw-r--r--src/tests/ecore/efl_app_test_promise.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/tests/ecore/efl_app_test_promise.c b/src/tests/ecore/efl_app_test_promise.c
index e1a74d6ab5..424c278704 100644
--- a/src/tests/ecore/efl_app_test_promise.c
+++ b/src/tests/ecore/efl_app_test_promise.c
@@ -775,6 +775,34 @@ EFL_START_TEST(efl_test_promise_future_all)
775} 775}
776EFL_END_TEST 776EFL_END_TEST
777 777
778EFL_START_TEST(efl_test_promise_future_all_iterator)
779{
780 Eina_Future *futures[11];
781 Eina_Iterator *it;
782 unsigned int i, futures_called = 0, len = EINA_C_ARRAY_LENGTH(futures);
783
784 fail_if(!ecore_init());
785 for (i = 0; i < len; i++)
786 {
787 Eina_Future *f;
788 if (i % 2 == 0)
789 f = _str_future_get();
790 else
791 f = _int_future_get();
792 fail_if(!f);
793 futures[i] = eina_future_then(f, _future_all_count, &futures_called);
794 fail_if(!futures[i]);
795 }
796
797 it = EINA_C_ARRAY_ITERATOR_NEW(futures);
798 fail_if(!eina_future_then(eina_future_all_iterator(it), _all_cb, &len));
799
800 ecore_main_loop_begin();
801 ecore_shutdown();
802 fail_if(futures_called != len);
803}
804EFL_END_TEST
805
778EFL_START_TEST(efl_test_promise_future_race) 806EFL_START_TEST(efl_test_promise_future_race)
779{ 807{
780 Race_Ctx ctx = { 0 }; 808 Race_Ctx ctx = { 0 };
@@ -1446,6 +1474,7 @@ void efl_app_test_promise(TCase *tc)
1446 tcase_add_test(tc, efl_test_promise_future_convert); 1474 tcase_add_test(tc, efl_test_promise_future_convert);
1447 tcase_add_test(tc, efl_test_promise_future_easy); 1475 tcase_add_test(tc, efl_test_promise_future_easy);
1448 tcase_add_test(tc, efl_test_promise_future_all); 1476 tcase_add_test(tc, efl_test_promise_future_all);
1477 tcase_add_test(tc, efl_test_promise_future_all_iterator);
1449 tcase_add_test(tc, efl_test_promise_future_race); 1478 tcase_add_test(tc, efl_test_promise_future_race);
1450 tcase_add_test(tc, efl_test_promise_future_ignore_error); 1479 tcase_add_test(tc, efl_test_promise_future_ignore_error);
1451 tcase_add_test(tc, efl_test_promise_future_success); 1480 tcase_add_test(tc, efl_test_promise_future_success);