2 import junit
.framework
.*;
4 public class MySearcherLatexTest
extends TestCase
{
5 String
[] from
= {"Tegsbron" , "Flygplatsen" , "MIT" , "Nydala" , "Teg"};
6 String
[] to
= {"Nydala" , "Begbilar" , "Flygplatsen" , "Gamlia" , "Foa"};
8 public MySearcherLatexTest(String name
) {
12 public void testBreadthFirst() {
13 System
.out
.println("\\subsection{Test Bredden-först}");
14 for (int i
= 0; i
< from
.length
; i
++) {
15 MySearcher my
= new MySearcher();
16 my
.setMap(new File("maps/umea_map.xml"));
17 System
.out
.println("\\subsubsection{From: " + from
[i
] + " to " + to
[i
] + "}");
18 System
.out
.println(my
.breadthFirst(from
[i
], to
[i
]));
22 public void testDepthFirst() {
23 System
.out
.println("\\subsection{Test Djupet-först}");
24 for (int i
= 0; i
< from
.length
; i
++) {
25 MySearcher my
= new MySearcher();
26 my
.setMap(new File("maps/umea_map.xml"));
27 System
.out
.println("\\subsubsection{From: " + from
[i
] + " to " + to
[i
] + "}");
28 System
.out
.println(my
.depthFirst(from
[i
], to
[i
]));
32 public void testAStar() {
33 System
.out
.println("\\subsection{Test A* snabbast}");
34 for (int i
= 0; i
< from
.length
; i
++) {
35 MySearcher my
= new MySearcher();
36 my
.setMap(new File("maps/umea_map.xml"));
37 System
.out
.println("\\subsubsection{From: " + from
[i
] + " to " + to
[i
] + "}");
38 System
.out
.println(my
.aStar(from
[i
], to
[i
], true));
41 System
.out
.println("\\subsection{Test A* kortast}");
42 for (int i
= 0; i
< from
.length
; i
++) {
43 MySearcher my
= new MySearcher();
44 my
.setMap(new File("maps/umea_map.xml"));
45 System
.out
.println("\\subsubsection{From: " + from
[i
] + " to " + to
[i
] + "}");
46 System
.out
.println(my
.aStar(from
[i
], to
[i
], false));
50 public void testGreedy() {
51 System
.out
.println("\\subsection{Test Girig sökning}");
52 for (int i
= 0; i
< from
.length
; i
++) {
53 MySearcher my
= new MySearcher();
54 my
.setMap(new File("maps/umea_map.xml"));
55 System
.out
.println("\\subsubsection{From: " + from
[i
] + " to " + to
[i
] + "}");
56 System
.out
.println(my
.greedySearch(from
[i
], to
[i
]));