This is a fork of the `events` subdirectory of https://github.com/ARMmbed/mbed-os
Dependents: HelloWorld_CCA01M1 HelloWorld_CCA02M1 CI-data-logger-server HelloWorld_CCA02M1 ... more
This is a fork of the events
subdirectory of https://github.com/ARMmbed/mbed-os.
Note, you must import this library with import name: events
!!!
Diff: equeue/tests/tests.c
- Revision:
- 11:1bc395c82a41
- Parent:
- 0:a792d4bf36c2
--- a/equeue/tests/tests.c Mon Nov 07 10:25:17 2016 -0600 +++ b/equeue/tests/tests.c Sun Nov 20 14:18:08 2016 -0600 @@ -557,6 +557,42 @@ equeue_dispatch(&q1, 30); test_assert(touched == 6); + + equeue_destroy(&q1); + equeue_destroy(&q2); +} + +void unchain_test(void) { + equeue_t q1; + int err = equeue_create(&q1, 2048); + test_assert(!err); + + equeue_t q2; + err = equeue_create(&q2, 2048); + test_assert(!err); + + equeue_chain(&q2, &q1); + + int touched = 0; + int id1 = equeue_call(&q1, simple_func, &touched); + int id2 = equeue_call(&q2, simple_func, &touched); + test_assert(id1 && id2); + + equeue_dispatch(&q1, 0); + test_assert(touched == 2); + + equeue_chain(&q2, 0); + equeue_chain(&q1, &q2); + + id1 = equeue_call(&q1, simple_func, &touched); + id2 = equeue_call(&q2, simple_func, &touched); + test_assert(id1 && id2); + + equeue_dispatch(&q2, 0); + test_assert(touched == 4); + + equeue_destroy(&q1); + equeue_destroy(&q2); } // Barrage tests @@ -671,6 +707,7 @@ test_run(sloth_test); test_run(background_test); test_run(chain_test); + test_run(unchain_test); test_run(multithread_test); test_run(simple_barrage_test, 20); test_run(fragmenting_barrage_test, 20);