From 058f97a42e5022f5b138cca6d62ce085da0769b3 Mon Sep 17 00:00:00 2001 From: Rasmus Anthin Date: Tue, 24 Sep 2024 13:40:49 +0200 Subject: [PATCH] Rectangle_tests.h: * Adding more is_inside_offs() unit tests (for overloads with more than one offset arg). --- Tests/Rectangle_tests.h | 56 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/Tests/Rectangle_tests.h b/Tests/Rectangle_tests.h index a7618a9..c5ba0af 100644 --- a/Tests/Rectangle_tests.h +++ b/Tests/Rectangle_tests.h @@ -72,6 +72,62 @@ namespace ttl assert(rec.is_inside_offs(pt2, +2)); assert(rec.is_inside_offs(pt3, +2)); assert(rec.is_inside_offs(pt4, +2)); + + assert(rec.is_inside_offs(pt0, +1, +2)); + assert(!rec.is_inside_offs(pt1, +1, +2)); + assert(rec.is_inside_offs(pt2, +1, +2)); + assert(rec.is_inside_offs(pt3, +1, +2)); + assert(rec.is_inside_offs(pt4, +1, +2)); + + assert(rec.is_inside_offs(pt0, +1, +2, 0, +1)); + assert(!rec.is_inside_offs(pt0, +1, +2, +1, 0)); + assert(!rec.is_inside_offs(pt0, +2, 0, 0, +1)); + assert(rec.is_inside_offs(pt0, 0, +1, +1, +1)); + assert(!rec.is_inside_offs(pt0, 0, +1, -1, +1)); + assert(!rec.is_inside_offs(pt0, -1, +1, -1, +1)); + assert(!rec.is_inside_offs(pt0, +1, -1, +1, -1)); + assert(rec.is_inside_offs(pt0, +1, +1, +1, +1)); + assert(rec.is_inside_offs(pt0, +2, +2, +2, +2)); + + assert(rec.is_inside_offs(pt1, +1, +2, 0, +1)); + assert(!rec.is_inside_offs(pt1, +1, +2, +1, 0)); + assert(!rec.is_inside_offs(pt1, +2, 0, 0, +1)); + assert(!rec.is_inside_offs(pt1, 0, +1, +1, +1)); + assert(!rec.is_inside_offs(pt1, 0, +1, -1, +1)); + assert(!rec.is_inside_offs(pt1, -1, +1, -1, +1)); + assert(!rec.is_inside_offs(pt1, +1, -1, +1, -1)); + assert(!rec.is_inside_offs(pt1, +1, +1, +1, +1)); + assert(rec.is_inside_offs(pt1, +2, +2, +2, +2)); + + assert(!rec.is_inside_offs(pt2, +1, +2, 0, +1)); + assert(!rec.is_inside_offs(pt2, +1, +2, +1, 0)); + assert(!rec.is_inside_offs(pt2, +2, 0, 0, +1)); + assert(!rec.is_inside_offs(pt2, 0, +1, +1, +1)); + assert(!rec.is_inside_offs(pt2, 0, +1, -1, +1)); + assert(!rec.is_inside_offs(pt2, -1, +1, -1, +1)); + assert(!rec.is_inside_offs(pt2, +1, -1, +1, -1)); + assert(!rec.is_inside_offs(pt2, +1, +1, +1, +1)); + assert(rec.is_inside_offs(pt2, +2, +2, +2, +2)); + + assert(rec.is_inside_offs(pt3, +1, +2, 0, +1)); + assert(!rec.is_inside_offs(pt3, +1, +2, +1, 0)); + assert(rec.is_inside_offs(pt3, +2, 0, 0, +1)); + assert(!rec.is_inside_offs(pt3, 0, +1, +1, +1)); + assert(!rec.is_inside_offs(pt3, 0, +1, -1, +1)); + assert(!rec.is_inside_offs(pt3, -1, +1, -1, +1)); + assert(!rec.is_inside_offs(pt3, +1, -1, +1, -1)); + assert(rec.is_inside_offs(pt3, +1, +1, +1, +1)); + assert(rec.is_inside_offs(pt3, +2, +2, +2, +2)); + + assert(!rec.is_inside_offs(pt4, +1, +2, 0, +1)); + assert(rec.is_inside_offs(pt4, +1, +2, +1, 0)); + assert(!rec.is_inside_offs(pt4, +2, 0, 0, +1)); + assert(rec.is_inside_offs(pt4, 0, +1, +1, +1)); + assert(!rec.is_inside_offs(pt4, 0, +1, -1, +1)); + assert(!rec.is_inside_offs(pt4, -1, +1, -1, +1)); + assert(!rec.is_inside_offs(pt4, +1, -1, +1, -1)); + assert(rec.is_inside_offs(pt4, +1, +1, +1, +1)); + assert(rec.is_inside_offs(pt4, +2, +2, +2, +2)); } }