diff options
Diffstat (limited to 'src/test.c')
-rw-r--r-- | src/test.c | 54 |
1 files changed, 31 insertions, 23 deletions
@@ -63,38 +63,46 @@ int main(int argc, char *argv[]) return 1; } - for (int i = 0; i < sizeof(objects) / sizeof(*objects); i++) { - objects[i].ix = ix3_object_new(ix3, NULL, NULL, &objects[i].aabb, &objects[i]); - if (!o) { - fprintf(stderr, "unable to insert object %i\n", i); - return 1; + for (int n = 0; n < 20; n++) { + for (int i = 0; i < sizeof(objects) / sizeof(*objects); i++) { + objects[i].ix = ix3_object_new(ix3, NULL, NULL, &objects[i].aabb, &objects[i]); + if (!objects[i].ix) { + fprintf(stderr, "unable to insert object %i\n", i); + return 1; + } } - } - for (int i = 0; i < sizeof(objects) / sizeof(*objects); i++) { - /* TODO: actually verify the expected objects are hit */ - if (!ix3_search_by_point(ix3, &objects[i].aabb.min, cb, &objects[i])) { - fprintf(stderr, "unable to lookup object %i by min point\n", i); - return 1; + for (int i = 0; i < sizeof(objects) / sizeof(*objects); i++) { + /* TODO: actually verify the expected objects are hit */ + if (!ix3_search_by_point(ix3, &objects[i].aabb.min, cb, &objects[i])) { + fprintf(stderr, "unable to lookup object %i by min point\n", i); + return 1; + } + + if (!ix3_search_by_point(ix3, &objects[i].aabb.max, cb, &objects[i])) { + fprintf(stderr, "unable to lookup object %i by max point\n", i); + return 1; + } } - if (!ix3_search_by_point(ix3, &objects[i].aabb.max, cb, &objects[i])) { - fprintf(stderr, "unable to lookup object %i by max point\n", i); - return 1; + for (int i = 0; i < sizeof(objects) / sizeof(*objects); i++) { + /* TODO: actually verify the expected objects are hit */ + if (!ix3_search_by_aabb(ix3, NULL, NULL, &objects[i].aabb, cb, &objects[i])) { + fprintf(stderr, "unable to lookup object %i by perfect aabb\n", i); + return 1; + } } - } - for (int i = 0; i < sizeof(objects) / sizeof(*objects); i++) { - /* TODO: actually verify the expected objects are hit */ - if (!ix3_search_by_aabb(ix3, NULL, NULL, &objects[i].aabb, cb, &objects[i])) { - fprintf(stderr, "unable to lookup object %i by perfect aabb\n", i); - return 1; + if (n % 2) { + fprintf(stderr, "explicitly freeing all objects\n"); + for (int i = 0; i < sizeof(objects) / sizeof(*objects); i++) + ix3_object_free(ix3, objects[i].ix); + } else { + fprintf(stderr, "resetting\n"); + ix3_reset(ix3); } } - for (int i = 0; i < sizeof(objects) / sizeof(*objects); i++) - ix3_object_free(ix3, objects[i].ix); - ix3_free(ix3); return 0; |