region: add some region-region intersects tests
This commit is contained in:
parent
e22f4a9001
commit
6782b821b9
@ -24,6 +24,30 @@ main (int, char **)
|
||||
tap.expect (!a.intersects (b), "simple 2d intersection");
|
||||
}
|
||||
|
||||
{
|
||||
using p_t = cruft::point2i;
|
||||
using e_t = cruft::extent2i;
|
||||
|
||||
struct {
|
||||
cruft::region2i a;
|
||||
cruft::region2i b;
|
||||
bool intersection;
|
||||
char const *message;
|
||||
} const TESTS[] = {
|
||||
{
|
||||
.a = { p_t { 58, 22 }, e_t { 13, 8 } },
|
||||
.b = { p_t { 58, 22 }, e_t { 7, 7 } },
|
||||
.intersection = true,
|
||||
.message = "Coaligned base",
|
||||
},
|
||||
};
|
||||
|
||||
for (auto const &[a, b, res, msg]: TESTS) {
|
||||
tap.expect_eq (a.intersects (b), res, "intersection a-on-b: %!", msg);
|
||||
tap.expect_eq (b.intersects (a), res, "intersection b-on-a: %!", msg);
|
||||
}
|
||||
}
|
||||
|
||||
// check various floating point maximums successfully test for
|
||||
// intersection. the concern is that infinities are incorrectly handled
|
||||
// in some comparisons.
|
||||
|
Loading…
Reference in New Issue
Block a user