mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-18 15:21:50 -08:00
More bugfixes
This commit is contained in:
parent
7fb72bf0e2
commit
d74887eaa1
17 changed files with 81 additions and 62 deletions
|
|
@ -241,37 +241,32 @@ public class ApplicationTests{
|
|||
@Test
|
||||
void zoneEmptyWaves(){
|
||||
for(Zone zone : content.zones()){
|
||||
checkNoEmptyWaves(zone, zone.rules.get().spawns, 1, 100);
|
||||
Array<SpawnGroup> spawns = zone.rules.get().spawns;
|
||||
for(int i = 1; i <= 100; i++){
|
||||
int total = 0;
|
||||
for(SpawnGroup spawn : spawns){
|
||||
total += spawn.getUnitsSpawned(i);
|
||||
}
|
||||
|
||||
assertNotEquals(0, total, "Zone " + zone + " has no spawned enemies at wave " + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void zoneOverflowWaves(){
|
||||
for(Zone zone : content.zones()){
|
||||
checkExtraWaves(zone, zone.rules.get().spawns, 1, 40, 140);
|
||||
}
|
||||
}
|
||||
Array<SpawnGroup> spawns = zone.rules.get().spawns;
|
||||
|
||||
void checkNoEmptyWaves(Zone zone, Array<SpawnGroup> spawns, int from, int to){
|
||||
for(int i = from; i <= to; i++){
|
||||
int total = 0;
|
||||
for(SpawnGroup spawn : spawns){
|
||||
total += spawn.getUnitsSpawned(i);
|
||||
}
|
||||
for(int i = 1; i <= 40; i++){
|
||||
int total = 0;
|
||||
for(SpawnGroup spawn : spawns){
|
||||
total += spawn.getUnitsSpawned(i);
|
||||
}
|
||||
|
||||
assertNotEquals(0, total, "Zone " + zone + " has no spawned enemies at wave " + i);
|
||||
}
|
||||
}
|
||||
|
||||
void checkExtraWaves(Zone zone, Array<SpawnGroup> spawns, int from, int to, int max){
|
||||
for(int i = from; i <= to; i++){
|
||||
int total = 0;
|
||||
for(SpawnGroup spawn : spawns){
|
||||
total += spawn.getUnitsSpawned(i);
|
||||
}
|
||||
|
||||
if(total >= max){
|
||||
fail("Zone '" + zone + "' has too many spawned enemies at wave " + i + " : " + total);
|
||||
if(total >= 140){
|
||||
fail("Zone '" + zone + "' has too many spawned enemies at wave " + i + " : " + total);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue