Finaler Commit 04 (Test 2-4 grün)
Leider habe ich zu spät realisiert, dass nach dem bestehen des ersten Testes die anderen Test auch grün werden nachdem ich sie geschrieben habe. Ich hoffe meine Abgabe passt trotzallem, bei Rückfragen können Sie sich gerne melden.
This commit is contained in:
+26
-1
@@ -22,17 +22,42 @@ public class LifeTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void destroyLonelyCell() {
|
public void destroyLonelyCell() {
|
||||||
|
Life l = new Life();
|
||||||
|
l.setAlive(1,1);
|
||||||
|
|
||||||
|
ILife nextGen = l.nextGeneration();
|
||||||
|
|
||||||
|
assertFalse(nextGen.isAlive(1,1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void keepAliveCell() {
|
public void keepAliveCell() {
|
||||||
|
Life l = new Life();
|
||||||
|
|
||||||
|
l.setAlive(1,1);
|
||||||
|
l.setAlive(1,2);
|
||||||
|
l.setAlive(2,1);
|
||||||
|
|
||||||
|
ILife nextGen = l.nextGeneration();
|
||||||
|
|
||||||
|
assertTrue(nextGen.isAlive(1,1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void destroyCrowdedCell() {
|
public void destroyCrowdedCell() {
|
||||||
|
Life l = new Life();
|
||||||
|
|
||||||
|
l.setAlive(2,1);
|
||||||
|
l.setAlive(1,1);
|
||||||
|
l.setAlive(1,2);
|
||||||
|
l.setAlive(2,2);
|
||||||
|
l.setAlive(3,1);
|
||||||
|
|
||||||
|
ILife nextGen = l.nextGeneration();
|
||||||
|
|
||||||
|
assertFalse(nextGen.isAlive(2,1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user