2 import junit
.framework
.*;
4 public class MySearcherTest
extends TestCase
6 String from1
= "Nydala";
8 String from2
= "Berghem";
12 public MySearcherTest(String name
) {
14 my
= new MySearcher();
15 my
.setMap(new File("maps/umea_map.xml"));
18 public void testMap() {
19 System
.out
.println("----------Test Map-------------");
20 System
.out
.println(my
.toString());
23 public void testBreadthFirst() {
24 System
.out
.println("----------Test Breadthfirst-------------");
25 System
.out
.println("From: " + from1
+ " to " + to1
);
26 System
.out
.println(my
.breadthFirst(from1
, to1
));
27 my
.setMap(new File("maps/umea_map.xml"));
28 System
.out
.println("From: " + from2
+ " to " + to2
);
29 System
.out
.println(my
.breadthFirst(from2
, to2
));
32 public void testDepthFirst() {
33 System
.out
.println("----------Test Depthfirst-------------");
34 System
.out
.println("From: " + from1
+ " to " + to1
);
35 System
.out
.println(my
.depthFirst(from1
, to1
));
36 my
.setMap(new File("maps/umea_map.xml"));
37 System
.out
.println("From: " + from2
+ " to " + to2
);
38 System
.out
.println(my
.depthFirst(from2
, to2
));
41 public void testAStar() {
42 System
.out
.println("----------Test A*-------------");
43 System
.out
.println("From: " + from1
+ " to " + to1
);
44 System
.out
.println(my
.aStar(from1
, to1
, true));
45 my
.setMap(new File("maps/umea_map.xml"));
46 System
.out
.println("From: " + from2
+ " to " + to2
);
47 System
.out
.println(my
.aStar(from2
, to2
, true));
50 public void testGreedy() {
51 System
.out
.println("----------Test GreedySearch-------------");
52 System
.out
.println("From: " + from1
+ " to " + to1
);
53 System
.out
.println(my
.greedySearch(from1
, to1
));
54 my
.setMap(new File("maps/umea_map.xml"));
55 System
.out
.println("From: " + from2
+ " to " + to2
);
56 System
.out
.println(my
.greedySearch(from2
, to2
));