Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
226 changes: 226 additions & 0 deletions .besouro/20151008114615215/actions.txt

Large diffs are not rendered by default.

1,909 changes: 1,909 additions & 0 deletions .besouro/20151008114615215/besouroEpisodes.txt

Large diffs are not rendered by default.

Empty file.
3 changes: 3 additions & 0 deletions .besouro/20151008114615215/randomHeuristicEpisodes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
1444299473927 test-first 1 5498 true
1444299985877 refactoring 3 414 false
1444300676571 production 3 647 false
Empty file.
3 changes: 3 additions & 0 deletions .besouro/20151008114615215/zorroEpisodes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
1444299473927 test-first 1 5498 true
1444299985877 refactoring 3 511 true
1444300676571 production 3 690 false
57 changes: 56 additions & 1 deletion src/org/unioulu/tol/sqatlab/gameoflife/Cell.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,60 @@
package org.unioulu.tol.sqatlab.gameoflife;

public class Cell {

public boolean status;
public int neighbours;
public int col;
public int row;

public Cell (int col, int row, int neighbours, boolean status) {



}

public void update(int neighbours) {
if (neighbours < 2) {
setStatus(false);
}
else if (neighbours == 2 || neighbours == 3) {
setStatus(true);
}
else setStatus(false);


}

public void setStatus(boolean status) {
this.status = status;
}

public void setNeighbours(int neighbours) {
this.neighbours = neighbours;

}

public boolean isStatus() {
return status;
}

public int getCol() {
return col;
}

public void setCol(int col) {
this.col = col;
}

public int getRow() {
return row;
}

public void setRow(int row) {
this.row = row;
}


}


}
28 changes: 28 additions & 0 deletions src/org/unioulu/tol/sqatlab/gameoflife/Grid.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
package org.unioulu.tol.sqatlab.gameoflife;

public class Grid {

int size;
Cell [][] grid;
int columns;
int rows;

public Grid(int size) {
columns = size;
rows = size;

}

public int getSize() {
return size;
}

public void setSize(int size) {
this.size = size;
}

public Cell[][] getGrid() {
return grid;
}

public void setGrid(Cell[][] grid) {
this.grid = grid;
}


}
46 changes: 43 additions & 3 deletions src/org/unioulu/tol/sqatlab/gameoflife/test/TestCell.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,54 @@
package org.unioulu.tol.sqatlab.gameoflife.test;

import static org.junit.Assert.*;

import static org.junit.Assert.*;
import org.unioulu.tol.sqatlab.gameoflife.*;
import org.junit.Before;
import org.junit.Test;

public class TestCell {

private Cell testCell;

@Before
public void setup() {
testCell = new Cell(0, 0, 0, false);

}


@Test
public void test() {
fail("Not yet implemented");
public void TestCellWithNoNeighboursDies() {
testCell.update(0);
assertEquals(false, testCell.isStatus());
}

@Test
public void TestCellWithLessThanTwoNeighboursDies() {
testCell.update(1);
assertEquals(false, testCell.isStatus());
}

@Test
public void TestCellWithTwoNeighboursLives() {
testCell.update(2);
assertEquals(true, testCell.isStatus());
}

@Test
public void TestCellWithThreeNeighboursLives() {
testCell.update(3);
assertEquals(true, testCell.isStatus());
}

@Test
public void TestCellWithMoreThanThreeNeighboursDies() {
testCell.update(5);
assertEquals(false, testCell.isStatus());
}





}
11 changes: 11 additions & 0 deletions src/org/unioulu/tol/sqatlab/gameoflife/test/TestGrid.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
package org.unioulu.tol.sqatlab.gameoflife.test;

import static org.junit.Assert.*;
import org.unioulu.tol.sqatlab.gameoflife.*;
import org.junit.Before;
import org.junit.Test;

public class TestGrid {

private Grid testGrid;


@Test
public void test() {
fail("Not yet implemented");
}

@Test
public void TestGridIsCreated() {
testGrid = new Grid(20);

}

}