Skip to content

Commit

Permalink
MapLattice glb
Browse files Browse the repository at this point in the history
  • Loading branch information
KuechA committed Feb 4, 2025
1 parent 2892f0e commit 2d7dcf1
Showing 1 changed file with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,10 @@ class BasicLatticesRedesignTest {
assertEquals(Order.EQUAL, mapLattice.compare(aBlaLattice1, emptyLubABla))

val aFooBBlaLattice =
(MapLattice.Element(
MapLattice.Element(
"a" to PowersetLattice.Element("foo"),
"b" to PowersetLattice.Element("bla"),
))
)
val aBlaFooBBla =
mapLattice.lub(aBlaFooLattice, aFooBBlaLattice) // a to {"foo", "bla"}, b to {"bla"}
assertNotSame(emptyLattice1, aBlaFooBBla)
Expand Down Expand Up @@ -238,6 +238,24 @@ class BasicLatticesRedesignTest {
assertTrue(aBlaLattice1 == aBlaLattice2) // This is equal
assertFalse(aBlaFooBBla == aBlaFooBBla["a"]) // Wrong types
assertFalse(aBlaFooBBla["a"] == aBlaFooBBla) // Wrong types

val aEmptyBEmptyGlb = mapLattice.glb(aFooBBlaLattice, aBlaBFooLattice)
val aEmptyBEmpty =
MapLattice.Element(
"a" to PowersetLattice.Element<String>(),
"b" to PowersetLattice.Element<String>(),
)
assertNotSame(aEmptyBEmptyGlb, aEmptyBEmpty)
assertEquals(aEmptyBEmptyGlb, aEmptyBEmpty)
assertEquals(Order.LESSER, aEmptyBEmptyGlb.compare(aFooBBlaLattice))
assertEquals(Order.LESSER, aEmptyBEmptyGlb.compare(aBlaBFooLattice))

val aBlaGlb = mapLattice.glb(aBlaFooLattice, aBlaBFooLattice)
assertNotSame(aBlaGlb, aBlaLattice1)
assertNotSame(aBlaGlb, aBlaLattice2)
assertEquals(aBlaGlb, aBlaLattice1)
assertEquals(Order.LESSER, aBlaGlb.compare(aBlaFooLattice))
assertEquals(Order.LESSER, aBlaGlb.compare(aBlaBFooLattice))
}

@Test
Expand Down

0 comments on commit 2d7dcf1

Please sign in to comment.