Fixed incorrect method call.

Added tests to make sure that this doesn't happen.
This commit is contained in:
Harrison Deng 2020-04-27 13:21:04 -05:00
parent 6ac686b86c
commit 39381f07f9
2 changed files with 3 additions and 1 deletions

View File

@ -67,6 +67,6 @@ public class Utilities {
} }
public static Point2 worldToLocalChunkCoordinates(Point2 worldCoordinates) { public static Point2 worldToLocalChunkCoordinates(Point2 worldCoordinates) {
return worldToChunkCoordinates(worldCoordinates.x, worldCoordinates.y); return worldToLocalChunkCoordinates(worldCoordinates.x, worldCoordinates.y);
} }
} }

View File

@ -74,10 +74,12 @@ public class UtilitiesTest {
@Test @Test
public void testWorldToLocalCoordinatesNegative() { public void testWorldToLocalCoordinatesNegative() {
assertEquals(new Point2(2, 5), Utilities.worldToLocalChunkCoordinates(-62, -27)); assertEquals(new Point2(2, 5), Utilities.worldToLocalChunkCoordinates(-62, -27));
assertEquals(new Point2(2, 5), Utilities.worldToLocalChunkCoordinates(new Point2(-62, -27)));
} }
@Test @Test
public void testWorldToLocalCoordinatesPositive() { public void testWorldToLocalCoordinatesPositive() {
assertEquals(new Point2(7, 3), Utilities.worldToLocalChunkCoordinates(39, 83)); assertEquals(new Point2(7, 3), Utilities.worldToLocalChunkCoordinates(39, 83));
assertEquals(new Point2(7, 3), Utilities.worldToLocalChunkCoordinates(new Point2(39, 83)));
} }
} }