bu5hm4n pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=0da0b8ea55ed9639565287e10b79bc61c48dcb38

commit 0da0b8ea55ed9639565287e10b79bc61c48dcb38
Author: Mike Blumenkrantz <zm...@samsung.com>
Date:   Thu Oct 24 14:26:24 2019 -0400

    tests/ecore: add more grueling timer throughput test
    
    this verifies that:
    * newly-created timers are not triggered in the next loop iteration
    * newly-created timers can be triggered the second loop after created
    * multiple timers can be triggered in a single loop iteration
    * timers are effectively added to the pending timer list
    
    ref T8434
    
    Reviewed-by: Cedric BAIL <cedric.b...@free.fr>
    Differential Revision: https://phab.enlightenment.org/D10516
---
 src/tests/ecore/ecore_test_timer.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/src/tests/ecore/ecore_test_timer.c 
b/src/tests/ecore/ecore_test_timer.c
index 222c4151c5..f394aaef56 100644
--- a/src/tests/ecore/ecore_test_timer.c
+++ b/src/tests/ecore/ecore_test_timer.c
@@ -288,6 +288,30 @@ EFL_START_TEST(ecore_test_timer_in_order)
 }
 EFL_END_TEST
 
+EFL_START_TEST(ecore_test_timer_iteration)
+{
+   count = 0;
+   ecore_timer_add(0, _timer_cb, (void *) 1);
+   ecore_main_loop_iterate();
+   /* timers should not expire for one loop iteration */
+   ck_assert_int_eq(count, 0);
+   ecore_main_loop_iterate();
+   /* timers should expire after one loop iteration */
+   ck_assert_int_eq(count, 1);
+   ecore_timer_add(0, _timer_cb, (void *) 2);
+   ecore_timer_add(0, _timer_cb, (void *) 3);
+   ecore_main_loop_iterate();
+   /* timers should not expire for one loop iteration */
+   ck_assert_int_eq(count, 1);
+   ecore_timer_add(0, _timer_cb, (void *) 4);
+   ecore_main_loop_iterate();
+   /* all pending and instantiated timers should expire after one loop 
iteration */
+   ck_assert_int_eq(count, 3);
+   ecore_main_loop_iterate();
+   ck_assert_int_eq(count, 4);
+}
+EFL_END_TEST
+
 void ecore_test_timer(TCase *tc)
 {
   tcase_add_test(tc, ecore_test_timers);
@@ -295,4 +319,5 @@ void ecore_test_timer(TCase *tc)
   tcase_add_test(tc, ecore_test_timer_valid_callbackfunc);
   tcase_add_test(tc, ecore_test_ecore_main_loop_timer);
   tcase_add_test(tc, ecore_test_timer_in_order);
+  tcase_add_test(tc, ecore_test_timer_iteration);
 }

-- 


Reply via email to