Skip to content
Snippets Groups Projects
FirefighterBoardTest.java 1.16 KiB
Newer Older
  • Learn to ignore specific revisions
  • LABOUREL Arnaud's avatar
    LABOUREL Arnaud committed
    package model;
    
    LABOUREL Arnaud's avatar
    LABOUREL Arnaud committed
    
    import org.junit.jupiter.api.Test;
    
    LABOUREL Arnaud's avatar
    LABOUREL Arnaud committed
    import util.Position;
    
    LABOUREL Arnaud's avatar
    LABOUREL Arnaud committed
    
    import java.util.List;
    
    import static org.assertj.core.api.Assertions.*;
    
    public class FirefighterBoardTest {
      @Test
      void testColumnCount(){
    
        Board<List<ModelElement>> board = new FirefighterBoard(20, 10, 1, 3, 3, 3);
    
    LABOUREL Arnaud's avatar
    LABOUREL Arnaud committed
        assertThat(board.columnCount()).isEqualTo(20);
      }
      @Test
      void testRowCount(){
    
        Board<List<ModelElement>> board = new FirefighterBoard(20, 10, 1, 3, 3, 3);
    
    LABOUREL Arnaud's avatar
    LABOUREL Arnaud committed
        assertThat(board.rowCount()).isEqualTo(10);
      }
      @Test
      void testStepNumber(){
    
        Board<List<ModelElement>> board = new FirefighterBoard(20, 10, 1, 3, 3, 3);
    
    LABOUREL Arnaud's avatar
    LABOUREL Arnaud committed
        for(int index = 0; index < 10; index++){
          assertThat(board.stepNumber()).isEqualTo(index);
          board.updateToNextGeneration();
        }
        assertThat(board.stepNumber()).isEqualTo(10);
      }
    
    LABOUREL Arnaud's avatar
    LABOUREL Arnaud committed
      @Test
      void testGetState_afterSet(){
    
        Board<List<ModelElement>> board = new FirefighterBoard(20, 10, 0, 0, 0, 0);
    
    LABOUREL Arnaud's avatar
    LABOUREL Arnaud committed
        Position position = new Position(1,2);
        assertThat(board.getState(position)).isEmpty();
        board.setState(List.of(ModelElement.FIRE), position);
        assertThat(board.getState(position)).containsExactly(ModelElement.FIRE);
      }
    
    
    LABOUREL Arnaud's avatar
    LABOUREL Arnaud committed
    }