diff --git a/OGP1718-Worms/src/worms/model/Worm.java b/OGP1718-Worms/src/worms/model/Worm.java index 6ebaf8e..7fe992a 100644 --- a/OGP1718-Worms/src/worms/model/Worm.java +++ b/OGP1718-Worms/src/worms/model/Worm.java @@ -6,17 +6,18 @@ import worms.util.IllegalNameException; import static java.lang.Math.*; -public class Worm { /** * a class with the specifications of the worm - * + * * @invar the location of the worm must be a valid location * |... * @invar - * + * * @version 1.0 * @author Arthur Bols and Leen Dereu */ +public class Worm { + // region properties //=================================================================================== @@ -24,7 +25,6 @@ public class Worm { // Location private Tuple location; - // jumping private Tuple oldLocation; @@ -332,11 +332,11 @@ public class Worm { * are equal to the maximum points. If the given points are lower then 0 * the current points are equal to 0. If the given points is between the * maximum points and 0, the current points is equal to the given points - * |if (points > this.maxPoints) - * | points = this.maxPoints - * |else if (points < 0) - * | points = 0 - * |this.points = points + * |if (points > this.maxActionPoints) + * | actionPoints = this.maxActionPoints + * |else if (actionPoints < 0) + * | actionPoints = 0 + * |this.actionPoints = actionPoints */ public void setActionPoints(long actionPoints) { @@ -506,7 +506,7 @@ public class Worm { if (numberSteps < 0) throw new IllegalArgumentException(); // TODO add decent exception msg - int cost = (int) ceil(abs(cos(this.orientation)) + abs(4 * sin(this.orientation))); + long cost = (long) ceil(abs(cos(this.orientation)) + abs(4 * sin(this.orientation))); if (cost > this.actionPoints) throw new IllegalArgumentException(); // TODO add decent exception msg diff --git a/OGP1718-Worms/tests/worms/model/WormTest.java b/OGP1718-Worms/tests/worms/model/WormTest.java new file mode 100644 index 0000000..72fb353 --- /dev/null +++ b/OGP1718-Worms/tests/worms/model/WormTest.java @@ -0,0 +1,80 @@ +package worms.model; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +class WormTest { + + @BeforeEach + void setUp() { + + } + + @Test + void getLocation() { + } + + @Test + void getOrientation() { + } + + @Test + void getRadius() { + } + + @Test + void setRadius() { + } + + @Test + void getMinimumRadius() { + } + + @Test + void getMass() { + } + + @Test + void getActionPoints() { + } + + @Test + void getMaxActionPoints() { + } + + @Test + void setActionPoints() { + } + + @Test + void decreaseActionPoints() { + } + + @Test + void getName() { + } + + @Test + void setName() { + } + + @Test + void move() { + } + + @Test + void turn() { + } + + @Test + void jump() { + } + + @Test + void jumpTime() { + } + + @Test + void jumpStep() { + } +} \ No newline at end of file