use of aima.core.util.datastructure.XYLocation in project aima-java by aimacode.
the class XYLocationTest method testEquality.
@Test
public void testEquality() {
XYLocation loc1 = new XYLocation(3, 4);
XYLocation loc2 = new XYLocation(3, 4);
Assert.assertEquals(loc1, loc2);
}
use of aima.core.util.datastructure.XYLocation in project aima-java by aimacode.
the class XYLocationTest method testXYLocationAtributeSettingOnConstruction.
@Test
public void testXYLocationAtributeSettingOnConstruction() {
XYLocation loc = new XYLocation(3, 4);
Assert.assertEquals(3, loc.getXCoOrdinate());
Assert.assertEquals(4, loc.getYCoOrdinate());
}
use of aima.core.util.datastructure.XYLocation in project aima-java by aimacode.
the class EightPuzzleBoardTest method testGetLocation.
@Test
public void testGetLocation() {
Assert.assertEquals(new XYLocation(0, 2), board.getLocationOf(0));
Assert.assertEquals(new XYLocation(1, 1), board.getLocationOf(1));
Assert.assertEquals(new XYLocation(2, 2), board.getLocationOf(2));
Assert.assertEquals(new XYLocation(2, 1), board.getLocationOf(3));
Assert.assertEquals(new XYLocation(0, 1), board.getLocationOf(4));
Assert.assertEquals(new XYLocation(0, 0), board.getLocationOf(5));
Assert.assertEquals(new XYLocation(1, 0), board.getLocationOf(6));
Assert.assertEquals(new XYLocation(2, 0), board.getLocationOf(7));
Assert.assertEquals(new XYLocation(1, 2), board.getLocationOf(8));
}
use of aima.core.util.datastructure.XYLocation in project aima-java by aimacode.
the class EightPuzzleBoardTest method testGetPositions.
@Test
public void testGetPositions() {
List<XYLocation> expected = new ArrayList<XYLocation>();
expected.add(new XYLocation(0, 2));
expected.add(new XYLocation(1, 1));
expected.add(new XYLocation(2, 2));
expected.add(new XYLocation(2, 1));
expected.add(new XYLocation(0, 1));
expected.add(new XYLocation(0, 0));
expected.add(new XYLocation(1, 0));
expected.add(new XYLocation(2, 0));
expected.add(new XYLocation(1, 2));
List<XYLocation> actual = board.getPositions();
Assert.assertEquals(expected, actual);
}
use of aima.core.util.datastructure.XYLocation in project aima-java by aimacode.
the class EightPuzzleBoardTest method testSetBoard.
@Test
public void testSetBoard() {
List<XYLocation> passedIn = new ArrayList<XYLocation>();
passedIn.add(new XYLocation(1, 1));
passedIn.add(new XYLocation(0, 2));
passedIn.add(new XYLocation(2, 2));
passedIn.add(new XYLocation(2, 1));
passedIn.add(new XYLocation(0, 1));
passedIn.add(new XYLocation(0, 0));
passedIn.add(new XYLocation(1, 0));
passedIn.add(new XYLocation(2, 0));
passedIn.add(new XYLocation(1, 2));
board.setBoard(passedIn);
Assert.assertEquals(new XYLocation(1, 1), board.getLocationOf(0));
Assert.assertEquals(new XYLocation(0, 2), board.getLocationOf(1));
}
Aggregations