summaryrefslogtreecommitdiff
path: root/src/tests/eina
diff options
context:
space:
mode:
authorCedric Bail <cedric.bail@free.fr>2019-09-14 10:54:05 -0700
committerCedric Bail <cedric.bail@free.fr>2019-09-19 14:37:41 -0700
commit9382bfc0bc1c6a5fb3aafce18094016b110036c0 (patch)
treed829f299356af2136ed3144887cb40b2f0dc884f /src/tests/eina
parentbf12fe241ec04c81129faf9ccfa7438fa9a23062 (diff)
downloadefl-9382bfc0bc1c6a5fb3aafce18094016b110036c0.tar.gz
eina: add eina_mempool_iterator_new to slowly iterate every allocated pointer in a mempool.
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Differential Revision: https://phab.enlightenment.org/D9941
Diffstat (limited to 'src/tests/eina')
-rw-r--r--src/tests/eina/eina_test_mempool.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/tests/eina/eina_test_mempool.c b/src/tests/eina/eina_test_mempool.c
index 78656cea53..c36bab1717 100644
--- a/src/tests/eina/eina_test_mempool.c
+++ b/src/tests/eina/eina_test_mempool.c
@@ -28,10 +28,12 @@ static void
_eina_mempool_test(Eina_Mempool *mp,
Eina_Bool with_realloc, Eina_Bool with_gc, Eina_Bool accurate_from)
{
+ Eina_Iterator *it;
int *tbl[512];
+ int *ptr;
int i;
- fail_if(!mp);
+ fail_if(!mp);
for (i = 0; i < 512; ++i)
{
@@ -52,6 +54,20 @@ _eina_mempool_test(Eina_Mempool *mp,
fail_if(eina_mempool_from(mp, tbl[i]) != EINA_FALSE);
}
+ it = eina_mempool_iterator_new(mp);
+ EINA_ITERATOR_FOREACH(it, ptr)
+ {
+ ck_assert_int_gt(*ptr, 255);
+ *ptr = 0;
+ }
+ eina_iterator_free(it);
+
+ if (it) // Only check if the mempool support iterator
+ {
+ for (; i < 512; ++i)
+ ck_assert_int_eq(*tbl[i], 0);
+ }
+
if (with_realloc)
fail_if(eina_mempool_realloc(mp, tbl[500], 25) == NULL);
else