Testfall Nr 2
This commit is contained in:
parent
1ec5b98cb7
commit
a3e3a3bc21
@ -48,7 +48,6 @@ public class Life implements ILife {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ILife nextGeneration() {
|
|
||||||
public ILife nextGeneration() {
|
public ILife nextGeneration() {
|
||||||
Life newLife = new Life();
|
Life newLife = new Life();
|
||||||
|
|
||||||
@ -82,4 +81,3 @@ public class Life implements ILife {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
|
@ -33,7 +33,17 @@ public class LifeTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void keepAliveCell() {
|
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