Testfall Nr 2

This commit is contained in:
Oli040404 2025-02-12 10:11:23 +01:00
parent 1ec5b98cb7
commit a3e3a3bc21
2 changed files with 10 additions and 2 deletions

View File

@ -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;
}
}

View File

@ -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));
}