public void RectangleOverlapSize2() { for (var x = -2; x < 4; x++) { for (var y = -2; y < 4; y++) { var result = World.RectanglesOverlap(new Int2(), new Int2(3, 3), new Int2(x, y), new Int2(2, 2)); var expected = !(x < -1 || x > 2 || y < -1 || y > 2); Assert.AreEqual(expected, result); } } }
public void RectanglesOverlapSizeZeroInvariant() { var r = new Random(223123); for (var i = 0; i < 500; i++) { var topLeft = RandomInt2(r, new Int2(-10, -10), new Int2(10, 10)); var size = RandomInt2(r, new Int2(0, 0), new Int2(10, 10)); var point = RandomInt2(r, new Int2(-10, -10), new Int2(10, 10)); var result = World.RectanglesOverlap(topLeft, size, point, new Int2()); var expected = World.PointInRectangle(topLeft, size, point); Assert.AreEqual(expected, result); } }
public void RectanglesOverlapBugTest() { Assert.IsFalse(World.RectanglesOverlap(new Int2(20, 51), new Int2(1, 1), new Int2(21, 50), new Int2(3, 3))); }