Browse Source

refactored correct size of chess field

feat-figureMovement
JD 4 years ago
parent
commit
dfc7b426d4
  1. 4
      fh.fd.ci.client/src/main/java/de/fd/fh/Figure.java
  2. 2
      fh.fd.ci.client/src/test/java/de/fd/fh/FigureTest.java

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

@ -2,9 +2,11 @@ package de.fd.fh;
public class Figure public class Figure
{ {
public static final int fieldSize = 64;
public boolean moveAllowed(int src, int dst, int[] field) public boolean moveAllowed(int src, int dst, int[] field)
{ {
if (field.length == 8*8)
if (field.length == fieldSize)
{ {
return true; return true;
} }

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

@ -24,6 +24,6 @@ class FigureTest
void checkMoveWithInvalidFieldCorrect() // Feldgröße sollte 8*8 betragen void checkMoveWithInvalidFieldCorrect() // Feldgröße sollte 8*8 betragen
{ {
Figure f = new Figure(); Figure f = new Figure();
assertTrue(f.moveAllowed(0,0, new int[8*8]));
assertTrue(f.moveAllowed(0,0, new int[Figure.fieldSize]));
} }
} }
Loading…
Cancel
Save