Skip to content

Commit

Permalink
Rectangle_tests.h:
Browse files Browse the repository at this point in the history
* Adding more is_inside_offs() unit tests (for overloads with more than one offset arg).
  • Loading branch information
razterizer committed Sep 24, 2024
1 parent 8fbc661 commit 058f97a
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions Tests/Rectangle_tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}

Expand Down

0 comments on commit 058f97a

Please sign in to comment.