From d24a9e1df5a896ffcf3f35f024573e027002c351 Mon Sep 17 00:00:00 2001 From: Nick Drabsch Date: Sun, 9 Jul 2023 13:40:30 +0100 Subject: [PATCH] Remove usages of ecs_field with index 0 in tests --- test/addons/src/util.c | 23 +++++++---------------- test/api/src/util.c | 23 +++++++---------------- 2 files changed, 14 insertions(+), 32 deletions(-) diff --git a/test/addons/src/util.c b/test/addons/src/util.c index a635072dd..a1cc9005f 100644 --- a/test/addons/src/util.c +++ b/test/addons/src/util.c @@ -26,24 +26,15 @@ void probe_system_w_ctx( test_assert(e != 0); } - if (it->entities) { - ecs_entity_t *e = ecs_field(it, ecs_entity_t, 0); - if (e) { - test_assert(e != NULL); - test_assert(it->entities != NULL); - test_assert(it->entities == e); - - for (i = 0; i < it->count; i ++) { - if (i + ctx->count < 256) { - ctx->e[i + ctx->count] = e[i]; - } else { - /* can't store more than that, tests shouldn't rely on - * getting back more than 256 results */ - } - } - ctx->count += it->count; + for (i = 0; i < it->count; i ++) { + if (i + ctx->count < 256) { + ctx->e[i + ctx->count] = it->entities[i]; + } else { + /* can't store more than that, tests shouldn't rely on + * getting back more than 256 results */ } } + ctx->count += it->count; ctx->invoked ++; } diff --git a/test/api/src/util.c b/test/api/src/util.c index e0849a26a..eedc14cbd 100644 --- a/test/api/src/util.c +++ b/test/api/src/util.c @@ -26,24 +26,15 @@ void probe_system_w_ctx( test_assert(e != 0); } - if (it->entities) { - ecs_entity_t *e = ecs_field(it, ecs_entity_t, 0); - if (e) { - test_assert(e != NULL); - test_assert(it->entities != NULL); - test_assert(it->entities == e); - - for (i = 0; i < it->count; i ++) { - if (i + ctx->count < 256) { - ctx->e[i + ctx->count] = e[i]; - } else { - /* can't store more than that, tests shouldn't rely on - * getting back more than 256 results */ - } - } - ctx->count += it->count; + for (i = 0; i < it->count; i ++) { + if (i + ctx->count < 256) { + ctx->e[i + ctx->count] = it->entities[i]; + } else { + /* can't store more than that, tests shouldn't rely on + * getting back more than 256 results */ } } + ctx->count += it->count; ctx->invoked ++; }