summaryrefslogtreecommitdiff
path: root/src/test.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/test.c')
-rw-r--r--src/test.c53
1 files changed, 31 insertions, 22 deletions
diff --git a/src/test.c b/src/test.c
index a1918ab..d00f63a 100644
--- a/src/test.c
+++ b/src/test.c
@@ -63,37 +63,46 @@ int main(int argc, char *argv[])
return 1;
}
- for (int i = 0; i < sizeof(objects) / sizeof(*objects); i++) {
- objects[i].ix = ix2_object_new(ix2, 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 = ix2_object_new(ix2, 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 (!ix2_search_by_point(ix2, &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 (!ix2_search_by_point(ix2, &objects[i].aabb.min, cb, &objects[i])) {
+ fprintf(stderr, "unable to lookup object %i by min point\n", i);
+ return 1;
+ }
+
+ if (!ix2_search_by_point(ix2, &objects[i].aabb.max, cb, &objects[i])) {
+ fprintf(stderr, "unable to lookup object %i by max point\n", i);
+ return 1;
+ }
}
- if (!ix2_search_by_point(ix2, &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 (!ix2_search_by_aabb(ix2, 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 (!ix2_search_by_aabb(ix2, 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++)
+ ix2_object_free(ix2, objects[i].ix);
+ } else {
+ fprintf(stderr, "resetting\n");
+ ix2_reset(ix2);
}
}
- for (int i = 0; i < sizeof(objects) / sizeof(*objects); i++)
- ix2_object_free(ix2, objects[i].ix);
ix2_free(ix2);
© All Rights Reserved