|
@ -73,17 +73,20 @@ class GameTest |
|
|
Game g = new Game(); |
|
|
Game g = new Game(); |
|
|
g.initNewGame(); |
|
|
g.initNewGame(); |
|
|
|
|
|
|
|
|
|
|
|
int src = Game.whiteRowFarmer * Figure.fieldLength + 0; |
|
|
|
|
|
int dst = (Game.whiteRowFarmer - 1) * Figure.fieldLength + 0; |
|
|
|
|
|
|
|
|
// zu bewegende Figur |
|
|
// zu bewegende Figur |
|
|
Figure f = g.mField[Game.whiteRowFarmer * 8 + 0]; |
|
|
|
|
|
|
|
|
Figure f = g.mField[src]; |
|
|
|
|
|
|
|
|
// Ziel sollte leer sein |
|
|
// Ziel sollte leer sein |
|
|
assertNull(g.mField[(Game.whiteRowFarmer - 1) * 8 + 0]); |
|
|
|
|
|
|
|
|
assertNull(g.mField[dst]); |
|
|
|
|
|
|
|
|
// Figur bewegen |
|
|
// Figur bewegen |
|
|
assertTrue(g.moveFigure(Game.whiteRowFarmer * 8 + 0, (Game.whiteRowFarmer - 1) * 8 + 0)); |
|
|
|
|
|
|
|
|
assertTrue(g.moveFigure(src, dst)); |
|
|
|
|
|
|
|
|
// Figur sollte nun verschoben sein |
|
|
// Figur sollte nun verschoben sein |
|
|
assertNull(g.mField[Game.whiteRowFarmer * 8 + 0]); |
|
|
|
|
|
assertSame(f, g.mField[(Game.whiteRowFarmer - 1) * 8 + 0]); |
|
|
|
|
|
|
|
|
assertNull(g.mField[src]); |
|
|
|
|
|
assertSame(f, g.mField[dst]); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |