END_TEST /* coord_2d_midpoint Test */ START_TEST(test_2d_midpoint) { coord_2d_t a; coord_2d_t b; coord_2d_t mid; coord_2d_t exp; a.x = b.x = 0; a.y = b.y = 0; coord_2d_midpoint(&mid, &a, &b); exp.x = 0; exp.y = 0; ck_assert(coord_2d_eq(&mid, &exp)); a.x = 0; a.y = 0; b.x = 3; b.y = 0; coord_2d_midpoint(&mid, &a, &b); exp.x = 1.5; exp.y = 0; ck_assert(coord_2d_eq(&mid, &exp)); a.x = 0; a.y = 0; b.x = 0; b.y = 3; coord_2d_midpoint(&mid, &a, &b); exp.x = 0; exp.y = 1.5; ck_assert(coord_2d_eq(&mid, &exp)); a.x = 0; a.y = 0; b.x = 3; b.y = 3; coord_2d_midpoint(&mid, &a, &b); exp.x = 1.5; exp.y = 1.5; ck_assert(coord_2d_eq(&mid, &exp)); a.x = 1; a.y = 2; b.x = 3; b.y = 4; coord_2d_midpoint(&mid, &a, &b); exp.x = 2; exp.y = 3; ck_assert(coord_2d_eq(&mid, &exp)); }
END_TEST /* coord_2d_eq Test */ START_TEST(test_2d_eq) { coord_2d_t a; coord_2d_t b; a.x = b.x = 0; a.y = b.y = 0; ck_assert(coord_2d_eq(&a, &b)); a.x = b.x = 9.99; a.y = b.y = 9.99; ck_assert(coord_2d_eq(&a, &b)); a.x = b.x = 3.33; a.y = b.y = 9.99; ck_assert(coord_2d_eq(&a, &b)); a.x = 3.33; a.y = 9.99; b.x = 3.33; b.y = 10.99; ck_assert(!coord_2d_eq(&a, &b)); a.x = 3.33; a.y = 9.99; b.x = 2.33; b.y = 9.99; ck_assert(!coord_2d_eq(&a, &b)); a.x = 1.11; a.y = 2.22; b.x = 7.77; b.y = 8.88; ck_assert(!coord_2d_eq(&a, &b)); }