improved wormtest

This commit is contained in:
2018-03-11 19:51:26 +01:00
parent 9334d1e75d
commit 157bd87ca9

View File

@@ -63,7 +63,7 @@ class WormTest {
} }
@RepeatedTest(5000) @RepeatedTest(5000)
void jump(RepetitionInfo repetitionInfo) { void jump() {
worm = new Worm(Tuple.create(0.0, 0.0), 0, "Test", 1); worm = new Worm(Tuple.create(0.0, 0.0), 0, "Test", 1);
double maxAngle = Math.abs(2 * Math.PI - worm.getOrientation()); double maxAngle = Math.abs(2 * Math.PI - worm.getOrientation());
@@ -79,9 +79,9 @@ class WormTest {
} }
else { else {
double orient = worm.getOrientation(); double orient = worm.getOrientation();
double force = 5 * worm.getActionPoints() + worm.getMass() * worm.G; double force = 5 * worm.getActionPoints() + worm.getMass() * Worm.G;
double v = force / worm.getMass() * worm.FORCE_TIME; double v = force / worm.getMass() * Worm.FORCE_TIME;
double newLocX = worm.getLocation().item1 + Math.pow(v, 2) * Math.sin(2 * orient) / worm.G; double newLocX = worm.getLocation().item1 + Math.pow(v, 2) * Math.sin(2 * orient) / Worm.G;
worm.jump(); worm.jump();
assertEquals(Tuple.create(newLocX, worm.getLocation().item2), worm.getLocation()); assertEquals(Tuple.create(newLocX, worm.getLocation().item2), worm.getLocation());
} }