Created
December 11, 2013 06:38
-
-
Save kietdlam/7905973 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package trip; | |
/* You MAY add public @Test methods to this class. You may also add | |
* additional public classes containing "Testing" in their name. These | |
* may not be part of your trip package per se (that is, it must be | |
* possible to remove them and still have your package work). */ | |
import org.junit.Test; | |
import ucb.junit.textui; | |
import static org.junit.Assert.*; | |
import graph.Graph; | |
import graph.Graphs; | |
import graph.UndirectedGraph; | |
import graph.Distancer; | |
import graph.Weighting; | |
import graph.Weighter; | |
import java.util.List; | |
import java.util.ArrayList; | |
import java.util.Map; | |
import java.util.HashMap; | |
/** Unit tests for the trip package. */ | |
public class Testing { | |
/** Run all JUnit tests in the graph package. */ | |
public static void main(String[] ignored) { | |
System.exit(textui.runClasses(trip.Testing.class)); | |
} | |
@Test | |
public void testMe() { | |
} | |
@Test | |
public void testAStar() { | |
Graph<String, String> g = new UndirectedGraph<String, String>(); | |
Graph<String, String>.Vertex A = g.add("A"); | |
Graph<String, String>.Vertex B = g.add("B"); | |
Distancer<String> distancer = new Distancer<String>() { | |
@Override | |
public double dist(String v0, String v1) { | |
return 0.0; | |
} | |
}; | |
Weighting<String> eweighter = new Weighting<String>() { | |
@Override | |
public double weight(String str) { | |
return 1.0; | |
} | |
}; | |
Weighter<String> vweighter = new Weighter<String>() { | |
@Override | |
public void setWeight(String str, double v) { | |
} | |
@Override | |
public double weight(String str) { | |
return 1.0; | |
} | |
}; | |
List<Graph<String, String>.Edge> output | |
= Graphs.shortestPath(g, A, B, distancer, vweighter, eweighter); | |
assertNotNull("Why does this always fail???", output); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment