improved wormtest
This commit is contained in:
@@ -10,7 +10,7 @@ import worms.util.Tuple;
|
||||
import java.util.Random;
|
||||
|
||||
class WormTest {
|
||||
|
||||
|
||||
private static Worm worm;
|
||||
private static Random r = new Random();
|
||||
|
||||
@@ -63,7 +63,7 @@ class WormTest {
|
||||
}
|
||||
|
||||
@RepeatedTest(5000)
|
||||
void jump(RepetitionInfo repetitionInfo) {
|
||||
void jump() {
|
||||
|
||||
worm = new Worm(Tuple.create(0.0, 0.0), 0, "Test", 1);
|
||||
double maxAngle = Math.abs(2 * Math.PI - worm.getOrientation());
|
||||
@@ -79,9 +79,9 @@ class WormTest {
|
||||
}
|
||||
else {
|
||||
double orient = worm.getOrientation();
|
||||
double force = 5 * worm.getActionPoints() + worm.getMass() * worm.G;
|
||||
double v = force / worm.getMass() * worm.FORCE_TIME;
|
||||
double newLocX = worm.getLocation().item1 + Math.pow(v, 2) * Math.sin(2 * orient) / worm.G;
|
||||
double force = 5 * worm.getActionPoints() + worm.getMass() * Worm.G;
|
||||
double v = force / worm.getMass() * Worm.FORCE_TIME;
|
||||
double newLocX = worm.getLocation().item1 + Math.pow(v, 2) * Math.sin(2 * orient) / Worm.G;
|
||||
worm.jump();
|
||||
assertEquals(Tuple.create(newLocX, worm.getLocation().item2), worm.getLocation());
|
||||
}
|
||||
|
Reference in New Issue
Block a user