mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-18 23:32:08 -08:00
Zone wave bugfix / New tests / More "encouragement"
This commit is contained in:
parent
b48110db3b
commit
ee06e620c6
5 changed files with 38 additions and 4 deletions
|
|
@ -178,6 +178,37 @@ public class ApplicationTests{
|
|||
assertTrue(ran[0]);
|
||||
}
|
||||
|
||||
@Test
|
||||
void manyTimers(){
|
||||
int runs = 100000;
|
||||
int[] total = {0};
|
||||
for(int i = 0; i < runs; i++){
|
||||
Time.run(0.999f, () -> total[0]++);
|
||||
}
|
||||
assertEquals(0, total[0]);
|
||||
Time.update();
|
||||
assertEquals(runs, total[0]);
|
||||
}
|
||||
|
||||
@Test
|
||||
void longTimers(){
|
||||
Time.setDeltaProvider(() -> Float.MAX_VALUE);
|
||||
Time.update();
|
||||
int steps = 100;
|
||||
float delay = 100000f;
|
||||
Time.setDeltaProvider(() -> delay / steps + 0.01f);
|
||||
int runs = 100000;
|
||||
int[] total = {0};
|
||||
for(int i = 0; i < runs; i++){
|
||||
Time.run(delay, () -> total[0]++);
|
||||
}
|
||||
assertEquals(0, total[0]);
|
||||
for(int i = 0; i < steps; i++){
|
||||
Time.update();
|
||||
}
|
||||
assertEquals(runs, total[0]);
|
||||
}
|
||||
|
||||
@Test
|
||||
void save(){
|
||||
world.loadMap(testMap);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue