Browse Source

test: bishop 1 step right

feat-figureMovement
JD 4 years ago
parent
commit
7d9510ccb9
  1. 5
      fh.fd.ci.client/src/main/java/de/fd/fh/FigureBishop.java
  2. 9
      fh.fd.ci.client/src/test/java/de/fd/fh/FigureBishopTest.java

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

@ -10,6 +10,11 @@ public class FigureBishop extends Figure
return false; return false;
} }
if (dst - src == 1) // 1 Feld nach rechts
{
return false;
}
return super.moveAllowed(src, dst, field); return super.moveAllowed(src, dst, field);
} }
} }

9
fh.fd.ci.client/src/test/java/de/fd/fh/FigureBishopTest.java

@ -17,4 +17,13 @@ class FigureBishopTest
assertFalse(f.moveAllowed(src, dst, assertFalse(f.moveAllowed(src, dst,
new Figure[Figure.fieldLength * Figure.fieldLength])); new Figure[Figure.fieldLength * Figure.fieldLength]));
} }
@Test
void checkInvalidMovesBishopRight()
{
Figure f = new FigureBishop();
assertFalse(f.moveAllowed(45, 46,
new Figure[64]));
}
} }
Loading…
Cancel
Save