mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Add transitiveClosure() to DynamicGraph.
This commit is contained in:
parent
c2441f939a
commit
67cb7a5360
2 changed files with 38 additions and 0 deletions
|
@ -2,6 +2,7 @@ package com.beust.kobalt.internal
|
|||
|
||||
import com.beust.kobalt.misc.Topological
|
||||
import com.beust.kobalt.misc.log
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.testng.Assert
|
||||
import org.testng.annotations.Test
|
||||
import java.util.*
|
||||
|
@ -48,6 +49,21 @@ class DynamicGraphTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun transitive() {
|
||||
DynamicGraph<Int>().apply {
|
||||
addEdge(1, 2)
|
||||
addEdge(1, 3)
|
||||
addEdge(2, 4)
|
||||
addEdge(6, 7)
|
||||
assertThat(transitiveClosure(1)).isEqualTo(setOf(1, 2, 3, 4))
|
||||
assertThat(transitiveClosure(2)).isEqualTo(setOf(2, 4))
|
||||
assertThat(transitiveClosure(3)).isEqualTo(setOf(3))
|
||||
assertThat(transitiveClosure(6)).isEqualTo(setOf(6, 7))
|
||||
assertThat(transitiveClosure(7)).isEqualTo(setOf(7))
|
||||
println("done")
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
private fun testExecutorWithSkip() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue