unit test graph (#1479)

This commit is contained in:
khadgarmage 2019-12-14 21:54:11 +08:00 committed by GitHub
parent 6ec5f2e3cd
commit bfa3a36c92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View File

@ -125,6 +125,10 @@ public class DAGTest {
assertTrue(graph.containsEdge(1, 2));
assertEquals(graph.getEdgesCount(), 1);
int node = 3;
graph.addNode(node, "v(3)");
assertFalse(graph.addEdge(node, node));
}
@ -347,4 +351,14 @@ public class DAGTest {
}
@Test
public void testTopologicalSort4() {
clear();
try {
graph.topologicalSort();
} catch (Exception e) {
assertTrue(e.getMessage().contains("serious error: graph has cycle"));
}
}
}

View File

@ -612,6 +612,7 @@
<version>${maven-surefire-plugin.version}</version>
<configuration>
<includes>
<include>**/common/graph/*.java</include>
<include>**/*CollectionUtilsTest.java</include><!--run test classes-->
</includes>
<!-- <skip>true</skip> -->