Skip to content
Snippets Groups Projects
Commit 1e1d7eb0 authored by Lawrence Chung's avatar Lawrence Chung
Browse files

CC test suite

parent bdd53305
No related branches found
No related tags found
No related merge requests found
package search;
import static org.junit.Assert.*;
import org.junit.*;
public class CCTest {
@Before
public void setUp() throws Exception {
System.out.println("Setting up....");
}
@Test
public void testId(){
int v = 11;
Graph g = new Graph(v);
g.addEdge(1,3);
g.addEdge(9,8);
g.addEdge(3, 8);
g.addEdge(3, 9);
g.addEdge(7, 4);
g.addEdge(2, 4);
g.addEdge(4, 6);
g.addEdge(0, 5);
CC cc = new CC(g);
assertEquals(cc.id(4), cc.id(6));
assertNotEquals(cc.id(3), cc.id(4));
}
@Test
public void TestConnected(){
int v = 11;
Graph g = new Graph(v);
g.addEdge(1,3);
g.addEdge(9,8);
g.addEdge(3, 8);
g.addEdge(3, 9);
g.addEdge(7, 4);
g.addEdge(2, 4);
g.addEdge(4, 6);
g.addEdge(0, 5);
CC cc = new CC(g);
assertEquals(cc.connected(0, 1), false);
assertEquals(cc.connected(8, 9), true);
assertNotEquals(cc.connected(0, 10), true);
assertEquals(cc.connected(2, 7), true);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment