diff options
Diffstat (limited to 'experimental/tectonics/quadtree.test.c')
-rw-r--r-- | experimental/tectonics/quadtree.test.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/experimental/tectonics/quadtree.test.c b/experimental/tectonics/quadtree.test.c index 273087b..472cc0d 100644 --- a/experimental/tectonics/quadtree.test.c +++ b/experimental/tectonics/quadtree.test.c @@ -209,16 +209,33 @@ mu_test test_get_closest() insert(&node, pts, 1); insert(&node, pts, 2); - int closest_75 = get_closest(&node, (struct point_t){0.75, 0.75}); + mu_assert_equal(node.nw->nw->id, 2); + mu_assert_equal(node.nw->nw->nw, NULL); + mu_assert_equal(node.nw->ne->id, -1); + mu_assert_equal(node.nw->ne->nw, NULL); + mu_assert_equal(node.nw->sw->id, -1); + mu_assert_equal(node.nw->sw->nw, NULL); + mu_assert_equal(node.nw->se->id, 1); + mu_assert_equal(node.nw->se->nw, NULL); + + int closest_75 = get_closest(&node, pts, + (struct point_t){0.75, 0.75}); mu_assert_equal(closest_75, 0); - int closest_33 = get_closest(&node, (struct point_t){0.3, 0.3}); + int closest_33 = get_closest(&node, pts, + (struct point_t){0.3, 0.3}); mu_assert_equal(closest_33, 1); - int closest_22 = get_closest(&node, (struct point_t){0.2, 0.2}); + int closest_22 = get_closest(&node, pts, + (struct point_t){0.2, 0.2}); mu_assert_equal(closest_22, 2); - int closest_nil = get_closest(&node, (struct point_t){100, 100}); + int closest_252 = get_closest(&node, pts, + (struct point_t){0.251, 0.21}); + mu_assert_equal(closest_252, 2); + + int closest_nil = get_closest(&node, pts, + (struct point_t){100, 100}); mu_assert_equal(closest_nil, -1); return 0; |