GameOfLifeAssignment/test/LifeTest.java

45 lines
811 B
Java
Raw Normal View History

2021-12-13 15:21:05 +01:00
import org.junit.Test;
import static org.junit.Assert.*;
public class LifeTest {
@Test
public void createNewCell() {
// Arrange: drei lebende Zellen
Life l = new Life();
l.setAlive(0, 0);
l.setAlive(0, 1);
l.setAlive(0, 2);
// Act: Berechnung der Folgegeneration
ILife nextGen = l.nextGeneration();
// Assert: Rasterpunkt mit drei Nachbarn sollte jetzt leben
assertTrue(nextGen.isAlive(1, 1));
}
@Test
public void destroyLonelyCell() {
2025-02-12 10:05:31 +01:00
Life l = new Life();
l.setAlive(2, 2);
ILife nextGen = l.nextGeneration();
assertFalse(nextGen.isAlive(2, 2));
2021-12-13 15:21:05 +01:00
}
@Test
public void keepAliveCell() {
}
@Test
public void destroyCrowdedCell() {
}
}