Skip to content
Open

Dev #11

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
124 changes: 124 additions & 0 deletions .besouro/20151009120851591/actions.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
FileOpenedAction 1444381731929 Cell.java 68 0 0 0
FileOpenedAction 1444382042814 TestCell.java 200 1 1 0
FileOpenedAction 1444382044824 TestGrid.java 199 1 1 0
RefactoringAction 1444382154363 TestCell.java RENAME test()=>void testLiveCell() METHOD
RefactoringAction 1444382159384 TestCell.java RENAME testLiveCell()=>void testLiveCellWithNoNei() METHOD
RefactoringAction 1444382161903 TestCell.java RENAME testLiveCellWithNoNei()=>void testLiveCellWithNoNeighbors() METHOD
RefactoringAction 1444382163920 TestCell.java RENAME testLiveCellWithNoNeighbors()=>void testLiveCellWithNoNeighborsS() METHOD
RefactoringAction 1444382166938 TestCell.java RENAME testLiveCellWithNoNeighborsS()=>void testLiveCellWithNoNeighborsShouldDie() METHOD
RefactoringAction 1444382343810 TestCell.java ADD import org.unioulu.tol.sqatlab.gameoflife.Cell IMPORT
RefactoringAction 1444382375514 Cell.java ADD Cell() METHOD
RefactoringAction 1444382400658 Cell.java ADD void nextIteration() METHOD
RefactoringAction 1444382407831 Cell.java ADD Object getState() METHOD
RefactoringAction 1444382454762 Cell.java ADD Cell(String) METHOD
RefactoringAction 1444382499474 Cell.java ADD String state FIELD
RefactoringAction 1444382527942 TestCell.java ADD void testLiveCellWithNoNeighborsShouldDie()/2 METHOD
RefactoringAction 1444382667364 TestCell.java RENAME testLiveCellWithNoNeighborsShouldDie()/2=>void testLiveCellTwoNeigh() METHOD
RefactoringAction 1444382669382 TestCell.java RENAME testLiveCellTwoNeigh()=>void testLiveCellTwoNeighbors() METHOD
RefactoringAction 1444382672400 TestCell.java RENAME testLiveCellTwoNeighbors()=>void testLiveCellTwoNeighborsShouldLive() METHOD
EditAction 1444382684458 Cell.java 317 4 2 0
EditAction 1444382687826 TestCell.java 633 2 8 2
RefactoringAction 1444382796684 Cell.java RENAME nextIteration()=>void nextIteration(int) METHOD
RefactoringAction 1444382802057 Cell.java RENAME nextIteration(int)=>void nextIteration() METHOD
RefactoringAction 1444382804068 Cell.java RENAME nextIteration()=>void nextIteration(int) METHOD
EditAction 1444382964926 TestCell.java 637 2 7 2
EditAction 1444383059188 TestCell.java 640 2 6 2
UnitTestCaseAction 1444383064879 TestCell.java OK
UnitTestSessionAction 1444383064882 TestCell OK
UnitTestCaseAction 1444383083295 TestCell.java OK
UnitTestSessionAction 1444383083296 TestCell OK
RefactoringAction 1444383214260 TestGrid.java ADD import org.unioulu.tol.sqatlab.gameoflife.Cell IMPORT
RefactoringAction 1444383223076 TestGrid.java ADD import org.unioulu.tol.sqatlab.gameoflife.Grid IMPORT
RefactoringAction 1444383396542 Cell.java ADD Cell(int, int) METHOD
RefactoringAction 1444383415717 Cell.java ADD int x FIELD
RefactoringAction 1444383415718 Cell.java ADD int y FIELD
FileOpenedAction 1444383466155 Grid.java 68 0 0 0
RefactoringAction 1444383500167 Grid.java ADD Grid() METHOD
RefactoringAction 1444383512726 TestGrid.java RENAME test()=>void testSi() METHOD
RefactoringAction 1444383517240 TestGrid.java RENAME testSi()=>void testSingleCellOn() METHOD
RefactoringAction 1444383522755 TestGrid.java RENAME testSingleCellOn()=>void testSingleCellOnGridHasNoNeighbors() METHOD
RefactoringAction 1444383531536 Grid.java ADD int getNeighbors(Cell) METHOD
RefactoringAction 1444383585118 Grid.java ADD void addCell(Cell) METHOD
RefactoringAction 1444383716046 TestGrid.java ADD void testSingleCellOnGridHasNoNeighbors()/2 METHOD
RefactoringAction 1444383724063 TestGrid.java RENAME testSingleCellOnGridHasNoNeighbors()/2=>void testTwo() METHOD
RefactoringAction 1444383726080 TestGrid.java RENAME testTwo()=>void testTwoNeigh() METHOD
RefactoringAction 1444383727596 TestGrid.java RENAME testTwoNeigh()=>void testTwoNeighbors() METHOD
RefactoringAction 1444383796196 TestGrid.java RENAME testTwoNeighbors()=>void testTwoNeighborsC() METHOD
RefactoringAction 1444383797713 TestGrid.java RENAME testTwoNeighborsC()=>void testTwoNeighborsCells() METHOD
RefactoringAction 1444383800230 TestGrid.java RENAME testTwoNeighborsCells()=>void testTwoNeighborsCellsS() METHOD
RefactoringAction 1444383802245 TestGrid.java RENAME testTwoNeighborsCellsS()=>void testTwoNeighborsCellsShould() METHOD
RefactoringAction 1444383807763 TestGrid.java RENAME testTwoNeighborsCellsShould()=>void testTwoNeighborsCellsShouldHaveOne() METHOD
RefactoringAction 1444383812279 TestGrid.java RENAME testTwoNeighborsCellsShouldHaveOne()=>void testTwoNeighborsCellsShouldHaveOneNeighbor() METHOD
EditAction 1444383843268 TestGrid.java 760 2 12 2
EditAction 1444383846261 Grid.java 197 3 1 0
EditAction 1444384408011 Grid.java 197 3 1 0
UnitTestCaseAction 1444384476954 TestGrid.java FAIL
UnitTestSessionAction 1444384476956 TestGrid FAIL
RefactoringAction 1444384563939 Grid.java ADD Set<> cells FIELD
RefactoringAction 1444384594660 Grid.java ADD import java.util.HashSet IMPORT
RefactoringAction 1444384598129 Grid.java ADD import java.util.Set IMPORT
RefactoringAction 1444384717061 Cell.java ADD int hashCode() METHOD
RefactoringAction 1444384717062 Cell.java ADD boolean equals(Object) METHOD
RefactoringAction 1444384960243 Cell.java ADD int get FIELD
RefactoringAction 1444384964267 Cell.java RENAME get=>int getX FIELD
RefactoringAction 1444384965791 Cell.java RENAME getX=>int getX() METHOD
RefactoringAction 1444384993491 Cell.java ADD int getX()/2 METHOD
RefactoringAction 1444384996016 Cell.java RENAME getX()/2=>int getY() METHOD
EditAction 1444385041968 Grid.java 353 3 3 0
EditAction 1444385134911 Grid.java 362 3 3 0
RefactoringAction 1444385505863 Grid.java RENAME getNeighbors(Cell)=>int getNumOfNeighbors(Cell) METHOD
EditAction 1444385647505 TestGrid.java 770 2 12 2
UnitTestCaseAction 1444385654688 TestGrid.java FAIL
UnitTestSessionAction 1444385654692 TestGrid FAIL
RefactoringAction 1444385844489 Grid.java ADD int dx FIELD
RefactoringAction 1444386253884 Grid.java REMOVE dx FIELD
CompilationAction 1444386305467 Grid.java
CompilationAction 1444386317135 Grid.java
UnitTestCaseAction 1444386318135 TestGrid.java OK
UnitTestSessionAction 1444386318136 TestGrid OK
FileOpenedAction 1444386759799 Cell.java 1232 9 21 0
RefactoringAction 1444386904582 TestCell.java ADD void testLiveCellTwoNeighborsShouldLive()/2 METHOD
RefactoringAction 1444386909599 TestCell.java RENAME testLiveCellTwoNeighborsShouldLive()/2=>void testLiveCellThreeNeighborsShouldLive() METHOD
EditAction 1444386923183 TestCell.java 869 3 9 3
UnitTestCaseAction 1444386932080 TestCell.java OK
UnitTestSessionAction 1444386932081 TestCell OK
UnitTestCaseAction 1444387083826 TestCell.java OK
UnitTestSessionAction 1444387083827 TestCell OK
RefactoringAction 1444387101669 TestCell.java ADD void testLiveCellThreeNeighborsShouldLive()/2 METHOD
RefactoringAction 1444387116687 TestCell.java RENAME testLiveCellThreeNeighborsShouldLive()/2=>void testLiveCellMoreThanThreeNeighborsShouldLive() METHOD
RefactoringAction 1444387121204 TestCell.java RENAME testLiveCellMoreThanThreeNeighborsShouldLive()=>void testLiveCellMoreThanThreeNeighborsShouldDie() METHOD
EditAction 1444387164688 TestCell.java 1105 4 12 4
UnitTestCaseAction 1444387167780 TestCell.java FAIL
UnitTestSessionAction 1444387167781 TestCell FAIL
EditAction 1444387174643 TestCell.java 1104 4 12 4
UnitTestCaseAction 1444387177940 TestCell.java OK
UnitTestSessionAction 1444387177940 TestCell OK
RefactoringAction 1444387218351 TestCell.java ADD void testLiveCellMoreThanThreeNeighborsShouldDie()/2 METHOD
RefactoringAction 1444387223370 TestCell.java RENAME testLiveCellMoreThanThreeNeighborsShouldDie()/2=>void testDeadCellMoreThanThreeNeighborsShouldDie() METHOD
RefactoringAction 1444387229388 TestCell.java RENAME testDeadCellMoreThanThreeNeighborsShouldDie()=>void testDeadCellThreeNeighborsShouldDie() METHOD
RefactoringAction 1444387233907 TestCell.java RENAME testDeadCellThreeNeighborsShouldDie()=>void testDeadCellThreeNeighborsShouldLive() METHOD
EditAction 1444387262177 TestCell.java 1204 5 15 5
UnitTestCaseAction 1444387265352 TestCell.java OK
UnitTestSessionAction 1444387265353 TestCell OK
UnitTestCaseAction 1444387373886 TestCell.java OK
UnitTestSessionAction 1444387373887 TestCell OK
EditAction 1444387382070 TestCell.java 1203 5 15 5
UnitTestCaseAction 1444387385187 TestCell.java FAIL
UnitTestSessionAction 1444387385188 TestCell FAIL
EditAction 1444387390465 TestCell.java 1204 5 15 5
UnitTestCaseAction 1444387395305 TestCell.java OK
UnitTestSessionAction 1444387395306 TestCell OK
RefactoringAction 1444387434615 TestCell.java ADD void testLiveCellMoreThanThreeNeighborsShouldDie()/2 METHOD
RefactoringAction 1444387442136 TestCell.java RENAME testLiveCellMoreThanThreeNeighborsShouldDie()/2=>void testLiveCellLessThanThreeNeighborsShouldDie() METHOD
RefactoringAction 1444387447156 TestCell.java RENAME testLiveCellLessThanThreeNeighborsShouldDie()=>void testLiveCellLessThanTNeighborsShouldDie() METHOD
RefactoringAction 1444387449675 TestCell.java RENAME testLiveCellLessThanTNeighborsShouldDie()=>void testLiveCellLessThanTwoNeighborsShouldDie() METHOD
EditAction 1444387476092 TestCell.java 1405 6 18 6
UnitTestCaseAction 1444387479171 TestCell.java OK
UnitTestSessionAction 1444387479172 TestCell OK
EditAction 1444387577706 Cell.java 1383 9 21 0
EditAction 1444387580729 TestCell.java 1406 6 18 6
UnitTestCaseAction 1444387585818 TestCell.java FAIL
UnitTestSessionAction 1444387585819 TestCell FAIL
EditAction 1444387590854 TestCell.java 1405 6 18 6
UnitTestCaseAction 1444387595920 TestCell.java OK
UnitTestSessionAction 1444387595921 TestCell OK
21 changes: 21 additions & 0 deletions .besouro/20151009120851591/besouroEpisodes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
1444383064882 test-first 4 1332 true
1444383064883 test-last 1 1332 false
1444383083296 regression 1 0 true
1444386318136 test-first 3 3103 true
1444386318137 test-first 3 3103 true
1444386318138 test-first 3 3103 true
1444386318139 test-first 3 3103 true
1444386932081 test-addition 1 172 true
1444386932082 test-addition 1 172 true
1444387083827 regression 1 0 true
1444387177940 test-addition 2 76 true
1444387177941 test-addition 1 76 true
1444387177942 test-addition 2 76 true
1444387177943 test-addition 1 76 true
1444387265353 test-addition 1 47 true
1444387265354 test-addition 1 47 true
1444387373887 regression 1 0 true
1444387395306 regression 2 13 true
1444387479172 test-addition 1 44 true
1444387479173 test-addition 1 44 true
1444387595921 refactoring 2A 18 true
Empty file.
11 changes: 11 additions & 0 deletions .besouro/20151009120851591/randomHeuristicEpisodes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
1444383064882 test-first 4 1332 true
1444383083296 regression 1 0 true
1444386318136 test-first 3 3103 true
1444386932081 test-addition 1 172 false
1444387083827 regression 1 0 true
1444387177940 test-addition 2 76 true
1444387265353 test-addition 1 47 true
1444387373887 regression 1 0 false
1444387395306 regression 2 13 true
1444387479172 test-addition 1 44 true
1444387595921 refactoring 2A 18 false
Empty file.
11 changes: 11 additions & 0 deletions .besouro/20151009120851591/zorroEpisodes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
1444383064882 test-first 4 1332 true
1444383083296 regression 1 18 true
1444386318136 test-first 3 3234 true
1444386932081 test-addition 1 613 true
1444387083827 regression 1 151 true
1444387177940 test-addition 2 94 true
1444387265353 test-addition 1 87 true
1444387373887 regression 1 108 true
1444387395306 regression 2 21 true
1444387479172 test-addition 1 83 true
1444387595921 refactoring 2A 116 true
80 changes: 80 additions & 0 deletions src/org/unioulu/tol/sqatlab/gameoflife/Cell.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,84 @@

public class Cell {

String state;
int x;
int y;

public Cell(){

}

public Cell(String initialState) {
this.state = initialState;
}

public Cell(int x, int y) {
this.x = x;
this.y = y;
}


public int getX(){
return x;
}

public int getY(){
return y;
}


public void nextIteration(int numOfLiveCells) {
if (state == "Dead" && numOfLiveCells == 3){
state = "Alive";
}
else if (state == "Alive" && numOfLiveCells < 2){
state = "Dead";
}
else if (state == "Alive" && numOfLiveCells > 3){
state = "Dead";
}
else{
state = "Alive";
}
}



@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((state == null) ? 0 : state.hashCode());
result = prime * result + x;
result = prime * result + y;
return result;
}

@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Cell other = (Cell) obj;
if (state == null) {
if (other.state != null)
return false;
} else if (!state.equals(other.state))
return false;
if (x != other.x)
return false;
if (y != other.y)
return false;
return true;
}

public String getState() {
// TODO Auto-generated method stub
return this.state;
}

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

import java.util.HashSet;
import java.util.Set;

public class Grid {

private Set<Cell> cells = new HashSet<>();

public Grid(){

}

public int getNumOfNeighbors(Cell cell) {
int numNeighbors = 0;
for (int dx=-1; dx<= 1; dx++){
for (int dy=-1; dy<= 1; dy++){
Cell neighbor = new Cell(cell.x + dx, cell.y + dy);
if(cells.contains(neighbor)){
numNeighbors++;
}
}

}

return numNeighbors-1;
}

public void addCell(Cell cell) {

cells.add(cell);

}



}




73 changes: 71 additions & 2 deletions src/org/unioulu/tol/sqatlab/gameoflife/test/TestCell.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,81 @@
import static org.junit.Assert.*;

import org.junit.Test;
import org.unioulu.tol.sqatlab.gameoflife.Cell;

public class TestCell {

@Test
public void test() {
fail("Not yet implemented");
public void testLiveCellWithNoNeighborsShouldDie() {
//arrange
Cell cell= new Cell("Alive");
//
cell.nextIteration(0);

//assert
assertEquals("Dead", cell.getState());
//fail("Not yet implemented");
}

@Test
public void testLiveCellTwoNeighborsShouldLive() {
//arrange
Cell cell= new Cell("Alive");
//
cell.nextIteration(2);

//assert
assertEquals("Alive", cell.getState());

}

@Test
public void testLiveCellThreeNeighborsShouldLive() {
//arrange
Cell cell= new Cell("Alive");
//
cell.nextIteration(3);

//assert
assertEquals("Alive", cell.getState());

}

@Test
public void testLiveCellMoreThanThreeNeighborsShouldDie() {
//arrange
Cell cell= new Cell("Alive");
//
cell.nextIteration(4);

//assert
assertEquals("Dead", cell.getState());

}

@Test
public void testDeadCellThreeNeighborsShouldLive() {
//arrange
Cell cell= new Cell("Dead");
//
cell.nextIteration(3);

//assert
assertEquals("Alive", cell.getState());

}

@Test
public void testLiveCellLessThanTwoNeighborsShouldDie() {
//arrange
Cell cell= new Cell("Alive");
//
cell.nextIteration(1);

//assert
assertEquals("Dead", cell.getState());

}


}
Loading