From 9098ea408de728a849e0582c3a55894edcbfb502 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Fri, 8 Jun 2012 16:48:33 +1000 Subject: [PATCH] Add contains vs includes region tests --- test/region.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/region.cpp b/test/region.cpp index fe45cc97..aaf7456f 100644 --- a/test/region.cpp +++ b/test/region.cpp @@ -1,7 +1,9 @@ #include "../region.hpp" +#include "../point.hpp" #include "../debug.hpp" using util::region; +using util::point2; int main (int, char **) { @@ -12,5 +14,16 @@ main (int, char **) { CHECK_HARD (!a.overlaps (b)); } + CHECK_HARD (region (0, 0, 2, 2).includes (point2(1.0, 1.0))); + CHECK_HARD (region (0, 0, 2, 2).includes (point2(0.0, 0.0))); + CHECK_HARD (region (0, 0, 2, 2).includes (point2(2.0, 2.0))); + + CHECK_HARD ( region (0, 0, 2, 2).contains (point2(1.0, 1.0))); + CHECK_HARD (!region (0, 0, 2, 2).contains (point2(0.0, 0.0))); + CHECK_HARD (!region (0, 0, 2, 2).contains (point2(2.0, 2.0))); + + CHECK_HARD (region (0, 0, 10, 10).includes (point2 (0.4, 0.01))); + CHECK_HARD (region (0, 0, 10, 10).contains (point2 (0.4, 0.01))); + return 0; }