Browse Source

figure movement: invalid step

feat-figureMovement
Julius Dewender 3 years ago
parent
commit
ef18ef4f98
  1. 5
      fh.fd.ci.client/src/main/java/de/fd/fh/Figure.java
  2. 7
      fh.fd.ci.client/src/test/java/de/fd/fh/FigureTest.java

5
fh.fd.ci.client/src/main/java/de/fd/fh/Figure.java

@ -6,6 +6,11 @@ public class Figure
public boolean moveAllowed(int src, int dst, int[] field)
{
if (src == dst)
{
return false;
}
if (field.length == fieldSize)
{
return true;

7
fh.fd.ci.client/src/test/java/de/fd/fh/FigureTest.java

@ -26,4 +26,11 @@ class FigureTest
Figure f = new Figure();
assertTrue(f.moveAllowed(48,40, new int[Figure.fieldSize]));
}
@Test
void checkMoveWithoutNewDestination()
{
Figure f = new Figure();
assertFalse(f.moveAllowed(48,48, new int[Figure.fieldSize]));
}
}
Loading…
Cancel
Save