summaryrefslogtreecommitdiff
path: root/src/ch/epfl/maze/tests/ZooTest.java
diff options
context:
space:
mode:
authorPacien TRAN-GIRARD2015-11-21 10:44:42 +0100
committerPacien TRAN-GIRARD2015-11-21 10:44:42 +0100
commit90bd766f361083f6fd9e39ff080c83fcc606832f (patch)
treedf81a931c9565a4b227068680087f58fdace1859 /src/ch/epfl/maze/tests/ZooTest.java
parent655ac88f4e73b2df532a451aedf5a561ea1b0d2c (diff)
downloadmaze-solver-90bd766f361083f6fd9e39ff080c83fcc606832f.tar.gz
Reformat imported code
Diffstat (limited to 'src/ch/epfl/maze/tests/ZooTest.java')
-rw-r--r--src/ch/epfl/maze/tests/ZooTest.java364
1 files changed, 179 insertions, 185 deletions
diff --git a/src/ch/epfl/maze/tests/ZooTest.java b/src/ch/epfl/maze/tests/ZooTest.java
index a86fd73..7170ab9 100644
--- a/src/ch/epfl/maze/tests/ZooTest.java
+++ b/src/ch/epfl/maze/tests/ZooTest.java
@@ -1,209 +1,203 @@
1package ch.epfl.maze.tests; 1package ch.epfl.maze.tests;
2 2
3import org.junit.Test;
4
5import ch.epfl.maze.graphics.Display; 3import ch.epfl.maze.graphics.Display;
6import ch.epfl.maze.physical.Maze; 4import ch.epfl.maze.physical.Maze;
7import ch.epfl.maze.physical.zoo.Bear; 5import ch.epfl.maze.physical.zoo.*;
8import ch.epfl.maze.physical.zoo.Hamster;
9import ch.epfl.maze.physical.zoo.Monkey;
10import ch.epfl.maze.physical.zoo.Mouse;
11import ch.epfl.maze.physical.zoo.Panda;
12import ch.epfl.maze.simulation.MazeSimulation; 6import ch.epfl.maze.simulation.MazeSimulation;
13import ch.epfl.maze.simulation.Simulation; 7import ch.epfl.maze.simulation.Simulation;
14import ch.epfl.maze.util.LabyrinthGenerator; 8import ch.epfl.maze.util.LabyrinthGenerator;
15import junit.framework.TestCase; 9import junit.framework.TestCase;
10import org.junit.Test;
16 11
17/** 12/**
18 * Test cases for animals implementation. 13 * Test cases for animals implementation.
19 *
20 */ 14 */
21 15
22public class ZooTest extends TestCase { 16public class ZooTest extends TestCase {
23 17
24 /** 18 /**
25 * Tests the behaviour of the Mouse A.I. 19 * Tests the behaviour of the Mouse A.I.
26 * <p> 20 * <p>
27 * The Mouse should go forward and never retrace its steps. 21 * The Mouse should go forward and never retrace its steps.
28 */ 22 */
29 23
30 @Test 24 @Test
31 public void testMouse() { 25 public void testMouse() {
32 int[][] labyrinth = LabyrinthGenerator.getDebugMouse(); 26 int[][] labyrinth = LabyrinthGenerator.getDebugMouse();
33 27
34 Maze m = new Maze(labyrinth); 28 Maze m = new Maze(labyrinth);
35 Simulation simulation = new MazeSimulation(m); 29 Simulation simulation = new MazeSimulation(m);
36 30
37 m.addAnimal(new Mouse(m.getStart())); 31 m.addAnimal(new Mouse(m.getStart()));
38 32
39 Display display = new Display(simulation); 33 Display display = new Display(simulation);
40 display.setDebug(true); 34 display.setDebug(true);
41 display.run(); 35 display.run();
42 } 36 }
43 37
44 /** 38 /**
45 * Tests the behaviour of the Hamster A.I. 39 * Tests the behaviour of the Hamster A.I.
46 * <p> 40 * <p>
47 * The Hamster should never revisit a dead-end it has already visited. 41 * The Hamster should never revisit a dead-end it has already visited.
48 */ 42 */
49 43
50 @Test 44 @Test
51 public void testHamster() { 45 public void testHamster() {
52 int[][] labyrinth = LabyrinthGenerator.getDebugHamster(); 46 int[][] labyrinth = LabyrinthGenerator.getDebugHamster();
53 47
54 Maze m = new Maze(labyrinth); 48 Maze m = new Maze(labyrinth);
55 Simulation simulation = new MazeSimulation(m); 49 Simulation simulation = new MazeSimulation(m);
56 50
57 m.addAnimal(new Hamster(m.getStart())); 51 m.addAnimal(new Hamster(m.getStart()));
58 52
59 Display display = new Display(simulation); 53 Display display = new Display(simulation);
60 display.setDebug(true); 54 display.setDebug(true);
61 display.run(); 55 display.run();
62 } 56 }
63 57
64 /** 58 /**
65 * Tests the behaviour of the Monkey A.I. 59 * Tests the behaviour of the Monkey A.I.
66 * <p> 60 * <p>
67 * The Monkey should go directly to the exit without taking any dead-end. 61 * The Monkey should go directly to the exit without taking any dead-end.
68 */ 62 */
69 63
70 @Test 64 @Test
71 public void testMonkey() { 65 public void testMonkey() {
72 int[][] labyrinth = LabyrinthGenerator.getDebugMonkey(); 66 int[][] labyrinth = LabyrinthGenerator.getDebugMonkey();
73 67
74 Maze m = new Maze(labyrinth); 68 Maze m = new Maze(labyrinth);
75 Simulation simulation = new MazeSimulation(m); 69 Simulation simulation = new MazeSimulation(m);
76 70
77 m.addAnimal(new Monkey(m.getStart())); 71 m.addAnimal(new Monkey(m.getStart()));
78 72
79 Display display = new Display(simulation); 73 Display display = new Display(simulation);
80 display.setDebug(true); 74 display.setDebug(true);
81 display.run(); 75 display.run();
82 } 76 }
83 77
84 /** 78 /**
85 * Tests the behaviour of the Bear A.I. 79 * Tests the behaviour of the Bear A.I.
86 * <p> 80 * <p>
87 * The Bear must follow the entire wall in front of him until the exit. If 81 * The Bear must follow the entire wall in front of him until the exit. If
88 * it loops infinitely in this maze, it means that it does not properly 82 * it loops infinitely in this maze, it means that it does not properly
89 * count the turns it makes. 83 * count the turns it makes.
90 */ 84 */
91 85
92 @Test 86 @Test
93 public void testBear1() { 87 public void testBear1() {
94 int[][] labyrinth = LabyrinthGenerator.getDebugBear1(); 88 int[][] labyrinth = LabyrinthGenerator.getDebugBear1();
95 89
96 Maze m = new Maze(labyrinth); 90 Maze m = new Maze(labyrinth);
97 Simulation simulation = new MazeSimulation(m); 91 Simulation simulation = new MazeSimulation(m);
98 92
99 m.addAnimal(new Bear(m.getStart())); 93 m.addAnimal(new Bear(m.getStart()));
100 94
101 Display display = new Display(simulation); 95 Display display = new Display(simulation);
102 display.setDebug(true); 96 display.setDebug(true);
103 display.run(); 97 display.run();
104 } 98 }
105 99
106 /** 100 /**
107 * Tests the behaviour of the Bear A.I. 101 * Tests the behaviour of the Bear A.I.
108 * <p> 102 * <p>
109 * If the Bear loops infinitely in this maze, it means that it does not 103 * If the Bear loops infinitely in this maze, it means that it does not
110 * properly count the turns it makes. 104 * properly count the turns it makes.
111 */ 105 */
112 106
113 @Test 107 @Test
114 public void testBear2() { 108 public void testBear2() {
115 int[][] labyrinth = LabyrinthGenerator.getDebugBear2(); 109 int[][] labyrinth = LabyrinthGenerator.getDebugBear2();
116 110
117 Maze m = new Maze(labyrinth); 111 Maze m = new Maze(labyrinth);
118 Simulation simulation = new MazeSimulation(m); 112 Simulation simulation = new MazeSimulation(m);
119 113
120 m.addAnimal(new Bear(m.getStart())); 114 m.addAnimal(new Bear(m.getStart()));
121 115
122 Display display = new Display(simulation); 116 Display display = new Display(simulation);
123 display.setDebug(true); 117 display.setDebug(true);
124 display.run(); 118 display.run();
125 } 119 }
126 120
127 /** 121 /**
128 * Tests the behaviour of the Panda A.I. 122 * Tests the behaviour of the Panda A.I.
129 * <p> 123 * <p>
130 * When the Panda comes back to the intersection, then it must leave the 124 * When the Panda comes back to the intersection, then it must leave the
131 * position marked once and go back into the loop. 125 * position marked once and go back into the loop.
132 */ 126 */
133 127
134 @Test 128 @Test
135 public void testPanda1() { 129 public void testPanda1() {
136 int[][] labyrinth = LabyrinthGenerator.getDebugPanda1(); 130 int[][] labyrinth = LabyrinthGenerator.getDebugPanda1();
137 131
138 Maze m = new Maze(labyrinth); 132 Maze m = new Maze(labyrinth);
139 Simulation simulation = new MazeSimulation(m); 133 Simulation simulation = new MazeSimulation(m);
140 134
141 m.addAnimal(new Panda(m.getStart())); 135 m.addAnimal(new Panda(m.getStart()));
142