Implement CommonizerTarget.allLeaves

This commit is contained in:
sebastian.sellmair
2021-03-26 10:46:14 +01:00
parent a78645e858
commit 46a20c81cc
2 changed files with 27 additions and 0 deletions
@@ -53,5 +53,28 @@ class CommonizerTargetUtilsTest {
"Expected all targets present"
)
}
@Test
fun allLeaves() {
val target = parseCommonizerTarget("((a, b), (c, d), (e, (f, g)))")
assertEquals(
setOf(
LeafCommonizerTarget("a"),
LeafCommonizerTarget("b"),
LeafCommonizerTarget("c"),
LeafCommonizerTarget("d"),
LeafCommonizerTarget("e"),
LeafCommonizerTarget("f"),
LeafCommonizerTarget("g")
),
target.allLeaves(),
"Expected leaf targets present"
)
assertEquals(
setOf(LeafCommonizerTarget("a")), LeafCommonizerTarget("a").allLeaves(),
"Expected LeafCommonizerTarget returns itself in 'allLeaves'"
)
}
}