Testfall Nr 2
This commit is contained in:
parent
1ec5b98cb7
commit
a3e3a3bc21
@ -49,7 +49,6 @@ public class Life implements ILife {
|
||||
|
||||
@Override
|
||||
public ILife nextGeneration() {
|
||||
public ILife nextGeneration() {
|
||||
Life newLife = new Life();
|
||||
|
||||
// Prüfe alle Zellen im aktuellen Spielfeld
|
||||
@ -82,4 +81,3 @@ public class Life implements ILife {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -33,7 +33,17 @@ public class LifeTest {
|
||||
|
||||
@Test
|
||||
public void keepAliveCell() {
|
||||
// Arrange: Eine Zelle mit zwei Nachbarn
|
||||
Life l = new Life();
|
||||
l.setAlive(1, 1);
|
||||
l.setAlive(1, 2);
|
||||
l.setAlive(2, 1);
|
||||
|
||||
// Act: Nächste Generation berechnen
|
||||
ILife nextGen = l.nextGeneration();
|
||||
|
||||
// Assert: Die Zelle bleibt am Leben
|
||||
assertTrue(nextGen.isAlive(1, 1));
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user