Tested/fixed delta calculations

Tests now use a fixed delta of 0.5 to make sure calculations work with deltas different from 1.0
This commit is contained in:
Timmeey86 2018-11-28 11:04:08 +01:00
parent 739219c57b
commit 1f8751054c
6 changed files with 53 additions and 33 deletions

View file

@ -1,5 +1,6 @@
package power;
import com.badlogic.gdx.math.MathUtils;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.content.blocks.Blocks;
import io.anuke.mindustry.core.ContentLoader;
@ -24,9 +25,15 @@ import static io.anuke.mindustry.Vars.world;
/** This class provides objects commonly used by power related unit tests.
* For now, this is a helper with static methods, but this might change.
*
* Note: All tests which subclass this will run with a fixed delta of 0.5!
* */
public class PowerTestFixture{
public static final float smallRoundingTolerance = MathUtils.FLOAT_ROUNDING_ERROR;
public static final float mediumRoundingTolerance = MathUtils.FLOAT_ROUNDING_ERROR * 10;
public static final float highRoundingTolerance = MathUtils.FLOAT_ROUNDING_ERROR * 100;
@BeforeAll
static void initializeDependencies(){
Vars.content = new ContentLoader();