Clement COLMERAUER commited on 2024-10-04 16:26:03
Showing 3 changed files, with 42 additions and 3 deletions.
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
plugins {
|
| 2 | 2 |
id 'java' |
| 3 | 3 |
id "jacoco" |
| 4 |
- id 'info.solidsoft.pitest' version '1.7.4' |
|
| 4 |
+ id 'info.solidsoft.pitest' version '1.15.0' |
|
| 5 | 5 |
} |
| 6 | 6 |
|
| 7 | 7 |
group = 're.forestier.edu' |
| ... | ... |
@@ -15,7 +15,7 @@ dependencies {
|
| 15 | 15 |
testImplementation platform('org.junit:junit-bom:5.10.0')
|
| 16 | 16 |
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.3.1' |
| 17 | 17 |
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.3.1' |
| 18 |
- testImplementation 'org.pitest:pitest-junit5-plugin:0.12' |
|
| 18 |
+ testImplementation 'org.pitest:pitest-junit5-plugin:1.1.1' |
|
| 19 | 19 |
testImplementation("com.approvaltests:approvaltests:15.6.0")
|
| 20 | 20 |
implementation 'org.hamcrest:hamcrest:2.2' |
| 21 | 21 |
implementation("org.freemarker:freemarker:2.3.30")
|
| ... | ... |
@@ -1,6 +1,6 @@ |
| 1 | 1 |
#Wed Jul 24 15:43:23 CEST 2024 |
| 2 | 2 |
distributionBase=GRADLE_USER_HOME |
| 3 | 3 |
distributionPath=wrapper/dists |
| 4 |
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip |
|
| 4 |
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip |
|
| 5 | 5 |
zipStoreBase=GRADLE_USER_HOME |
| 6 | 6 |
zipStorePath=wrapper/dists |
| ... | ... |
@@ -10,6 +10,7 @@ import static org.junit.jupiter.api.Assertions.fail; |
| 10 | 10 |
import static org.junit.jupiter.api.Assertions.assertThrows; |
| 11 | 11 |
import static org.junit.jupiter.api.Assertions.assertEquals; |
| 12 | 12 |
import static org.junit.jupiter.api.Assertions.assertNotNull; |
| 13 |
+import static org.junit.jupiter.api.Assertions.assertNotEquals; |
|
| 13 | 14 |
import org.junit.jupiter.api.BeforeEach; |
| 14 | 15 |
import org.junit.jupiter.api.AfterEach; |
| 15 | 16 |
|
| ... | ... |
@@ -60,6 +61,8 @@ public class UnitTests {
|
| 60 | 61 |
p.removeMoney(50); |
| 61 | 62 |
assertThat(p.money, is(50)); |
| 62 | 63 |
assertThat(p.money, not(150)); |
| 64 |
+ p.removeMoney(50); |
|
| 65 |
+ assertThat(p.money, is(0)); |
|
| 63 | 66 |
} |
| 64 | 67 |
|
| 65 | 68 |
@Test |
| ... | ... |
@@ -93,6 +96,23 @@ public class UnitTests {
|
| 93 | 96 |
assertThat(p.retrieveLevel(),is(4)); |
| 94 | 97 |
b = UpdatePlayer.addXp(p,100); |
| 95 | 98 |
assertThat(p.retrieveLevel(),is(5)); |
| 99 |
+ |
|
| 100 |
+ p = new player("Florian", "Grognak le barbare", "ADVENTURER", 100, new ArrayList<>());
|
|
| 101 |
+ int tailleinv = p.inventory.size(); |
|
| 102 |
+ b = UpdatePlayer.addXp(p,10); |
|
| 103 |
+ int atk = p.abilities.get("ATK");
|
|
| 104 |
+ assertNotEquals(p.inventory.size(),tailleinv); |
|
| 105 |
+ assertThat(p.retrieveLevel(),is(2)); |
|
| 106 |
+ assertThat(b,is(true)); |
|
| 107 |
+ b = UpdatePlayer.addXp(p,17); |
|
| 108 |
+ assertThat(p.retrieveLevel(),is(3)); |
|
| 109 |
+ b = UpdatePlayer.addXp(p,30); |
|
| 110 |
+ assertThat(p.retrieveLevel(),is(4)); |
|
| 111 |
+ b = UpdatePlayer.addXp(p,54); |
|
| 112 |
+ assertThat(p.retrieveLevel(),is(5)); |
|
| 113 |
+ b = UpdatePlayer.addXp(p,1); |
|
| 114 |
+ assertThat(b,is(false)); |
|
| 115 |
+ assertNotEquals(p.abilities.get("ATK"),atk);
|
|
| 96 | 116 |
} |
| 97 | 117 |
|
| 98 | 118 |
@Test |
| ... | ... |
@@ -121,6 +141,12 @@ public class UnitTests {
|
| 121 | 141 |
UpdatePlayer.majFinDeTour(p); |
| 122 | 142 |
assertThat(p.currenthealthpoints,is(2)); |
| 123 | 143 |
|
| 144 |
+ p = new player("Florian", "Grognak le barbare", "DWARF", 100, new ArrayList<>());
|
|
| 145 |
+ p.currenthealthpoints = 5; |
|
| 146 |
+ p.healthpoints = 10; |
|
| 147 |
+ UpdatePlayer.majFinDeTour(p); |
|
| 148 |
+ assertThat(p.currenthealthpoints,is(5)); |
|
| 149 |
+ |
|
| 124 | 150 |
ArrayList<String> inv = new ArrayList<String>(); |
| 125 | 151 |
inv.add("Holy Elixir");
|
| 126 | 152 |
p = new player("Florian", "Grognak le barbare", "DWARF", 100, inv);
|
| ... | ... |
@@ -135,6 +161,13 @@ public class UnitTests {
|
| 135 | 161 |
UpdatePlayer.majFinDeTour(p); |
| 136 | 162 |
assertThat(p.currenthealthpoints,is(2)); |
| 137 | 163 |
|
| 164 |
+ p = new player("Florian", "Grognak le barbare", "ADVENTURER", 100, new ArrayList<>());
|
|
| 165 |
+ p.currenthealthpoints = 1; |
|
| 166 |
+ p.healthpoints = 10; |
|
| 167 |
+ UpdatePlayer.addXp(p,28); |
|
| 168 |
+ UpdatePlayer.majFinDeTour(p); |
|
| 169 |
+ assertThat(p.currenthealthpoints,is(3)); |
|
| 170 |
+ |
|
| 138 | 171 |
inv.add("Magic Bow");
|
| 139 | 172 |
p = new player("Florian", "Grognak le barbare", "ARCHER", 100, inv);
|
| 140 | 173 |
p.currenthealthpoints = 1; |
| ... | ... |
@@ -146,6 +179,12 @@ public class UnitTests {
|
| 146 | 179 |
p.healthpoints = 40; |
| 147 | 180 |
UpdatePlayer.majFinDeTour(p); |
| 148 | 181 |
assertThat(p.currenthealthpoints,is(17 + 17/8-1)); |
| 182 |
+ |
|
| 183 |
+ p = new player("Florian", "Grognak le barbare", "ADVENTURER", 100, new ArrayList<>());
|
|
| 184 |
+ p.currenthealthpoints = 20; |
|
| 185 |
+ p.healthpoints = 40; |
|
| 186 |
+ UpdatePlayer.majFinDeTour(p); |
|
| 187 |
+ assertEquals(p.currenthealthpoints,20); |
|
| 149 | 188 |
} |
| 150 | 189 |
|
| 151 | 190 |
@Test |
| 152 | 191 |