1
0
Fork 0

we have a Mars Rover with the Mars map and an starting point

This commit is contained in:
Xavier Fontanet 2024-06-20 14:46:28 +02:00
parent a8c70f42b1
commit d5388d1e3c
2 changed files with 27 additions and 4 deletions

View File

@ -0,0 +1,13 @@
package cat.hack3.codingtests.marsrover;
public class MarsRover {
private final MarsMap marsMap;
private final int latitudeStartingPoint;
private final int longitudeStartingPoint;
public MarsRover(MarsMap marsMap, int latitudeStartingPoint, int longitudeStartingPoint) {
this.marsMap = marsMap;
this.latitudeStartingPoint = latitudeStartingPoint;
this.longitudeStartingPoint = longitudeStartingPoint;
}
}

View File

@ -1,13 +1,23 @@
package cat.hack3.codingtests.marsrover; package cat.hack3.codingtests.marsrover;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test; import org.testng.annotations.Test;
public class MarsRoverTest { public class MarsRoverTest {
public static final int MAP_WIDTH = 10;
public static final int MAP_HEIGHT = 10;
private MarsMap marsMap;
@BeforeMethod
public void setUp() {
marsMap = new MarsMap(MAP_WIDTH, MAP_HEIGHT);
}
@Test @Test
public void havingTwoDimensionalMapOfMars() { public void havingARoverWithStartingPoint() {
int width = 10; int latitudeStartingPoint = 2;
int height = 10; int longitudeStartingPoint = 3;
new MarsMap(width, height); new MarsRover(marsMap, latitudeStartingPoint, longitudeStartingPoint);
} }
} }