Commit 680b05f6 authored by Farah Matta's avatar Farah Matta

Rapport

parent 18461347
......@@ -44,6 +44,10 @@ public class Board {
* An iterator pointing towards the current pawn that must play.
*/
private Pawn currentPawn;
//Correction: Ajout de la 2ème cas bonus
//private int xBonusSquare2;
//private int yBonusSquare2;
public int getXSize() {
return xSize;
......@@ -70,12 +74,15 @@ public class Board {
* @param sizeX The number of squares on the x axis.
* @param sizeY The number of squares on the y axis.
*/
public Board(int numberOfPawns, int sizeX, int sizeY, int xBonus, int yBonus) {
public Board(int numberOfPawns, int sizeX, int sizeY, int xBonus, int yBonus/*, int xBonus2, int yBonus2*/) {
Random random = new Random();
this.xSize = sizeX;
this.ySize = sizeY;
this.xBonusSquare = xBonus;
this.yBonusSquare = yBonus;
//Correction: Ajout de la 2ème cas bonus
//this.xBonusSquare2 = xBonus2;
//this.yBonusSquare2 = yBonus2;
this.pawns = new ArrayList<Pawn>();
for (int i = 1; i <= numberOfPawns; i++) {
//Correction: getCharForNumber(i) au lieu de getCharForNumber(i+1) pour avoir le Pawn A
......@@ -128,8 +135,9 @@ public class Board {
* @param y The y axis value.
* @return True if the square is bonus, false otherwise.
*/
//Correction: Ajout de la 2ème cas bonus
public boolean isBonusSquare(int x, int y) {
return x == xBonusSquare && y == yBonusSquare;
return (x == xBonusSquare && y == yBonusSquare) /*|| (x == xBonusSquare2 && y == yBonusSquare2)*/ ;
}
/**
......@@ -218,6 +226,7 @@ public class Board {
//Correction: faire les parcours de 1 au size et non pas de 0 à size-1 pour correspondre au squareContent
for (int y = ySize; y > 0; y--) {
for (int x = 1; x <= xSize; x++) {
//Trace le contenu du Board selon le contenu des cases
result += squareContentSprite(x, y);
if (x == xSize) {
result += '|';
......
......@@ -19,15 +19,11 @@ public class Game {
* Constructs a Game with 2 pawns on a 4x4 board.
*/
public Game() {
board = new Board(2,4,4, new Random().nextInt(4), new Random().nextInt(4));
board = new Board(2,4,4, new Random().nextInt(4), new Random().nextInt(4)/*,new Random().nextInt(4), new Random().nextInt(4)*/);
}
/**
* Ajout:
* Getter du board créé par le Game
* @return board
* @author Farah Matta
*/
//Ajout:Getter du board créé par le Game
public Board getBoard() {
return board;
}
......
......@@ -52,12 +52,8 @@ public class Pawn {
return gold;
}
/**
* Ajout:
* Getter du nombre de hitpoints
* @return entier: nombre de hitpoints
* @author Farah Matta
*/
//Ajout: Getter du nombre de hitpoints
public int getHitpoints() {
return hitpoints;
}
......@@ -124,11 +120,14 @@ public class Pawn {
&& newx <= board.getXSize()
&& newy > 0
&& newx > 0) {
//On regarde si la case où le pion veut avancer est vide ou non
Pawn content = board.getSquareContent(newx,newy);
if (content == null) {
// si elle est vide le pion avance
if (content == null) {
x = newx;
y = newy;
}
//si elle n'est pas vide le pion attaque
else {
message = this.attack(content);
}
......
......@@ -18,7 +18,7 @@ public class StringColoring {
/**
* Supported colors.
*/
//Correction: Ajout du Default pour pouvoir allez dans le cas par défaut
//Ajout: Default pour pouvoir allez dans le cas par défaut
public enum Color {
BLACK, RED, GREEN, YELLOW, BLUE, PURPLE, CYAN, WHITE, DEFAULT
}
......@@ -56,7 +56,7 @@ public class StringColoring {
//Correction le cas BLACK prend la couleur blue
case BLACK:
outString = ANSI_BLACK;
//outString = ANSI_BLUE;
//outString = ANSI_BLUE; (ancienne ligne)
break;
case YELLOW:
outString = ANSI_YELLOW;
......
......@@ -23,7 +23,7 @@ public class BoardTest {
private Board board2 = new Board(1,5,5,4,1);
private Pawn p1 = new Pawn('A',2,3,board);
private Pawn p2 = new Pawn('B',4,1,board);
//private Pawn p3 = new Pawn('C',3,4,board);
@Test //Fonctionnel - Spec1
public void getXSizeTest() {
......@@ -111,7 +111,7 @@ public class BoardTest {
assertEquals("A",b1.squareContentSprite(1,2));
}
@Test
@Test //Sttructurel
public void toStringTestBoard() {
Board b = new Board(1,2,2,2,2);
Pawn p4 = new Pawn('A',2,1,b);
......
......@@ -19,23 +19,6 @@ public class GameTest {
private Pawn p1 = new Pawn('A',1,1,b);
private Pawn p2 = new Pawn('B',2,1,b);
/*@Test //Fonctionnel - Spec3
public void moveNextPawnTest() throws OutOfBoardException {
b.removeAllPawns();
b.addPawn(p1);
b.addPawn(p2);
System.out.print("AFFICHAGE p1: " +b.isBonusSquare(p1.getX(), p1.getY()));
String m="A attacks!\\n ";
if(b.isBonusSquare(p1.getX(), p1.getY())) {
m+="B loses 2 hitpoints.";
}
else {
m+="B loses 1 hitpoints.";
}
assertEquals(m,game.moveNextPawn(Direction.Right));
}*/
@Test //Fonctionnel - Spec6
......
......@@ -73,7 +73,7 @@ public class PawnTest {
}
@Test //Structurel
@Test //Structurel- Mutation
public void attackTestSizeY() throws OutOfBoardException {
//Board b= new Board(2,4,4,1,2);
board.removeAllPawns();
......@@ -82,7 +82,7 @@ public class PawnTest {
p.move(Direction.Up);
}
@Test //Structurel
@Test //Structurel - Mutation
public void attackTestSizeX() throws OutOfBoardException {
//Board b= new Board(2,4,4,1,2);
board.removeAllPawns();
......@@ -91,7 +91,7 @@ public class PawnTest {
p.move(Direction.Right);
}
@Test //Structurel
@Test //Structurel - Mutation
public void attackTestSizeXLeft() throws OutOfBoardException {
//Board b= new Board(2,4,4,1,2);
board.removeAllPawns();
......@@ -100,7 +100,7 @@ public class PawnTest {
p.move(Direction.Left);
}
@Test //Structurel
@Test //Structurel - Mutation
public void attackTestSizeYNeg() throws OutOfBoardException {
board.removeAllPawns();
Pawn p = new Pawn('A',1,1,board);
......@@ -114,7 +114,7 @@ public class PawnTest {
}
}
@Test //Structurel
@Test //Structurel - Mutation
public void attackTestSizeXNeg() throws OutOfBoardException {
board.removeAllPawns();
Pawn p = new Pawn('A',1,1,board);
......@@ -128,7 +128,7 @@ public class PawnTest {
}
}
@Test //Structurel
@Test //Structurel - Mutation
public void attackTestSizeXY() throws OutOfBoardException {
board.removeAllPawns();
Pawn p = new Pawn('A',5,5,board);
......@@ -157,15 +157,7 @@ public class PawnTest {
}
/*@Test //Fonctionnel - Spec3
public void moveTest2() throws OutOfBoardException {
board.removeAllPawns();
Pawn p = new Pawn('A',0,0,board);
board.addPawn(p);
p.move(Direction.Up);
//assertEquals("This square does not exist: 5,6",p.move(Direction.Up));
}*/
......
No preview for this file type
artifactId=simpleGame
groupId=fr.univ-nantes
version=1
......@@ -32,8 +32,8 @@ simpleGame.core
simpleGame.core
simpleGame.util
simpleGame.cli
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/classes = 1592043612000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/test-classes = 1592043613000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/classes = 1592211368000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/test-classes = 1592211369000
/Users/farah/.m2/repository/org/assertj/assertj-core/3.16.0/assertj-core-3.16.0.jar = 1590514699000
/Users/farah/.m2/repository/org/pitest/pitest/1.5.1/pitest-1.5.1.jar = 1590514697000
/Users/farah/.m2/repository/com/google/code/findbugs/findbugs/3.0.1/findbugs-3.0.1.jar = 1590514699000
......@@ -62,24 +62,24 @@ simpleGame.cli
/Users/farah/.m2/repository/junit/junit/4.11/junit-4.11.jar = 1583161185000
/Users/farah/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar = 1583161185000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/src/test/java = 1591866222000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/generated-test-sources/test-annotations = 1592043612000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/constant-values.html = 1592044883000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/member-search-index.zip = 1592044883000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/overview-tree.html = 1592044883000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/index.html = 1592044883000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/package-search-index.js = 1592044883000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/package-search-index.zip = 1592044883000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/overview-frame.html = 1592044883000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/type-search-index.zip = 1592044883000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/allclasses-noframe.html = 1592044883000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/index-all.html = 1592044883000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/deprecated-list.html = 1592044883000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/member-search-index.js = 1592044883000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/script.js = 1592044883000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/stylesheet.css = 1592044625000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/overview-summary.html = 1592044883000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/help-doc.html = 1592044883000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/allclasses-frame.html = 1592044883000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/package-list = 1592044883000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/type-search-index.js = 1592044883000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/search.js = 1592044883000
\ No newline at end of file
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/generated-test-sources/test-annotations = 1592211368000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/constant-values.html = 1592211433000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/member-search-index.zip = 1592211433000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/overview-tree.html = 1592211433000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/index.html = 1592211433000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/package-search-index.js = 1592211433000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/package-search-index.zip = 1592211433000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/overview-frame.html = 1592211433000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/type-search-index.zip = 1592211433000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/allclasses-noframe.html = 1592211433000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/index-all.html = 1592211433000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/deprecated-list.html = 1592211433000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/member-search-index.js = 1592211433000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/script.js = 1592211433000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/stylesheet.css = 1592211433000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/overview-summary.html = 1592211433000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/help-doc.html = 1592211433000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/allclasses-frame.html = 1592211433000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/package-list = 1592211433000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/type-search-index.js = 1592211433000
/Users/farah/Documents/Université/M2Isi/vv/simpleGame/target/site/testapidocs/search.js = 1592211433000
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<h1>Pit Test Coverage Report</h1>
<h3>Project Summary</h3>
<table>
<thead>
<tr>
<th>Number of Classes</th>
<th>Line Coverage</th>
<th>Mutation Coverage</th>
</tr>
</thead>
<tbody>
<tr>
<td>5</td>
<td>86% <div class="coverage_bar"><div class="coverage_complete width-86"></div><div class="coverage_legend">148/172</div></div></td>
<td>84% <div class="coverage_bar"><div class="coverage_complete width-84"></div><div class="coverage_legend">81/96</div></div></td>
</tr>
</tbody>
</table>
<h3>Breakdown by Package</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Number of Classes</th>
<th>Line Coverage</th>
<th>Mutation Coverage</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="./simpleGame.cli/index.html">simpleGame.cli</a></td>
<td>1</td>
<td><div class="coverage_percentage">0% </div><div class="coverage_bar"><div class="coverage_complete width-0"></div><div class="coverage_legend">0/21</div></div></td>
<td><div class="coverage_percentage">0% </div><div class="coverage_bar"><div class="coverage_complete width-0"></div><div class="coverage_legend">0/12</div></div></td>
</tr>
<tr>
<td><a href="./simpleGame.core/index.html">simpleGame.core</a></td>
<td>3</td>
<td><div class="coverage_percentage">98% </div><div class="coverage_bar"><div class="coverage_complete width-98"></div><div class="coverage_legend">126/128</div></div></td>
<td><div class="coverage_percentage">96% </div><div class="coverage_bar"><div class="coverage_complete width-96"></div><div class="coverage_legend">79/82</div></div></td>
</tr>
<tr>
<td><a href="./simpleGame.util/index.html">simpleGame.util</a></td>
<td>1</td>
<td><div class="coverage_percentage">96% </div><div class="coverage_bar"><div class="coverage_complete width-96"></div><div class="coverage_legend">22/23</div></div></td>
<td><div class="coverage_percentage">100% </div><div class="coverage_bar"><div class="coverage_complete width-100"></div><div class="coverage_legend">2/2</div></div></td>
</tr>
</tbody>
</table>
<br/>
<hr/>
Report generated by <a href='http://pitest.org'>PIT</a> 1.5.1
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="../style.css">
</head>
<body>
<h1>Pit Test Coverage Report</h1>
<h2>Package Summary</h2>
<h3>simpleGame.core</h3>
<table>
<thead>
<tr>
<th>Number of Classes</th>
<th>Line Coverage</th>
<th>Mutation Coverage</th>
</tr>
</thead>
<tbody>
<tr>
<td>3</td>
<td>98% <div class="coverage_bar"><div class="coverage_complete width-98"></div><div class="coverage_legend">126/128</div></div></td>
<td>96% <div class="coverage_bar"><div class="coverage_complete width-96"></div><div class="coverage_legend">79/82</div></div></td>
</tr>
</tbody>
</table>
<h3>Breakdown by Class</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Line Coverage</th>
<th>Mutation Coverage</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="./Board.java.html">Board.java</a></td>
<td><div class="coverage_percentage">100% </div><div class="coverage_bar"><div class="coverage_complete width-100"></div><div class="coverage_legend">64/64</div></div></td>
<td><div class="coverage_percentage">95% </div><div class="coverage_bar"><div class="coverage_complete width-95"></div><div class="coverage_legend">41/43</div></div></td>
</tr>
<tr>
<td><a href="./Game.java.html">Game.java</a></td>
<td><div class="coverage_percentage">91% </div><div class="coverage_bar"><div class="coverage_complete width-91"></div><div class="coverage_legend">10/11</div></div></td>
<td><div class="coverage_percentage">88% </div><div class="coverage_bar"><div class="coverage_complete width-88"></div><div class="coverage_legend">7/8</div></div></td>
</tr>
<tr>
<td><a href="./Pawn.java.html">Pawn.java</a></td>
<td><div class="coverage_percentage">98% </div><div class="coverage_bar"><div class="coverage_complete width-98"></div><div class="coverage_legend">52/53</div></div></td>
<td><div class="coverage_percentage">100% </div><div class="coverage_bar"><div class="coverage_complete width-100"></div><div class="coverage_legend">31/31</div></div></td>
</tr>
</tbody>
</table>
<br/>
<hr/>
Report generated by <a href='http://pitest.org'>PIT</a> 1.5.1
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="../style.css">
</head>
<body>
<h1>Pit Test Coverage Report</h1>
<h2>Package Summary</h2>
<h3>simpleGame.cli</h3>
<table>
<thead>
<tr>
<th>Number of Classes</th>
<th>Line Coverage</th>
<th>Mutation Coverage</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>0% <div class="coverage_bar"><div class="coverage_complete width-0"></div><div class="coverage_legend">0/21</div></div></td>
<td>0% <div class="coverage_bar"><div class="coverage_complete width-0"></div><div class="coverage_legend">0/12</div></div></td>
</tr>
</tbody>
</table>
<h3>Breakdown by Class</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Line Coverage</th>
<th>Mutation Coverage</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="./CLIMain.java.html">CLIMain.java</a></td>
<td><div class="coverage_percentage">0% </div><div class="coverage_bar"><div class="coverage_complete width-0"></div><div class="coverage_legend">0/21</div></div></td>
<td><div class="coverage_percentage">0% </div><div class="coverage_bar"><div class="coverage_complete width-0"></div><div class="coverage_legend">0/12</div></div></td>
</tr>
</tbody>
</table>
<br/>
<hr/>
Report generated by <a href='http://pitest.org'>PIT</a> 1.5.1
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="../style.css">
</head>
<body>
<h1>Pit Test Coverage Report</h1>
<h2>Package Summary</h2>
<h3>simpleGame.util</h3>
<table>
<thead>
<tr>
<th>Number of Classes</th>
<th>Line Coverage</th>
<th>Mutation Coverage</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>96% <div class="coverage_bar"><div class="coverage_complete width-96"></div><div class="coverage_legend">22/23</div></div></td>
<td>100% <div class="coverage_bar"><div class="coverage_complete width-100"></div><div class="coverage_legend">2/2</div></div></td>
</tr>
</tbody>
</table>