finished uebung10
This commit is contained in:
30
src/uebung10/logo/HanselGretelTest.java
Normal file
30
src/uebung10/logo/HanselGretelTest.java
Normal file
@@ -0,0 +1,30 @@
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user