Files
oop/src/uebung10/logo/HanselGretelTest.java
2024-06-18 13:17:01 +00:00

31 lines
742 B
Java

package uebung10.logo;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import org.junit.Before;
public class HanselGretelTest {
public static final double EPS = 1e-10;
public static final Stmt PROG = new Sequence(new PenDown(), new Go(50),
new Turn(120), new Go(50),
new Turn(120), new Go(50));
private Turtle turtle;
@Before
public void setup() {
turtle = new Turtle(2, 1, 0);
}
@Test
public void TestTriangle() {
final Visitor<Void> visitor = new HanselGretelVisitor(10, turtle, new BlackForest()); //final ist egal
PROG.accept(visitor);
assertEquals(2, turtle.getX(), EPS);
assertEquals(1, turtle.getY(), EPS);
}
}